3 lá˜_U ã @ sŽ d dl mZmZmZ d dlZd dlZd dlmZ d dlm Z m Z mZmZm Z d dlmZ d dlmZ d dlmZ ejejƒG dd „ d eƒƒZejejƒG d d„ deƒƒZejejƒG dd „ d eƒƒZejejƒG dd„ deƒƒZejejƒG dd„ deƒƒZejejƒG dd„ deƒƒZG dd„ deƒZejeƒG dd„ deƒƒZejeƒejeƒejeƒG dd„ deƒƒƒƒZ ejeƒG dd„ de ƒƒZ!dS )é )Úabsolute_importÚdivisionÚprint_functionN)Úutils)ÚAlreadyFinalizedÚAlreadyUpdatedÚNotYetFinalizedÚUnsupportedAlgorithmÚ_Reasons)Ú_get_backend)Ú CipherBackend)Úmodesc @ s( e Zd Zejdd„ ƒZejdd„ ƒZdS )ÚCipherAlgorithmc C s dS )zE A string naming this mode (e.g. "AES", "Camellia"). N© )Úselfr r ú/usr/lib64/python3.6/base.pyÚname s zCipherAlgorithm.namec C s dS )zW The size of the key being used as an integer in bits (e.g. 128, 256). Nr )r r r r Úkey_size s zCipherAlgorithm.key_sizeN)Ú__name__Ú __module__Ú__qualname__ÚabcÚabstractpropertyr r r r r r r s r c @ s e Zd Zejdd„ ƒZdS )ÚBlockCipherAlgorithmc C s dS )zK The size of a block as an integer in bits (e.g. 64, 128). Nr )r r r r Ú block_size) s zBlockCipherAlgorithm.block_sizeN)r r r r r r r r r r r ' s r c @ s6 e Zd Zejdd„ ƒZejdd„ ƒZejdd„ ƒZdS )Ú CipherContextc C s dS )zk Processes the provided bytes through the cipher and returns the results as bytes. Nr )r Údatar r r Úupdate2 s zCipherContext.updatec C s dS )z“ Processes the provided bytes and writes the resulting data into the provided buffer. Returns the number of bytes written. Nr )r r Úbufr r r Úupdate_into9 s zCipherContext.update_intoc C s dS )zM Returns the results of processing the final block as bytes. Nr )r r r r Úfinalize@ s zCipherContext.finalizeN)r r r r Úabstractmethodr r r r r r r r 0 s r c @ s e Zd Zejdd„ ƒZdS )ÚAEADCipherContextc C s dS )z3 Authenticates the provided bytes. Nr )r r r r r Úauthenticate_additional_dataI s z.AEADCipherContext.authenticate_additional_dataN)r r r r r! r# r r r r r" G s r" c @ s e Zd Zejdd„ ƒZdS )ÚAEADDecryptionContextc C s dS )zŠ Returns the results of processing the final block as bytes and allows delayed passing of the authentication tag. Nr )r Útagr r r Úfinalize_with_tagR s z'AEADDecryptionContext.finalize_with_tagN)r r r r r! r&