Class: Acme::Client::SelfSignCertificate
- Inherits:
-
Object
- Object
- Acme::Client::SelfSignCertificate
- Extended by:
- Forwardable
- Defined in:
- lib/acme/client/self_sign_certificate.rb
Instance Attribute Summary collapse
-
#not_after ⇒ Object
readonly
Returns the value of attribute not_after.
-
#not_before ⇒ Object
readonly
Returns the value of attribute not_before.
-
#private_key ⇒ Object
readonly
Returns the value of attribute private_key.
-
#subject_alt_names ⇒ Object
readonly
Returns the value of attribute subject_alt_names.
Instance Method Summary collapse
- #certificate ⇒ Object
-
#initialize(subject_alt_names:, not_before: default_not_before, not_after: default_not_after, private_key: generate_private_key) ⇒ SelfSignCertificate
constructor
A new instance of SelfSignCertificate.
Constructor Details
#initialize(subject_alt_names:, not_before: default_not_before, not_after: default_not_after, private_key: generate_private_key) ⇒ SelfSignCertificate
Returns a new instance of SelfSignCertificate.
7 8 9 10 11 12 |
# File 'lib/acme/client/self_sign_certificate.rb', line 7 def initialize(subject_alt_names:, not_before: default_not_before, not_after: default_not_after, private_key: generate_private_key) @private_key = private_key @subject_alt_names = subject_alt_names @not_before = not_before @not_after = not_after end |
Instance Attribute Details
#not_after ⇒ Object (readonly)
Returns the value of attribute not_after.
2 3 4 |
# File 'lib/acme/client/self_sign_certificate.rb', line 2 def not_after @not_after end |
#not_before ⇒ Object (readonly)
Returns the value of attribute not_before.
2 3 4 |
# File 'lib/acme/client/self_sign_certificate.rb', line 2 def not_before @not_before end |
#private_key ⇒ Object (readonly)
Returns the value of attribute private_key.
2 3 4 |
# File 'lib/acme/client/self_sign_certificate.rb', line 2 def private_key @private_key end |
#subject_alt_names ⇒ Object (readonly)
Returns the value of attribute subject_alt_names.
2 3 4 |
# File 'lib/acme/client/self_sign_certificate.rb', line 2 def subject_alt_names @subject_alt_names end |
Instance Method Details
#certificate ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/acme/client/self_sign_certificate.rb', line 14 def certificate @certificate ||= begin certificate = generate_certificate extension_factory = generate_extension_factory(certificate) subject_alt_name_entry = subject_alt_names.map { |d| "DNS: #{d}" }.join(',') subject_alt_name_extension = extension_factory.create_extension('subjectAltName', subject_alt_name_entry) certificate.add_extension(subject_alt_name_extension) certificate.sign(private_key, digest) end end |