Re: Twisted Web Agent configurable Elliptic Curves settings

Paul Tremberth <[email protected]> Thu, 27 Apr 2017 10:56:06 +0200
Newsgroups gmane.comp.python.twisted.web
Message-ID <CAELvJCvBUpMgrUf8M-uHSpr7hSuHscFXGJG8gYEwEAMxFY5ZyQ@mail.gmail.com>
--===============4917626654941846357==
Content-Type: multipart/alternative; boundary=001a1140137cd7cdf7054e222124

--001a1140137cd7cdf7054e222124
Content-Type: text/plain; charset=UTF-8

> What platform are you on?
> How do you know what version of OpenSSL you're using?
> (It can sometimes be quite tricky to suss out what OpenSSL twisted is
using unless you know the internals fairly well, unfortunately; 'twist
--version' really ought to print it out.)

I'm on (X)Ubuntu 16.10. And the system uses 1.0.2g-1ubuntu9.1.
But I built my own static wheel version of cryptography following
https://cryptography.io/en/latest/installation/#static-wheels ,
with OPENSSL_VERSION="1.1.0e"
and pip installed the wheel in another virtualenv to test it, along with
twisted[tls]

I checked OpenSSL version using this (that's what scrapy also does when
printing versions):
$ python -c "import OpenSSL;
print(OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION))"
OpenSSL 1.1.0e  16 Feb 2017

> What about with 1.0.2?

I just tested it again this morning with my system's default openssl:

    $ python -c "import OpenSSL;
print(OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION))"
    OpenSSL 1.0.2g  1 Mar 2016

with the same snippet using Twisted Web Agent,
this is what wireshark shows in the ClientHello:

Extension: elliptic_curves
    Type: elliptic_curves (0x000a)
    Length: 28
    Elliptic Curves Length: 26
    Elliptic curves (13 curves)
        Elliptic curve: secp256r1 (0x0017)
        Elliptic curve: secp521r1 (0x0019)
        Elliptic curve: brainpoolP512r1 (0x001c)
        Elliptic curve: brainpoolP384r1 (0x001b)
        Elliptic curve: secp384r1 (0x0018)
        Elliptic curve: brainpoolP256r1 (0x001a)
        Elliptic curve: secp256k1 (0x0016)
        Elliptic curve: sect571r1 (0x000e)
        Elliptic curve: sect571k1 (0x000d)
        Elliptic curve: sect409k1 (0x000b)
        Elliptic curve: sect409r1 (0x000c)
        Elliptic curve: sect283k1 (0x0009)
        Elliptic curve: sect283r1 (0x000a)


>
>

