Class: R509::Cert::Extensions::PolicyQualifiers
- Inherits:
-
Object
- Object
- R509::Cert::Extensions::PolicyQualifiers
- Defined in:
- lib/r509/cert/extensions/certificate_policies.rb
Overview
This class is used to help build the certificate policies extension
PolicyQualifierInfo ::= SEQUENCE {
policyQualifierId PolicyQualifierId,
qualifier ANY DEFINED BY policyQualifierId }
Instance Attribute Summary (collapse)
-
- (Object) cps_uris
readonly
Returns the value of attribute cps_uris.
-
- (Object) user_notices
readonly
Returns the value of attribute user_notices.
Instance Method Summary (collapse)
-
- (PolicyQualifiers) initialize
constructor
A new instance of PolicyQualifiers.
-
- (Object) parse(data)
parse each PolicyQualifier and store the results into the object array.
- - (Hash) to_h
- - (YAML) to_yaml
Constructor Details
- (PolicyQualifiers) initialize
A new instance of PolicyQualifiers
163 164 165 166 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 163 def initialize @cps_uris = [] @user_notices = [] end |
Instance Attribute Details
- (Object) cps_uris (readonly)
Returns the value of attribute cps_uris
162 163 164 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 162 def cps_uris @cps_uris end |
- (Object) user_notices (readonly)
Returns the value of attribute user_notices
162 163 164 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 162 def user_notices @user_notices end |
Instance Method Details
- (Object) parse(data)
parse each PolicyQualifier and store the results into the object array
169 170 171 172 173 174 175 176 177 178 |
# 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 |
- (Hash) to_h
181 182 183 184 185 186 |
# 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 |
- (YAML) to_yaml
189 190 191 |
# File 'lib/r509/cert/extensions/certificate_policies.rb', line 189 def to_yaml self.to_h.to_yaml end |