Module: CaHelper

Defined in:
lib/tasks/helper.rb

Class Method Summary collapse

Class Method Details

.caObject



19
20
21
# File 'lib/tasks/helper.rb', line 19

def self.ca
  @ca ||= R509::CertificateAuthority::Signer.new pool['rcv_spec_ca']
end

.csrObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/tasks/helper.rb', line 4

def self.csr
  R509::CSR.new(
                subject: {
                  C: 'US',
                  ST: 'Florida',
                  L: 'Miami',
                  O: 'r509-cert-validator',
                  CN: 'localhost'
                },
                bit_length: 512,
                type: 'RSA',
                message_digest: 'sha1'
                )
end

.options_builderObject



23
24
25
# File 'lib/tasks/helper.rb', line 23

def self.options_builder
  @builder ||= R509::CertificateAuthority::OptionsBuilder.new pool['rcv_spec_ca']
end

.poolObject



27
28
29
30
31
32
# File 'lib/tasks/helper.rb', line 27

def self.pool
  @pool ||= R509::Config::CAConfigPool.from_yaml(
                                                 'certificate_authorities', 
                                                 File.read('spec/support/ca/config.yaml')
                                                 )
end