Issue #8086: In :func:`ssl.DER_cert_to_PEM_cert()`, fix missing newline
before the certificate footer. Patch by Kyle VanderBeek.
This commit is contained in:
parent
9751472001
commit
4c7bcf1194
|
@ -365,7 +365,7 @@ def DER_cert_to_PEM_cert(der_cert_bytes):
|
||||||
# preferred because older API gets line-length wrong
|
# preferred because older API gets line-length wrong
|
||||||
f = base64.standard_b64encode(der_cert_bytes)
|
f = base64.standard_b64encode(der_cert_bytes)
|
||||||
return (PEM_HEADER + '\n' +
|
return (PEM_HEADER + '\n' +
|
||||||
textwrap.fill(f, 64) +
|
textwrap.fill(f, 64) + '\n' +
|
||||||
PEM_FOOTER + '\n')
|
PEM_FOOTER + '\n')
|
||||||
else:
|
else:
|
||||||
return (PEM_HEADER + '\n' +
|
return (PEM_HEADER + '\n' +
|
||||||
|
|
|
@ -113,6 +113,10 @@ class BasicTests(unittest.TestCase):
|
||||||
p2 = ssl.DER_cert_to_PEM_cert(d1)
|
p2 = ssl.DER_cert_to_PEM_cert(d1)
|
||||||
d2 = ssl.PEM_cert_to_DER_cert(p2)
|
d2 = ssl.PEM_cert_to_DER_cert(p2)
|
||||||
self.assertEqual(d1, d2)
|
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):
|
def test_openssl_version(self):
|
||||||
n = ssl.OPENSSL_VERSION_NUMBER
|
n = ssl.OPENSSL_VERSION_NUMBER
|
||||||
|
|
|
@ -780,6 +780,7 @@ Michael Urman
|
||||||
Hector Urtubia
|
Hector Urtubia
|
||||||
Andi Vajda
|
Andi Vajda
|
||||||
Case Van Horsen
|
Case Van Horsen
|
||||||
|
Kyle VanderBeek
|
||||||
Atul Varma
|
Atul Varma
|
||||||
Dmitry Vasiliev
|
Dmitry Vasiliev
|
||||||
Alexandre Vassalotti
|
Alexandre Vassalotti
|
||||||
|
|
|
@ -27,6 +27,9 @@ Core and Builtins
|
||||||
Library
|
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 #8546: Reject None given as the buffering argument to _pyio.open.
|
||||||
|
|
||||||
- Issue #8549: Fix compiling the _ssl extension under AIX. Patch by
|
- Issue #8549: Fix compiling the _ssl extension under AIX. Patch by
|
||||||
|
|
Loading…
Reference in New Issue