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
-
#policy_identifier ⇒ Object
readonly
Returns the value of attribute policy_identifier.
-
#policy_qualifiers ⇒ Object
readonly
Returns the value of attribute policy_qualifiers.
Instance Method Summary collapse
-
#initialize(data) ⇒ PolicyInformation
constructor
A new instance of PolicyInformation.
- #to_h ⇒ Hash
- #to_yaml ⇒ YAML
Constructor Details
#initialize(data) ⇒ PolicyInformation
Returns 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 return if data.entries[1].nil? @policy_qualifiers = PolicyQualifiers.new data.entries[1].each do |pq| @policy_qualifiers.parse(pq) end end |
Instance Attribute Details
#policy_identifier ⇒ Object (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 |
#policy_qualifiers ⇒ Object (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
#to_h ⇒ Hash
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 |
#to_yaml ⇒ YAML
152 153 154 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 152 def to_yaml self.to_h.to_yaml end |