B #aLS@sddlZddlZddlmZddlmZmZddlmZm Z ddl m Z ddl m Z ddlmZmZmZddlmZmZmZmZmZmZmZ m!Z"m#Z$m%Z&dd l'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\gSZ.ye/Z0Wn&e1k rGd]d^d^e2Z0YnXej3Z3ej4Z4ej5Z5ej6Z6ej7Z7ej8Z8ej9Z:ej;ZdaZ?dbZ@dcZAddZBejCZDejEZFejGZHejIZJejKZLy ejMZNWneOk rYnXejPZQejRZSejTZUejVZWejXZYejZZ[ej\Z]ej^Z_ej`ZaejbZcejdZeejfZgejhZiejjZkejlZmejnZoejpZqejrZsejtZuejvZwejxZyejzZ{ej|Z}ej~ZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZdedfdgdhdigZdjgZdkZdlZGdmdSdSeZeeeZeeZGdndTdTeZGdodUdUeZGdpdVdVeZGdqdWdWeZGdrdXdXeZGdsdtdte2ZGdudvdveZe2ZGdwdxdxeZGdydzdzeZGd{d|d|eZd}d~ZddYZddZeejdZeeedddZGddZdZe2ZGdd[d[e2ZGdd\d\e2ZeǡdS)N)platform)wrapspartial)countchain)WeakValueDictionary) errorcode) integer_typesint2byte indexbytes) UNSPECIFIEDexception_from_error_queueffi from_bufferlib make_assertnative path_stringtext_to_bytes_and_warnno_zero_allocator) FILETYPE_PEM_PassphraseHelperPKeyX509NameX509 X509StoreOPENSSL_VERSION_NUMBERSSLEAY_VERSION SSLEAY_CFLAGSSSLEAY_PLATFORM SSLEAY_DIRSSLEAY_BUILT_ON SENT_SHUTDOWNRECEIVED_SHUTDOWN SSLv2_METHOD SSLv3_METHOD SSLv23_METHOD TLSv1_METHODTLSv1_1_METHODTLSv1_2_METHOD OP_NO_SSLv2 OP_NO_SSLv3 OP_NO_TLSv1 OP_NO_TLSv1_1 OP_NO_TLSv1_2 OP_NO_TLSv1_3MODE_RELEASE_BUFFERSOP_SINGLE_DH_USEOP_SINGLE_ECDH_USEOP_EPHEMERAL_RSAOP_MICROSOFT_SESS_ID_BUGOP_NETSCAPE_CHALLENGE_BUG#OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUGOP_SSLREF2_REUSE_CERT_TYPE_BUGOP_MICROSOFT_BIG_SSLV3_BUFFEROP_MSIE_SSLV2_RSA_PADDINGOP_SSLEAY_080_CLIENT_DH_BUG OP_TLS_D5_BUGOP_TLS_BLOCK_PADDING_BUGOP_DONT_INSERT_EMPTY_FRAGMENTSOP_CIPHER_SERVER_PREFERENCEOP_TLS_ROLLBACK_BUGOP_PKCS1_CHECK_1OP_PKCS1_CHECK_2OP_NETSCAPE_CA_DN_BUG"OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUGOP_NO_COMPRESSIONOP_NO_QUERY_MTUOP_COOKIE_EXCHANGE OP_NO_TICKETOP_ALL VERIFY_PEERVERIFY_FAIL_IF_NO_PEER_CERTVERIFY_CLIENT_ONCE VERIFY_NONESESS_CACHE_OFFSESS_CACHE_CLIENTSESS_CACHE_SERVERSESS_CACHE_BOTHSESS_CACHE_NO_AUTO_CLEARSESS_CACHE_NO_INTERNAL_LOOKUPSESS_CACHE_NO_INTERNAL_STORESESS_CACHE_NO_INTERNALSSL_ST_CONNECT SSL_ST_ACCEPT SSL_ST_MASK SSL_CB_LOOP SSL_CB_EXIT SSL_CB_READ SSL_CB_WRITE SSL_CB_ALERTSSL_CB_READ_ALERTSSL_CB_WRITE_ALERTSSL_CB_ACCEPT_LOOPSSL_CB_ACCEPT_EXITSSL_CB_CONNECT_LOOPSSL_CB_CONNECT_EXITSSL_CB_HANDSHAKE_STARTSSL_CB_HANDSHAKE_DONEError WantReadErrorWantWriteErrorWantX509LookupErrorZeroReturnError SysCallErrorSSLeay_versionSessionContext Connectionc@s eZdZdS)_bufferN)__name__ __module__ __qualname__rsrs2/tmp/pip-target-jgxl_w8r/lib/python/OpenSSL/SSL.pyro{sroz"/etc/ssl/certs/ca-certificates.crtz /etc/pki/tls/certs/ca-bundle.crtz/etc/ssl/ca-bundle.pemz/etc/pki/tls/cacert.pemz1/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pemz/etc/ssl/certss$/opt/pyca/cryptography/openssl/certss'/opt/pyca/cryptography/openssl/cert.pemc@seZdZdZdS)rez4 An error occurred in an `OpenSSL.SSL` API. N)rprqrr__doc__rsrsrsrtresc@s eZdZdS)rfN)rprqrrrsrsrsrtrfsc@s eZdZdS)rgN)rprqrrrsrsrsrtrgsc@s eZdZdS)rhN)rprqrrrsrsrsrtrhsc@s eZdZdS)riN)rprqrrrsrsrsrtrisc@s eZdZdS)rjN)rprqrrrsrsrsrtrjsc@s eZdZdZddZddZdS)_CallbackExceptionHelpera A base class for wrapper classes that allow for intelligent exception handling in OpenSSL callbacks. :ivar list _problems: Any exceptions that occurred while executing in a context where they could not be raised in the normal way. Typically this is because OpenSSL has called into some Python code and requires a return value. The exceptions are saved to be raised later when it is possible to do so. cCs g|_dS)N) _problems)selfrsrsrt__init__sz!_CallbackExceptionHelper.__init__cCs6|jr2y tWntk r$YnX|jddS)z Raise an exception from the OpenSSL error queue or that was previously captured whe running a callback. rN)r}_raise_current_errorrepop)r~rsrsrtraise_if_problems  z)_CallbackExceptionHelper.raise_if_problemN)rprqrrr{rrrsrsrsrtr| s r|c@seZdZdZddZdS) _VerifyHelperz^ Wrap a callback such that it can be used as a certificate verification callback. cs2ttfdd}td|_dS)Nc st|}t|t|}t|}t|}t}t||}t j |}y|||||} Wn.t k r} zj | dSd} ~ XYnX| rt|tjdSdSdS)Nrru)_libZX509_STORE_CTX_get_current_cert X509_up_refr_from_raw_x509_ptrZX509_STORE_CTX_get_errorZX509_STORE_CTX_get_error_depthZ"SSL_get_ex_data_X509_STORE_CTX_idxZX509_STORE_CTX_get_ex_datarn_reverse_mapping Exceptionr}appendZX509_STORE_CTX_set_errorZ X509_V_OK) okZ store_ctxx509certZ error_numberZ error_depthindexssl connectionresulte)callbackr~rsrtwrapper1s$        z'_VerifyHelper.__init__..wrapperzint (*)(int, X509_STORE_CTX *))r|rr_ffir)r~rrrs)rr~rtr.s z_VerifyHelper.__init__N)rprqrrr{rrsrsrsrtr(src@seZdZdZddZdS)_ALPNSelectHelperzQ Wrap a callback such that it can be used as an ALPN selection callback. cs2ttfdd}td|_dS)Nc sytj|}t||dd}g}x<|r`t|d} |d| d} || || dd}q&W||} d} | tkrd} d} nt| tst dt dt | t d| g|_ |j dd|d<|j d|d<| st jSt jStk r} zj| t jSd} ~ XYnXdS) NrruTFz^ALPN callback must return a bytestring or the special NO_OVERLAPPING_PROTOCOLS sentinel value.zunsigned char *zunsigned char[])rnrrbufferr rNO_OVERLAPPING_PROTOCOLS isinstancebytes TypeErrornewlen_alpn_select_callback_argsrZSSL_TLSEXT_ERR_NOACKZSSL_TLSEXT_ERR_OKrr}ZSSL_TLSEXT_ERR_ALERT_FATAL)routZoutlenZin_ZinlenargconninstrZ protolistZ encoded_lenprotoZoutbytesZ any_acceptedr)rr~rsrtr[s6      z+_ALPNSelectHelper.__init__..wrapperz^int (*)(SSL *, unsigned char **, unsigned char *, const unsigned char *, unsigned int, void *))r|rrrr)r~rrrs)rr~rtrXs  ,z_ALPNSelectHelper.__init__N)rprqrrr{rrsrsrsrtrSsrc@seZdZdZddZdS)_OCSPServerCallbackHelpera Wrap a callback such that it can be used as an OCSP callback for the server side. Annoyingly, OpenSSL defines one OCSP callback but uses it in two different ways. For servers, that callback is expected to retrieve some OCSP data and hand it to OpenSSL, and may return only SSL_TLSEXT_ERR_OK, SSL_TLSEXT_ERR_FATAL, and SSL_TLSEXT_ERR_NOACK. For clients, that callback is expected to check the OCSP data, and returns a negative value on error, 0 if the response is not acceptable, or positive if it is. These are mutually exclusive return code behaviours, and they mean that we need two helpers so that we always return an appropriate error code if the user's code throws an exception. Given that we have to have two helpers anyway, these helpers are a bit more helpery than most: specifically, they hide a few more of the OpenSSL functions so that the user has an easier time writing these callbacks. This helper implements the server side. cs2ttfdd}td|_dS)Nc sytj|}|tjkr"t|}nd}||}t|tsBtd|sJdSt|}t |}|t ||dd<t |||dSt k r}zj|dSd}~XYnXdS)Nz'OCSP callback must return a bytestring.rwrrv)rnrrNULL from_handlerrrrrZOPENSSL_mallocrZSSL_set_tlsext_status_ocsp_resprr}r)rcdatardata ocsp_dataZocsp_data_lengthZdata_ptrr)rr~rsrtrs&        z3_OCSPServerCallbackHelper.__init__..wrapperzint (*)(SSL *, void *))r|rrrr)r~rrrs)rr~rtrs 'z"_OCSPServerCallbackHelper.__init__N)rprqrrr{rrsrsrsrtrsrc@seZdZdZddZdS)_OCSPClientCallbackHelpera Wrap a callback such that it can be used as an OCSP callback for the client side. Annoyingly, OpenSSL defines one OCSP callback but uses it in two different ways. For servers, that callback is expected to retrieve some OCSP data and hand it to OpenSSL, and may return only SSL_TLSEXT_ERR_OK, SSL_TLSEXT_ERR_FATAL, and SSL_TLSEXT_ERR_NOACK. For clients, that callback is expected to check the OCSP data, and returns a negative value on error, 0 if the response is not acceptable, or positive if it is. These are mutually exclusive return code behaviours, and they mean that we need two helpers so that we always return an appropriate error code if the user's code throws an exception. Given that we have to have two helpers anyway, these helpers are a bit more helpery than most: specifically, they hide a few more of the OpenSSL functions so that the user has an easier time writing these callbacks. This helper implements the client side. cs2ttfdd}td|_dS)Nc syxtj|}|tjkr"t|}nd}td}t||}|dkrJd}nt|d|dd}|||}t t |St k r}zj |dSd}~XYnXdS)Nzunsigned char **rr)rnrrrrrrZSSL_get_tlsext_status_ocsp_resprintboolrr}r) rrrrZocsp_ptrZocsp_lenrZvalidr)rr~rsrtrs        z3_OCSPClientCallbackHelper.__init__..wrapperzint (*)(SSL *, void *))r|rrrr)r~rrrs)rr~rtrs z"_OCSPClientCallbackHelper.__init__N)rprqrrr{rrsrsrsrtrsrcCsdd}t|ts(t|dd}|dk r(|}t|tr6|}t|tsJtdn|dkr`td|f|S)Nfilenoz3argument must be an int, or have a fileno() method.rz1file descriptor cannot be a negative integer (%i))rr getattrr ValueError)objfdmethrsrsrt_asFileDescriptors      rcCstt|S)z Return a string describing the version of OpenSSL in use. :param type: One of the :const:`SSLEAY_` constants defined in this module. )rstringrrk)typersrsrtrk"scsfdd}|S)a Builds a decorator that ensures that functions that rely on OpenSSL functions that are not present in this build raise NotImplementedError, rather than AttributeError coming out of cryptography. :param flag: A cryptography flag that guards the functions, e.g. ``Cryptography_HAS_NEXTPROTONEG``. :param error: The string to be used in the exception if the flag is false. cs$st|fdd}|S|SdS)Ncs tdS)N)NotImplementedError)argskwargs)errorrsrtexplode9sz<_make_requires.._requires_decorator..explode)r)funcr)rflagrsrt_requires_decorator6sz+_make_requires.._requires_decoratorrs)rrrrs)rrrt_make_requires+s  rzALPN not availableZCryptography_HAS_KEYLOGzKey logging not availablec@seZdZdZdS)rlz A class representing an SSL session. A session defines certain connection parameters which may be re-used to speed up the setup of subsequent connections. .. versionadded:: 0.14 N)rprqrrr{rsrsrsrtrlNsc @seZdZdZededededede diZ e dd e DZ d d Z dcd dZddZddddZddZddZddZddZefddZddZdd Zd!d"Zefd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Z d/d0Z!ded1d2Z"d3d4Z#d5d6Z$d7d8Z%d9d:Z&d;d<Z'd=d>Z(d?d@Z)dAdBZ*dCdDZ+dEdFZ,dGdHZ-e.dIdJZ/dKdLZ0dMdNZ1dOdPZ2dQdRZ3dSdTZ4dUdVZ5dWdXZ6e7dYdZZ8e7d[d\Z9d]d^Z:dfd_d`Z;dgdadbZlszContext.cCst|tstdy|j|}Wntk r<tdYnX|}t|tjkt |}t|tjkt |t j }t |d}t|dk||_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_|t jdS)Nzmethod must be an integerzNo such protocolru)rr r_methodsKeyErrorr_openssl_assertrrrZ SSL_CTX_newgcZ SSL_CTX_freeZSSL_CTX_set_ecdh_auto_context_passphrase_helper_passphrase_callback_passphrase_userdata_verify_helper_verify_callback_info_callback_keylog_callback_tlsext_servername_callback _app_data_alpn_select_helper_alpn_select_callback _ocsp_helper_ocsp_callback _ocsp_dataset_modeZSSL_MODE_ENABLE_PARTIAL_WRITE)r~methodZ method_funcZ method_objcontextresrsrsrtrqs:    zContext.__init__NcCsN|dkrtj}nt|}|dkr(tj}nt|}t|j||}|sJtdS)aU Let SSL know where we can find trusted certificates for the certificate chain. Note that the certificates have to be in PEM format. If capath is passed, it must be a directory prepared using the ``c_rehash`` tool included with OpenSSL. Either, but not both, of *pemfile* or *capath* may be :data:`None`. :param cafile: In which file we can find the certificates (``bytes`` or ``unicode``). :param capath: In which directory we can find the certificates (``bytes`` or ``unicode``). :return: None N)rr _path_stringrZSSL_CTX_load_verify_locationsrr)r~cafilecapathZ load_resultrsrsrtload_verify_locationss zContext.load_verify_locationscs&tfdd}tt|dddS)Ncs||jS)N)r)sizeverifyuserdata)rr~rsrtrsz'Context._wrap_callback..wrapperT)Z more_argstruncate)rrr)r~rrrs)rr~rt_wrap_callbackszContext._wrap_callbackcCs@t|std|||_|jj|_t|j|j||_ dS)a Set the passphrase callback. This function will be called when a private key with a passphrase is loaded. :param callback: The Python callback to use. This must accept three positional arguments. First, an integer giving the maximum length of the passphrase it may return. If the returned passphrase is longer than this, it will be truncated. Second, a boolean value which will be true if the user should be prompted for the passphrase twice and the callback should verify that the two values supplied are equal. Third, the value given as the *userdata* parameter to :meth:`set_passwd_cb`. The *callback* must return a byte string. If an error occurs, *callback* should return a false value (e.g. an empty string). :param userdata: (optional) A Python object which will be given as argument to the callback :return: None zcallback must be callableN) callablerrrrrrZSSL_CTX_set_default_passwd_cbrr)r~rrrsrsrt set_passwd_cbs   zContext.set_passwd_cbcCst|j}t|dkttd}ttd}| ||stt }tt }|t kr|t kr|ttdS)a Specify that the platform provided CA certificates are to be used for verification purposes. This method has some caveats related to the binary wheels that cryptography (pyOpenSSL's primary dependency) ships: * macOS will only load certificates using this method if the user has the ``openssl@1.1`` `Homebrew `_ formula installed in the default location. * Windows will not work. * manylinux1 cryptography wheels will work on most common Linux distributions in pyOpenSSL 17.1.0 and above. pyOpenSSL detects the manylinux1 wheel and attempts to load roots via a fallback path. :return: None ruasciiN)rZ SSL_CTX_set_default_verify_pathsrrrrZX509_get_default_cert_dir_envdecodeZX509_get_default_cert_file_env_check_env_vars_setZX509_get_default_cert_dirZX509_get_default_cert_file_CRYPTOGRAPHY_MANYLINUX1_CA_DIR _CRYPTOGRAPHY_MANYLINUX1_CA_FILE_fallback_default_verify_paths_CERTIFICATE_FILE_LOCATIONS_CERTIFICATE_PATH_LOCATIONS)r~ set_result dir_env_var file_env_varZ default_dirZ default_filersrsrtset_default_verify_pathss    z Context.set_default_verify_pathscCs tj|dk ptj|dk S)zp Check to see if the default cert dir/file environment vars are present. :return: bool N)osenvironget)r~rrrsrsrtrszContext._check_env_vars_setcCsRx$|D]}tj|r||PqWx&|D]}tj|r,|d|Pq,WdS)aW Default verify paths are based on the compiled version of OpenSSL. However, when pyca/cryptography is compiled as a manylinux1 wheel that compiled location can potentially be wrong. So, like Go, we will try a predefined set of paths and attempt to load roots from there. :return: None N)rpathisfilerisdir)r~ file_pathZdir_pathrrrsrsrtrs      z&Context._fallback_default_verify_pathscCs$t|}t|j|}|s tdS)z Load a certificate chain from a file. :param certfile: The name of the certificate chain file (``bytes`` or ``unicode``). Must be PEM encoded. :return: None N)rrZ"SSL_CTX_use_certificate_chain_filerr)r~certfilerrsrsrtuse_certificate_chain_file.s  z"Context.use_certificate_chain_filecCs8t|}t|tstdt|j||}|s4tdS)ah Load a certificate from a file :param certfile: The name of the certificate file (``bytes`` or ``unicode``). :param filetype: (optional) The encoding of the file, which is either :const:`FILETYPE_PEM` or :const:`FILETYPE_ASN1`. The default is :const:`FILETYPE_PEM`. :return: None zfiletype must be an integerN)rrr rrZSSL_CTX_use_certificate_filerr)r~rfiletype use_resultrsrsrtuse_certificate_file?s   zContext.use_certificate_filecCs0t|tstdt|j|j}|s,tdS)zs Load a certificate from a X509 object :param cert: The X509 object :return: None zcert must be an X509 instanceN)rrrrZSSL_CTX_use_certificater_x509r)r~rrrsrsrtuse_certificateUs  zContext.use_certificatecCsDt|tstdt|j}t|j|}|s@t|t dS)z Add certificate to chain :param certobj: The X509 certificate object to add to the chain :return: None z certobj must be an X509 instanceN) rrrrZX509_duprZSSL_CTX_add_extra_chain_certrZ X509_freer)r~Zcertobjcopy add_resultrsrsrtadd_extra_chain_certcs   zContext.add_extra_chain_certcCs |jdk r|jttdS)N)rrrer)r~rsrsrt_raise_passphrase_exceptionts  z#Context._raise_passphrase_exceptioncCsHt|}|tkrt}nt|ts(tdt|j||}|sD| dS)aR Load a private key from a file :param keyfile: The name of the key file (``bytes`` or ``unicode``) :param filetype: (optional) The encoding of the file, which is either :const:`FILETYPE_PEM` or :const:`FILETYPE_ASN1`. The default is :const:`FILETYPE_PEM`. :return: None zfiletype must be an integerN) r _UNSPECIFIEDrrr rrZSSL_CTX_use_PrivateKey_filerr)r~keyfilerrrsrsrtuse_privatekey_filezs   zContext.use_privatekey_filecCs2t|tstdt|j|j}|s.|dS)zs Load a private key from a PKey object :param pkey: The PKey object :return: None zpkey must be a PKey instanceN)rrrrZSSL_CTX_use_PrivateKeyrZ_pkeyr)r~Zpkeyrrsrsrtuse_privatekeys  zContext.use_privatekeycCst|jstdS)z Check if the private key (loaded with :meth:`use_privatekey`) matches the certificate (loaded with :meth:`use_certificate`) :return: :data:`None` (raises :exc:`Error` if something's wrong) N)rZSSL_CTX_check_private_keyrr)r~rsrsrtcheck_privatekeys zContext.check_privatekeycCs0ttd|}t|tjkt|j|dS)a% Load the trusted certificates that will be sent to the client. Does not actually imply any of the certificates are trusted; that must be configured separately. :param bytes cafile: The path to a certificates file in PEM format. :return: None rN)rZSSL_load_client_CA_file_text_to_bytes_and_warnrrrSSL_CTX_set_client_CA_listr)r~rZca_listrsrsrtload_client_cas  zContext.load_client_cacCs*td|}tt|j|t|dkdS)aV Set the session id to *buf* within which a session can be reused for this Context object. This is needed when doing session resumption, because there is no way for a stored session to know which Context object it is associated with. :param bytes buf: The session id. :returns: None bufruN)r rrZSSL_CTX_set_session_id_contextrr)r~r rsrsrtset_session_ids zContext.set_session_idcCs t|tstdt|j|S)a Set the behavior of the session cache used by all connections using this Context. The previously set mode is returned. See :const:`SESS_CACHE_*` for details about particular modes. :param mode: One or more of the SESS_CACHE_* flags (combine using bitwise or) :returns: The previously set caching mode. .. versionadded:: 0.14 zmode must be an integer)rr rrZSSL_CTX_set_session_cache_moder)r~modersrsrtset_session_cache_modes zContext.set_session_cache_modecCs t|jS)z Get the current session cache mode. :returns: The currently used cache mode. .. versionadded:: 0.14 )rZSSL_CTX_get_session_cache_moder)r~rsrsrtget_session_cache_modeszContext.get_session_cache_modecCstt|tstd|dkr:d|_d|_t|j|tj n6t |sJtdt ||_|jj |_t|j||jdS)a Set the verification flags for this Context object to *mode* and specify that *callback* should be used for verification callbacks. :param mode: The verify mode, this should be one of :const:`VERIFY_NONE` and :const:`VERIFY_PEER`. If :const:`VERIFY_PEER` is used, *mode* can be OR:ed with :const:`VERIFY_FAIL_IF_NO_PEER_CERT` and :const:`VERIFY_CLIENT_ONCE` to further control the behaviour. :param callback: The optional Python verification callback to use. This should take five arguments: A Connection object, an X509 object, and three integer variables, which are in turn potential error number, error depth and return code. *callback* should return True if verification passes and False otherwise. If omitted, OpenSSL's default verification is used. :return: None See SSL_CTX_set_verify(3SSL) for further details. zmode must be an integerNzcallback must be callable) rr rrrrZSSL_CTX_set_verifyrrrrrr)r~rrrsrsrt set_verifys   zContext.set_verifycCs$t|tstdt|j|dS)z Set the maximum depth for the certificate chain verification that shall be allowed for this Context object. :param depth: An integer specifying the verify depth :return: None zdepth must be an integerN)rr rrZSSL_CTX_set_verify_depthr)r~depthrsrsrtset_verify_depths zContext.set_verify_depthcCs t|jS)z Retrieve the Context object's verify mode, as set by :meth:`set_verify`. :return: The verify mode )rZSSL_CTX_get_verify_moder)r~rsrsrtget_verify_modeszContext.get_verify_modecCs t|jS)z Retrieve the Context object's verify depth, as set by :meth:`set_verify_depth`. :return: The verify depth )rZSSL_CTX_get_verify_depthr)r~rsrsrtget_verify_depthszContext.get_verify_depthcCstt|}t|d}|tjkr$tt|tj}t|tjtjtj}t|tj }t |j |}t |dkdS)z Load parameters for Ephemeral Diffie-Hellman :param dhfile: The file to load EDH parameters from (``bytes`` or ``unicode``). :return: None rruN) rrZ BIO_new_filerrrrZBIO_freeZPEM_read_bio_DHparamsZDH_freeZSSL_CTX_set_tmp_dhrr)r~ZdhfilebioZdhrrsrsrt load_tmp_dh's   zContext.load_tmp_dhcCst|j|dS)a  Select a curve to use for ECDHE key exchange. :param curve: A curve object to use as returned by either :meth:`OpenSSL.crypto.get_elliptic_curve` or :meth:`OpenSSL.crypto.get_elliptic_curves`. :return: None N)rZSSL_CTX_set_tmp_ecdhrZ _to_EC_KEY)r~Zcurversrsrt set_tmp_ecdh<s zContext.set_tmp_ecdhcCs\td|}t|tstdtt|j|dkt|d}| dddgkrXt dgdS) z Set the list of ciphers to be used in this context. See the OpenSSL manual for more information (e.g. :manpage:`ciphers(1)`). :param bytes cipher_list: An OpenSSL cipher string. :return: None cipher_listz"cipher_list must be a byte string.ruNZTLS_AES_256_GCM_SHA384ZTLS_CHACHA20_POLY1305_SHA256ZTLS_AES_128_GCM_SHA256)z SSL routinesSSL_CTX_set_cipher_listzno cipher match) r rrrrrrrrnget_cipher_listre)r~rZtmpconnrsrsrtset_cipher_listHs   zContext.set_cipher_listcCst}t|tjkyjxd|D]\}t|ts@tdt|j ft |j }t|tjkt ||}|st |tqWWn tk rt|YnXt|j|dS)a_ Set the list of preferred client certificate signers for this server context. This list of certificate authorities will be sent to the client when the server requests a client certificate. :param certificate_authorities: a sequence of X509Names. :return: None .. versionadded:: 0.10 z3client CAs must be X509Name objects, not %s objectsN)rZsk_X509_NAME_new_nullrrrrrrrrp X509_NAME_dup_nameZsk_X509_NAME_pushX509_NAME_freerrZsk_X509_NAME_freer r)r~Zcertificate_authoritiesZ name_stackZca_namerZ push_resultrsrsrtset_client_ca_listos$       zContext.set_client_ca_listcCs2t|tstdt|j|j}t|dkdS)ai Add the CA certificate to the list of preferred signers for this context. The list of certificate authorities will be sent to the client when the server requests a client certificate. :param certificate_authority: certificate authority's X509 certificate. :return: None .. versionadded:: 0.10 z.certificate_authority must be an X509 instanceruN)rrrrZSSL_CTX_add_client_CArrr)r~Zcertificate_authorityrrsrsrt add_client_cas  zContext.add_client_cacCs t|tstdt|j|S)aQ Set the timeout for newly created sessions for this Context object to *timeout*. The default value is 300 seconds. See the OpenSSL manual for more information (e.g. :manpage:`SSL_CTX_set_timeout(3)`). :param timeout: The timeout in (whole) seconds :return: The previous session timeout ztimeout must be an integer)rr rrZSSL_CTX_set_timeoutr)r~timeoutrsrsrt set_timeouts zContext.set_timeoutcCs t|jS)z Retrieve session timeout, as set by :meth:`set_timeout`. The default is 300 seconds. :return: The session timeout )rZSSL_CTX_get_timeoutr)r~rsrsrt get_timeoutszContext.get_timeoutcs6tfdd}td||_t|j|jdS)a Set the information callback to *callback*. This function will be called from time to time during SSL handshakes. :param callback: The Python callback to use. This should take three arguments: a Connection object and two integers. The first integer specifies where in the SSL handshake the function was called, and the other the return code from a (possibly failed) internal function call. :return: None cstj|||dS)N)rnr)rwhereZ return_code)rrsrtrsz*Context.set_info_callback..wrapperzvoid (*)(const SSL *, int, int)N)rrrrrZSSL_CTX_set_info_callbackr)r~rrrs)rrtset_info_callbacks  zContext.set_info_callbackcs6tfdd}td||_t|j|jdS)a Set the TLS key logging callback to *callback*. This function will be called whenever TLS key material is generated or received, in order to allow applications to store this keying material for debugging purposes. :param callback: The Python callback to use. This should take two arguments: a Connection object and a bytestring that contains the key material in the format used by NSS for its SSLKEYLOGFILE debugging output. :return: None cst|}tj||dS)N)rrrnr)rline)rrsrtrs z,Context.set_keylog_callback..wrapperz#void (*)(const SSL *, const char *)N)rrrrrZSSL_CTX_set_keylog_callbackr)r~rrrs)rrtset_keylog_callbacks zContext.set_keylog_callbackcCs|jS)zw Get the application data (supplied via :meth:`set_app_data()`) :return: The application data )r)r~rsrsrt get_app_dataszContext.get_app_datacCs ||_dS)z Set the application data (will be returned from get_app_data()) :param data: Any Python object :return: None N)r)r~rrsrsrt set_app_dataszContext.set_app_datacCs.t|j}|tjkrdStt}||_|S)z Get the certificate store for the context. This can be used to add "trusted" certificates without using the :meth:`load_verify_locations` method. :return: A X509Store object or None if it does not have one. N)rZSSL_CTX_get_cert_storerrrr__new___store)r~storeZpystorersrsrtget_cert_stores    zContext.get_cert_storecCs t|tstdt|j|S)z Add options. Options set before are not cleared! This method should be used with the :const:`OP_*` constants. :param options: The options to add. :return: The new option bitmask. zoptions must be an integer)rr rrZSSL_CTX_set_optionsr)r~optionsrsrsrt set_optionss zContext.set_optionscCs t|tstdt|j|S)z Add modes via bitmask. Modes set before are not cleared! This method should be used with the :const:`MODE_*` constants. :param mode: The mode to add. :return: The new mode bitmask. zmode must be an integer)rr rrZSSL_CTX_set_moder)r~rrsrsrtrs zContext.set_modecs6tfdd}td||_t|j|jdS)a Specify a callback function to be called when clients specify a server name. :param callback: The callback function. It will be invoked with one argument, the Connection instance. .. versionadded:: 0.13 cstj|dS)Nr)rnr)ralertr)rrsrtr4sz7Context.set_tlsext_servername_callback..wrapperzint (*)(SSL *, int *, void *)N)rrrrrZ&SSL_CTX_set_tlsext_servername_callbackr)r~rrrs)rrtset_tlsext_servername_callback)s  z&Context.set_tlsext_servername_callbackcCs,t|tstdtt|j|dkdS)z Enable support for negotiating SRTP keying material. :param bytes profiles: A colon delimited list of protection profile names, like ``b'SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32'``. :return: None zprofiles must be a byte string.rN)rrrrrZSSL_CTX_set_tlsext_use_srtpr)r~Zprofilesrsrsrtset_tlsext_use_srtp@s zContext.set_tlsext_use_srtpcCs>dtdd|D}td|}t|j|t|dS)a Specify the protocols that the client is prepared to speak after the TLS connection has been negotiated using Application Layer Protocol Negotiation. :param protos: A list of the protocols to be offered to the server. This list should be a Python list of bytestrings representing the protocols to offer, e.g. ``[b'http/1.1', b'spdy/2']``. rcss|]}tt||fVqdS)N)r r)rprsrsrtr]sz*Context.set_alpn_protos..zunsigned char[]N) joinr from_iterablerrrZSSL_CTX_set_alpn_protosrr)r~protosprotostr input_strrsrsrtset_alpn_protosOs  zContext.set_alpn_protoscCs,t||_|jj|_t|j|jtjdS)a Specify a callback function that will be called on the server when a client offers protocols using ALPN. :param callback: The callback function. It will be invoked with two arguments: the Connection, and a list of offered protocols as bytestrings, e.g ``[b'http/1.1', b'spdy/2']``. It can return one of those bytestrings to indicate the chosen protocol, the empty bytestring to terminate the TLS connection, or the :py:obj:`NO_OVERLAPPING_PROTOCOLS` to indicate that no offered protocol was selected, but that the connection should not be aborted. N) rrrrrZSSL_CTX_set_alpn_select_cbrrr)r~rrsrsrtset_alpn_select_callbackes  z Context.set_alpn_select_callbackcCsh||_|j|_|dkr tj|_n t||_t|j |j}t |dkt |j |j}t |dkdS)z This internal helper does the common work for ``set_ocsp_server_callback`` and ``set_ocsp_client_callback``, which is almost all of it. Nru) rrrrrrZ new_handlerZSSL_CTX_set_tlsext_status_cbrrZSSL_CTX_set_tlsext_status_arg)r~helperrrcrsrsrt_set_ocsp_callbackzs    zContext._set_ocsp_callbackcCst|}|||dS)a Set a callback to provide OCSP data to be stapled to the TLS handshake on the server side. :param callback: The callback function. It will be invoked with two arguments: the Connection, and the optional arbitrary data you have provided. The callback must return a bytestring that contains the OCSP data to staple to the handshake. If no OCSP data is available for this connection, return the empty bytestring. :param data: Some opaque data that will be passed into the callback function when called. This can be used to avoid needing to do complex data lookups or to keep track of what context is being used. This parameter is optional. N)rr?)r~rrr=rsrsrtset_ocsp_server_callbacksz Context.set_ocsp_server_callbackcCst|}|||dS)a Set a callback to validate OCSP data stapled to the TLS handshake on the client side. :param callback: The callback function. It will be invoked with three arguments: the Connection, a bytestring containing the stapled OCSP assertion, and the optional arbitrary data you have provided. The callback must return a boolean that indicates the result of validating the OCSP data: ``True`` if the OCSP data is valid and the certificate can be trusted, or ``False`` if either the OCSP data is invalid or the certificate has been revoked. :param data: Some opaque data that will be passed into the callback function when called. This can be used to avoid needing to do complex data lookups or to keep track of what context is being used. This parameter is optional. N)rr?)r~rrr=rsrsrtset_ocsp_client_callbacksz Context.set_ocsp_client_callback)N)N)N)N)N)=rprqrrr{r$r%r&r'r(r)rdictitemsrrrrrrrrrrrrrrrrrr r rrrrrrrrrr!r"r$r%r'_requires_keylogr)r*r+r/r1rr3r4_requires_alpnr;r<r?r@rArsrsrsrtrmZsl(  0     #    '#        c@s eZdZeZdyddZddZddZdd Zd d Z d d Z ddZ ddZ dzddZ e Zd{ddZd|ddZeZd}ddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Z d7d8Z!d9d:Z"d;d<Z#d=d>Z$d?d@Z%dAdBZ&dCdDZ'dEdFZ(dGdHZ)d~dIdJZ*dKdLZ+dMdNZ,dOdPZ-e.dQdRZ/dSdTZ0dUdVZ1dWdXZ2dYdZZ3d[d\Z4d]d^Z5d_d`Z6dadbZ7dcddZ8dedfZ9dgdhZ:didjZ;dkdlZdqdrZ?e@dsdtZAe@dudvZBdwdxZCdS)rnNcCst|tstdt|j}t|tj|_ t |j tj ||_d|_ d|_ |j|_|j|_||j|j <|dkrd|_tt|_t|jtjktt|_t|jtjkt|j |j|jn2d|_d|_||_t|j t|j}t|dkdS)z Create a new Connection object, using the given OpenSSL.SSL.Context instance and socket. :param context: An SSL Context to use for this connection :param socket: The socket to use for transport layer z"context must be a Context instanceNru)rrmrrZSSL_newrrrZSSL_free_sslZ SSL_set_modeZSSL_MODE_AUTO_RETRYrrrrr_socketZBIO_newZ BIO_s_mem _into_sslrr _from_sslZ SSL_set_bioZ SSL_set_fdr)r~rsocketrrrsrsrtrs0   zConnection.__init__cCs0|jdkr td|jj|fn t|j|SdS)zy Look up attributes on the wrapped socket object if they are not found on the Connection object. Nz!'%s' object has no attribute '%s')rGAttributeError __class__rpr)r~rrsrsrt __getattr__s  zConnection.__getattr__cCs|jjdk r|jj|jjdk r0|jj|jjdk rH|jjt||}|tjkrftn|tj krxt n|tj krt n|tj krtn||tjkrtdkr|dkrtdkrtd}ntj}|dkrt|t|tddntn|tjkrntdS)Nrwin32rzUnexpected EOF)rrrrrrZ SSL_get_errorSSL_ERROR_WANT_READrfSSL_ERROR_WANT_WRITErgSSL_ERROR_ZERO_RETURNriSSL_ERROR_WANT_X509_LOOKUPrhSSL_ERROR_SYSCALLZERR_peek_errorrrZ getwinerrorerrnorjrrrZSSL_ERROR_NONE)r~rrrrTrsrsrt_raise_ssl_errors8               zConnection._raise_ssl_errorcCs|jS)zh Retrieve the :class:`Context` object associated with this :class:`Connection`. )r)r~rsrsrt get_context szConnection.get_contextcCs,t|tstdt|j|j||_dS)z Switch this connection to a new session context. :param context: A :class:`Context` instance giving the new session context to use. z"context must be a Context instanceN)rrmrrZSSL_set_SSL_CTXrFr)r~rrsrsrt set_context's zConnection.set_contextcCs(t|jtj}|tjkrdSt|S)z Retrieve the servername extension value if provided in the client hello message, or None if there wasn't one. :return: A byte string giving the server name or :data:`None`. .. versionadded:: 0.13 N)rZSSL_get_servernamerFZTLSEXT_NAMETYPE_host_namerrr)r~rrsrsrtget_servername4s   zConnection.get_servernamecCs6t|tstdnd|kr$tdt|j|dS)z Set the value of the servername extension to send in the client hello. :param name: A byte string giving the name. .. versionadded:: 0.13 zname must be a byte stringzname must not contain NUL byteN)rrrrZSSL_set_tlsext_host_namerF)r~rrsrsrtset_tlsext_host_nameEs   zConnection.set_tlsext_host_namecCs t|jS)z Get the number of bytes that can be safely read from the SSL buffer (**not** the underlying transport buffer). :return: The number of bytes available in the receive buffer. )rZ SSL_pendingrF)r~rsrsrtpendingUszConnection.pendingrc CsXtd|}t|<}t|dkr(tdt|j|t|}||j||SQRXdS)a Send data on the connection. NOTE: If you get one of the WantRead, WantWrite or WantX509Lookup exceptions on this, you have to call the method again with the SAME buffer. :param buf: The string, buffer or memoryview to send :param flags: (optional) Included for compatibility with the socket API, the value is ignored :return: The number of bytes written r iz,Cannot send more than 2**31-1 bytes at once.N)r  _from_bufferrrr SSL_writerFrU)r~r flagsrrrsrsrtsend^s   zConnection.sendc Csptd|}t|T}t|}d}x@|r`t|j||t|d}||j|||7}||8}q"W|SQRXdS)a Send "all" data on the connection. This calls send() repeatedly until all data is sent. If an error occurs, it's impossible to tell how much data has been sent. :param buf: The string, buffer or memoryview to send :param flags: (optional) Included for compatibility with the socket API, the value is ignored :return: The number of bytes written r riN)r r\rrr]rFminrU)r~r r^rZ left_to_send total_sentrrsrsrtsendallzs   zConnection.sendallcCs`td|}|dk r.|tj@r.t|j||}nt|j||}||j|t ||ddS)a Receive data on the connection. :param bufsiz: The maximum number of bytes to read :param flags: (optional) The only supported flag is ``MSG_PEEK``, all other flags are ignored. :return: The string read from the Connection zchar[]N) _no_zero_allocatorrJMSG_PEEKrSSL_peekrFSSL_readrUrr)r~bufsizr^r rrsrsrtrecvs zConnection.recvcCs|dkrt|}nt|t|}td|}|dk rN|tj@rNt|j||}nt|j||}| |j|t t |||d|<|S)ae Receive data on the connection and copy it directly into the provided buffer, rather than creating a new string. :param buffer: The buffer to copy into. :param nbytes: (optional) The maximum number of bytes to read into the buffer. If not present, defaults to the size of the buffer. If larger than the size of the buffer, is reduced to the size of the buffer. :param flags: (optional) The only supported flag is ``MSG_PEEK``, all other flags are ignored. :return: The number of bytes read into the buffer. Nzchar[]) rr`rcrJrdrrerFrfrU memoryviewrr)r~rnbytesr^r rrsrsrt recv_intos  zConnection.recv_intocCsVt|rLt|rtqRt|r.tqRt|rBtdqRtdntdS)NBIO_should_io_specialzunknown bio failure) rZBIO_should_retryZBIO_should_readrfZBIO_should_writergrlrr)r~rrrsrsrt_handle_bio_errorss      zConnection._handle_bio_errorscCsh|jdkrtdt|ts$tdtd|}t|j||}|dkrT||j|t ||ddS)a If the Connection was created with a memory BIO, this method can be used to read bytes from the write end of that memory BIO. Many Connection methods will add bytes which must be read in this manner or the buffer will eventually fill up and the Connection will be able to take no further actions. :param bufsiz: The maximum number of bytes to read :return: The string read. NzConnection sock was not Nonezbufsiz must be an integerzchar[]r) rIrrr rcrZBIO_readrmrr)r~rgr rrsrsrtbio_reads   zConnection.bio_readc Cs^td|}|jdkrtdt|0}t|j|t|}|dkrP||j||SQRXdS)aj If the Connection was created with a memory BIO, this method can be used to add bytes to the read end of that memory BIO. The Connection can then read the bytes (for example, in response to a call to :meth:`recv`). :param buf: The string to put into the memory BIO. :return: The number of bytes written r NzConnection sock was not Noner)r rHrr\rZ BIO_writerrm)r~r rrrsrsrt bio_writes   zConnection.bio_writecCs$|s tt|jdkdSdS)z Renegotiate the session. :return: True if the renegotiation can be started, False otherwise :rtype: bool ruTF)renegotiate_pendingrrZSSL_renegotiaterF)r~rsrsrt renegotiateszConnection.renegotiatecCst|j}||j|dS)a Perform an SSL handshake (usually called after :meth:`renegotiate` or one of :meth:`set_accept_state` or :meth:`set_connect_state`). This can raise the same exceptions as :meth:`send` and :meth:`recv`. :return: None. N)rZSSL_do_handshakerFrU)r~rrsrsrt do_handshakes zConnection.do_handshakecCst|jdkS)z Check if there's a renegotiation in progress, it will return False once a renegotiation is finished. :return: Whether there's a renegotiation in progress :rtype: bool ru)rZSSL_renegotiate_pendingrF)r~rsrsrtrp&szConnection.renegotiate_pendingcCs t|jS)z Find out the total number of renegotiations. :return: The number of renegotiations. :rtype: int )rZSSL_total_renegotiationsrF)r~rsrsrttotal_renegotiations0szConnection.total_renegotiationscCst|j|j|S)a4 Call the :meth:`connect` method of the underlying socket and set up SSL on the socket, using the :class:`Context` object supplied to this :class:`Connection` object at creation. :param addr: A remote address :return: What the socket's connect method returns )rSSL_set_connect_staterFrGconnect)r~addrrsrsrtru9s zConnection.connectcCs|jj}|||S)a Call the :meth:`connect_ex` method of the underlying socket and set up SSL on the socket, using the Context object supplied to this Connection object at creation. Note that if the :meth:`connect_ex` method of the socket doesn't return 0, SSL won't be initialized. :param addr: A remove address :return: What the socket's connect_ex method returns )rG connect_exset_connect_state)r~rvrwrsrsrtrwEs zConnection.connect_excCs*|j\}}t|j|}|||fS)a Call the :meth:`accept` method of the underlying socket and set up SSL on the returned socket, using the Context object supplied to this :class:`Connection` object at creation. :return: A *(conn, addr)* pair where *conn* is the new :class:`Connection` object created, and *address* is as returned by the socket's :meth:`accept`. )rGacceptrnrset_accept_state)r~clientrvrrsrsrtrySs  zConnection.acceptcCs$|jdkrtdt|jddS)z If the Connection was created with a memory BIO, this method can be used to indicate that *end of file* has been reached on the read end of that memory BIO. :return: None NzConnection sock was not Noner)rIrrZBIO_set_mem_eof_returnrH)r~rsrsrt bio_shutdownbs zConnection.bio_shutdowncCs8t|j}|dkr$||j|n|dkr0dSdSdS)aQ Send the shutdown message to the Connection. :return: True if the shutdown completed successfully (i.e. both sides have sent closure alerts), False otherwise (in which case you call :meth:`recv` or :meth:`send` when the connection becomes readable/writeable). rTFN)rZ SSL_shutdownrFrU)r~rrsrsrtshutdownos zConnection.shutdowncCsFg}x Retrieve the protocol version of the current connection. :returns: The TLS version of the current connection, for example the value for TLS 1.2 would be ``TLSv1.2``or ``Unknown`` for connections that were not successfully established. :rtype: :class:`unicode` zutf-8)rrrZSSL_get_versionrFr)r~rrsrsrtget_protocol_version_name2 s z$Connection.get_protocol_version_namecCst|j}|S)a  Retrieve the SSL or TLS protocol version of the current connection. :returns: The TLS version of the current connection. For example, it will return ``0x769`` for connections made over TLS version 1. :rtype: :class:`int` )rZ SSL_versionrF)r~rrsrsrtget_protocol_version> s zConnection.get_protocol_versioncCs>dtdd|D}td|}t|j|t|dS)ah Specify the client's ALPN protocol list. These protocols are offered to the server during protocol negotiation. :param protos: A list of the protocols to be offered to the server. This list should be a Python list of bytestrings representing the protocols to offer, e.g. ``[b'http/1.1', b'spdy/2']``. rcss|]}tt||fVqdS)N)r r)rr5rsrsrtrW sz-Connection.set_alpn_protos..zunsigned char[]N) r6rr7rrrZSSL_set_alpn_protosrFr)r~r8r9r:rsrsrtr;I s  zConnection.set_alpn_protoscCsHtd}td}t|j|||s,dSt|d|dddS)z Get the protocol that was negotiated by ALPN. :returns: A bytestring of the protocol name. If no protocol has been negotiated yet, returns an empty string. zunsigned char **zunsigned int *rrN)rrrZSSL_get0_alpn_selectedrFr)r~rZdata_lenrsrsrtget_alpn_proto_negotiated_ s   z$Connection.get_alpn_proto_negotiatedcCs t|jtj}t|dkdS)a Called to request that the server sends stapled OCSP data, if available. If this is not called on the client side then the server will not send OCSP data. Should be used in conjunction with :meth:`Context.set_ocsp_client_callback`. ruN)rZSSL_set_tlsext_status_typerFZTLSEXT_STATUSTYPE_ocspr)r~r>rsrsrt request_ocspq s zConnection.request_ocsp)N)r)r)N)NN)N)DrprqrrrrrrMrUrVrWrXrZr[r_writerbrhreadrkrmrnrorqrrrprsrurwryr|r}rrrr*r+rrrrrrrrrr staticmethodrrrrrrzrxrrrrrrrrrrrEr;rrrsrsrsrtrns| 6 %     %                    "     )rrJsysr functoolsrr itertoolsrrweakrefrrTrsixr r r Z OpenSSL._utilr rr Z_exception_from_error_queuerrrr\rrrZ _make_assertrr~rrrr rrcZOpenSSL.cryptorrrrrr__all__rro NameErrorobjectrrrrr r!ZSSL_SENT_SHUTDOWNr"ZSSL_RECEIVED_SHUTDOWNr#r$r%r&r'r(r)ZSSL_OP_NO_SSLv2r*ZSSL_OP_NO_SSLv3r+ZSSL_OP_NO_TLSv1r,ZSSL_OP_NO_TLSv1_1r-ZSSL_OP_NO_TLSv1_2r.ZSSL_OP_NO_TLSv1_3r/rKZSSL_MODE_RELEASE_BUFFERSr0ZSSL_OP_SINGLE_DH_USEr1ZSSL_OP_SINGLE_ECDH_USEr2ZSSL_OP_EPHEMERAL_RSAr3ZSSL_OP_MICROSOFT_SESS_ID_BUGr4ZSSL_OP_NETSCAPE_CHALLENGE_BUGr5Z'SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUGr6Z"SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUGr7Z!SSL_OP_MICROSOFT_BIG_SSLV3_BUFFERr8ZSSL_OP_MSIE_SSLV2_RSA_PADDINGr9ZSSL_OP_SSLEAY_080_CLIENT_DH_BUGr:ZSSL_OP_TLS_D5_BUGr;ZSSL_OP_TLS_BLOCK_PADDING_BUGr<Z"SSL_OP_DONT_INSERT_EMPTY_FRAGMENTSr=ZSSL_OP_CIPHER_SERVER_PREFERENCEr>ZSSL_OP_TLS_ROLLBACK_BUGr?ZSSL_OP_PKCS1_CHECK_1r@ZSSL_OP_PKCS1_CHECK_2rAZSSL_OP_NETSCAPE_CA_DN_BUGrBZ&SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUGrCZSSL_OP_NO_COMPRESSIONrDZSSL_OP_NO_QUERY_MTUrEZSSL_OP_COOKIE_EXCHANGErFZSSL_OP_NO_TICKETrGZ SSL_OP_ALLrHZSSL_VERIFY_PEERrIZSSL_VERIFY_FAIL_IF_NO_PEER_CERTrJZSSL_VERIFY_CLIENT_ONCErKZSSL_VERIFY_NONErLZSSL_SESS_CACHE_OFFrMZSSL_SESS_CACHE_CLIENTrNZSSL_SESS_CACHE_SERVERrOZSSL_SESS_CACHE_BOTHrPZSSL_SESS_CACHE_NO_AUTO_CLEARrQZ!SSL_SESS_CACHE_NO_INTERNAL_LOOKUPrRZ SSL_SESS_CACHE_NO_INTERNAL_STORErSZSSL_SESS_CACHE_NO_INTERNALrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrrrrrrerrrfrgrhrirjr|rrrrrrrkrZCryptography_HAS_ALPNrErrDrlrmrnZSSL_library_initrsrsrsrts   0   (=C;   aR