class CertificateAuthority::Extensions::KeyUsage

Specifies the allowed usage purposes of the keypair specified in this certificate. Reference: Section 4.2.1.3 of RFC3280 tools.ietf.org/html/rfc3280#section-4.2.1.3

Note: OpenSSL when parsing an extension will return results in the form 'Digital Signature', but on signing you have to set it to 'digitalSignature'. So copying an extension from an imported cert isn't going to work yet.

Constants

OPENSSL_IDENTIFIER

Attributes

critical[RW]
usage[RW]

Public Class Methods

new() click to toggle source
# File vendor/certificate_authority/lib/certificate_authority/extensions.rb, line 324
def initialize
  @critical = false
  @usage = ["digitalSignature", "nonRepudiation"]
end
parse(value, critical) click to toggle source
# File vendor/certificate_authority/lib/certificate_authority/extensions.rb, line 343
def self.parse(value, critical)
  obj = self.new
  return obj if value.nil?
  obj.critical = critical
  obj.usage = value.split(/,\s*/)
  obj
end

Public Instance Methods

==(o) click to toggle source
# File vendor/certificate_authority/lib/certificate_authority/extensions.rb, line 339
def ==(o)
  o.class == self.class && o.state == state
end
openssl_identifier() click to toggle source
# File vendor/certificate_authority/lib/certificate_authority/extensions.rb, line 329
def openssl_identifier
  OPENSSL_IDENTIFIER
end
to_s() click to toggle source
# File vendor/certificate_authority/lib/certificate_authority/extensions.rb, line 333
def to_s
  res = []
  res += @usage
  res.join(',')
end

Protected Instance Methods

state() click to toggle source
# File vendor/certificate_authority/lib/certificate_authority/extensions.rb, line 352
def state
  [@critical,@usage]
end