Class: R509::Cert::Extensions::UserNotice

Inherits:
Object
  • Object
show all
Defined in:
lib/r509/cert/extensions/certificate_policies.rb

Overview

This class is used to help build the certificate policies extension

UserNotice ::= SEQUENCE {
     noticeRef        NoticeReference OPTIONAL,
     explicitText     DisplayText OPTIONAL }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ UserNotice

Returns a new instance of UserNotice



200
201
202
203
204
205
206
207
208
209
210
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 200

def initialize(data)
  data.each do |qualifier|
    # if we find another sequence, that's a noticeReference, otherwise it's explicitText
    if qualifier.is_a?(OpenSSL::ASN1::Sequence)
      @notice_reference = NoticeReference.new(qualifier)
    else
      @explicit_text = qualifier.value
    end

  end if data.respond_to?(:each)
end

Instance Attribute Details

#explicit_textObject (readonly)

Returns the value of attribute explicit_text



199
200
201
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 199

def explicit_text
  @explicit_text
end

#notice_referenceObject (readonly)

Returns the value of attribute notice_reference



199
200
201
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 199

def notice_reference
  @notice_reference
end

Instance Method Details

#to_hHash

Returns:

  • (Hash)


213
214
215
216
217
218
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 213

def to_h
  hash = {}
  hash[:explicit_text] = @explicit_text unless @explicit_text.nil?
  hash.merge!(@notice_reference.to_h) unless @notice_reference.nil?
  hash
end

#to_yamlYAML

Returns:

  • (YAML)


221
222
223
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 221

def to_yaml
  self.to_h.to_yaml
end