+
      xi@  c                  s>   R t ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
HtHt ^ RIHtHt ]'       d   ^ RIHt ^ RI	Ht R	 R
 ltR R lt]P(                  ! R4      t]P(                  ! R4      tRR]P.                  3R R lltRR]P.                  3R R lltR# )z=Implement key wrapping as described in RFC 3394 and RFC 5649.)annotationsN)TYPE_CHECKING)default_backend)Cipher
algorithmsmodes)DecryptionErrorEncryptionError)Type)BlockCipherAlgorithmc               s$    V ^8  d   QhRRRRRR/# )   abytesbreturn Zformat   "6/usr/lib/python3.14/site-packages/pskc/crypto/aeskw.py__annotate__r   (   s!     0 0u 0 05 0    c                s8    \        R \        W4       4       4      # )zReturn a XOR b.c              3  s6   "   T F  w  rW,          x  K  	  R # 5i)Nr   )Z.0ZxZys   &  r   Z	<genexpr>Z_strxor.<locals>.<genexpr>*   s     /Y6AYs   )r   Zzip)r   r   s   &&r   _strxorr   (   s    /SY///r   c               s     V ^8  d   QhRRRR/# )r
   valuer   r   ztuple[bytes, bytes]r   r   r   r   r   r   -   s        %  /  r   c                s&    V R ,          V R,          3# )N   N:r   NNr   )r   s   &r   _splitr   -   s    9eBir   Za6a6a6a6a6a6a6a6Za65959a6c               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r
   	plaintextr   keyivbytes | Nonepadbool | None	algorithmType[BlockCipherAlgorithm]r   r   r   r   r   r   r   5   sD     0 00	0 	0 
	0
 *0 0r   c           
     s   Ve   Rp\        V 4      pVRJ d!   V^,          ^ 8w  g   V^8  d   \        R4      hV^,          ^ 8w  d4   VRJd.   V^,           ^,          pW^,          V,
          R,          ,          p Vf@   \        V 4      V8w  g   VRJ d$   \        \        P                  ! RV4      ,           pM\
        p\        V! V4      \        P                  ! 4       \        4       4      pVP                  4       p\        V 4      ^,          p	V	^8X  d   VP                  W ,           4      # Tp
\        V	4       Uu. uF  pW^,          V^,          ^,            NK  	  pp\        ^4       Fv  p\        V	4       Fd  p\        VP                  WV,          ,           4      4      w  qV&   \        V
\        P                  ! RW,          V,           ^,           4      4      p
Kf  	  Kx  	  V
RP                  V4      ,           # u upi )az  Apply the AES key wrap algorithm to the plaintext.

The iv can specify an initial value, otherwise the value from RFC 3394 or
RFC 5649 will be used, depending on the plaintext length and the value of
pad.

If pad is True, padding as described in RFC 5649 will always be used. If
pad is False, padding is disabled. Other values automatically enable RFC
5649 padding when needed.
FzPlaintext length wrong    T>I>Qr   )lenr   
RFC5649_IVstructpack
RFC3394_IVr   r   ECBr   	encryptorupdateranger   r   join)r   r   r   r   r!   mliZrcipherr,   nAiRj   &&&&&         r   wrapr8   5   s   " 
~
i.C
e|qAr677
Qw!|5(1WN1umu,,		zy>S C4Kfkk$44BBIcNEIIK1BCF  "II!AAv//
A(	Q 
q5Q	#  	1XqAY--aA$h78GAt6;;tQUQY];<A   sxx{?	s   9"G:c               r   )r
   
ciphertextr   r   r   r   r   r    r!   r"   r   r   r   r   r   r   r   h   sD     0/ 0/0/	0/ 	0/ 
	0/
 *0/ 0/r   c           
     s   Ve   Rp\        V 4      ^,          ^ 8w  g   VRJ d   \        V 4      ^8  d   \        R4      h\        V! V4      \        P                  ! 4       \        4       4      pVP                  4       p\        V 4      ^,          ^,
          pV^8X  d   \        VP                  V 4      4      w  rMV R,          p\        V4       U
u. uF#  p
W
^,           ^,          V
^,           ^,           NK%  	  pp
\        \        ^4      4       F  p\        \        V4      4       Fd  p
\        V\        P                  ! RW|,          V
,           ^,           4      4      p\        VP                  WV
,          ,           4      4      w  qV
&   Kf  	  K  	  RP                  V4      p	Vf   V\        8X  d	   VRJd   V	# VR,          \         8X  d   VRJd   \        P"                  ! R	VR
,          4      ^ ,          p^V^,
          ,          Tu;8  d   ^V,          8:  d7   M M<V	P%                  \        V	4      V,
          R,          4      '       d   V	RV # MW8X  d   V	# \        R4      hu up
i )aA  Apply the AES key unwrap algorithm to the ciphertext.

The iv can specify an initial value, otherwise the value from RFC 3394 or
RFC 5649 will be used, depending on the value of pad.

If pad is False, unpadding as described in RFC 5649 will be disabled,
otherwise checking and removing the padding is automatically done.
NFzCiphertext length wrongr   r%   r   T:N   Nr$   :r:   NNr#   zIV does not match)r&   r   r   r   r+   r   	decryptorr   r-   r.   Zreversedr   r(   r)   r/   r*   r'   ZunpackZendswith)r9   r   r   r   r!   r1   r;   r2   r3   r   r4   r5   r6   r0   r7   r   unwrapr<   h   s    
~
:aC5LS_r5I788IcNEIIK1BCF  "IJ1q AAvi..z:;9rNAh  Q!QUaK0 	
  %(#AeAh'Av{{4Q?@ !1!1!d(!;<Q4 ( $ HHQK		z
?s$rUj S%5--ae,Q/CAE{S)AE)!!3y>C#75"@AA #&	

-
..' s   )I%)Z__doc__Z
__future__r    Zbinasciir(   Ztypingr   Zcryptography.hazmat.backendsr   Z&cryptography.hazmat.primitives.ciphersr   r   r   Zpskc.exceptionsr   r   r   r	   r   r   Za2b_hexr*   r'   ZAESr8   r<   r   r   r   <module>r=      s   * D "     8 L L <K0
  01
j)
 ,6NN0l ,6NN0/ 0/r   