Class: EaSSL::CertificateName

Inherits:
Object
  • Object
show all
Defined in:
lib/eassl/certificate_name.rb

Overview

Author

Paul Nicholson ([email protected])

Co-Author

Adam Williams ([email protected])

Copyright

Copyright © 2006 WebPower Design

License

Distributes under the same terms as Ruby

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CertificateName

Returns a new instance of CertificateName.



9
10
11
# File 'lib/eassl/certificate_name.rb', line 9

def initialize(options)
  @options = options
end

Instance Method Details

#nameObject



32
33
34
# File 'lib/eassl/certificate_name.rb', line 32

def name
  ssl
end

#optionsObject



36
37
38
# File 'lib/eassl/certificate_name.rb', line 36

def options
  @options
end

#sslObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/eassl/certificate_name.rb', line 13

def ssl
  name_mapping = [
    ['C', :country],
    ['ST', :state],
    ['L', :city],
    ['O', :organization],
    ['OU', :department],
    ['CN', :common_name],
    ['emailAddress', :email]
  ]

  name = []
  name_mapping.each do |k|
    name << [k[0], @options[k[1]], OpenSSL::ASN1::PRINTABLESTRING] if @options[k[1]]
  end

  OpenSSL::X509::Name.new(name)
end