[Cryptography-dev] Cipher/tls cipher negotiated

Alex Gaynor alex.gaynor at gmail.com
Thu Jul 13 20:54:59 EDT 2017


This is properly a question for the requests mailing list I think.

That said, if you can root around in the response object and find the
SSL.Connection, you can call:

-
https://pyopenssl.org/en/stable/api/ssl.html#OpenSSL.SSL.Connection.get_protocol_version
-
https://pyopenssl.org/en/stable/api/ssl.html#OpenSSL.SSL.Connection.get_cipher_name

Alex

On Thu, Jul 13, 2017 at 8:49 PM, Karan karan <karan7868 at gmail.com> wrote:

> Hi,
>
> I'm trying to test different cipher and protocols using the request
> packages, for which i extend the HTTPAdapter. Here are some of the code
> snippet i have :
> https://lukasa.co.uk/2013/01/Choosing_SSL_Version_In_Requests/
>
> and then wrap it in Session object as follows:
>
> from ssl import SSLContext
> ...
> def create_connection(self, sessionreuse=None):
> """
> Create a http connection over ssl
>     Arguments:
>     Returns:   returns the Session object, which can use to be make HTTP
> call
>
> """
> if self._ssl_version and self._cipher:
> self._context = SSLContext(self._ssl_version)
> self._context.set_ciphers(self._ciphers)
> cipher_adapter = SSLAdapter({'ssl_context': self._context})
> if self._proxy:
> self._session.update(proxies)
> self._session.mount('https://', cipher_adapter)
> return self._session
>
> Then i use self._session to make get call.
>
> What i need to find is the :
> - SSL version negotatiated finally
> - Cipher used by the server.
>
> I would appreciate if some one could help out on it.
>
> Thanks,
> Karan.
>
> _______________________________________________
> Cryptography-dev mailing list
> Cryptography-dev at python.org
> https://mail.python.org/mailman/listinfo/cryptography-dev
>
>


-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: D1B3 ADC0 E023 8CA6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cryptography-dev/attachments/20170713/6e71b621/attachment.html>


More information about the Cryptography-dev mailing list