Class: Xml::Kit::Fingerprint
- Inherits:
-
Object
- Object
- Xml::Kit::Fingerprint
- Defined in:
- lib/xml/kit/fingerprint.rb
Overview
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.
17 18 19 |
# File 'lib/xml/kit/fingerprint.rb', line 17 def initialize(raw_certificate) @x509 = Certificate.to_x509(raw_certificate) end |
Instance Attribute Details
#x509 ⇒ Object (readonly)
The OpenSSL::X509::Certificate
15 16 17 |
# File 'lib/xml/kit/fingerprint.rb', line 15 def x509 @x509 end |
Instance Method Details
#==(other) ⇒ Object
29 30 31 |
# File 'lib/xml/kit/fingerprint.rb', line 29 def ==(other) to_s == other.to_s end |
#algorithm(algorithm) ⇒ String
Generates a formatted fingerprint using the specified hash algorithm.
25 26 27 |
# File 'lib/xml/kit/fingerprint.rb', line 25 def algorithm(algorithm) pretty_fingerprint(algorithm.new.hexdigest(x509.to_der)) end |
#eql?(other) ⇒ Boolean
33 34 35 |
# File 'lib/xml/kit/fingerprint.rb', line 33 def eql?(other) self == other end |
#hash ⇒ Object
37 38 39 |
# File 'lib/xml/kit/fingerprint.rb', line 37 def hash to_s.hash end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/xml/kit/fingerprint.rb', line 41 def to_s algorithm(OpenSSL::Digest::SHA256) end |