Camellia¶
- class pyflocker.ciphers.backends.cryptography_.Camellia.Camellia(encrypting: bool, key: bytes, mode: Modes, iv_or_nonce: bytes)[source]¶
Bases:
NonAEADCipherTemplate
Camellia cipher class.
- pyflocker.ciphers.backends.cryptography_.Camellia.new(encrypting: bool, key: bytes, mode: Modes, iv_or_nonce: bytes, *, use_hmac: bool = False, tag_length: int | None = 16, digestmod: None | base.BaseHash = None, file: io.BufferedIOBase | None = None) Camellia | FileCipherWrapper | HMACWrapper [source]¶
Instantiate a new Camellia cipher wrapper object.
- Parameters:
encrypting – True is encryption and False is decryption.
key – The key for the cipher.
mode – The mode to use for Camellia cipher. All backends may not support that particular mode.
iv_or_nonce – The Initialization Vector or Nonce for the cipher. It must not be repeated with the same key.
- Keyword Arguments:
use_hmac – Should the cipher use HMAC as authentication or not. (Default:
False
)tag_length – Length of HMAC tag. By default, a 16 byte tag is generated. If
tag_length
isNone
, a non-truncated tag is generated. Length of non-truncated tag depends on the digest size of the underlying hash algorithm used by HMAC.digestmod – The algorithm to use for HMAC. If
None
, Defaults tosha256
. Specifying this value without settinguse_hmac
to True has no effect.file – The source file to read from. If
file
is specified and themode
is not an AEAD mode, HMAC is always used.
Important
The following arguments are ignored if the mode is an AEAD mode:
use_hmac
tag_length
digestmod
- Returns:
Camellia cipher.
- Raises:
UnsupportedMode – if the given
mode
is not supported by the cipher.
Note
Any other error that is raised is from the backend itself.