module OpenSSL::X509::Extension::SubjectKeyIdentifier

Included modules:
OpenSSL::X509::Extension::Helpers

Public Instance Methods

subject_key_identifier() Show source
# File ext/openssl/lib/openssl/x509.rb, line 82
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

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.

Ruby Core © 1993–2020 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.