Class: CertificateAuthority::Pkcs11KeyMaterial
- Inherits:
-
Object
- Object
- CertificateAuthority::Pkcs11KeyMaterial
- Includes:
- ActiveModel::Serialization, ActiveModel::Validations, KeyMaterial
- Defined in:
- lib/certificate_authority/pkcs11_key_material.rb
Instance Attribute Summary collapse
-
#engine ⇒ Object
Returns the value of attribute engine.
-
#openssl_pkcs11_engine_lib ⇒ Object
Returns the value of attribute openssl_pkcs11_engine_lib.
-
#pin ⇒ Object
Returns the value of attribute pin.
-
#pkcs11_lib ⇒ Object
Returns the value of attribute pkcs11_lib.
-
#token_id ⇒ Object
Returns the value of attribute token_id.
Instance Method Summary collapse
- #generate_key(modulus_bits = 1024) ⇒ Object
-
#initialize(attributes = {}) ⇒ Pkcs11KeyMaterial
constructor
A new instance of Pkcs11KeyMaterial.
- #is_in_hardware? ⇒ Boolean
- #is_in_memory? ⇒ Boolean
- #private_key ⇒ Object
- #public_key ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Pkcs11KeyMaterial
Returns a new instance of Pkcs11KeyMaterial.
13 14 15 16 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 13 def initialize(attributes = {}) @attributes = attributes initialize_engine end |
Instance Attribute Details
#engine ⇒ Object
Returns the value of attribute engine.
7 8 9 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 7 def engine @engine end |
#openssl_pkcs11_engine_lib ⇒ Object
Returns the value of attribute openssl_pkcs11_engine_lib.
10 11 12 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 10 def openssl_pkcs11_engine_lib @openssl_pkcs11_engine_lib end |
#pin ⇒ Object
Returns the value of attribute pin.
11 12 13 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 11 def pin @pin end |
#pkcs11_lib ⇒ Object
Returns the value of attribute pkcs11_lib.
9 10 11 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 9 def pkcs11_lib @pkcs11_lib end |
#token_id ⇒ Object
Returns the value of attribute token_id.
8 9 10 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 8 def token_id @token_id end |
Instance Method Details
#generate_key(modulus_bits = 1024) ⇒ Object
26 27 28 29 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 26 def generate_key(modulus_bits=1024) puts "Key generation is not currently supported in hardware" nil end |
#is_in_hardware? ⇒ Boolean
18 19 20 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 18 def is_in_hardware? true end |
#is_in_memory? ⇒ Boolean
22 23 24 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 22 def is_in_memory? false end |
#private_key ⇒ Object
31 32 33 34 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 31 def private_key initialize_engine self.engine.load_private_key(self.token_id) end |
#public_key ⇒ Object
36 37 38 39 |
# File 'lib/certificate_authority/pkcs11_key_material.rb', line 36 def public_key initialize_engine self.engine.load_public_key(self.token_id) end |