Module: Signet::OAuth1::RSASHA1

Defined in:
lib/signet/oauth_1/signature_methods/rsa_sha1.rb

Class Method Summary collapse

Class Method Details

.generate_signature(base_string, client_credential_secret, _token_credential_secret) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/signet/oauth_1/signature_methods/rsa_sha1.rb', line 9

def self.generate_signature \
    base_string, client_credential_secret, _token_credential_secret


  private_key = OpenSSL::PKey::RSA.new client_credential_secret
  signature = private_key.sign OpenSSL::Digest.new("SHA1"), base_string
  # using strict_encode64 because the encode64 method adds newline characters after ever 60 chars
  Base64.strict_encode64(signature).strip
end