Class: Virgil::Crypto::VirgilPrivateKeyExporter
- Inherits:
-
Object
- Object
- Virgil::Crypto::VirgilPrivateKeyExporter
- Defined in:
- lib/virgil/crypto/private_key_exporter.rb
Overview
Provides export [PrivateKey] into its material representation bytes and import [PrivateKey] from its material representation bytes.
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#virgil_crypto ⇒ Object
readonly
Returns the value of attribute virgil_crypto.
Instance Method Summary collapse
-
#export_private_key(private_key) ⇒ Crypto::Bytes
Exports the provided [PrivateKey] into material representation bytes.
-
#import_private_key(private_key_bytes) ⇒ VirgilPrivateKey
Imports the private key from its material representation.
-
#initialize(crypto: nil, password: nil) ⇒ VirgilPrivateKeyExporter
constructor
Initializes a new instance of the [VirgilPrivateKeyExporter] class.
Constructor Details
#initialize(crypto: nil, password: nil) ⇒ VirgilPrivateKeyExporter
Initializes a new instance of the [VirgilPrivateKeyExporter] class. that is used for export and import of [PrivateKey]
47 48 49 50 |
# File 'lib/virgil/crypto/private_key_exporter.rb', line 47 def initialize(crypto: nil, password: nil) @password = password @virgil_crypto = crypto || VirgilCrypto.new end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
41 42 43 |
# File 'lib/virgil/crypto/private_key_exporter.rb', line 41 def password @password end |
#virgil_crypto ⇒ Object (readonly)
Returns the value of attribute virgil_crypto.
40 41 42 |
# File 'lib/virgil/crypto/private_key_exporter.rb', line 40 def virgil_crypto @virgil_crypto end |
Instance Method Details
#export_private_key(private_key) ⇒ Crypto::Bytes
Exports the provided [PrivateKey] into material representation bytes.
55 56 57 |
# File 'lib/virgil/crypto/private_key_exporter.rb', line 55 def export_private_key(private_key) @virgil_crypto.export_private_key(private_key, @password) end |
#import_private_key(private_key_bytes) ⇒ VirgilPrivateKey
Imports the private key from its material representation.
62 63 64 |
# File 'lib/virgil/crypto/private_key_exporter.rb', line 62 def import_private_key(private_key_bytes) @virgil_crypto.import_private_key(private_key_bytes, @password) end |