Class: Puppet::SSL::Certificate Deprecated
- Defined in:
- lib/puppet/ssl/certificate.rb
Overview
Use SSLProvider instead.
This class and its associated helpers are still
necessary as they enable FIPS-mode OpenVox Server
to populate trusted data when require 'openssl'
is not available.
Manage certificates themselves. This class has no 'generate' method because the CA is responsible for turning CSRs into certificates; we can only retrieve them from the CA (or not, as is often the case).
Constant Summary
Constants inherited from Base
Base::SEPARATOR, Base::VALID_CERTNAME
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
- .subject_alt_names_for(cert) ⇒ Object
-
.supported_formats ⇒ Object
Because of how the format handler class is included, this can't be in the base class.
Instance Method Summary collapse
-
#custom_extensions ⇒ Array<Hash{String => String}>
Any extensions registered with custom OIDs as defined in module Puppet::SSL::Oids may be looked up here.
- #expiration ⇒ Object
- #subject_alt_names ⇒ Object
-
#unmunged_name ⇒ Object
This name is what gets extracted from the subject before being passed to the constructor, so it's not downcased.
Methods inherited from Base
#digest, #digest_algorithm, #fingerprint, from_instance, from_multiple_s, from_s, #generate, #initialize, name_from_subject, #read, #to_data_hash, to_multiple_s, #to_s, #to_text, validate_certname, wrapped_class, wraps
Constructor Details
This class inherits a constructor from Puppet::SSL::Base
Class Method Details
.subject_alt_names_for(cert) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/puppet/ssl/certificate.rb', line 26 def self.subject_alt_names_for(cert) alts = cert.extensions.find { |ext| ext.oid == "subjectAltName" } return [] unless alts alts.value.split(/\s*,\s*/) end |
.supported_formats ⇒ Object
Because of how the format handler class is included, this can't be in the base class.
22 23 24 |
# File 'lib/puppet/ssl/certificate.rb', line 22 def self.supported_formats [:s] end |
Instance Method Details
#custom_extensions ⇒ Array<Hash{String => String}>
Any extensions registered with custom OIDs as defined in module Puppet::SSL::Oids may be looked up here.
A cert with a 'pp_uuid' extension having the value 'abcd' would return:
[{ 'oid' => 'pp_uuid', 'value' => 'abcd'}]
with key/value pairs for the extension's oid, and its value.
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/puppet/ssl/certificate.rb', line 58 def custom_extensions custom_exts = content.extensions.select do |ext| Puppet::SSL::Oids.subtree_of?('ppRegCertExt', ext.oid) or Puppet::SSL::Oids.subtree_of?('ppPrivCertExt', ext.oid) or Puppet::SSL::Oids.subtree_of?('ppAuthCertExt', ext.oid) end custom_exts.map do |ext| { 'oid' => ext.oid, 'value' => get_ext_val(ext.oid) } end end |
#expiration ⇒ Object
37 38 39 40 41 |
# File 'lib/puppet/ssl/certificate.rb', line 37 def expiration return nil unless content content.not_after end |
#subject_alt_names ⇒ Object
33 34 35 |
# File 'lib/puppet/ssl/certificate.rb', line 33 def subject_alt_names self.class.subject_alt_names_for(content) end |
#unmunged_name ⇒ Object
This name is what gets extracted from the subject before being passed to the constructor, so it's not downcased
45 46 47 |
# File 'lib/puppet/ssl/certificate.rb', line 45 def unmunged_name self.class.name_from_subject(content.subject.to_utf8) end |