Class: RightScale::DistinguishedName
- Defined in:
- lib/right_agent/security/distinguished_name.rb
Overview
Build X.509 compliant distinguished names Distinguished names are used to describe both a certificate issuer and subject
Instance Method Summary collapse
-
#initialize(hash) ⇒ DistinguishedName
constructor
Initialize distinguished name from hash e.g.: { ‘C’ => ‘US’, ‘ST’ => ‘California’, ‘L’ => ‘Santa Barbara’, ‘O’ => ‘RightScale’, ‘OU’ => ‘Certification Services’, ‘CN’ => ‘rightscale.com/[email protected]’ }.
-
#to_s ⇒ Object
Human readable form.
-
#to_x509 ⇒ Object
Conversion to OpenSSL X509 DN.
Constructor Details
#initialize(hash) ⇒ DistinguishedName
Initialize distinguished name from hash e.g.:
{ 'C' => 'US',
'ST' => 'California',
'L' => 'Santa Barbara',
'O' => 'RightScale',
'OU' => 'Certification Services',
'CN' => 'rightscale.com/[email protected]' }
38 39 40 |
# File 'lib/right_agent/security/distinguished_name.rb', line 38 def initialize(hash) @value = hash end |
Instance Method Details
#to_s ⇒ Object
Human readable form
50 51 52 |
# File 'lib/right_agent/security/distinguished_name.rb', line 50 def to_s '/' + @value.to_a.collect { |p| p.join('=') }.join('/') if @value end |
#to_x509 ⇒ Object
Conversion to OpenSSL X509 DN
43 44 45 46 47 |
# File 'lib/right_agent/security/distinguished_name.rb', line 43 def to_x509 if @value OpenSSL::X509::Name.new(@value.to_a, OpenSSL::X509::Name::OBJECT_TYPE_TEMPLATE) end end |