
    /h                         d Z ddlmZmZmZ ddlmZmZmZ ddl	m
Z
 ddlmZmZ ddlmZmZ ddlmZ dd	lmZmZ d
Z ed          Z G d d          Zdddde
dfdZdS )zSecure serializer.    )dumpsloadsregistry)bytes_to_strensure_bytesstr_to_bytes)DEFAULT_SECURITY_DIGEST)	b64decode	b64encode   )CertificateFSCertStore)
PrivateKey)get_digest_algorithmreraise_errors)SecureSerializerregister_authz c                   D    e Zd ZdZdddedfdZd Zd ZefdZ	efdZ
dS )	r   zSigned serializer.Njsonc                 f    || _         || _        || _        t          |          | _        || _        d S N)_key_cert_cert_storer   _digest_serializer)selfkeycert
cert_storedigest
serializers         a/var/www/html/e360mart/e360mart_env/lib/python3.11/site-packages/celery/security/serialization.py__init__zSecureSerializer.__init__   s5    	
%+F33%    c           
      v   | j         J | j        J t          dt          f          5  t	          || j                  \  }}}t          |          }|                     |||| j                             || j	                  | j        
                                          cddd           S # 1 swxY w Y   dS )z%Serialize data structure into string.NzUnable to serialize: {0!r}r"   )	signaturesigner)r   r   r   	Exceptionr   r   r   _packsignr   get_id)r   datacontent_typecontent_encodingbodys        r#   	serializezSecureSerializer.serialize   s   y$$$z%%%89,GG 	: 	:38!143 43 430L*D  %%D::dL2B(,	tT\(J(J%)Z%6%6%8%8  : :	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:s   A8B..B25B2c                 V   | j         J t          dt          f          5  |                     |          }|d         |d         |d         }}}| j         |                             ||| j                   ddd           n# 1 swxY w Y   t          ||d         |d         d	          S )
z'Deserialize data structure from string.NzUnable to deserialize: {0!r}r(   r)   r1   r/   r0   T)force)r   r   r*   _unpackverifyr   r   )r   r.   payloadr(   r)   r1   s         r#   deserializezSecureSerializer.deserialize0   s   +++:YLII 	K 	Kll4((G'.{';'.x'8'.v  $vI V$++D)T\JJJ	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K T7>2/0> > > 	>s   ABBBc                     |                     d t          |          t          |          |||fD                       }t          |          S )Nc              3   4   K   | ]}t          |          V  d S r   )r   ).0ss     r#   	<genexpr>z)SecureSerializer._pack.<locals>.<genexpr>>   s9       
 
 !LOO
 
 
 
 
 
r%   )joinr   )r   r1   r/   r0   r)   r(   sepfieldss           r#   r+   zSecureSerializer._pack<   sa     
 
&/&7&799M9M&24Dd&L
 
 
 
 
    r%   c                    t          t          |                    }|                    |d          }t          |d                   t          |d                   t          |d                   t          |d                   |d         dS )N   )maxsplitr   r         )r)   r(   r/   r0   r1   )r
   r   splitr   )r   r7   r?   raw_payloadvs        r#   r5   zSecureSerializer._unpackD   s}    W 5 566cA..!oo"1Q4(1.. ,QqT 2 2aD
 
 	
r%   )__name__
__module____qualname____doc__r	   r$   r2   r8   DEFAULT_SEPARATORr+   r5    r%   r#   r   r      s        dt/F& & & &: : :"
> 
> 
> $! ! ! ! $5 	
 	
 	
 	
 	
 	
r%   r   Nr   c                     t          | ot          | |          |ot          |          |ot          |          ||          }t	          j        d|j        |j        dd           dS )zRegister security serializer.)passwordr'   authzapplication/datazutf-8)r/   r0   N)r   r   r   r   r   registerr2   r8   )r   key_passwordr   storer!   r"   r<   s          r#   r   r   P   s     	GC,!G!G!G3+d"3"35;u#5#5J	8 	8 	8A fak1=#5'.0 0 0 0 0 0r%   )rL   kombu.serializationr   r   r   kombu.utils.encodingr   r   r   celery.app.defaultsr	   celery.utils.serializationr
   r   certificater   r   r   r   utilsr   r   __all__rM   r   r   rN   r%   r#   <module>r\      s"     6 6 6 6 6 6 6 6 6 6 I I I I I I I I I I 7 7 7 7 7 7 ; ; ; ; ; ; ; ; 1 1 1 1 1 1 1 1       7 7 7 7 7 7 7 7
/
 !L,, 9
 9
 9
 9
 9
 9
 9
 9
x D0#
0 
0 
0 
0 
0 
0r%   