class Azure::Core::Auth::Signer
Public: Utility
class to sign strings with HMAC-256 and then encode the signed string using Base64.
Attributes
access_key[R]
The access key for the account
Public Class Methods
new(access_key=Azure.config.storage_access_key)
click to toggle source
Public: Initialize the Signer
.
access_key
- The access_key
encoded in Base64. Defaults to the one
in the global configuration.
# File lib/azure/core/auth/signer.rb, line 32 def initialize(access_key=Azure.config.storage_access_key) @access_key = Base64.strict_decode64(access_key) end
Public Instance Methods
sign(body)
click to toggle source
Public: Generate an HMAC signature.
body - The string to sign.
Returns a Base64 String
signed with HMAC.
# File lib/azure/core/auth/signer.rb, line 41 def sign(body) signed = OpenSSL::HMAC.digest("sha256", access_key, body) Base64.strict_encode64(signed) end