[Python-checkins] r80557 - in python/trunk: Lib/ssl.py Lib/test/test_ssl.py Misc/ACKS Misc/NEWS

antoine.pitrou python-checkins at python.org
Wed Apr 28 00:03:38 CEST 2010


Author: antoine.pitrou
Date: Wed Apr 28 00:03:37 2010
New Revision: 80557

Log:
Issue #8086: In :func:`ssl.DER_cert_to_PEM_cert()`, fix missing newline
before the certificate footer.  Patch by Kyle VanderBeek.



Modified:
   python/trunk/Lib/ssl.py
   python/trunk/Lib/test/test_ssl.py
   python/trunk/Misc/ACKS
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/ssl.py
==============================================================================
--- python/trunk/Lib/ssl.py	(original)
+++ python/trunk/Lib/ssl.py	Wed Apr 28 00:03:37 2010
@@ -365,7 +365,7 @@
         # 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' +

Modified: python/trunk/Lib/test/test_ssl.py
==============================================================================
--- python/trunk/Lib/test/test_ssl.py	(original)
+++ python/trunk/Lib/test/test_ssl.py	Wed Apr 28 00:03:37 2010
@@ -113,6 +113,10 @@
         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_openssl_version(self):
         n = ssl.OPENSSL_VERSION_NUMBER

Modified: python/trunk/Misc/ACKS
==============================================================================
--- python/trunk/Misc/ACKS	(original)
+++ python/trunk/Misc/ACKS	Wed Apr 28 00:03:37 2010
@@ -780,6 +780,7 @@
 Hector Urtubia
 Andi Vajda
 Case Van Horsen
+Kyle VanderBeek
 Atul Varma
 Dmitry Vasiliev
 Alexandre Vassalotti

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Apr 28 00:03:37 2010
@@ -27,6 +27,9 @@
 Library
 -------
 
+- Issue #8086: In :func:`ssl.DER_cert_to_PEM_cert()`, fix missing newline
+  before the certificate footer.  Patch by Kyle VanderBeek.
+
 - Issue #8546: Reject None given as the buffering argument to _pyio.open.
 
 - Issue #8549: Fix compiling the _ssl extension under AIX.  Patch by


More information about the Python-checkins mailing list