<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
3
lá˜_J  ã               @   sø  d dl mZmZmZ d dlZd dlZd dlmZ ejej	ƒG dd„ de
ƒƒZejej	ƒG dd„ de
ƒƒZejej	ƒG dd	„ d	e
ƒƒZejej	ƒG d
d„ de
ƒƒZejej	ƒG dd„ de
ƒƒZdd„ Zdd„ Zdd„ ZejeƒejeƒG dd„ de
ƒƒƒZejeƒejeƒG dd„ de
ƒƒƒZejeƒG dd„ de
ƒƒZejeƒejeƒG dd„ de
ƒƒƒZejeƒejeƒG dd„ de
ƒƒƒZejeƒejeƒG dd„ de
ƒƒƒZejeƒejeƒG d d!„ d!e
ƒƒƒZejeƒejeƒejeƒG d"d#„ d#e
ƒƒƒƒZdS )$é    )Úabsolute_importÚdivisionÚprint_functionN)Úutilsc               @   s(   e Zd Zejdd„ ƒZejdd„ ƒZdS )ÚModec             C   s   dS )z@
        A string naming this mode (e.g. "ECB", "CBC").
        N© )Úselfr   r   ú/usr/lib64/python3.6/modes.pyÚname   s    z	Mode.namec             C   s   dS )zq
        Checks that all the necessary invariants of this (mode, algorithm)
        combination are met.
        Nr   )r   Ú	algorithmr   r   r	   Úvalidate_for_algorithm   s    zMode.validate_for_algorithmN)Ú__name__Ú
__module__Ú__qualname__ÚabcÚabstractpropertyr
   Úabstractmethodr   r   r   r   r	   r      s   r   c               @   s   e Zd Zejdd„ ƒZdS )ÚModeWithInitializationVectorc             C   s   dS )zP
        The value of the initialization vector for this mode as bytes.
        Nr   )r   r   r   r	   Úinitialization_vector    s    z2ModeWithInitializationVector.initialization_vectorN)r   r   r   r   r   r   r   r   r   r	   r      s   r   c               @   s   e Zd Zejdd„ ƒZdS )ÚModeWithTweakc             C   s   dS )z@
        The value of the tweak for this mode as bytes.
        Nr   )r   r   r   r	   Útweak)   s    zModeWithTweak.tweakN)r   r   r   r   r   r   r   r   r   r	   r   '   s   r   c               @   s   e Zd Zejdd„ ƒZdS )ÚModeWithNoncec             C   s   dS )z@
        The value of the nonce for this mode as bytes.
        Nr   )r   r   r   r	   Únonce2   s    zModeWithNonce.nonceN)r   r   r   r   r   r   r   r   r   r	   r   0   s   r   c               @   s   e Zd Zejdd„ ƒZdS )ÚModeWithAuthenticationTagc             C   s   dS )zP
        The value of the tag supplied to the constructor of this mode.
        Nr   )r   r   r   r	   Útag;   s    zModeWithAuthenticationTag.tagN)r   r   r   r   r   r   r   r   r   r	   r   9   s   r   c             C   s    |j dkr|jdkrtdƒ‚d S )Né   ZAESz=Only 128, 192, and 256 bit keys are allowed for this AES mode)Úkey_sizer
   Ú
ValueError)r   r   r   r   r	   Ú_check_aes_key_lengthB   s    r   c             C   s0   t | jƒd |jkr,tdjt | jƒ| jƒƒ‚d S )Né   zInvalid IV size ({}) for {}.)Úlenr   Ú
block_sizer   Úformatr
   )r   r   r   r   r	   Ú_check_iv_lengthI   s    r#   c             C   s   t | |ƒ t| |ƒ d S )N)r   r#   )r   r   r   r   r	   Ú_check_iv_and_key_lengthR   s    
