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
- OID =
friendly name for CP OID
"certificatePolicies"
Instance Attribute Summary (collapse)
-
- (Array) policies
readonly
Array of R509::Cert::Extensions::PolicyObjects::PolicyInformation objects.
Instance Method Summary (collapse)
-
- (CertificatePolicies) initialize(arg)
constructor
This method takes a hash or an existing Extension object to parse.
- - (Hash) to_h
- - (YAML) to_yaml
Constructor Details
- (CertificatePolicies) initialize(arg)
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.
37 38 39 40 41 42 43 44 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 37 def initialize(arg) if not R509::Cert::Extensions.is_extension?(arg) arg = build_extension(arg) end super(arg) parse_extension end |
Instance Attribute Details
- (Array) policies (readonly)
Array of R509::Cert::Extensions::PolicyObjects::PolicyInformation objects
23 24 25 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 23 def policies @policies end |
Instance Method Details
- (Hash) to_h
47 48 49 50 51 52 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 47 def to_h { :critical => self.critical?, :value => @policies.map { |policy| policy.to_h } } end |
- (YAML) to_yaml
55 56 57 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 55 def to_yaml self.to_h.to_yaml end |