Class: Xml::Kit::SelfSignedCertificate

Inherits:
Object
  • Object
show all
Defined in:
lib/xml/kit/self_signed_certificate.rb

Constant Summary collapse

SUBJECT =
'/C=CA/ST=AB/L=Calgary/O=XmlKit/OU=XmlKit/CN=XmlKit'.freeze

Instance Method Summary collapse

Instance Method Details

#create(algorithm: 'AES-256-CBC', passphrase: nil, key_pair: OpenSSL::PKey::RSA.new(2048)) ⇒ Object



8
9
10
11
12
# File 'lib/xml/kit/self_signed_certificate.rb', line 8

def create(algorithm: 'AES-256-CBC', passphrase: nil, key_pair: OpenSSL::PKey::RSA.new(2048))
  certificate = certificate_for(key_pair.public_key)
  certificate.sign(key_pair, OpenSSL::Digest::SHA256.new)
  [certificate.to_pem, export(key_pair, algorithm, passphrase)]
end