3 l_U @ s d dl mZmZmZ d dlZd dlZd dlmZ d dlm Z m Z mZmZm Z d dlmZ d dlmZ d dlmZ ejejG dd d eZejejG d d deZejejG dd d eZejejG dd deZejejG dd deZejejG dd deZG dd deZejeG dd deZejeejeejeG dd deZ ejeG dd de Z!dS ) )absolute_importdivisionprint_functionN)utils)AlreadyFinalizedAlreadyUpdatedNotYetFinalizedUnsupportedAlgorithm_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.pyname 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__abcabstractpropertyr 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&