class SSLTest::CertificateManager

Handles the loading and caching of certificates and private keys.

Public Class Methods

new(certinfo) click to toggle source
# File lib/ssl_test/certificate_manager.rb, line 5
def initialize(certinfo)
  @certinfo = certinfo
end

Public Instance Methods

get_cert(name) click to toggle source
# File lib/ssl_test/certificate_manager.rb, line 13
def get_cert(name)
  OpenSSL::X509::Certificate.new(get_raw_cert(name))
end
get_chain(list) click to toggle source
# File lib/ssl_test/certificate_manager.rb, line 25
def get_chain(list)
  list.map { |name| get_cert(name) }
end
get_key(name) click to toggle source
# File lib/ssl_test/certificate_manager.rb, line 21
def get_key(name)
  OpenSSL::PKey.read(get_raw_key(name))
end
get_keychain(list) click to toggle source
# File lib/ssl_test/certificate_manager.rb, line 29
def get_keychain(list)
  list.map { |name| get_key(name) }
end
get_raw_cert(name) click to toggle source
# File lib/ssl_test/certificate_manager.rb, line 9
def get_raw_cert(name)
  File.read(File.join('certs',name+"cert.pem"))
end
get_raw_key(name) click to toggle source
# File lib/ssl_test/certificate_manager.rb, line 17
def get_raw_key(name)
  File.read(File.join('certs',name+"key.pem"))
end