Ciphers#

KMS Cipher#

class core_aws.ciphers.kms_cipher.KMSCipher(key_arn: str, botocore_session: Session | None = None, **kwargs)[source]#

Bases: ICipher

It uses the AWS Encryption SDK for Python

__init__(key_arn: str, botocore_session: Session | None = None, **kwargs) None[source]#

Initialize the cipher with encryption parameters.

Parameters:
  • key – Encryption key as bytes. If None, a random key is generated (32 bytes for MODE_SIV, 16 bytes for other modes).

  • mode – AES cipher mode (default: AES.MODE_GCM).

  • encoding – Character encoding for string operations (default: “UTF-8”).

encrypt(data: bytes, *args, **kwargs) bytes[source]#

Encrypt the data.

Parameters:

data – The data to encrypt.

Returns:

The encrypted data (implementation-specific format).

decrypt(data: bytes, *args, **kwargs) str[source]#

Decrypt the data.

Parameters:

data – The encrypted data to decrypt.

Returns:

The decrypted data (implementation-specific format).

_abc_impl = <_abc._abc_data object>#