Class: Samlr::Certificate

Inherits:
Object show all
Defined in:
lib/samlr/certificate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Certificate

Returns a new instance of Certificate.



5
6
7
8
9
10
11
12
13
# File 'lib/samlr/certificate.rb', line 5

def initialize(value)
  @x509 = if value.is_a?(OpenSSL::X509::Certificate)
    value
  elsif value.is_a?(IO)
    OpenSSL::X509::Certificate.new(value.read)
  else
    OpenSSL::X509::Certificate.new(value)
  end
end

Instance Attribute Details

#x509Object (readonly)

Returns the value of attribute x509.



3
4
5
# File 'lib/samlr/certificate.rb', line 3

def x509
  @x509
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/samlr/certificate.rb', line 19

def ==(other)
  other.is_a?(Certificate) && fingerprint == other.fingerprint
end

#fingerprintObject



15
16
17
# File 'lib/samlr/certificate.rb', line 15

def fingerprint
  @fingerprint ||= FingerprintSHA256.new(@x509)
end