Class: Saml::Kit::Fingerprint
- Inherits:
-
Object
- Object
- Saml::Kit::Fingerprint
- Defined in:
- lib/saml/kit/fingerprint.rb
Overview
This generates a fingerprint for an X509 Certificate.
Instance Attribute Summary collapse
-
#x509 ⇒ Object
readonly
The OpenSSL::X509::Certificate.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#algorithm(algorithm) ⇒ String
Generates a formatted fingerprint using the specified hash algorithm.
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(raw_certificate) ⇒ Fingerprint
constructor
A new instance of Fingerprint.
- #to_s ⇒ Object
Constructor Details
#initialize(raw_certificate) ⇒ Fingerprint
Returns a new instance of Fingerprint.
8 9 10 |
# File 'lib/saml/kit/fingerprint.rb', line 8 def initialize(raw_certificate) @x509 = Certificate.to_x509(raw_certificate) end |
Instance Attribute Details
#x509 ⇒ Object (readonly)
The OpenSSL::X509::Certificate
6 7 8 |
# File 'lib/saml/kit/fingerprint.rb', line 6 def x509 @x509 end |
Instance Method Details
#==(other) ⇒ Object
20 21 22 |
# File 'lib/saml/kit/fingerprint.rb', line 20 def ==(other) self.to_s == other.to_s end |
#algorithm(algorithm) ⇒ String
Generates a formatted fingerprint using the specified hash algorithm.
16 17 18 |
# File 'lib/saml/kit/fingerprint.rb', line 16 def algorithm(algorithm) pretty_fingerprint(algorithm.new.hexdigest(x509.to_der)) end |
#eql?(other) ⇒ Boolean
24 25 26 |
# File 'lib/saml/kit/fingerprint.rb', line 24 def eql?(other) self == other end |
#hash ⇒ Object
28 29 30 |
# File 'lib/saml/kit/fingerprint.rb', line 28 def hash to_s.hash end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/saml/kit/fingerprint.rb', line 32 def to_s algorithm(OpenSSL::Digest::SHA256) end |