Class: Saml::Elements::KeyInfo::X509Data

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/saml/elements/key_info/x509_data.rb

Instance Method Summary collapse

Constructor Details

#initialize(cert = nil) ⇒ X509Data

Returns a new instance of X509Data.



14
15
16
# File 'lib/saml/elements/key_info/x509_data.rb', line 14

def initialize(cert = nil)
  self.x509certificate = cert
end

Instance Method Details

#x509certificate=(cert) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/saml/elements/key_info/x509_data.rb', line 18

def x509certificate=(cert)
  if cert.present?
    if cert =~ /-----BEGIN CERTIFICATE-----/
      @x509certificate = OpenSSL::X509::Certificate.new(cert)
    else
      @x509certificate = OpenSSL::X509::Certificate.new(Base64.decode64(cert))
    end
  end
rescue OpenSSL::X509::CertificateError => e
  nil
end