123456789_123456789_123456789_123456789_123456789_

Module: OpenSSL::X509::Extension::AuthorityKeyIdentifier

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

  • #authority_key_identifier

    Get the issuing certificate’s key identifier from the authorityKeyIdentifier extension, as described in RFC5280 Section 4.2.1.1.

Helpers - Included

Instance Method Details

#authority_key_identifier

Get the issuing certificate’s key identifier from the authorityKeyIdentifier extension, as described in RFC5280 Section 4.2.1.1

Returns the binary String keyIdentifier or nil or raises ::OpenSSL::ASN1::ASN1Error.

[ GitHub ]

  
# File 'ext/openssl/lib/openssl/x509.rb', line 104

def authority_key_identifier
  ext = find_extension("authorityKeyIdentifier")
  return nil if ext.nil?

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

  key_id = aki_asn1.value.find do |v|
    v.tag_class == :CONTEXT_SPECIFIC && v.tag == 0
  end

  key_id.nil? ? nil : key_id.value
end