
    k7i                     6    S r SSKJr  SSKJr   " S S\5      rg)zauthlib.jose.draft.
~~~~~~~~~~~~~~~~~~~~

Content Encryption per `Section 4`_.

.. _`Section 4`: https://datatracker.ietf.org/doc/html/draft-amringer-jose-chacha-02#section-4
    )ChaCha20Poly1305)JWEEncAlgorithmc                   *    \ rS rSrSrS rS rS rSrg)C20PEncAlgorithm   `   c                 8    SU l         SU l        Xl        Xl        g )NC20PzChaCha20-Poly1305)namedescriptionkey_sizeCEK_SIZE)selfr   s     c/home/james-whalen/.local/lib/python3.13/site-packages/authlib/jose/drafts/_jwe_enc_cryptography.py__init__C20PEncAlgorithm.__init__   s    	.      c                 r    U R                  U5        [        U5      nUR                  X1U5      nUSS USS 4$ )zContent 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   C20PEncAlgorithm.encrypt   sC     	b!#&^^BS1
$3CD!111r   c                 d    U R                  U5        [        U5      nUR                  X1U-   U5      $ )a  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   C20PEncAlgorithm.decrypt'   s0     	b!#&~~bs"2C88r   )r   r   r   r   N)	__name__
__module____qualname____firstlineno__IV_SIZEr   r   r   __static_attributes__ r   r   r   r      s     G!29r   r   N)__doc__+cryptography.hazmat.primitives.ciphers.aeadr   authlib.jose.rfc7516r   r   r(   r   r   <module>r,      s    I 0%9 %9r   