class Digicert::CSRGenerator
Attributes
common_name[R]
organization[R]
rsa_key[R]
san_names[R]
Public Class Methods
generate(attributes)
click to toggle source
# File lib/digicert/csr_generator.rb, line 16 def self.generate(attributes) new(attributes).generate end
new(common_name:, organization:, san_names: [], rsa_key: nil)
click to toggle source
# File lib/digicert/csr_generator.rb, line 5 def initialize(common_name:, organization:, san_names: [], rsa_key: nil) @rsa_key = rsa_key @common_name = common_name @san_names = san_names @organization = organization end
Public Instance Methods
generate()
click to toggle source
# File lib/digicert/csr_generator.rb, line 12 def generate create_r509_csr.to_s end
Private Instance Methods
create_r509_csr()
click to toggle source
# File lib/digicert/csr_generator.rb, line 24 def create_r509_csr R509::CSR.new(r509_attributes_hash) end
r509_attributes_hash()
click to toggle source
# File lib/digicert/csr_generator.rb, line 28 def r509_attributes_hash { key: rsa_key, subject: subject_items, san_names: san_names }. reject { |_key, value| value.nil? || value.empty? } end
subject_items()
click to toggle source
# File lib/digicert/csr_generator.rb, line 33 def subject_items [ ["CN", common_name], ["C", organization.country], ["ST", organization.state], ["L", organization.city], ["O", organization.name], ] end