o
    ›¨Êh;	  ã                   @   s„   d Z ddlmZ ddlmZ ddlmZ ddlmZ dZ	dZ
d	Zd
ZzddlZW n ey3   ee	ƒ‚w 		ddd„Zddd„ZdS )zMessage Signing Serializer.é    )Údisable_insecure_serializers)Úregistry)ÚImproperlyConfiguredé   )Úregister_authz|You need to install the cryptography library to use the auth serializer.
Please install by:

    $ pip install cryptography
zçSorry, but you have to configure the
    * security_key
    * security_certificate, and the
    * security_cert_store
configuration settings to use the auth serializer.

Please see the configuration reference for more information.
a  You have to configure a special task serializer
for signing and verifying tasks:
    * task_serializer = 'auth'

You have to accept only tasks which are serialized with 'auth'.
There is no point in signing messages if they are not verified.
    * accept_content = ['auth']
)Úsetup_securityNÚjsonc              	   C   s  |du rddl m} | ¡ }t| ƒ |j}	|	jdks |	jdgkr$ttƒ‚|p(|	j	}|p-|	j
}|p2|	j}|p7|	j}|p<|	j}|rC|rC|sGttƒ‚t|ƒ�)}
t|ƒ�}t|
 ¡ || ¡ |||ƒ W d  ƒ n1 shw   Y  W d  ƒ n1 sww   Y  t d¡ dS )z#See :meth:`@Celery.setup_security`.Nr   )Úcurrent_appÚauth)Úceleryr	   Ú_get_current_objectÚ_disable_insecure_serializersÚconfÚtask_serializerÚaccept_contentr   ÚSETTING_MISSINGÚsecurity_keyÚsecurity_key_passwordÚsecurity_certificateÚsecurity_cert_storeÚsecurity_digestÚSECURITY_SETTING_MISSINGÚopenr   Úreadr   Ú_set_default_serializer)Úallowed_serializersÚkeyÚkey_passwordÚcertÚstoreÚdigestÚ
serializerÚappr	   r   ÚkfÚcf© r%   úJ/var/www/html/env/lib/python3.10/site-packages/celery/security/__init__.pyr   ,   s*   






ÿ€ÿr   c                 C   s   t | d� d S )N)Úallowed)r   )Ú	whitelistr%   r%   r&   Údisable_untrusted_serializersI   s   r)   )NNNNNNr   N)N)Ú__doc__Úkombu.serializationr   r   r   Úcelery.exceptionsr   Úserializationr   ÚCRYPTOGRAPHY_NOT_INSTALLEDr   r   Ú__all__ÚcryptographyÚImportErrorr   r)   r%   r%   r%   r&   Ú<module>   s$    

ÿ
ÿ