r$   c               @   s&   e Zd Zd Zdd„ ZejdƒZeZ	dS )ÚCBCc             C   s   t jd|ƒ || _d S )Nr   )r   Ú_check_byteslikeÚ_initialization_vector)r   r   r   r   r	   Ú__init__\   s    zCBC.__init__r'   N)
r   r   r   r
   r(   r   Úread_only_propertyr   r$   r   r   r   r   r	   r%   W   s   
r%   c               @   s*   e Zd Zd Zdd„ ZejdƒZdd„ ZdS )ÚXTSc             C   s*   t jd|ƒ t|ƒdkr tdƒ‚|| _d S )Nr   é   z!tweak must be 128-bits (16 bytes))r   r&   r    r   Ú_tweak)r   r   r   r   r	   r(   i   s    zXTS.__init__r,   c             C   s   |j dkrtdƒ‚d S )Nr   é   z\The XTS specification requires a 256-bit key for AES-128-XTS and 512-bit key for AES-256-XTS)r   r-   )r   r   )r   r   r   r   r	   r   s   s    
zXTS.validate_for_algorithmN)	r   r   r   r
   r(   r   r)   r   r   r   r   r   r	   r*   d   s   
r*   c               @   s   e Zd Zd ZeZdS )ÚECBN)r   r   r   r
   r   r   r   r   r   r	   r.   {   s   r.   c               @   s&   e Zd Zd Zdd„ ZejdƒZeZ	dS )ÚOFBc             C   s   t jd|ƒ || _d S )Nr   )r   r&   r'   )r   r   r   r   r	   r(   ‡   s    zOFB.__init__r'   N)
r   r   r   r
   r(   r   r)   r   r$   r   r   r   r   r	   r/   ‚   s   
r/   c               @   s&   e Zd Zd Zdd„ ZejdƒZeZ	dS )ÚCFBc             C   s   t jd|ƒ || _d S )Nr   )r   r&   r'   )r   r   r   r   r	   r(   ”   s    zCFB.__init__r'   N)
r   r   r   r
   r(   r   r)   r   r$   r   r   r   r   r	   r0      s   
r0   c               @   s&   e Zd Zd Zdd„ ZejdƒZeZ	dS )ÚCFB8c             C   s   t jd|ƒ || _d S )Nr   )r   r&   r'   )r   r   r   r   r	   r(   ¡   s    zCFB8.__init__r'   N)
r   r   r   r
   r(   r   r)   r   r$   r   r   r   r   r	   r1   œ   s   
r1   c               @   s*   e Zd Zd Zdd„ ZejdƒZdd„ ZdS )ÚCTRc             C   s   t jd|ƒ || _d S )Nr   )r   r&   Ú_nonce)r   r   r   r   r	   r(   ®   s    zCTR.__init__r3   c             C   s:   t | |ƒ t| jƒd |jkr6tdjt| jƒ| jƒƒ‚d S )Nr   zInvalid nonce size ({}) for {}.)r   r    r   r!   r   r"   r
   )r   r   r   r   r	   r   ´   s
    
zCTR.validate_for_algorithmN)	r   r   r   r
   r(   r   r)   r   r   r   r   r   r	   r2   ©   s   
r2   c               @   s>   e Zd Zd ZdZdZddd	„Zejd
ƒZ	ejdƒZ
dd„ ZdS )ÚGCMé   é'   r   r   é@   Nr+   c             C   st   t jd|ƒ t|ƒdkr tdƒ‚|| _|d k	rdt jd|ƒ |dk rJtdƒ‚t|ƒ|k rdtdj|ƒƒ‚|| _|| _d S )Nr   r   z-initialization_vector must be at least 1 byter   é   zmin_tag_length must be >= 4z.Authentication tag must be {} bytes or longer.)	r   r&   r    r   r'   Ú_check_bytesr"   Ú_tagZ_min_tag_length)r   r   r   Zmin_tag_lengthr   r   r	   r(   Æ   s    zGCM.__init__r:   r'   c             C   s   t | |ƒ d S )N)r   )r   r   r   r   r	   r   Þ   s    zGCM.validate_for_algorithml        l    ÿÿl   àÿ? l            l            )Nr+   )r   r   r   r
   Z_MAX_ENCRYPTED_BYTESZ_MAX_AAD_BYTESr(   r   r)   r   r   r   r   r   r   r	   r4   ¾   s   


r4   )Z
__future__r   r   r   r   ZsixZcryptographyr   Zadd_metaclassÚABCMetaÚobjectr   r   r   r   r   r   r#   r$   Zregister_interfacer%   r*   r.   r/   r0   r1   r2   r4   r   r   r   r	   Ú<module>   sP   	





