class Izokatu::ActionCallSelector
Izokatu
selector of action class to be called
Attributes
@return [Symbol] action to execute
@return [Symbol] OpenSSL public key cipher type
@return [Bool] status of cipher as authenticated
@return [Bool] equality of cipher mode to CCM
@return [Symbol] mode of encryption/decryption
@return [Symbol] library used for encryption/decryption
Public Class Methods
Initializing options for selection of action class
@param via (via
) @param mode (mode
) @param action (action
) @param asym_cipher_type
(asym_cipher_type
) @param ccm_cipher
(ccm_cipher
) @param auth_cipher
(auth_cipher
)
@since 0.1.0
# File lib/izokatu/action_call_selector.rb, line 34 def initialize(via:, mode:, action:, asym_cipher_type:, ccm_cipher:, auth_cipher:) @via = via @mode = mode @action = action @asym_cipher_type = asym_cipher_type @ccm_cipher = ccm_cipher @auth_cipher = auth_cipher end
Public Instance Methods
Selecting action class for keys generation or encryption/decryption
@return [Class] selected class for keys generation
@since 0.1.0
# File lib/izokatu/action_call_selector.rb, line 49 def perform action == :keys_generation ? select_keys_generation_action_call : select_default_action_call end
Private Instance Methods
Selecting action class for encryption/decryption
@return [Class] selected class for encryption/decryption
@since 0.1.0
# File lib/izokatu/action_call_selector.rb, line 78 def select_default_action_call via == :rbnacl ? select_rbnacl_action_call : select_openssl_action_call end
Selecting action class for keys generation
@return [Class] selected class for keys generation
@since 0.1.0
# File lib/izokatu/action_call_selector.rb, line 61 def select_keys_generation_action_call case [via, mode, action, asym_cipher_type, ccm_cipher, auth_cipher] in [:rbnacl, :public_key, :keys_generation, _, _, _] Izokatu::Rbnacl::PublicKey::KeysGenerator in [:openssl, :public_key, :keys_generation, :rsa, _, _] Izokatu::Openssl::PublicKey::RSA::KeysGenerator in [:openssl, :public_key, :keys_generation, :ec, _, _] Izokatu::Openssl::PublicKey::EC::KeysGenerator end end
Selecting action class for Openssl
encryption/decryption
@return [Class] selected class for encryption/decryption
@since 0.1.0
# File lib/izokatu/action_call_selector.rb, line 107 def select_openssl_action_call case [via, mode, action, asym_cipher_type, ccm_cipher, auth_cipher] in [:openssl, :private_key, :encryption, _, false, false] Izokatu::Openssl::PrivateKey::Default::Encrypter in [:openssl, :private_key, :decryption, _, false, false] Izokatu::Openssl::PrivateKey::Default::Decrypter in [:openssl, :private_key, :encryption, _, false, true] Izokatu::Openssl::PrivateKey::Auth::Encrypter in [:openssl, :private_key, :decryption, _, false, true] Izokatu::Openssl::PrivateKey::Auth::Decrypter in [:openssl, :private_key, :encryption, _, true, _] Izokatu::Openssl::PrivateKey::Auth::CCM::Encrypter in [:openssl, :private_key, :decryption, _, true, _] Izokatu::Openssl::PrivateKey::Auth::CCM::Decrypter in [:openssl, :public_key, :encryption, :rsa, _, _] Izokatu::Openssl::PublicKey::RSA::Encrypter in [:openssl, :public_key, :decryption, :rsa, _, _] Izokatu::Openssl::PublicKey::RSA::Decrypter in [:openssl, :public_key, :encryption, :ec, _, _] Izokatu::Openssl::PublicKey::EC::Encrypter in [:openssl, :public_key, :decryption, :ec, _, _] Izokatu::Openssl::PublicKey::EC::Decrypter end end
Selecting action class for Rbnacl
encryption/decryption
@return [Class] selected class for Rbnal encryption/decryption
@since 0.1.0
# File lib/izokatu/action_call_selector.rb, line 88 def select_rbnacl_action_call case [via, mode, action, asym_cipher_type, ccm_cipher, auth_cipher] in [:rbnacl, :private_key, :encryption, _, _, _] Izokatu::Rbnacl::PrivateKey::Encrypter in [:rbnacl, :private_key, :decryption, _, _, _] Izokatu::Rbnacl::PrivateKey::Decrypter in [:rbnacl, :public_key, :encryption, _, _, _] Izokatu::Rbnacl::PublicKey::Encrypter in [:rbnacl, :public_key, :decryption, _, _, _] Izokatu::Rbnacl::PublicKey::Decrypter end end