Sha256: 0e18ee5bbb8ab136fc07dd076cb51db948d93f9a13a069d8f6aabd3af8ea2fb4

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'r509/csr'
require 'r509/certificate_authority/signer'
require 'r509/certificate_authority/options_builder'
require 'r509/config/ca_config'

module CaHelper
  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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cert_validator-0.0.1 lib/tasks/helper.rb