Chains are not always a given. (#645)

This commit is contained in:
kevgliss 2017-01-08 17:27:50 -08:00 committed by GitHub
parent 4cfb5752b2
commit d67b6c6120
1 changed files with 5 additions and 1 deletions

View File

@ -102,10 +102,14 @@ def create_keystore(cert, chain, jks_tmp, key, alias, passphrase):
if isinstance(key, bytes):
key = key.decode('utf-8')
# Create PKCS12 keystore from private key and public certificate
with mktempfile() as cert_tmp:
with open(cert_tmp, 'w') as f:
f.writelines([key.strip() + "\n", cert.strip() + "\n", chain.strip() + "\n"])
if chain:
f.writelines([key.strip() + "\n", cert.strip() + "\n", chain.strip() + "\n"])
else:
f.writelines([key.strip() + "\n", cert.strip() + "\n"])
with mktempfile() as p12_tmp:
run_process([