Class: Izokatu::Encrypter Abstract
- Inherits:
-
Object
- Object
- Izokatu::Encrypter
- Extended by:
- Callable
- Includes:
- Contracts
- Defined in:
- lib/izokatu/encrypter.rb
Overview
This class is abstract.
Subclasses are containing implementation of #encrypt_data!
Abstract class for encrypters
Direct Known Subclasses
Openssl::PrivateKey::Default::Encrypter, Openssl::PublicKey::EC::Encrypter, Openssl::PublicKey::RSA::Encrypter, Rbnacl::Encrypter
Constant Summary collapse
- DEFAULT_OPTIONS =
Default options for Izokatu::Encrypter
{ clear_data_string: 'Testing, testing...' }.freeze
Instance Attribute Summary collapse
-
#clear_data ⇒ String
readonly
Clear data for encryption.
-
#encrypted_data ⇒ Hash
readonly
Encrypted data for export.
-
#encrypter ⇒ Object
readonly
Encrypter instance.
Instance Method Summary collapse
-
#encrypt_data! ⇒ Object
private
Encrypting data`.
-
#import_clear_data!(clear_data) ⇒ String
Imporing clear data from options.
-
#initialize(clear_data:) ⇒ Encrypter
constructor
Initializing option for encryption.
-
#perform ⇒ Hash
Performing encryption.
Methods included from Callable
Constructor Details
#initialize(clear_data:) ⇒ Encrypter
Initializing option for encryption
30 31 32 |
# File 'lib/izokatu/encrypter.rb', line 30 def initialize(clear_data:) import_clear_data!(clear_data) end |
Instance Attribute Details
#clear_data ⇒ String (readonly)
Returns clear data for encryption.
15 16 17 |
# File 'lib/izokatu/encrypter.rb', line 15 def clear_data @clear_data end |
#encrypted_data ⇒ Hash (readonly)
Returns encrypted data for export.
17 18 19 |
# File 'lib/izokatu/encrypter.rb', line 17 def encrypted_data @encrypted_data end |
#encrypter ⇒ Object (readonly)
Returns encrypter instance.
13 14 15 |
# File 'lib/izokatu/encrypter.rb', line 13 def encrypter @encrypter end |
Instance Method Details
#encrypt_data! ⇒ Object (private)
Encrypting data`
63 64 65 |
# File 'lib/izokatu/encrypter.rb', line 63 def encrypt_data! raise 'Not implemented!' end |
#import_clear_data!(clear_data) ⇒ String
Imporing clear data from options
42 43 44 |
# File 'lib/izokatu/encrypter.rb', line 42 def import_clear_data!(clear_data) @clear_data = clear_data || DEFAULT_OPTIONS[:clear_data_string] end |
#perform ⇒ Hash
Performing encryption
52 53 54 |
# File 'lib/izokatu/encrypter.rb', line 52 def perform encrypt_data! end |