class R509::Cert::Extensions::PolicyQualifiers

This class is used to help build the certificate policies extension

PolicyQualifierInfo ::= SEQUENCE {
     policyQualifierId  PolicyQualifierId,
     qualifier          ANY DEFINED BY policyQualifierId }

Attributes

cps_uris[R]
user_notices[R]

Public Class Methods

new() click to toggle source
# File lib/r509/cert/extensions/certificate_policies.rb, line 163
def initialize
  @cps_uris = []
  @user_notices = []
end

Public Instance Methods

parse(data) click to toggle source

parse each PolicyQualifier and store the results into the object array

# File lib/r509/cert/extensions/certificate_policies.rb, line 169
def parse(data)
  oid = data.entries[0].value
  case
  when oid == 'id-qt-cps'
    # by RFC definition must be URIs
    @cps_uris << data.entries[1].value
  when oid == 'id-qt-unotice'
    @user_notices <<  UserNotice.new(data.entries[1])
  end
end
to_h() click to toggle source

@return [Hash]

# File lib/r509/cert/extensions/certificate_policies.rb, line 181
def to_h
  hash = {}
  hash[:cps_uris] = @cps_uris
  hash[:user_notices] = @user_notices.map { |notice| notice.to_h } unless @user_notices.empty?
  hash
end
to_yaml() click to toggle source

@return [YAML]

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