Skip to content

Commit

Permalink
removes blank line from chain.pem (#5730)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmw authored and ohemorange committed Mar 15, 2018
1 parent 065e923 commit b3e73bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion certbot/crypto_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,5 +445,5 @@ def cert_and_chain_from_fullchain(fullchain_pem):
"""
cert = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM,
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)
8 changes: 5 additions & 3 deletions certbot/tests/crypto_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,12 @@ def test_cert_and_chain_from_fullchain(self):
cert_pem = CERT.decode()
chain_pem = cert_pem + SS_CERT.decode()
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
cert_out, chain_out = cert_and_chain_from_fullchain(fullchain_pem)
self.assertEqual(cert_out, cert_pem)
self.assertEqual(chain_out, chain_pem)
for fullchain in (fullchain_pem, spacey_fullchain_pem):
cert_out, chain_out = cert_and_chain_from_fullchain(fullchain)
self.assertEqual(cert_out, cert_pem)
self.assertEqual(chain_out, chain_pem)


if __name__ == '__main__':
Expand Down

0 comments on commit b3e73bd

Please sign in to comment.