class R509::Cert::Extensions::NoticeReference

This class is used to help build the certificate policies extension

NoticeReference ::= SEQUENCE {
     organization     DisplayText,
     noticeNumbers    SEQUENCE OF INTEGER }

Attributes

notice_numbers[R]
organization[R]

Public Class Methods

new(data) click to toggle source
# File lib/r509/cert/extensions/certificate_policies.rb, line 232
def initialize(data)
  data.each do |notice_reference|
    # if it's displaytext then it's the organization
    # if it's YET ANOTHER ASN1::Sequence, then it's noticeNumbers
    if notice_reference.is_a?(OpenSSL::ASN1::Sequence)
      @notice_numbers = []
      notice_reference.each do |ints|
        @notice_numbers << ints.value.to_i
      end
    else
      @organization = notice_reference.value
    end
  end
end

Public Instance Methods

to_h() click to toggle source

@return [Hash]

# File lib/r509/cert/extensions/certificate_policies.rb, line 248
def to_h
  hash = {}
  hash[:organization] = @organization unless @organization.nil?
  hash[:notice_numbers] = @notice_numbers unless @notice_numbers.empty?
  hash
end
to_yaml() click to toggle source

@return [YAML]

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