--001a1140137cd7cdf7054e222124
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span style=3D"font-size:12.8px">&gt; What platform are yo=
u on?=C2=A0</span><div><span style=3D"font-size:12.8px">&gt; How do you kno=
w what version of OpenSSL you&#39;re using?=C2=A0</span></div><div><span st=
yle=3D"font-size:12.8px">&gt; (It can sometimes be quite tricky to suss out=
 what OpenSSL twisted is using unless you know the internals fairly well, u=
nfortunately; &#39;twist --version&#39; really ought to print it out.)</spa=
n></div><div><span style=3D"font-size:12.8px"><br></span></div><div><span s=
tyle=3D"font-size:12.8px">I&#39;m on (X)Ubuntu 16.10. And the system uses 1=
.0.2g-1ubuntu9.1.</span></div><div><span style=3D"font-size:12.8px">But I b=
uilt my own static wheel version of cryptography following <a href=3D"https=
://cryptography.io/en/latest/installation/#static-wheels">https://cryptogra=
phy.io/en/latest/installation/#static-wheels</a> , with=C2=A0OPENSSL_VERSIO=
N=3D&quot;1.1.0e&quot;</span></div><div><span style=3D"font-size:12.8px">an=
d pip installed the wheel in another virtualenv to test it, along with twis=
ted[tls]</span></div><div><span style=3D"font-size:12.8px"><br></span></div=
><div><span style=3D"font-size:12.8px">I checked OpenSSL version using this=
 (that&#39;s what scrapy also does when printing versions):</span></div><di=
v><div><span style=3D"font-size:12.8px">$ python -c &quot;import OpenSSL; p=
rint(OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION))&quot;</span></=
div><div><span style=3D"font-size:12.8px">OpenSSL 1.1.0e =C2=A016 Feb 2017<=
/span></div><div style=3D"font-size:12.8px"><br></div><div style=3D"font-si=
ze:12.8px"><span style=3D"font-size:12.8px">&gt; What about with 1.0.2?</sp=
an><br></div><div style=3D"font-size:12.8px"><span style=3D"font-size:12.8p=
x"><br></span></div><div style=3D"font-size:12.8px"><span style=3D"font-siz=
e:12.8px">I just tested it again this morning with my system&#39;s default =
openssl:</span></div><div style=3D"font-size:12.8px"><span style=3D"font-si=
ze:12.8px"><br></span></div><div style=3D"font-size:12.8px"><div style=3D"f=
ont-size:12.8px">=C2=A0 =C2=A0 $ python -c &quot;import OpenSSL; print(Open=
SSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION))&quot;</div><div style=
=3D"font-size:12.8px">=C2=A0 =C2=A0 OpenSSL 1.0.2g =C2=A01 Mar 2016</div><d=
iv><br></div><div>with the same snippet using Twisted Web Agent,</div><div>=
this is what wireshark shows in the ClientHello:</div><div><br></div></div>=
<div style=3D"font-size:12.8px"><div style=3D"font-size:12.8px">Extension: =
elliptic_curves</div><div style=3D"font-size:12.8px">=C2=A0 =C2=A0 Type: el=
liptic_curves (0x000a)</div><div style=3D"font-size:12.8px">=C2=A0 =C2=A0 L=
ength: 28</div><div style=3D"font-size:12.8px">=C2=A0 =C2=A0 Elliptic Curve=
s Length: 26</div><div style=3D"font-size:12.8px">=C2=A0 =C2=A0 Elliptic cu=
rves (13 curves)</div><div style=3D"font-size:12.8px">=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 Elliptic curve: secp256r1 (0x0017)</div><div style=3D"font-size:12.8=
px">=C2=A0 =C2=A0 =C2=A0 =C2=A0 Elliptic curve: secp521r1 (0x0019)</div><di=
v style=3D"font-size:12.8px">=C2=A0 =C2=A0 =C2=A0 =C2=A0 Elliptic curve: br=
ainpoolP512r1 (0x001c)</div><div style=3D"font-size:12.8px">=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 Elliptic curve: brainpoolP384r1 (0x001b)</div><div style=3D"f=
ont-size:12.8px">=C2=A0 =C2=A0 =C2=A0 =C2=A0 Elliptic curve: secp384r1 (0x0=
018)</div><div style=3D"font-size:12.8px">=C2=A0 =C2=A0 =C2=A0 =C2=A0 Ellip=
tic curve: brainpoolP256r1 (0x001a)</div><div style=3D"font-size:12.8px">=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Elliptic curve: secp256k1 (0x0016)</div><div st=
yle=3D"font-size:12.8px">=C2=A0 =C2=A0 =C2=A0 =C2=A0 Elliptic curve: sect57=
1r1 (0x000e)</div><div style=3D"font-size:12.8px">=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 Elliptic curve: sect571k1 (0x000d)</div><div style=3D"font-size:12.8px"=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 Elliptic curve: sect409k1 (0x000b)</div><div s=
tyle=3D"font-size:12.8px">=C2=A0 =C2=A0 =C2=A0 =C2=A0 Elliptic curve: sect4=
09r1 (0x000c)</div><div style=3D"font-size:12.8px">=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 Elliptic curve: sect283k1 (0x0009)</div><div style=3D"font-size:12.8px"=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 Elliptic curve: sect283r1 (0x000a)</div></div>=
<div class=3D"gmail_extra"><br><div class=3D"gmail_quote"><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex"><br>
<br></blockquote></div><br></div></div></div>

--001a1140137cd7cdf7054e222124--

--===============4917626654941846357==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KVHdpc3RlZC13
ZWIgbWFpbGluZyBsaXN0ClR3aXN0ZWQtd2ViQHR3aXN0ZWRtYXRyaXguY29tCmh0dHA6Ly90d2lz
dGVkbWF0cml4LmNvbS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vdHdpc3RlZC13ZWIK

--===============4917626654941846357==--