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