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

Inherits:
Base
  • Object
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

digest_class, implements, #initialize, #signature, #signature_base_string, #verify

Methods included from Helper

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

Constructor Details

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

Instance Method Details

#==(cmp_signature) ⇒ Object



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

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



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

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