Class: Izokatu::Openssl::PrivateKey::Auth::Encrypter
- Inherits:
-
Default::Encrypter
- Object
- Encrypter
- Default::Encrypter
- Izokatu::Openssl::PrivateKey::Auth::Encrypter
- Defined in:
- lib/izokatu/openssl/private_key/auth/encrypter.rb
Overview
OpenSSL private key encrypter for authenticated ciphers
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_AUTH_OPTIONS =
Default Openssl::PrivateKey::Auth::Encrypter option
{ auth_data: '' }.freeze
Constants inherited from Default::Encrypter
Default::Encrypter::DEFAULT_OPTIONS
Constants inherited from Encrypter
Instance Attribute Summary collapse
-
#auth_data ⇒ String
readonly
Authenticated data.
Attributes inherited from Default::Encrypter
Attributes inherited from Encrypter
#clear_data, #encrypted_data, #encrypter
Instance Method Summary collapse
-
#compute_auth_tag! ⇒ Hash
private
Computing authentication tag.
-
#decrypter_params ⇒ Hash
private
Returning decrypter params.
-
#encrypt_data! ⇒ Array
private
Encrypting data.
-
#initialize(cipher:, clear_data:, auth_data:) ⇒ Encrypter
constructor
Initializing options for OpenSSL EC encryption.
-
#initialize_auth_encrypter_params!(auth_data) ⇒ String
private
Initializing encrypter auth param.
Methods inherited from Default::Encrypter
#create_encrypter!, #initialize_encrypter_params!
Methods inherited from Encrypter
Methods included from Callable
Constructor Details
#initialize(cipher:, clear_data:, auth_data:) ⇒ Encrypter
Initializing options for OpenSSL EC encryption
25 26 27 28 |
# File 'lib/izokatu/openssl/private_key/auth/encrypter.rb', line 25 def initialize(cipher:, clear_data:, auth_data:) super(cipher: cipher, clear_data: clear_data) initialize_auth_encrypter_params!(auth_data) end |
Instance Attribute Details
#auth_data ⇒ String (readonly)
Returns authenticated data.
10 11 12 |
# File 'lib/izokatu/openssl/private_key/auth/encrypter.rb', line 10 def auth_data @auth_data end |
Instance Method Details
#compute_auth_tag! ⇒ Hash (private)
Computing authentication tag
70 71 72 |
# File 'lib/izokatu/openssl/private_key/auth/encrypter.rb', line 70 def compute_auth_tag! { auth_tag: encrypter.auth_tag } end |
#decrypter_params ⇒ Hash (private)
Returning decrypter params
60 61 62 |
# File 'lib/izokatu/openssl/private_key/auth/encrypter.rb', line 60 def decrypter_params super.merge(auth_data: auth_data, **compute_auth_tag!) end |
#encrypt_data! ⇒ Array (private)
Encrypting data
49 50 51 52 |
# File 'lib/izokatu/openssl/private_key/auth/encrypter.rb', line 49 def encrypt_data! encrypted_data, decrypter_params = super [encrypted_data, decrypter_params] end |
#initialize_auth_encrypter_params!(auth_data) ⇒ String (private)
Initializing encrypter auth param
38 39 40 41 |
# File 'lib/izokatu/openssl/private_key/auth/encrypter.rb', line 38 def initialize_auth_encrypter_params!(auth_data) @auth_data = auth_data || DEFAULT_AUTH_OPTIONS[:auth_data] encrypter.auth_data = @auth_data end |