
    mbi                        U d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z
 ddlm	Z ddlmZmZ d	Zd
ed<   g Zded<    e            Z e            dd            Z	 e            dd            ZddZddZddZdZdS )z
the Wassima library is a simple library.
It aims to provide a pythonic way to retrieve root CAs from your system without any difficulties or hazmat.
    )annotationsN)	lru_cache)RLock   )root_der_certificates)VERSION__version__zECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305strMOZ_INTERMEDIATE_CIPHERSlist[bytes]_MANUALLY_REGISTERED_CAreturnc                     t           5  t                      } | st                      } |                     t                     | cd d d            S # 1 swxY w Y   d S )N)_USER_APPEND_CA_LOCK_root_der_certificatesfallback_der_certificatesextendr   )certificatess    `/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/wassima/__init__.pyr   r      s    	  -// 	7466L3444                 s   :AAA	list[str]c                 z    g } t                      D ])}|                     t          j        |                     *| S )zs
    Retrieve a list of root certificate from your operating system trust store.
    They will be PEM encoded.
    )r   appendsslDER_cert_to_PEM_cert)	pem_certsbin_certs     r   root_pem_certificatesr   (   sF     I)++ = =1(;;<<<<    c                 D    d                     t                                S )z
    Generate an aggregated CA bundle that originate from your system trust store.
    Simply put, concatenated root PEM certificate.
    z

)joinr    r   r   generate_ca_bundler"   6   s    
 ;;,..///r   pem_or_der_certificatebytes | strNonec                B   t           5  t          | t                    rt          j        |           } | t
          vrLt
                              |            t                                           t                                           ddd           dS # 1 swxY w Y   dS )zZ
    You may register your own CA certificate in addition to your system trust store.
    N)
r   
isinstancer
   r   PEM_cert_to_DER_certr   r   r   cache_clearr   )r#   s    r   register_car*   >   s     
 0 0,c22 	V%(%=>T%U%U"!)@@@#**+ABBB!--///!--///0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s   A?BBBssl.SSLContextc                 l   t          j        t           j                  } |                     t	                                 t           j        j        | _        |                     t                     t           j
        | _        	 d| _        n# t          $ r Y nw xY w	 d| _        n# t          $ r Y nw xY w| S )aq  
    Instantiate a native SSLContext (client purposes) that ships with your system root CAs.
    In addition to that, assign it the default OpenSSL ciphers suite and set
    TLS 1.2 as the minimum supported version. Also disable commonName check and enforce
    hostname altName verification. The Mozilla Recommended Cipher Suite is used instead of system default.
    )cadataFT)r   
SSLContextPROTOCOL_TLS_CLIENTload_verify_locationsr"   
TLSVersionTLSv1_2minimum_versionset_ciphersr   CERT_REQUIREDverify_modehostname_checks_common_nameAttributeErrorcheck_hostname)ctxs    r   create_default_ssl_contextr;   M   s     .0
1
1C%7%9%9:::.0COO,---'CO*/''   !    Js$   B 
BBB$ $
B10B1)r   r   r"   r;   r*   r	   r   )r   r   )r   r   )r   r
   )r#   r$   r   r%   )r   r+   )__doc__
__future__r   r   	functoolsr   	threadingr   _osr   r   
_os._embedr   _versionr   r	   r   __annotations__r   r   r   r"   r*   r;   __all__r!   r   r   <module>rE      sr    
 # " " " " " 



                  K J J J J J * * * * * * * * !^   ^  ^  ^  ^')  ) ) ) )uww  	 	 	 	 
 
 
 
0 0 0 00 0 0 0   8r   