Cipher

module cipher

Cipher Module

This module provides encryption and decryption functionalities for vectors and scores using the EnvectorClient framework.

  • Cipher — Handles encryption and decryption operations.

class Cipher

class Cipher()

Cipher class for handling encryption and decryption operations.


encrypt()

def encrypt(vector, encode_type, enc_key_path: Optional[str] = None)

Encrypts a vector.

ARGUMENTS

  • vector (Union[list, np.ndarray]): The vector to be encrypted.

  • encode_type (str): The encoding type for encryption.

  • enc_key_path (str): The path to the encryption key file. If not provided, uses the key path set at initialization.

RETURNS

CipherBlock : Encrypted vector.


encrypt_multiple()

Encrypts a vector.

PARAMETERS

  • vector: The vector to be encrypted.

  • encode_type: The encoding type for encryption.

  • enc_key_path: Optional; The path to the encryption key file. If not provided, uses the key path set at initialization.

RETURNS

Encrypted vector.

EXAMPLES


decrypt()

Decrypts an encrypted vector.

ARGUMENTS

  • encrypted_vector (CipherBlock): The vector to be decrypted.

  • sec_key_path (str): The path to the secret key file for decryption. If not provided, uses the default path.

RETURNS

list : Decrypted vector.


decrypt_score()

Decrypts an encrypted score.

ARGUMENTS

  • encrypted_score (CipherBlock): The score to be decrypted.

  • sec_key_path (str): The path to the secret key file for decryption. If not provided, uses the default path set in Cipher initialization.

RETURNS

list : Decrypted score.


encryptor()

Returns the encryptor object.

RETURNS

Encryptor: The encryptor object for encryption operations.


decryptor()

Returns the decryptor object.

RETURNS

Decryptor: The decryptor object for decryption operations.


sec_key_path()

Returns the path to the secret key file.

RETURNS

str: The path to the secret key file used for decryption.

Last updated