Class: LetsEncrypt::Certificate
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- LetsEncrypt::Certificate
- Includes:
- CertificateIssuable, CertificateVerifiable
- Defined in:
- app/models/lets_encrypt/certificate.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#active? ⇒ Boolean
Returns false if certificate is not issued.
-
#bundle ⇒ Object
Returns full-chain bundled certificates.
- #certificate_object ⇒ Object
-
#expired? ⇒ Boolean
Returns true if certificate is expired.
-
#get ⇒ Object
(also: #renew)
Returns true if success get a new certificate.
- #key_object ⇒ Object
-
#save_to_redis ⇒ Object
Save certificate into redis.
Methods included from CertificateIssuable
Methods included from CertificateVerifiable
Instance Method Details
#active? ⇒ Boolean
Returns false if certificate is not issued.
This method didn’t check certificate is valid, its only uses for checking is there has a certificate.
22 23 24 |
# File 'app/models/lets_encrypt/certificate.rb', line 22 def active? certificate.present? end |
#bundle ⇒ Object
Returns full-chain bundled certificates
39 40 41 |
# File 'app/models/lets_encrypt/certificate.rb', line 39 def bundle [intermediaries, certificate].join("\n") end |
#certificate_object ⇒ Object
43 44 45 |
# File 'app/models/lets_encrypt/certificate.rb', line 43 def certificate_object @certificate_object ||= OpenSSL::X509::Certificate.new(certificate) end |
#expired? ⇒ Boolean
Returns true if certificate is expired.
27 28 29 |
# File 'app/models/lets_encrypt/certificate.rb', line 27 def expired? Time.zone.now >= expires_at end |
#get ⇒ Object Also known as: renew
Returns true if success get a new certificate
32 33 34 |
# File 'app/models/lets_encrypt/certificate.rb', line 32 def get verify && issue end |
#key_object ⇒ Object
47 48 49 |
# File 'app/models/lets_encrypt/certificate.rb', line 47 def key_object @key_object ||= OpenSSL::PKey::RSA.new(key) end |
#save_to_redis ⇒ Object
Save certificate into redis
52 53 54 |
# File 'app/models/lets_encrypt/certificate.rb', line 52 def save_to_redis LetsEncrypt::Redis.save(self) end |