
    h                     H   d Z ddlZddlZ eedej                        Z eedd      Z eedd      Z eedd      Z	 eedd      Z
 eedd	      Zd	Zej                  Z	 dd
lmZ  eed      rddlmZ ej"                  dd dk\  Zy# e$ r ddlmZ  G d de      ZY yw xY w)z!A fake SSLContext implementation.    NPROTOCOL_TLS_CLIENTOP_NO_SSLv2OP_NO_SSLv3OP_NO_COMPRESSIONOP_NO_RENEGOTIATIONHAS_SNIF)
SSLContextVERIFY_CRL_CHECK_LEAF)r
      )      )ConfigurationErrorc                   f    e Zd ZdZdZd Zed        Zd Zd Z	 eee	      Z
ddZdd	Z	 	 	 dd
Zy)r	   a  A fake SSLContext.

        This implements an API similar to ssl.SSLContext from python 3.2
        but does not implement methods or properties that would be
        incompatible with ssl.wrap_socket from python 2.7 < 2.7.9.

        You must pass protocol which must be one of the PROTOCOL_* constants
        defined in the ssl module. ssl.PROTOCOL_SSLv23 is recommended for maximum
        interoperability.
        )_cafile	_certfile_keyfile	_protocol_verify_modec                 f    d | _         d | _        d | _        || _        t        j
                  | _        y )N)r   r   r   r   _ssl	CERT_NONEr   )selfprotocols     V/var/www/html/ranktracker/api/venv/lib/python3.12/site-packages/pymongo/ssl_context.py__init__zSSLContext.__init__E   s*    DL!DN DM%DN $D    c                     | j                   S )zpThe protocol version chosen when constructing the context.
            This attribute is read-only.
            )r   r   s    r   r   zSSLContext.protocolL   s    
 >>!r   c                     | j                   S )zWhether to try to verify other peers' certificates and how to
            behave if verification fails. This attribute must be one of
            ssl.CERT_NONE, ssl.CERT_OPTIONAL or ssl.CERT_REQUIRED.
            r   r   s    r   __get_verify_modezSSLContext.__get_verify_modeS   s    
 $$$r   c                     || _         y)zSetter for verify_mode.Nr    )r   values     r   __set_verify_modezSSLContext.__set_verify_modeZ   s
     %Dr   Nc                 :    |t        d      || _        || _        y)a  Load a private key and the corresponding certificate. The certfile
            string must be the path to a single file in PEM format containing the
            certificate as well as any number of CA certificates needed to
            establish the certificate's authenticity. The keyfile string, if
            present, must point to a file containing the private key. Otherwise
            the private key will be taken from certfile as well.
            NzZSupport for ssl_pem_passphrase requires python 2.7.9+ (pypy 2.5.1+), python 3 or PyOpenSSL)r   r   r   )r   certfilekeyfilepasswords       r   load_cert_chainzSSLContext.load_cert_chain`   s,     #( ! ! &DN#DMr   c                     || _         y)zLoad a set of "certification authority"(CA) certificates used to
            validate other peers' certificates when `~verify_mode` is other than
            ssl.CERT_NONE.
            N)r   )r   cafiledummys      r   load_verify_locationsz SSLContext.load_verify_locationsp   s    
 "DLr   c                     t        j                  || j                  | j                  || j                  | j
                  | j                  ||	      S )z`Wrap an existing Python socket sock and return an ssl.SSLSocket
            object.
            )r'   r&   server_side	cert_reqsssl_versionca_certsdo_handshake_on_connectsuppress_ragged_eofs)r   wrap_socketr   r   r   r   r   )r   sockr/   r3   r4   r,   s         r   r5   zSSLContext.wrap_socketw   sH     ##D$---1^^0;.2.?.?04-1\\<S9MO Or   )NN)FTTN)__name__
__module____qualname____doc__	__slots__r   propertyr   _SSLContext__get_verify_mode_SSLContext__set_verify_modeverify_moder)   r-   r5    r   r   r	   r	   6   s\    		>		/ 
	" 
	"	%	& 02CD	$ 	" 16049=	Or   r	   )r:   sslr   sys_sysgetattrPROTOCOL_SSLv23r   r   r   r   r   IS_PYOPENSSLSSLErrorr	   hasattrr
   version_infoCHECK_HOSTNAME_SAFEImportErrorpymongo.errorsr   objectr@   r   r   <module>rN      s    (   $ 5t7K7KLdM1-dM1-D"5q9 d$91=  $	5
) ==^Ot,-- ++BQ/69 QO1NOV NOQOs    'B B! B!