Remove private key from PKCS12 file

Fixes #2349
This commit is contained in:
Oliver Graff 2017-06-12 00:44:29 -07:00
parent 93d37e29c3
commit bd9d0bf6b1

View File

@ -264,6 +264,12 @@ class CertStore:
# Dump the certificate in PKCS12 format for Windows devices
with open(os.path.join(path, basename + "-ca-cert.p12"), "wb") as f:
p12 = OpenSSL.crypto.PKCS12()
p12.set_certificate(ca)
f.write(p12.export())
# Dump the certificate and key in a PKCS12 format for Windows devices
with open(os.path.join(path, basename + "-ca.p12"), "wb") as f:
p12 = OpenSSL.crypto.PKCS12()
p12.set_certificate(ca)
p12.set_privatekey(key)