Class: R509::Cert::Extensions::PolicyInformation
- Inherits:
-
Object
- Object
- R509::Cert::Extensions::PolicyInformation
- Defined in:
- lib/r509/cert/extensions/certificate_policies.rb
Overview
This class is used to help build the certificate policies extension
PolicyInformation ::= SEQUENCE {
policyIdentifier CertPolicyId,
policyQualifiers SEQUENCE SIZE (1..MAX) OF
PolicyQualifierInfo OPTIONAL }
Instance Attribute Summary (collapse)
-
- (Object) policy_identifier
readonly
Returns the value of attribute policy_identifier.
-
- (Object) policy_qualifiers
readonly
Returns the value of attribute policy_qualifiers.
Instance Method Summary (collapse)
-
- (PolicyInformation) initialize(data)
constructor
A new instance of PolicyInformation.
- - (Hash) to_h
- - (YAML) to_yaml
Constructor Details
- (PolicyInformation) initialize(data)
A new instance of PolicyInformation
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 131 def initialize(data) # store the policy identifier OID @policy_identifier = data.entries[0].value # iterate the policy qualifiers if any exist if not data.entries[1].nil? @policy_qualifiers = PolicyQualifiers.new data.entries[1].each do |pq| @policy_qualifiers.parse(pq) end end end |
Instance Attribute Details
- (Object) policy_identifier (readonly)
Returns the value of attribute policy_identifier
130 131 132 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 130 def policy_identifier @policy_identifier end |
- (Object) policy_qualifiers (readonly)
Returns the value of attribute policy_qualifiers
130 131 132 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 130 def policy_qualifiers @policy_qualifiers end |
Instance Method Details
- (Hash) to_h
144 145 146 147 148 149 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 144 def to_h hash = {} hash[:policy_identifier] = @policy_identifier hash.merge!(@policy_qualifiers.to_h) unless @policy_qualifiers.nil? hash end |
- (YAML) to_yaml
152 153 154 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 152 def to_yaml self.to_h.to_yaml end |