Class: R509::Cert::Extensions::KeyUsage
- Inherits:
-
OpenSSL::X509::Extension
- Object
- OpenSSL::X509::Extension
- R509::Cert::Extensions::KeyUsage
- Defined in:
- lib/r509/cert/extensions.rb
Overview
Implements the KeyUsage certificate extension, with methods to provide access to the components and meaning of the extension's contents.
Constant Summary
- OID =
"keyUsage"
- AU_DIGITAL_SIGNATURE =
The OpenSSL friendly name for the "digitalSignature" key use.
"Digital Signature"
- AU_NON_REPUDIATION =
The OpenSSL friendly name for the "nonRepudiation" key use.
"Non Repudiation"
- AU_KEY_ENCIPHERMENT =
The OpenSSL friendly name for the "keyEncipherment" key use.
"Key Encipherment"
- AU_DATA_ENCIPHERMENT =
The OpenSSL friendly name for the "dataEncipherment" key use.
"Data Encipherment"
- AU_KEY_AGREEMENT =
The OpenSSL friendly name for the "keyAgreement" key use.
"Key Agreement"
- AU_CERTIFICATE_SIGN =
The OpenSSL friendly name for the "keyCertSign" key use.
"Certificate Sign"
- AU_CRL_SIGN =
The OpenSSL friendly name for the "cRLSign" key use.
"CRL Sign"
- AU_ENCIPHER_ONLY =
The OpenSSL friendly name for the "encipherOnly" key use.
"Encipher Only"
- AU_DECIPHER_ONLY =
The OpenSSL friendly name for the "decipherOnly" key use.
"Decipher Only"
Instance Attribute Summary (collapse)
-
- (Object) allowed_uses
readonly
An array of the key uses allowed.
Instance Method Summary (collapse)
-
- (Boolean) allows?(friendly_use_name)
Returns true if the given use is allowed by this extension.
- - (Boolean) certificate_sign?
- - (Boolean) crl_sign?
- - (Boolean) data_encipherment?
- - (Boolean) decipher_only?
- - (Boolean) digital_signature?
- - (Boolean) encipher_only?
-
- (KeyUsage) initialize(*args)
constructor
See OpenSSL::X509::Extension#initialize.
- - (Boolean) key_agreement?
- - (Boolean) key_encipherment?
- - (Boolean) non_repudiation?
Constructor Details
- (KeyUsage) initialize(*args)
See OpenSSL::X509::Extension#initialize
83 84 85 86 87 |
# File 'lib/r509/cert/extensions.rb', line 83 def initialize(*args) super(*args) @allowed_uses = self.value.split(",").map {|use| use.strip} end |
Instance Attribute Details
- (Object) allowed_uses (readonly)
An array of the key uses allowed. See the AU_* constants in this class.
80 81 82 |
# File 'lib/r509/cert/extensions.rb', line 80 def allowed_uses @allowed_uses end |
Instance Method Details
- (Boolean) allows?(friendly_use_name)
Returns true if the given use is allowed by this extension.
91 92 93 |
# File 'lib/r509/cert/extensions.rb', line 91 def allows?( friendly_use_name ) @allowed_uses.include?( friendly_use_name ) end |
- (Boolean) certificate_sign?
115 116 117 |
# File 'lib/r509/cert/extensions.rb', line 115 def certificate_sign? allows?( AU_CERTIFICATE_SIGN ) end |
- (Boolean) crl_sign?
119 120 121 |
# File 'lib/r509/cert/extensions.rb', line 119 def crl_sign? allows?( AU_CRL_SIGN ) end |
- (Boolean) data_encipherment?
107 108 109 |
# File 'lib/r509/cert/extensions.rb', line 107 def data_encipherment? allows?( AU_DATA_ENCIPHERMENT ) end |
- (Boolean) decipher_only?
127 128 129 |
# File 'lib/r509/cert/extensions.rb', line 127 def decipher_only? allows?( AU_DECIPHER_ONLY ) end |
- (Boolean) digital_signature?
95 96 97 |
# File 'lib/r509/cert/extensions.rb', line 95 def digital_signature? allows?( AU_DIGITAL_SIGNATURE ) end |
- (Boolean) encipher_only?
123 124 125 |
# File 'lib/r509/cert/extensions.rb', line 123 def encipher_only? allows?( AU_ENCIPHER_ONLY ) end |
- (Boolean) key_agreement?
111 112 113 |
# File 'lib/r509/cert/extensions.rb', line 111 def key_agreement? allows?( AU_KEY_AGREEMENT ) end |
- (Boolean) key_encipherment?
103 104 105 |
# File 'lib/r509/cert/extensions.rb', line 103 def key_encipherment? allows?( AU_KEY_ENCIPHERMENT ) end |
- (Boolean) non_repudiation?
99 100 101 |
# File 'lib/r509/cert/extensions.rb', line 99 def non_repudiation? allows?( AU_NON_REPUDIATION ) end |