class EaSSL::CertificateName

Author

Paul Nicholson (paul@webpowerdesign.net)

Co-Author

Adam Williams (adam@thewilliams.ws)

Copyright

Copyright © 2006 WebPower Design

License

Distributes under the same terms as Ruby

Public Class Methods

new(options) click to toggle source
# File lib/eassl/certificate_name.rb, line 9
def initialize(options)
  @options = options
end

Public Instance Methods

name() click to toggle source
# File lib/eassl/certificate_name.rb, line 32
def name
  ssl
end
options() click to toggle source
# File lib/eassl/certificate_name.rb, line 36
def options
  @options
end
ssl() click to toggle source
# 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