123456789_123456789_123456789_123456789_123456789_

Module: OpenSSL::X509::Extension::SubjectKeyIdentifier

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
self, Helpers
Defined in: ext/openssl/lib/openssl/x509.rb

Instance Method Summary

  • #subject_key_identifier

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

Helpers - Included

Instance Method Details

#subject_key_identifier

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 ::OpenSSL::ASN1::ASN1Error.

[ GitHub ]

  
# 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