In Files

  • openssl/lib/openssl/x509.rb

Class/Module Index [+]

Quicksearch

OpenSSL::X509::Extension::SubjectKeyIdentifier

Public Instance Methods

subject_key_identifier() click to toggle source

Get the subject’s key identifier from the subjectKeyIdentifier exteension, as described in RFC5280 Section 4.2.1.2.

Returns the binary String key identifier or nil or raises ASN1::ASN1Error.

 
               # File openssl/lib/openssl/x509.rb, line 96
def subject_key_identifier
  ext = find_extension("subjectKeyIdentifier")
  return nil if ext.nil?

  ski_asn1 = ASN1.decode(ext.value_der)
  if ext.critical? || ski_asn1.tag_class != :UNIVERSAL || ski_asn1.tag != ASN1::OCTET_STRING
    raise ASN1::ASN1Error, "invalid extension"
  end

  ski_asn1.value
end