Class: CertificateAuthority::Extensions::CertificatePolicies

Inherits:
Object
  • Object
show all
Includes:
ExtensionAPI
Defined in:
lib/certificate_authority/extensions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCertificatePolicies

Returns a new instance of CertificatePolicies.



205
206
207
# File 'lib/certificate_authority/extensions.rb', line 205

def initialize
  @contains_data = false
end

Instance Attribute Details

#cps_urisObject

Returns the value of attribute cps_uris.



199
200
201
# File 'lib/certificate_authority/extensions.rb', line 199

def cps_uris
  @cps_uris
end

#explicit_textObject

User notice



201
202
203
# File 'lib/certificate_authority/extensions.rb', line 201

def explicit_text
  @explicit_text
end

#notice_numbersObject

Returns the value of attribute notice_numbers.



203
204
205
# File 'lib/certificate_authority/extensions.rb', line 203

def notice_numbers
  @notice_numbers
end

#organizationObject

Returns the value of attribute organization.



202
203
204
# File 'lib/certificate_authority/extensions.rb', line 202

def organization
  @organization
end

#policy_identifierObject

Returns the value of attribute policy_identifier.



198
199
200
# File 'lib/certificate_authority/extensions.rb', line 198

def policy_identifier
  @policy_identifier
end

Instance Method Details

#config_extensionsObject



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/certificate_authority/extensions.rb', line 220

def config_extensions
  config_extension = {}
  custom_policies = {}
  notice = {}
  unless self.policy_identifier.nil?
    custom_policies["policyIdentifier"] = self.policy_identifier
  end

  if !self.cps_uris.nil? and self.cps_uris.is_a?(Array)
    self.cps_uris.each_with_index do |cps_uri,i|
      custom_policies["CPS.#{i}"] = cps_uri
    end
  end

  unless self.explicit_text.nil?
    notice["explicitText"] = self.explicit_text
  end

  unless self.organization.nil?
    notice["organization"] = self.organization
  end

  unless self.notice_numbers.nil?
    notice["noticeNumbers"] = self.notice_numbers
  end

  if notice.keys.size > 0
    custom_policies["userNotice.1"] = "@notice"
    config_extension["notice"] = notice
  end

  if custom_policies.keys.size > 0
    config_extension["custom_policies"] = custom_policies
    @contains_data = true
  end

  config_extension
end

#openssl_identifierObject



210
211
212
# File 'lib/certificate_authority/extensions.rb', line 210

def openssl_identifier
  "certificatePolicies"
end

#to_sObject



259
260
261
262
# File 'lib/certificate_authority/extensions.rb', line 259

def to_s
  return "" unless @contains_data
  "ia5org,@custom_policies"
end

#user_notice=(value = {}) ⇒ Object



214
215
216
217
218
# File 'lib/certificate_authority/extensions.rb', line 214

def user_notice=(value={})
  value.keys.each do |key|
    self.send("#{key}=".to_sym, value[key])
  end
end