mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 10:51:53 +02:00
removes blank line from chain.pem (#5730)
This commit is contained in:
@@ -445,5 +445,5 @@ def cert_and_chain_from_fullchain(fullchain_pem):
|
|||||||
"""
|
"""
|
||||||
cert = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM,
|
cert = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM,
|
||||||
OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, fullchain_pem)).decode()
|
OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, fullchain_pem)).decode()
|
||||||
chain = fullchain_pem[len(cert):]
|
chain = fullchain_pem[len(cert):].lstrip()
|
||||||
return (cert, chain)
|
return (cert, chain)
|
||||||
|
|||||||
@@ -380,10 +380,12 @@ class CertAndChainFromFullchainTest(unittest.TestCase):
|
|||||||
cert_pem = CERT.decode()
|
cert_pem = CERT.decode()
|
||||||
chain_pem = cert_pem + SS_CERT.decode()
|
chain_pem = cert_pem + SS_CERT.decode()
|
||||||
fullchain_pem = cert_pem + chain_pem
|
fullchain_pem = cert_pem + chain_pem
|
||||||
|
spacey_fullchain_pem = cert_pem + u'\n' + chain_pem
|
||||||
from certbot.crypto_util import cert_and_chain_from_fullchain
|
from certbot.crypto_util import cert_and_chain_from_fullchain
|
||||||
cert_out, chain_out = cert_and_chain_from_fullchain(fullchain_pem)
|
for fullchain in (fullchain_pem, spacey_fullchain_pem):
|
||||||
self.assertEqual(cert_out, cert_pem)
|
cert_out, chain_out = cert_and_chain_from_fullchain(fullchain)
|
||||||
self.assertEqual(chain_out, chain_pem)
|
self.assertEqual(cert_out, cert_pem)
|
||||||
|
self.assertEqual(chain_out, chain_pem)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user