Created
May 31, 2019 13:39
-
-
Save asfelix/2f62cc6d0218871d7a57e1a463cc9b02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from OpenSSL import crypto | |
| # May require "" for empty password depending on version | |
| with open("certificate.p12", "rb") as file: | |
| p12 = crypto.load_pkcs12(file.read(), 'password') | |
| # PEM formatted private key | |
| print('PRIVATE KEY:\n', crypto.dump_privatekey(crypto.FILETYPE_PEM, p12.get_privatekey())) | |
| # PEM formatted certificate | |
| print('\nCERTIFICATE:\n', crypto.dump_certificate(crypto.FILETYPE_PEM, p12.get_certificate())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment