Class: R509::Cert::Extensions::AuthorityKeyIdentifier

Inherits:
OpenSSL::X509::Extension
  • Object
show all
Defined in:
lib/r509/cert/extensions.rb

Overview

Implements the AuthorityKeyIdentifier certificate extension, with methods to provide access to the components and meaning of the extension's contents.

Constant Summary

OID =

friendly name for Authority Key Identifier OID

"authorityKeyIdentifier"

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (AuthorityKeyIdentifier) initialize(*args)

A new instance of AuthorityKeyIdentifier



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/r509/cert/extensions.rb', line 350

def initialize(*args)
  super(*args)

  data = R509::ASN1.get_extension_payload(self)
  #   AuthorityKeyIdentifier ::= SEQUENCE {
  #      keyIdentifier             [0] KeyIdentifier           OPTIONAL,
  #      authorityCertIssuer       [1] GeneralNames            OPTIONAL,
  #      authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL  }
  data.entries.each do |el|
    case el.tag
    when 0
      @key_identifier = el.value.unpack("H*")[0].upcase.scan(/../).join(":")
    when 1
      @authority_cert_issuer = R509::ASN1::GeneralName.new(el.value.first)
    when 2
      arr = el.value.unpack("H*")[0].upcase.scan(/../)
      # OpenSSL's convention is to drop leading 00s, so let's strip that off if
      # present
      if arr[0] == "00"
        arr.delete_at(0)
      end
      @authority_cert_serial_number = arr.join(":")
    end
  end

end

Instance Attribute Details

- (Object) authority_cert_issuer (readonly)

key_identifier, if present, will be a hex string delimited by colons authority_cert_issuer, if present, will be a GeneralName object authority_cert_serial_number, if present, will be a hex string delimited by colons



348
349
350
# File 'lib/r509/cert/extensions.rb', line 348

def authority_cert_issuer
  @authority_cert_issuer
end

- (Object) authority_cert_serial_number (readonly)

key_identifier, if present, will be a hex string delimited by colons authority_cert_issuer, if present, will be a GeneralName object authority_cert_serial_number, if present, will be a hex string delimited by colons



348
349
350
# File 'lib/r509/cert/extensions.rb', line 348

def authority_cert_serial_number
  @authority_cert_serial_number
end

- (Object) key_identifier (readonly)

key_identifier, if present, will be a hex string delimited by colons authority_cert_issuer, if present, will be a GeneralName object authority_cert_serial_number, if present, will be a hex string delimited by colons



348
349
350
# File 'lib/r509/cert/extensions.rb', line 348

def key_identifier
  @key_identifier
end