Class: AWS::DefaultSigner
- Inherits:
-
Object
- Object
- AWS::DefaultSigner
- Defined in:
- lib/aws/default_signer.rb
Overview
Computes signatures using credentials that are stored in memory.
Instance Attribute Summary collapse
-
#access_key_id ⇒ String
readonly
The Access Key ID used to sign requests.
-
#secret_access_key ⇒ String
readonly
The Secret Access Key used to sign requests.
Instance Method Summary collapse
-
#initialize(access_key_id, secret_access_key) ⇒ DefaultSigner
constructor
A new instance of DefaultSigner.
-
#sign(string_to_sign, digest_method = 'sha256') ⇒ Object
Signs a string using the credentials stored in memory.
Constructor Details
#initialize(access_key_id, secret_access_key) ⇒ DefaultSigner
Returns a new instance of DefaultSigner.
33 34 35 36 |
# File 'lib/aws/default_signer.rb', line 33 def initialize(access_key_id, secret_access_key) @access_key_id = access_key_id @secret_access_key = secret_access_key end |
Instance Attribute Details
#access_key_id ⇒ String (readonly)
Returns The Access Key ID used to sign requests.
23 24 25 |
# File 'lib/aws/default_signer.rb', line 23 def access_key_id @access_key_id end |
#secret_access_key ⇒ String (readonly)
Returns The Secret Access Key used to sign requests.
26 27 28 |
# File 'lib/aws/default_signer.rb', line 26 def secret_access_key @secret_access_key end |
Instance Method Details
#sign(string_to_sign, digest_method = 'sha256') ⇒ Object
Signs a string using the credentials stored in memory.
44 45 46 47 48 49 50 |
# File 'lib/aws/default_signer.rb', line 44 def sign(string_to_sign, digest_method = 'sha256') Base64.encode64( OpenSSL::HMAC.digest( OpenSSL::Digest::Digest.new(digest_method), secret_access_key, string_to_sign)).strip end |