mirror of
https://github.com/certbot/certbot.git
synced 2026-05-28 04:34:11 -04:00
(cherry picked from commit b3e73bd2ab)
This commit is contained in:
parent
d0b336085c
commit
cedbf8906c
2 changed files with 6 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -380,10 +380,12 @@ class CertAndChainFromFullchainTest(unittest.TestCase):
|
|||
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__':
|
||||
|
|
|
|||
Loading…
Reference in a new issue