
    nh                       d Z ddlmZ ddlZddlmZ ddlmZ dZ	 ddl	m
Z eraddlZddlmZmZ ej0                  ZdZej4                  Zej6                  Zej8                  Zej:                  ZeZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy G d de       Zd
Zd
ZdZd Zy# eef$ r=Z eee      r ej                   ded	       	 ddlmZ n# e$ r d
ZY nw xY wY dZ[dZ[ww xY w)zSupport for SSL in PyMongo.    )annotationsN)OptionalConfigurationErrorTzFailed to use the installed version of PyOpenSSL. Falling back to stdlib ssl, disabling OCSP support. This is likely caused by incompatible versions of PyOpenSSL < 23.2.0 and cryptography >= 42.0.0. Try updating PyOpenSSL >= 23.2.0 to enable OCSP.   )
stacklevelF)	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
             y/var/www/html/SchoolMeal/SchoolMeal/pds_admin_SchoolMeal/Backend/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   m   s    r0   r   r/   c                     t        d      )z(No ssl module, raise ConfigurationError.zThe ssl module is not availabler   )dummys    r)   r*   r*   t   s     !BCCr0   )r    Optional[str]r!   r3   r"   r3   r#   r3   r$   boolr%   r4   r&   r4   returnz_ssl.SSLContext)!__doc__
__future__r   warningstypingr   pymongo.errorsr   HAVE_SSLpymongo.pyopenssl_contextpyopenssl_contextr   ImportErrorAttributeErrorr(   
isinstancewarnUserWarningpymongo.ssl_contextssl_contextssl
_stdlibsslr	   r
   HAS_SNIIPADDR_SAFEr   BLOCKING_IO_ERRORSBLOCKING_IO_READ_ERRORBLOCKING_IO_WRITE_ERRORBLOCKING_IO_LOOKUP_ERRORr*   	Exceptionr/   r0   r)   <module>rN      s@   " "   -,$ 
 ,llGK}}H00!88"::5--!-  - 	-
 %)- "&- &*- 
-b9  GKDs 	^$ #~&?
 	
* s;   B C!C CCCCCCC