Class: Izokatu::Rbnacl::Encrypter Abstract
- Defined in:
- lib/izokatu/rbnacl/encrypter.rb
Overview
This class is abstract.
Subclasses are containing implementation of #create_encrypter!
Abstract class for Rbnacl encrypters
Direct Known Subclasses
Constant Summary
Constants inherited from Encrypter
Instance Attribute Summary collapse
-
#nonce ⇒ String
readonly
Initialization vector for one-time use.
Attributes inherited from Encrypter
#clear_data, #encrypted_data, #encrypter
Instance Method Summary collapse
-
#create_encrypter! ⇒ Object
Creating encrypter instance.
-
#generate_nonce! ⇒ String
Generating nonce from encrypter instance.
-
#initialize(clear_data:) ⇒ Encrypter
constructor
Initializing option for encryption.
Methods inherited from Encrypter
#encrypt_data!, #import_clear_data!, #perform
Methods included from Callable
Constructor Details
#initialize(clear_data:) ⇒ Encrypter
Initializing option for encryption
19 20 21 22 23 |
# File 'lib/izokatu/rbnacl/encrypter.rb', line 19 def initialize(clear_data:) super create_encrypter! generate_nonce! end |
Instance Attribute Details
#nonce ⇒ String (readonly)
Returns initialization vector for one-time use.
11 12 13 |
# File 'lib/izokatu/rbnacl/encrypter.rb', line 11 def nonce @nonce end |
Instance Method Details
#create_encrypter! ⇒ Object
Creating encrypter instance
30 31 32 |
# File 'lib/izokatu/rbnacl/encrypter.rb', line 30 def create_encrypter! raise 'Not implemented!' end |
#generate_nonce! ⇒ String
Generating nonce from encrypter instance
40 41 42 |
# File 'lib/izokatu/rbnacl/encrypter.rb', line 40 def generate_nonce! @nonce = RbNaCl::Random.random_bytes(encrypter.nonce_bytes) end |