Class: SSOlo::Certificate
- Inherits:
-
Object
- Object
- SSOlo::Certificate
- Defined in:
- lib/ssolo/certificate.rb
Overview
Generates an X509 certificate with the given private key. These certificates are not meant for production use.
Class Method Summary collapse
Instance Method Summary collapse
-
#call ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#initialize(private_key) ⇒ Certificate
constructor
A new instance of Certificate.
Constructor Details
#initialize(private_key) ⇒ Certificate
Returns a new instance of Certificate.
13 14 15 |
# File 'lib/ssolo/certificate.rb', line 13 def initialize(private_key) @private_key = private_key end |
Class Method Details
.call ⇒ Object
9 10 11 |
# File 'lib/ssolo/certificate.rb', line 9 def self.call(...) new(...).call end |
Instance Method Details
#call ⇒ Object
rubocop:disable Metrics/AbcSize
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ssolo/certificate.rb', line 18 def call OpenSSL::X509::Certificate.new.tap do |certificate| certificate.version = 2 certificate.serial = 0 certificate.not_before = not_before certificate.not_after = not_after certificate.public_key = public_key certificate.subject = name certificate.issuer = name certificate.sign(private_key, digest) end end |