class Izokatu::Openssl::PrivateKey::Default::Decrypter
OpenSSL private key decrypter for non-authenticated ciphers
Constants
- DEFAULT_OPTIONS
Attributes
cipher[R]
@return [String] OpenSSL private key cipher
key[R]
@return [String] key for private key encryption/decryption
nonce[R]
@return [String] initialization vector for one-time use
Public Class Methods
new(encrypted_data:, cipher:, key:, nonce:)
click to toggle source
Initialize options for OpenSSL EC decryption
@param encrypted_data (encrypted_data
) @param cipher (cipher
) @param key (key
) @param nonce (nonce
)
@since 0.1.0
Calls superclass method
Izokatu::Decrypter::new
# File lib/izokatu/openssl/private_key/default/decrypter.rb, line 32 def initialize(encrypted_data:, cipher:, key:, nonce:) super(encrypted_data: encrypted_data) @cipher = cipher || DEFAULT_OPTIONS[:cipher] @key = key @nonce = nonce create_decrypter! initialize_decrypter_params! end
Private Instance Methods
create_decrypter!()
click to toggle source
Initializing decrypter
@return [OpenSSL::Cipher] decrypter instance
@since 0.1.0
# File lib/izokatu/openssl/private_key/default/decrypter.rb, line 49 def create_decrypter! @decrypter = OpenSSL::Cipher.new(cipher).decrypt end
decrypt_data!()
click to toggle source
Decrypting data
@return [Hash] decrypted data
@since 0.1.0
# File lib/izokatu/openssl/private_key/default/decrypter.rb, line 68 def decrypt_data! { decrypted_data_string: decrypter.update(encrypted_data) + decrypter.final } end
initialize_decrypter_params!()
click to toggle source
Initializing decrypter params
@since 0.1.0
# File lib/izokatu/openssl/private_key/default/decrypter.rb, line 57 def initialize_decrypter_params! decrypter.key = key decrypter.iv = nonce end