Class: ZeroSSL::CSR

Inherits:
Object
  • Object
show all
Defined in:
lib/zerossl/csr.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ CSR

Returns a new instance of CSR.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/zerossl/csr.rb', line 5

def initialize opts = {}
  opts.transform_keys!(&:to_s)

  @common_name  = opts.dig('common_name')
  @organization = opts.dig('organization')
  @country      = opts.dig('country')
  @state_name   = opts.dig('state_name')
  @locality     = opts.dig('locality')

  @signing_key  = signing_key
  @subject      = subject
end

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
# File 'lib/zerossl/csr.rb', line 18

def call
  csr            = OpenSSL::X509::Request.new
  csr.version    = 0
  csr.subject    = subject
  csr.public_key = signing_key.public_key
  csr.sign signing_key, OpenSSL::Digest::SHA256.new

  [csr.to_s, signing_key.to_s]
end