class R509::Cert::Extensions::PolicyInformation

This class is used to help build the certificate policies extension

PolicyInformation ::= SEQUENCE {
     policyIdentifier   CertPolicyId,
     policyQualifiers   SEQUENCE SIZE (1..MAX) OF
                             PolicyQualifierInfo OPTIONAL }

Attributes

policy_identifier[R]
policy_qualifiers[R]

Public Class Methods

new(data) click to toggle source
# 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

Public Instance Methods

to_h() click to toggle source

@return [Hash]

# 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() click to toggle source

@return [YAML]

# File lib/r509/cert/extensions/certificate_policies.rb, line 152
def to_yaml
  self.to_h.to_yaml
end