Class: Saml::Kit::Fingerprint

Inherits:
Object
  • Object
show all
Defined in:
lib/saml/kit/fingerprint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_certificate) ⇒ Fingerprint

Returns a new instance of Fingerprint.



6
7
8
# File 'lib/saml/kit/fingerprint.rb', line 6

def initialize(raw_certificate)
  @x509 = Certificate.to_x509(raw_certificate)
end

Instance Attribute Details

#x509 ⇒ Object (readonly)

Returns the value of attribute x509.



4
5
6
# File 'lib/saml/kit/fingerprint.rb', line 4

def x509
  @x509
end

Instance Method Details

#==(other) ⇒ Object



14
15
16
# File 'lib/saml/kit/fingerprint.rb', line 14

def ==(other)
  self.to_s == other.to_s
end

#algorithm(algorithm) ⇒ Object



10
11
12
# File 'lib/saml/kit/fingerprint.rb', line 10

def algorithm(algorithm)
  pretty_fingerprint(algorithm.new.hexdigest(x509.to_der))
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/saml/kit/fingerprint.rb', line 18

def eql?(other)
  self == other
end

#hash ⇒ Object



22
23
24
# File 'lib/saml/kit/fingerprint.rb', line 22

def hash
  to_s.hash
end

#to_s ⇒ Object



26
27
28
# File 'lib/saml/kit/fingerprint.rb', line 26

def to_s
  algorithm(OpenSSL::Digest::SHA256)
end