o Sûbfã @sÆdZddlmZdZzddlmZWney/zddlm ZWn ey,dZYnwYnwerOddl Z ddl m Z m Z ejZdZejZejZdd„ZdSGd d „d eƒZdZdZd Zd d„ZdS) zSupport for SSL in PyMongo.é©ÚConfigurationErrorTNF)Ú CERT_NONEÚ CERT_REQUIREDc Cs2|rtnt}t tj¡}|tkr| |_nd|_t|dƒr!| |_t|dƒrF|jtj O_|jtj O_|jtj O_|jtj O_|durhz |  |d|¡Wntjyg} ztd| fƒ‚d} ~ ww|dur‚tjrstdƒ‚t|dttdd ƒƒ| |¡|durŒ| |¡n|tkr”| ¡||_|S) z'Create and return an SSLContext object.FÚcheck_ocsp_endpointÚoptionsNz)Private key doesn't match certificate: %sz(tlsCRLFile cannot be used with PyOpenSSLÚ verify_flagsÚVERIFY_CRL_CHECK_LEAFr)rrÚ_sslÚ SSLContextÚPROTOCOL_SSLv23Úcheck_hostnameÚhasattrrrÚ OP_NO_SSLv2Ú OP_NO_SSLv3ÚOP_NO_COMPRESSIONÚOP_NO_RENEGOTIATIONÚload_cert_chainÚSSLErrorrÚ IS_PYOPENSSLÚsetattrÚgetattrÚload_verify_locationsÚload_default_certsÚ verify_mode) ÚcertfileZ passphraseÚca_certsZcrlfileZallow_invalid_certificatesZallow_invalid_hostnamesZdisable_ocsp_endpoint_checkrÚctxÚexc©rú:/tmp/pip-target-onvjaxws/lib/python/pymongo/ssl_support.pyÚget_ssl_context+s<    €ÿ  r!c@s eZdZdS)rN)Ú__name__Ú __module__Ú __qualname__rrrr rZsrrcGstdƒ‚)z(No ssl module, raise ConfigurationError.z The ssl module is not available.r)Údummyrrr r!as)Ú__doc__Zpymongo.errorsrZHAVE_SSLZpymongo.pyopenssl_contextZpyopenssl_contextr Ú ImportErrorZpymongo.ssl_contextÚ ssl_contextÚsslZ _stdlibsslrrÚHAS_SNIZ IPADDR_SAFErZBLOCKING_IO_ERRORSr!Ú Exceptionrrrr Ús4   ÿ€ý /