+
    P(i4                         ^ RI t ^ RIHt  ! R R]R7      t ! R R]]R7      t ! R R	]]R7      t ! R
 R4      t ! R R4      t ! R R]4      t	 ! R R]4      t
R# )    N)ABCMetac                   H   a  ] tR t^t o RtRtRtRtRtRt	Rt
R tR tRtV tR# )	JWEAlgorithmBasez&Base interface for all JWE algorithms.NFJWEalgc                    \         hNNotImplementedError)selfraw_datas   &&a/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/authlib/jose/rfc7516/models.pyprepare_keyJWEAlgorithmBase.prepare_key       !!    c                    \         hr	   r
   )r   enc_algkeys   &&&r   generate_preset JWEAlgorithmBase.generate_preset   r   r    )__name__
__module____qualname____firstlineno____doc__EXTRA_HEADERSnamedescription
deprecatedalgorithm_typealgorithm_locationr   r   __static_attributes____classdictcell____classdict__s   @r   r   r      s6     0MDKJN"" "r   r   )	metaclassc                   4   a  ] tR t^t o RtRR ltR tRtV tR# )JWEAlgorithmzInterface for JWE algorithm conforming to RFC7518.
JWA specification (RFC7518) SHOULD implement the algorithms for JWE
with this base implementation.
Nc                    \         hr	   r
   )r   r   headersr   presets   &&&&&r   wrapJWEAlgorithm.wrap   r   r   c                    \         hr	   r
   )r   r   ekr,   r   s   &&&&&r   unwrapJWEAlgorithm.unwrap    r   r   r   r	   )	r   r   r   r   r   r.   r2   r$   r%   r&   s   @r   r*   r*      s     
"" "r   r*   c                   H   a  ] tR t^$t o RtRR ltR tRR ltRR ltRt	V t
R# )	$JWEAlgorithmWithTagAwareKeyAgreementzInterface for JWE algorithm with tag-aware key agreement (in key agreement
with key wrapping mode).
ECDH-1PU is an example of such an algorithm.
Nc                    \         hr	   r
   )r   r   r   
sender_keyr-   s   &&&&&r   !generate_keys_and_prepare_headersFJWEAlgorithmWithTagAwareKeyAgreement.generate_keys_and_prepare_headers*   r   r   c                    \         hr	   r
   )r   r   r,   r   r7   epkcektags   &&&&&&&&r   agree_upon_key_and_wrap_cek@JWEAlgorithmWithTagAwareKeyAgreement.agree_upon_key_and_wrap_cek-   s
     "!r   c                    \         hr	   r
   )r   r   r,   r   r7   r-   s   &&&&&&r   r.   )JWEAlgorithmWithTagAwareKeyAgreement.wrap2   r   r   c                    \         hr	   r
   )r   r   r1   r,   r   r7   r=   s   &&&&&&&r   r2   +JWEAlgorithmWithTagAwareKeyAgreement.unwrap5   r   r   r   r	   )r   r   r   r   r   r8   r>   r.   r2   r$   r%   r&   s   @r   r5   r5   $   s#     
""
"" "r   r5   c                   V   a  ] tR t^9t o RtRtRtRtRtRt	R t
R tR tR tR tR	tV tR# )
JWEEncAlgorithmNr   encc                P    \         P                  ! V P                  ^,          4      #    )osurandomCEK_SIZEr   s   &r   generate_cekJWEEncAlgorithm.generate_cekB   s    zz$--1,--r   c                P    \         P                  ! V P                  ^,          4      # rH   )rJ   rK   IV_SIZErM   s   &r   generate_ivJWEEncAlgorithm.generate_ivE   s    zz$,,!+,,r   c                ^    \        V4      ^,          V P                  8w  d   \        R4      hR# )rI   zInvalid "iv" sizeN)lenrQ   
ValueError)r   ivs   &&r   check_ivJWEEncAlgorithm.check_ivH   s'    r7Q;$,,&011 'r   c                    \         h)zEncrypt the given "msg" text.

: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)
r
   )r   msgaadrW   r   s   &&&&&r   encryptJWEEncAlgorithm.encryptL   s
     "!r   c                    \         h)a   Decrypt the given cipher text.

: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   
ciphertextr\   rW   r=   r   s   &&&&&&r   decryptJWEEncAlgorithm.decryptW   s
     "!r   r   )r   r   r   r   r   r    r"   r#   rQ   rL   rN   rR   rX   r]   ra   r$   r%   r&   s   @r   rE   rE   9   sB     DKNGH.-2	"
" 
"r   rE   c                   <   a  ] tR t^dt o RtRtRtRtR tR t	Rt
V tR# )JWEZipAlgorithmNr   zipc                    \         hr	   r
   r   ss   &&r   compressJWEZipAlgorithm.compressj   r   r   c                    \         hr	   r
   rg   s   &&r   
decompressJWEZipAlgorithm.decompressm   r   r   r   )r   r   r   r   r   r    r"   r#   ri   rl   r$   r%   r&   s   @r   rd   rd   d   s)     DKN"" "r   rd   c                   L   a a ] tR t^qt oRtV 3R ltR t]R 4       tRt	Vt
V ;t# )JWESharedHeaderzaShared header object for JWE.

Combines protected header and shared unprotected header together.
c                   < / pV'       d   VP                  V4       V'       d   VP                  V4       \        SV `	  V4       V'       d   TM/ V n        V'       d	   W n        R # / V n        R # r	   )updatesuper__init__	protectedunprotected)r   rt   ru   obj	__class__s   &&& r   rs   JWESharedHeader.__init__w   sM    JJ{#JJy!&/R*5;2r   c                ^    V P                  V4       V P                  P                  V4       R # r	   )rq   rt   )r   additions   &&r   update_protected JWESharedHeader.update_protected   s     Hh'r   c                v    \        W4      '       d   V# V ! VP                  R 4      VP                  R4      4      # rt   ru   )
isinstanceget)clsrv   s   &&r   	from_dictJWESharedHeader.from_dict   s1    cJ377;')?@@r   r~   )r   r   r   r   r   rs   r{   classmethodr   r$   r%   __classcell__rw   r'   s   @@r   ro   ro   q   s0     
>( A A Ar   ro   c                   6   a a ] tR t^t oRtV 3R ltRtVtV ;t# )	JWEHeaderzHeader object for JWE.

Combines protected header, shared unprotected header
and specific recipient's unprotected header together.
c                2  < / pV'       d   VP                  V4       V'       d   VP                  V4       V'       d   VP                  V4       \        SV `	  V4       V'       d   TM/ V n        V'       d   TM/ V n        V'       d	   W0n        R # / V n        R # r	   )rq   rr   rs   rt   ru   header)r   rt   ru   r   rv   rw   s   &&&& r   rs   JWEHeader.__init__   sf    JJ{#JJvJJy!&/R*5;2 &fBr   )r   rt   ru   )	r   r   r   r   r   rs   r$   r%   r   r   s   @@r   r   r      s     / /r   r   )rJ   abcr   r   r*   r5   rE   rd   dictro   r   r   r   r   <module>r      sd    	 " "$
"#w 
""+;w "*(" ("V
" 
"Ad A6/ /r   