Class: CertificateAuthority::WrappedDistinguishedName

Inherits:
DistinguishedName show all
Defined in:
lib/certificate_authority/distinguished_name.rb

Overview

This is a significantly more complicated case. It’s possible that generically handled certificates will include custom OIDs in the subject.

Instance Attribute Summary collapse

Attributes inherited from DistinguishedName

#common_name, #country, #email_address, #locality, #organization, #organizational_unit, #serial_number, #state

Instance Method Summary collapse

Methods inherited from DistinguishedName

#==, from_openssl, #validate

Methods included from Validations

#errors, #valid?, #validate

Constructor Details

#initialize(x509_name) ⇒ WrappedDistinguishedName

Returns a new instance of WrappedDistinguishedName.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/certificate_authority/distinguished_name.rb', line 79

def initialize(x509_name)
  @x509_name = x509_name

  subject = @x509_name.to_a
  subject.each do |element|
    field = element[0].downcase
    value = element[1]
    #type = element[2] ## -not used
    method_sym = "#{field}=".to_sym
    if self.respond_to?(method_sym)
      self.send("#{field}=",value)
    else
      ## Custom OID
      @custom_oids = true
    end
  end

end

Instance Attribute Details

#x509_nameObject

Returns the value of attribute x509_name.



77
78
79
# File 'lib/certificate_authority/distinguished_name.rb', line 77

def x509_name
  @x509_name
end

Instance Method Details

#custom_oids?Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/certificate_authority/distinguished_name.rb', line 102

def custom_oids?
  @custom_oids
end

#to_x509_nameObject



98
99
100
# File 'lib/certificate_authority/distinguished_name.rb', line 98

def to_x509_name
  @x509_name
end