class Izokatu::Openssl::PrivateKey::Auth::Encrypter
OpenSSL private key encrypter for authenticated ciphers
Constants
- DEFAULT_AUTH_OPTIONS
Attributes
auth_data[R]
@return [String] authenticated data
Public Class Methods
new(cipher:, clear_data:, auth_data:)
click to toggle source
Initializing options for OpenSSL EC encryption
@param cipher (cipher
) @param clear_data (clear_data
) @param auth_data
(auth_data
)
@since 0.1.0
Calls superclass method
Izokatu::Openssl::PrivateKey::Default::Encrypter::new
# 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
Private Instance Methods
compute_auth_tag!()
click to toggle source
Computing authentication tag
@return [Hash] authentication tag
@since 0.1.0
# File lib/izokatu/openssl/private_key/auth/encrypter.rb, line 70 def compute_auth_tag! { auth_tag: encrypter.auth_tag } end
decrypter_params()
click to toggle source
Returning decrypter params
@return [Hash] decrypter params
@since 0.1.1
Calls superclass method
Izokatu::Openssl::PrivateKey::Default::Encrypter#decrypter_params
# 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!()
click to toggle source
Encrypting data
@return [Array] encrypted data with decrypter params
@since 0.1.0
Calls superclass method
Izokatu::Openssl::PrivateKey::Default::Encrypter#encrypt_data!
# 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)
click to toggle source
Initializing encrypter auth param
@return [String] authenticated data
@since 0.1.0
# 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