Module: AWS::Core::Signer
- Defined in:
- lib/aws/core/signer.rb
Overview
This module provides a #sign method that accepts a secret and a string to sign.
Class Method Summary collapse
- 
  
    
      .hmac(key, value, digest = 'sha256')  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Computes an HMAC digest of the passed string. 
- 
  
    
      .sign(secret, string_to_sign, digest_method = 'sha256')  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Signs a string using the credentials stored in memory. 
Class Method Details
.hmac(key, value, digest = 'sha256') ⇒ String
Computes an HMAC digest of the passed string.
| 39 40 41 | # File 'lib/aws/core/signer.rb', line 39 def hmac key, value, digest = 'sha256' OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new(digest), key, value) end | 
.sign(secret, string_to_sign, digest_method = 'sha256') ⇒ String
Signs a string using the credentials stored in memory.
| 29 30 31 | # File 'lib/aws/core/signer.rb', line 29 def sign secret, string_to_sign, digest_method = 'sha256' Base64.encode64(hmac(secret, string_to_sign, digest_method)).strip end |