관리-도구
편집 파일: _mode_eax.cpython-311.pyc
� O�Dgu8 � � � d Z dgZddlZddlmZ ddlmZmZmZ ddl m Z ddlmZ ddl mZmZ dd lmZmZ dd lmZ G d� de� � Zd� ZdS ) z EAX mode. �EaxMode� N)� unhexlify)�byte_string�bord�_copy_bytes)� is_buffer)�strxor)� long_to_bytes� bytes_to_long)�CMAC�BLAKE2s)�get_random_bytesc �V � e Zd ZdZd� Zd� Zd d�Zd d�Zd� Zd� Z d � Z d � Zd d�Zd d�Z dS )r a� *EAX* mode. This is an Authenticated Encryption with Associated Data (`AEAD`_) mode. It provides both confidentiality and authenticity. The header of the message may be left in the clear, if needed, and it will still be subject to authentication. The decryption step tells the receiver if the message comes from a source that really knowns the secret key. Additionally, decryption detects if any part of the message - including the header - has been modified or corrupted. This mode requires a *nonce*. This mode is only available for ciphers that operate on 64 or 128 bits blocks. There are no official standards defining EAX. The implementation is based on `a proposal`__ that was presented to NIST. .. _AEAD: http://blog.cryptographyengineering.com/2012/05/how-to-choose-authenticated-encryption.html .. __: http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/eax/eax-spec.pdf :undocumented: __init__ c � � ���� �j � _ t dd|� � � _ |� _ d� _ g d�� _ d� j cxk r� j k sn t d� j z � � �t � j � � dk rt d� � �t |� � st d� � ����� fd�t dd � � D � � � _ � j d � � j � � � j d � _ t � j d � � � � � } �j ��j f|dd����� _ dS ) zEAX cipher modeN��update�encrypt�decrypt�digest�verify� z3'mac_len' must be at least 2 and not larger than %dr z!Nonce cannot be empty in EAX modez,nonce must be bytes, bytearray or memoryviewc � �� g | ];}t j �d �j dz z t j d|� � z ���� � ��<S )� � �B)� ciphermod� cipher_params)r �new� block_size�struct�pack)�.0�ir �factory�key�selfs �����y/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Cipher/_mode_eax.py� <listcomp>z$EaxMode.__init__.<locals>.<listcomp>k sd �� � � � � � ��� �D�O�a�$7�8�6�;�s�A�;N�;N�N�#*�'4�6� 6� 6�� � � � r r) )� initial_value�nonce)r r r, �_mac_len�_mac_tag�_next� ValueError�lenr � TypeError�range�_omacr �_signerr r r �MODE_CTR�_cipher)r&