summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-04-27 22:05:18 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-04-27 22:05:18 (GMT)
commit12cb1297f4c055e70a0d89359030d0051bdeed92 (patch)
tree0ea11d1874fd08f0a72ed55f705fd7b29a363347
parentbcc17e7223fe4378127b054aade28a1bfa0536e5 (diff)
downloadcpython-12cb1297f4c055e70a0d89359030d0051bdeed92.zip
cpython-12cb1297f4c055e70a0d89359030d0051bdeed92.tar.gz
cpython-12cb1297f4c055e70a0d89359030d0051bdeed92.tar.bz2
Merged revisions 80557 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80557 | antoine.pitrou | 2010-04-28 00:03:37 +0200 (mer., 28 avril 2010) | 4 lines Issue #8086: In :func:`ssl.DER_cert_to_PEM_cert()`, fix missing newline before the certificate footer. Patch by Kyle VanderBeek. ........
-rw-r--r--Lib/ssl.py2
-rw-r--r--Lib/test/test_ssl.py4
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS3
4 files changed, 9 insertions, 1 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index 1af9fa9..3c0783f 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -361,7 +361,7 @@ def DER_cert_to_PEM_cert(der_cert_bytes):
# preferred because older API gets line-length wrong
f = base64.standard_b64encode(der_cert_bytes)
return (PEM_HEADER + '\n' +
- textwrap.fill(f, 64) +
+ textwrap.fill(f, 64) + '\n' +
PEM_FOOTER + '\n')
else:
return (PEM_HEADER + '\n' +
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index cc04f4c..e5f4a9e 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -116,6 +116,10 @@ class BasicTests(unittest.TestCase):
p2 = ssl.DER_cert_to_PEM_cert(d1)
d2 = ssl.PEM_cert_to_DER_cert(p2)
self.assertEqual(d1, d2)
+ if not p2.startswith(ssl.PEM_HEADER + '\n'):
+ self.fail("DER-to-PEM didn't include correct header:\n%r\n" % p2)
+ if not p2.endswith('\n' + ssl.PEM_FOOTER + '\n'):
+ self.fail("DER-to-PEM didn't include correct footer:\n%r\n" % p2)
def test_refcycle(self):
# Issue #7943: an SSL object doesn't create reference cycles with
diff --git a/Misc/ACKS b/Misc/ACKS
index 09de7aa..c324936 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -734,6 +734,7 @@ Lionel Ulmer
Roger Upole
Michael Urman
Hector Urtubia
+Kyle VanderBeek
Atul Varma
Dmitry Vasiliev
Alexandre Vassalotti
diff --git a/Misc/NEWS b/Misc/NEWS
index 359a3c3..ea1f7ec 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -33,6 +33,9 @@ Core and Builtins
Library
-------
+- Issue #8086: In :func:`ssl.DER_cert_to_PEM_cert()`, fix missing newline
+ before the certificate footer. Patch by Kyle VanderBeek.
+
- Issue #8549: Fix compiling the _ssl extension under AIX. Patch by
Sridhar Ratnakumar.