Class: Izokatu::Rbnacl::PublicKey::Decrypter
- Defined in:
- lib/izokatu/rbnacl/public_key/decrypter.rb
Overview
RbNaCl public key decrypter
Constant Summary
Constants inherited from Decrypter
Instance Attribute Summary collapse
-
#private_key ⇒ RbNaCl::Boxes::Curve25519XSalsa20Poly1305::PrivateKey
readonly
Private key.
-
#public_key ⇒ RbNaCl::Boxes::Curve25519XSalsa20Poly1305::PublicKey
readonly
Public key.
Attributes inherited from Decrypter
Attributes inherited from Decrypter
#decrypted_data, #decrypter, #encrypted_data
Instance Method Summary collapse
-
#create_decrypter! ⇒ RbNaCl::Boxes::Curve25519XSalsa20Poly1305
Initializing decrypter instance.
-
#decrypt_data! ⇒ Hash
Decrypting data.
-
#initialize(public_key:, private_key:, encrypted_data:, nonce:) ⇒ Decrypter
constructor
Initializing option for decryption.
Methods inherited from Decrypter
#import_encrypted_data!, #perform
Methods included from Callable
Constructor Details
#initialize(public_key:, private_key:, encrypted_data:, nonce:) ⇒ Decrypter
Initializing option for decryption
23 24 25 26 27 |
# File 'lib/izokatu/rbnacl/public_key/decrypter.rb', line 23 def initialize(public_key:, private_key:, encrypted_data:, nonce:) @public_key = public_key @private_key = private_key super(encrypted_data: encrypted_data, nonce: nonce) end |
Instance Attribute Details
#private_key ⇒ RbNaCl::Boxes::Curve25519XSalsa20Poly1305::PrivateKey (readonly)
Returns private key.
12 13 14 |
# File 'lib/izokatu/rbnacl/public_key/decrypter.rb', line 12 def private_key @private_key end |
#public_key ⇒ RbNaCl::Boxes::Curve25519XSalsa20Poly1305::PublicKey (readonly)
Returns public key.
10 11 12 |
# File 'lib/izokatu/rbnacl/public_key/decrypter.rb', line 10 def public_key @public_key end |
Instance Method Details
#create_decrypter! ⇒ RbNaCl::Boxes::Curve25519XSalsa20Poly1305
Initializing decrypter instance
35 36 37 |
# File 'lib/izokatu/rbnacl/public_key/decrypter.rb', line 35 def create_decrypter! @decrypter = RbNaCl::Box.new(public_key, private_key) end |
#decrypt_data! ⇒ Hash
Decrypting data
45 46 47 |
# File 'lib/izokatu/rbnacl/public_key/decrypter.rb', line 45 def decrypt_data! { decrypted_data_string: decrypter.decrypt(nonce, encrypted_data) } end |