class OpenSSLExtensions::X509::AuthorityKeyIdentifier
Returned with requesting an OpenSSLExtensions::X509::Certificate.authority_key_identifier
. If available, this collects the issuer_name
(issuer’s common name), serial_number
, and key_id
(fingerprint).
Attributes
issuer_name[R]
key_id[R]
serial[R]
serial_number[R]
Public Class Methods
new(extension_string)
click to toggle source
# File lib/openssl-extensions/x509/authority_key_identifier.rb, line 14 def initialize(extension_string) parse(extension_string.dup) if extension_string end
Private Instance Methods
common_name(input)
click to toggle source
# File lib/openssl-extensions/x509/authority_key_identifier.rb, line 22 def common_name(input) if input name = input.split('/'). collect { |v| v.split('=') }. detect { |id, val| id == 'CN' } name[1] if name end end
parse(string)
click to toggle source
# File lib/openssl-extensions/x509/authority_key_identifier.rb, line 31 def parse(string) Hash[string.scan(%r{(\w+):([^,\n]+)})].tap do |h| @issuer_name = common_name(strip(h['DirName'])) @serial_number = strip(h['serial']) @key_id = strip(h['keyid']) end end
strip(input)
click to toggle source
# File lib/openssl-extensions/x509/authority_key_identifier.rb, line 39 def strip(input) input ? input.to_s.strip : nil end