End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Gem::Security.create_cert
create_cert(subject, key, age = ONE_YEAR, extensions = EXTENSIONS, serial = 1)
lib/rubygems/security.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/rubygems/security.rb, line 401
def self.create_cert(subject, key, age = ONE_YEAR, extensions = EXTENSIONS,
serial = 1)
cert = OpenSSL::X509::Certificate.new
cert.public_key = get_public_key(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
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.
See also
.alt_name_or_x509_entry
.create_cert_email
.create_cert_self_signed
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0