Sha256: b67be783a7043d25c4b1bbe678bd72fd69929a4f5f5b618b2e1818625a22cf16

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

module R509::CertificateAuthority::HTTP
  class Config
    def self.load_config(config_file = "config.yaml")
      config_data = File.read(config_file)

      Dependo::Registry[:config_pool] = R509::Config::CAConfigPool.from_yaml("certificate_authorities", config_data)

      Dependo::Registry[:crls] = {}
      Dependo::Registry[:options_builders] = {}
      Dependo::Registry[:certificate_authorities] = {}
      Dependo::Registry[:config_pool].names.each do |name|
        Dependo::Registry[:crls][name] = R509::CRL::Administrator.new(Dependo::Registry[:config_pool][name])
        Dependo::Registry[:options_builders][name] = R509::CertificateAuthority::OptionsBuilder.new(Dependo::Registry[:config_pool][name])
        Dependo::Registry[:certificate_authorities][name] = R509::CertificateAuthority::Signer.new(Dependo::Registry[:config_pool][name])
      end
    end

    def self.print_config
      Dependo::Registry[:log].warn "Config loaded"
      Dependo::Registry[:config_pool].all.each do |config|
        Dependo::Registry[:log].warn "Config: "
        Dependo::Registry[:log].warn "CA Cert:"+config.ca_cert.subject.to_s
        Dependo::Registry[:log].warn "OCSP Cert (may be the same as above):"+config.ocsp_cert.subject.to_s
        Dependo::Registry[:log].warn "OCSP Validity Hours: "+config.ocsp_validity_hours.to_s
        Dependo::Registry[:log].warn "CRL Validity Hours: "+config.crl_validity_hours.to_s
        Dependo::Registry[:log].warn "\n"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
r509-ca-http-0.3.2 lib/r509/certificateauthority/http/config.rb