create_cert(subject, key, age = ONE_YEAR, extensions = EXTENSIONS, serial = 1)
public
Creates an unsigned certificate for subject and key. The
lifetime of the key is from the current time to age which defaults
to one year.
The extensions restrict the key to the indicated uses.
# File lib/rubygems/security.rb, line 422
def self.create_cert(subject, key, age = ONE_YEAR, extensions = EXTENSIONS,
serial = 1)
cert = OpenSSL::X509::Certificate.new
cert.public_key = key.public_key
cert.version = 2
cert.serial = serial
cert.not_before = Time.now
cert.not_after = Time.now + age
cert.subject = subject
ef = OpenSSL::X509::ExtensionFactory.new nil, cert
cert.extensions = extensions.map do |ext_name, value|
ef.create_extension ext_name, value
end
cert
end