
    dfE                    8   d Z ddlmZ ddlmZ ddlmZ dZ	 ddlm	Z
 erGddlZddlmZmZ e
j$                  ZdZe
j(                  Ze
j*                  Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Zy G d
 de      ZdZdZdZd Zy# e$ r 	 ddlmZ
 n# e$ r dZY nw xY wY zw xY w)zSupport for SSL in PyMongo.    )annotations)OptionalConfigurationErrorTNF)	CERT_NONECERT_REQUIREDc                b   |rt         nt        }t        j                  t        j                        }|t         k7  r	| |_        nd|_        t        |d      r| |_        t        |d      r|xj                  t        j                  z  c_        |xj                  t        j                  z  c_        |xj                  t        j                  z  c_        |xj                  t        j                  z  c_        | 	 |j                  | d|       |Bt        j                   rt        d      t#        t        dd      |_        |j'                  |       ||j'                  |       n|t         k7  r|j)                          ||_        |S # t        j                  $ r}	t        d|	       dd}	~	ww xY w)	z'Create and return an SSLContext object.Fcheck_ocsp_endpointoptionsNz'Private key doesn't match certificate: z(tlsCRLFile cannot be used with PyOpenSSLVERIFY_CRL_CHECK_LEAFr   )r   r   _ssl
SSLContextPROTOCOL_SSLv23check_hostnamehasattrr
   r   OP_NO_SSLv2OP_NO_SSLv3OP_NO_COMPRESSIONOP_NO_RENEGOTIATIONload_cert_chainSSLErrorr   IS_PYOPENSSLgetattrverify_flagsload_verify_locationsload_default_certsverify_mode)
certfile
passphraseca_certscrlfileallow_invalid_certificatesallow_invalid_hostnamesdisable_ocsp_endpoint_checkr   ctxexcs
             L/home/api-vastappli/venv/lib/python3.12/site-packages/pymongo/ssl_support.pyget_ssl_contextr(   .   sr    $>i=ood223)#%<!<C!&C3-.*E&EC#3	"
 KK4+++KKK4+++KKK4111KKK4333Kd##HdJ?   ()STT&-q C %%g.%%h/I%""$%
 == d(+RSVRW)XY_ccds   :F F.F))F.c                      e Zd Zy)r   N)__name__
__module____qualname__     r'   r   r   _   s    r.   r   r-   c                     t        d      )z(No ssl module, raise ConfigurationError.z The ssl module is not available.r   )dummys    r'   r(   r(   f   s     !CDDr.   )r   Optional[str]r   r1   r    r1   r!   r1   r"   boolr#   r2   r$   r2   returnz_ssl.SSLContext)__doc__
__future__r   typingr   pymongo.errorsr   HAVE_SSLpymongo.pyopenssl_contextpyopenssl_contextr   ImportErrorpymongo.ssl_contextssl_contextssl
_stdlibsslr   r   HAS_SNIIPADDR_SAFEr   BLOCKING_IO_ERRORSr(   	Exceptionr-   r.   r'   <module>rD      s    " "  -, 
 ,llGK}}H00--!-  - 	-
 %)- "&- &*- 
-b9  GKEY  * s5   A< <BB	B	BBBBB