pylibressl.cipher.auth¶
Module Contents¶
Classes¶
Base symmetric cipher class. |
|
Ready to use cipher+HMAC combination. |
|
Base GCM symmetric cipher class. |
|
AES 256-bit cipher in GCM (Galois counter) mode. |
Attributes¶
- class pylibressl.cipher.auth.BaseCipherAuth(key, iv)¶
Bases:
pylibressl.cipher.cipher.BaseCipherBase symmetric cipher class.
- abstract encrypt(self, data)¶
- abstract decrypt(self, data, auth_code)¶
- class pylibressl.cipher.auth.CipherHMAC(key, iv)¶
Bases:
BaseCipherAuthReady to use cipher+HMAC combination.
- classmethod new(cls, cipher_type, hash_type, name='NewCipherHMAC')¶
Create new cipher+HMAC type.
- encrypt(self, data)¶
Encrypt a message.
- Parameters
data – data to encrypt as a byte string
- Returns
encrypted message and authencity code as byte strings
- decrypt(self, data, auth_code)¶
Encrypt a message.
- Parameters
data – data to encrypt as a byte string
auth_code – authencity code as byte strings
- Returns
decrypted message
- pylibressl.cipher.auth.GOST89_HMAC_Streebog512¶
- pylibressl.cipher.auth.__doc__ = GOST89-HMAC-Streebog512¶
- pylibressl.cipher.auth.AES256_HMAC_SHA512¶
- pylibressl.cipher.auth.__doc__ = AES256-HMAC-SHA512¶
- class pylibressl.cipher.auth.BaseCipherGCM(key, iv)¶
Bases:
BaseCipherAuthBase GCM symmetric cipher class.
- _AEAD_TAG_SIZE = 16¶
- classmethod iv_length(self)¶
- _init_cipher_ctx(self, is_encrypt)¶
Initialise cipher context.
Should return cipher context cdata. It should be ready to do EVP_CipherUpdate.
- encrypt(self, data, aad=None)¶
Encrypt a message.
- Parameters
data – data to encrypt as a byte string
aad – AAD data for GCM mode
- Returns
encrypted message and tag as byte strings
- decrypt(self, data, tag, aad=None)¶
Decrypt a message.
- Parameters
data – data to encrypt as a byte string
tag – tag value
aad – AAD data for GCM mode
- Returns
decrypted message
- class pylibressl.cipher.auth.AES256_GCM(key, iv)¶
Bases:
BaseCipherGCMAES 256-bit cipher in GCM (Galois counter) mode.
- _CIPHER_ID¶
- _MODE¶