Sha256: 5a5f052b49df087fbc20dec66278b7f80697d545c93f234b5df91b68c21a7dbc
Contents?: true
Size: 1.27 KB
Versions: 9
Compression:
Stored size: 1.27 KB
Contents
module Saml module Kit class Certificate BEGIN_CERT=/-----BEGIN CERTIFICATE-----/ END_CERT=/-----END CERTIFICATE-----/ attr_reader :value, :use def initialize(value, use:) @value = value @use = use.downcase.to_sym end def fingerprint Fingerprint.new(value) end def for?(use) self.use == use.to_sym end def encryption? for?(:encryption) end def signing? for?(:signing) end def x509 self.class.to_x509(value) end def public_key x509.public_key end def ==(other) self.to_s == other.to_s end def eql?(other) self == other end def hash value.hash end def to_s value end def to_h { use: @use, x509: @value } end def inspect to_h.inspect end def stripped value.to_s.gsub(BEGIN_CERT, '').gsub(END_CERT, '').gsub(/\n/, '') end def self.to_x509(value) OpenSSL::X509::Certificate.new(Base64.decode64(value)) rescue OpenSSL::X509::CertificateError => error Saml::Kit.logger.warn(error) OpenSSL::X509::Certificate.new(value) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems