Skip to content

Commit

Permalink
Revert "OpenSSL >= 1.1.0 requires keys be at least 4096 bytes."
Browse files Browse the repository at this point in the history
This reverts commit e2fa89f.
  • Loading branch information
markrwilliams committed Mar 19, 2017
1 parent 9bf53b7 commit f9cb58c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 86 deletions.
2 changes: 1 addition & 1 deletion src/twisted/protocols/test/test_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def cbHandshook(ignored):
self.assertEqual(
cert.digest('sha1'),
# openssl x509 -noout -sha1 -fingerprint -in server.pem
b'A4:83:4B:E6:56:36:CA:25:BD:DE:0B:8C:E1:6D:4B:51:BE:D6:DE:B1')
b'45:DD:FD:E2:BD:BF:8B:D0:00:B7:D2:7A:BB:20:F5:34:05:4B:15:80')
handshakeDeferred.addCallback(cbHandshook)
return handshakeDeferred

Expand Down
132 changes: 49 additions & 83 deletions src/twisted/test/server.pem
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from datetime import datetime
from OpenSSL.crypto import FILETYPE_PEM, TYPE_RSA, X509, PKey, dump_privatekey, dump_certificate

key = PKey()
key.generate_key(TYPE_RSA, 4096)
key.generate_key(TYPE_RSA, 2048)

cert = X509()
issuer = cert.get_issuer()
Expand Down Expand Up @@ -40,89 +40,55 @@ with open(b"server.pem", "wb") as fObj:
fObj.write(b"'''\n")
'''
-----BEGIN PRIVATE KEY-----
MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQC9NXLadNeT94rY
9Ycj2Iw6XgtJk9kgtE9dY0ghX3dRbaW2yRE2H2NcmsdbPcfRi3PKDIrv/hkH3y5w
kJ7QMqQJN/htSxtvCDqyEELqFuu+yTNDOMwEzpvoyEhRHfX6G2S1CvKnS795w1QT
ixVMokDlj8B/ykUaPHlxeTAcPuxrLWtyok3UxQAJ9ICe/tjwBm92/gEk8QqadU4t
07k1L6+g7puuJD2P5Bk//jkf4K4LhpIrVEv6hN7Ze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PisHJF0vBDox9Fx91nROlUngntqknrqlm3zkv
re7xNmIBl0GByjBfqCKiVruRRQwbrptKLZfqwgXF1cfDOtaUU2dJsqo6oqUauOYE
dRipEWuAsAsqRoykXfSiUeftAuonbn3aEwVWQ5ADM2vxdvXmYXbsG5YVh3s/pOKu
zEIR370EUVuGXS8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAK+HqbIUN6qHYYQZw
7qqsTJWni8NOfK3aguyKAPcdCPP2DCZ6zlxxkUWL57gvsohyDu8Nr9iSI6wePjmI
cN9eCZdc6mD9kYW4qBYhh2T48TOhEEW7zO6bWQUqWohHW+bG+GfrHnvxIx56OC2B
eDS2djvvScYm45etlHprfrVEDIssh956O6qJCySax3D2w+i8YanXji1EbS61XTDw
CMxDdWYmd2MDARRwlMcfcUIfKZUGl5NmqpnOx+H5MyAGwt86s647GMYZborQh+Mj
tNHVpyKf/a8/HjqP1sCOrjCPZIjP6Qp5j4gifAjUStNmCgaBe7CpFtBSLnHqb4o/
gU7u1w==
-----END CERTIFICATE-----
'''
2 changes: 1 addition & 1 deletion src/twisted/test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def generateCertificateObjects(organization, organizationalUnit):
@return: a tuple of (key, request, certificate) objects.
"""
pkey = crypto.PKey()
pkey.generate_key(crypto.TYPE_RSA, 4096)
pkey.generate_key(crypto.TYPE_RSA, 512)
req = crypto.X509Req()
subject = req.get_subject()
subject.O = organization
Expand Down
2 changes: 1 addition & 1 deletion src/twisted/test/test_sslverify.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def counter(counter=itertools.count()):

def makeCertificate(**kw):
keypair = PKey()
keypair.generate_key(TYPE_RSA, 4096)
keypair.generate_key(TYPE_RSA, 768)

certificate = X509()
certificate.gmtime_adj_notBefore(0)
Expand Down

0 comments on commit f9cb58c

Please sign in to comment.