Class: OAuth::Signature::RSA::SHA1

Inherits:
Base show all
Defined in:
lib/oauth/signature/rsa/sha1.rb

Instance Attribute Summary

Attributes inherited from Base

#consumer_secret, #options, #request, #token_secret

Instance Method Summary collapse

Methods inherited from Base

#body_hash, digest_class, digest_klass, hash_class, implements, #initialize, #signature, #signature_base_string, #verify

Methods included from Helper

#escape, #generate_key, #generate_timestamp, #normalize, #parse_header, #stringify_keys, #unescape

Constructor Details

This class inherits a constructor from OAuth::Signature::Base

Instance Method Details

#==(cmp_signature) ⇒ Object



9
10
11
# File 'lib/oauth/signature/rsa/sha1.rb', line 9

def ==(cmp_signature)
  public_key.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(cmp_signature.is_a?(Array) ? cmp_signature.first : cmp_signature), signature_base_string)
end

#public_keyObject



13
14
15
16
17
18
19
20
21
# File 'lib/oauth/signature/rsa/sha1.rb', line 13

def public_key
  if consumer_secret.is_a?(String)
    decode_public_key
  elsif consumer_secret.is_a?(OpenSSL::X509::Certificate)
    consumer_secret.public_key
  else
    consumer_secret
  end
end