§
    iÝ[fÏ  ã                   ó>   — d Z ddlmZ ddlmZ  G d„ de¦  «        ZdS )z¿
    authlib.jose.draft
    ~~~~~~~~~~~~~~~~~~~~

    Content Encryption per `Section 4`_.

    .. _`Section 4`: https://datatracker.ietf.org/doc/html/draft-amringer-jose-chacha-02#section-4
é    )ÚChaCha20Poly1305)ÚJWEEncAlgorithmc                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚC20PEncAlgorithmé`   c                 ó>   — d| _         d| _        || _        || _        d S )NÚC20PzChaCha20-Poly1305)ÚnameÚdescriptionÚkey_sizeÚCEK_SIZE)Úselfr   s     ú]/var/www/piapp/venv/lib/python3.11/site-packages/authlib/jose/drafts/_jwe_enc_cryptography.pyÚ__init__zC20PEncAlgorithm.__init__   s#   € ØˆŒ	Ø.ˆÔØ ˆŒØ ˆŒˆˆó    c                 ó    — |                       |¦  «         t          |¦  «        }|                     |||¦  «        }|dd…         |dd…         fS )a#  Content Encryption with AEAD_CHACHA20_POLY1305

        :param msg: text to be encrypt in bytes
        :param aad: additional authenticated data in bytes
        :param iv: initialization vector in bytes
        :param key: encrypted key in bytes
        :return: (ciphertext, tag)
        Niðÿÿÿ)Úcheck_ivr   Úencrypt)r   ÚmsgÚaadÚivÚkeyÚchachaÚ
ciphertexts          r   r   zC20PEncAlgorithm.encrypt   sU   € ð 	�Š�bÑÔÐÝ! #Ñ&Ô&ˆØ—^’^ B¨¨SÑ1Ô1ˆ
Ø˜$˜3˜$Ô ¨C¨D¨DÔ!1Ð1Ð1r   c                 ó~   — |                       |¦  «         t          |¦  «        }|                     |||z   |¦  «        S )aH  Content Decryption with AEAD_CHACHA20_POLY1305

        :param ciphertext: ciphertext in bytes
        :param aad: additional authenticated data in bytes
        :param iv: initialization vector in bytes
        :param tag: authentication tag in bytes
        :param key: encrypted key in bytes
        :return: message
        )r   r   Údecrypt)r   r   r   r   Útagr   r   s          r   r   zC20PEncAlgorithm.decrypt&   s>   € ð 	�Š�bÑÔÐÝ! #Ñ&Ô&ˆØ�~Š~˜b *¨sÑ"2°CÑ8Ô8Ð8r   N)Ú__name__Ú
__module__Ú__qualname__ÚIV_SIZEr   r   r   © r   r   r   r      sH   € € € € € ð €Gð!ð !ð !ð2ð 2ð 2ð9ð 9ð 9ð 9ð 9r   r   N)Ú__doc__Ú+cryptography.hazmat.primitives.ciphers.aeadr   Úauthlib.jose.rfc7516r   r   r"   r   r   ú<module>r&      sj   ððð ð IÐ HÐ HÐ HÐ HÐ HØ 0Ð 0Ð 0Ð 0Ð 0Ð 0ð%9ð %9ð %9ð %9ð %9�ñ %9ô %9ð %9ð %9ð %9r   