<div dir="ltr">Hello,<br><br>The other day, we had a Scrapy user report an issue connecting to <a href="https://www.skelbiu.lt/">https://www.skelbiu.lt/</a> with OpenSSL 1.1 [1]<br><br>To not mix scrapy's things with Twisted Web, I used this (adapted from official docs):<br><br>#---------------<br>from __future__ import print_function<br><br>from twisted.internet import reactor<br>from twisted.web.client import Agent<br>from twisted.web.http_headers import Headers<br><br>agent = Agent(reactor)<br><br>d = agent.request(<br>    'GET',<br>    '<a href="https://www.skelbiu.lt/">https://www.skelbiu.lt/</a>',<br>    Headers({'User-Agent': ['Twisted Web Client Example']}),<br>    None)<br><br>def cbResponse(ignored):<br>    print('Response received')<br>d.addCallback(cbResponse)<br><br>def cbShutdown(ignored):<br>    print(ignored)<br>    reactor.stop()<br>d.addBoth(cbShutdown)<br><br>reactor.run()<br>#---------------<br><br>And I did get a Handshake failure too:<br><br>    $ python twistedtest.py <br>    [Failure instance: Traceback (failure with no frames): <class 'twisted.web._newclient.ResponseNeverReceived'>: [<twisted.python.failure.Failure OpenSSL.SSL.Error: [('SSL routines', 'ssl3_read_bytes', 'sslv3 alert handshake failure')]>]<br>    ]<br><br><br>It seems this happens (at least) with OpenSSL 1.1.0e (currently in Debian 9 sid [2])<br>It does not happen (for me) with OpenSSL 1.0.2g for example.<br><br>I dug into this this afternoon and narrowed it down to the use of <div>_defaultCurveName = u"prime256v1"</div><div>in twisted.internet._sslverify.py<br><br></div><div>I tried patching the current trunk with _defaultCurveName = u"secp384r1" (the EC that <a href="http://ssllabs.com">ssllabs.com</a> reports)<br>and it did work.<br><br>Looking at ClientHello messages for openssl 1.0.2 and 1.1 [4]:<br>with 1.1, only 1 Elliptic Curve is sent by Twisted Web Agent, secp256r1<br><br>openssl v1.1 client uses 4 by default: ecdh_x25519, secp256r1, secp521r1, secp384r1<br><br>I was wondering what is the proper way to configure requested Elliptic Curves.<br>I haven't seen any interface for this, contrary to ciphers with acceptableCiphers.<br><br>Thank you for your input.</div><div><br></div><div><br>Best,<br>Paul.<br><br>[1] <a href="https://github.com/scrapy/scrapy/issues/2717">https://github.com/scrapy/scrapy/issues/2717</a><br>[2] <a href="https://packages.debian.org/fr/source/sid/openssl">https://packages.debian.org/fr/source/sid/openssl</a><br>[3] <a href="https://github.com/twisted/twisted/blob/78679af87e349721a167f35bef239e192e91d126/src/twisted/internet/_sslverify.py#L1904">https://github.com/twisted/twisted/blob/78679af87e349721a167f35bef239e192e91d126/src/twisted/internet/_sslverify.py#L1904</a><br>[4] <a href="https://github.com/scrapy/scrapy/issues/2717#issuecomment-297464034">https://github.com/scrapy/scrapy/issues/2717#issuecomment-297464034</a><br></div></div>