
    i)i                    b   U d Z ddlmZ ddlZddlZddlmZmZmZ ddl	m
Z
 dZdZ	 ddlmZ n5# eef$ r+ZdZ eee          r ej        ded	
           Y dZ[ndZ[ww xY w	 ddlmZ n# e$ r dZY nw xY werddlZddlmZmZ dZerGej        Zde d<   ej!        ej!        z   Z!de d<   ej"        ej"        fZ"de d<   ej#        ej#        fZ#de d<   n-ej        Zej!        Z!de d<   ej"        fZ"de d<   ej#        fZ#de d<   ej        Ze"Z$d%dZ%d&dZ&dS  G d  d!e'          ZdZd"Z!de d<   d%d#Z%d$ Z&dS )'zSupport for SSL in PyMongo.    )annotationsN)AnyOptionalUnionConfigurationErrorTFzFailed 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.   )
stacklevel)	CERT_NONECERT_REQUIREDr   
PYSSLErrortupleBLOCKING_IO_ERRORSBLOCKING_IO_READ_ERRORBLOCKING_IO_WRITE_ERRORis_syncboolreturnc                D    | rt           rt          j        S t          j        S )N)
HAVE_PYSSL_pysslHAS_SNI_sslr   s    e/Users/user/workspace/sujinbaek/cqa-test-app/venv/lib/python3.11/site-packages/pymongo/ssl_support.py_has_snir   N   s!     	"z 	">!|    certfileOptional[str]
passphraseca_certscrlfileallow_invalid_certificatesallow_invalid_hostnamesdisable_ocsp_endpoint_check)Union[_pyssl.SSLContext, _ssl.SSLContext]c                :   |rt           rt          }nt          }|rt          nt          }	|                    |j                  }
|	t          k    r	| |
_        nd|
_        t          |
d          r| |
_	        t          |
d          rT|
xj
        |j        z  c_
        |
xj
        |j        z  c_
        |
xj
        |j        z  c_
        |
xj
        |j        z  c_
        | >	 |
                    | d|           n%# |j        $ r}t#          d|           dd}~ww xY w|A|j        rt#          d          t'          |dd          |
_        |
                    |           ||
                    |           n|	t          k    r|
                                 |	|
_        |
S )	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   r   r   r   
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)r   r    r!   r"   r#   r$   r%   r   sslr:   ctxexcs               r   get_ssl_contextr>   S   s     	z 	$*CCC#=Pii=nnS011)##%<!<C!&C3-.. 	F*E&EC#3	"" 	3
 KK3?*KKKK3?*KKKK300KKKK322KKd##HdJ????< d d d()XSV)X)XYY_ccd U()STTT&s,CQGGC%%g...%%h////I%%""$$$%
s   C5 5
D?DDc                      e Zd ZdS )r4   N)__name__
__module____qualname__ r   r   r4   r4      s        r   r4   rC   c                    dS )NFrC   r   s    r   r   r      s    ur   c                      t          d          )z(No ssl module, raise ConfigurationError.zThe ssl module is not availabler   )dummys    r   r>   r>      s     !BCCCr   )r   r   r   r   )r   r   r    r   r!   r   r"   r   r#   r   r$   r   r%   r   r   r   r   r&   )(__doc__
__future__r   typeswarningstypingr   r   r   pymongo.errorsr   HAVE_SSLr   pymongo.pyopenssl_contextpyopenssl_contextr   ImportErrorAttributeErrorr=   
isinstancewarnUserWarningpymongo.ssl_contextssl_contextr   r;   
_stdlibsslr   r   IPADDR_SAFEr4   r   __annotations__r   r   r   BLOCKING_IO_LOOKUP_ERRORr   r>   	ExceptionrC   r   r   <module>r\      s   " ! ! " " " " " "   ' ' ' ' ' ' ' ' ' ' - - - - - -

.......^$ 
 
 
Jz#~&& 	
?
 	
 	
 	
 	

&&&&&&&   HHH  cD
 ,,,,,,,,K I /
))))#f&?? 	 	
 	
 	
 	
 )')
 	
 	
 	
 	

 *(*
 	
 	
 	
 	
 	

 ]
$($;;;;;)-)D(FFFFF*.*F)HHHHH}H5   
0 0 0 0 0 0h    9    K """""   D D D D Ds&   . A !AA $A+ +A54A5