Class: Izokatu::Openssl::PrivateKey::Auth::Decrypter
- Inherits:
-
Default::Decrypter
- Object
- Decrypter
- Default::Decrypter
- Izokatu::Openssl::PrivateKey::Auth::Decrypter
- Defined in:
- lib/izokatu/openssl/private_key/auth/decrypter.rb
Overview
OpenSSL private key decrypter for authenticated ciphers
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_AUTH_TAG_LENGTH =
Default Openssl::PrivateKey::Auth::Decrypter option
16
Constants inherited from Default::Decrypter
Default::Decrypter::DEFAULT_OPTIONS
Instance Attribute Summary collapse
-
#auth_data ⇒ String
readonly
Authenticated data.
-
#auth_tag ⇒ String
readonly
Authentication tag.
Attributes inherited from Default::Decrypter
Attributes inherited from Decrypter
#decrypted_data, #decrypter, #encrypted_data
Instance Method Summary collapse
-
#initialize(auth_data:, auth_tag:, cipher:, encrypted_data:, key:, nonce:) ⇒ Decrypter
constructor
Initializing options for OpenSSL EC decryption.
-
#initialize_auth_decrypter_params! ⇒ Object
private
Initializing decrypter auth params.
-
#initialize_decrypter_params! ⇒ Object
private
Initializing decrypter params.
-
#perform ⇒ OpenSSL::Cipher
Initializing decrypter.
-
#verify_tag_size! ⇒ Object
private
Raising exception if auth tag is truncated.
Methods inherited from Default::Decrypter
#create_decrypter!, #decrypt_data!
Methods inherited from Decrypter
#decrypt_data!, #import_encrypted_data!
Methods included from Callable
Constructor Details
#initialize(auth_data:, auth_tag:, cipher:, encrypted_data:, key:, nonce:) ⇒ Decrypter
Initializing options for OpenSSL EC decryption
29 30 31 32 33 |
# File 'lib/izokatu/openssl/private_key/auth/decrypter.rb', line 29 def initialize(auth_data:, auth_tag:, cipher:, encrypted_data:, key:, nonce:) @auth_data = auth_data @auth_tag = auth_tag super(cipher: cipher, encrypted_data: encrypted_data, key: key, nonce: nonce) end |
Instance Attribute Details
#auth_data ⇒ String (readonly)
Returns authenticated data.
11 12 13 |
# File 'lib/izokatu/openssl/private_key/auth/decrypter.rb', line 11 def auth_data @auth_data end |
#auth_tag ⇒ String (readonly)
Returns authentication tag.
13 14 15 |
# File 'lib/izokatu/openssl/private_key/auth/decrypter.rb', line 13 def auth_tag @auth_tag end |
Instance Method Details
#initialize_auth_decrypter_params! ⇒ Object (private)
Initializing decrypter auth params
61 62 63 64 65 |
# File 'lib/izokatu/openssl/private_key/auth/decrypter.rb', line 61 def initialize_auth_decrypter_params! # unless added just for ARIA-***-CCM ciphers decrypter.auth_data = auth_data unless cipher.include?('ARIA') decrypter.auth_tag = auth_tag end |
#initialize_decrypter_params! ⇒ Object (private)
Initializing decrypter params
52 53 54 55 |
# File 'lib/izokatu/openssl/private_key/auth/decrypter.rb', line 52 def initialize_decrypter_params! super initialize_auth_decrypter_params! end |
#perform ⇒ OpenSSL::Cipher
Initializing decrypter
41 42 43 44 |
# File 'lib/izokatu/openssl/private_key/auth/decrypter.rb', line 41 def perform verify_tag_size! super end |
#verify_tag_size! ⇒ Object (private)
Raising exception if auth tag is truncated
72 73 74 |
# File 'lib/izokatu/openssl/private_key/auth/decrypter.rb', line 72 def verify_tag_size! raise 'tag is truncated!' unless auth_tag.bytesize == DEFAULT_AUTH_TAG_LENGTH end |