Class: R509::Cert::Extensions::CertificatePolicies
- Inherits:
-
OpenSSL::X509::Extension
- Object
- OpenSSL::X509::Extension
- R509::Cert::Extensions::CertificatePolicies
- Defined in:
- lib/r509/cert/extensions/certificate_policies.rb
Overview
RFC 5280 Description (see: www.ietf.org/rfc/rfc5280.txt)
The certificate policies extension contains a sequence of one or more policy information terms, each of which consists of an object identifier (OID) and optional qualifiers. Optional qualifiers, which MAY be present, are not expected to change the definition of the policy. A certificate policy OID MUST NOT appear more than once in a certificate policies extension.
You can use this extension to parse an existing extension for easy access to the contents or create a new one.
Constant Summary collapse
- OID =
friendly name for CP OID
"certificatePolicies"
Instance Attribute Summary collapse
-
#policies ⇒ Array
readonly
Array of R509::Cert::Extensions::PolicyObjects::PolicyInformation objects.
Instance Method Summary collapse
-
#initialize(arg) ⇒ CertificatePolicies
constructor
This method takes a hash or an existing Extension object to parse.
- #to_h ⇒ Hash
- #to_yaml ⇒ YAML
Constructor Details
#initialize(arg) ⇒ CertificatePolicies
This method takes a hash or an existing Extension object to parse. The hash must contain a :value that is an array of policy information. See the example.
36 37 38 39 40 41 42 43 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 36 def initialize(arg) unless R509::Cert::Extensions.is_extension?(arg) arg = build_extension(arg) end super(arg) parse_extension end |
Instance Attribute Details
#policies ⇒ Array (readonly)
Returns Array of R509::Cert::Extensions::PolicyObjects::PolicyInformation objects.
22 23 24 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 22 def policies @policies end |
Instance Method Details
#to_h ⇒ Hash
46 47 48 49 50 51 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 46 def to_h { :critical => self.critical?, :value => @policies.map { |policy| policy.to_h } } end |
#to_yaml ⇒ YAML
54 55 56 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 54 def to_yaml self.to_h.to_yaml end |