Sha256: 862a95e834d01997fec7514d5c52c6e13f8cdee00dd6025a8a9f6ed024fb28dc
Contents?: true
Size: 942 Bytes
Versions: 1
Compression:
Stored size: 942 Bytes
Contents
require "r509" module Digicert class CSRGenerator 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 def generate create_r509_csr.to_s end def self.generate(attributes) new(**attributes).generate end private attr_reader :organization, :common_name, :san_names, :rsa_key def create_r509_csr R509::CSR.new(r509_attributes_hash) end def r509_attributes_hash { key: rsa_key, subject: subject_items, san_names: san_names }. reject { |_key, value| value.nil? || value.empty? } end def subject_items [ ["CN", common_name], ["C", organization.country], ["ST", organization.state], ["L", organization.city], ["O", organization.name], ] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
digicert-1.0.0 | lib/digicert/csr_generator.rb |