Created
December 24, 2018 03:13
-
-
Save suzaku/01e29b1698d372c3c916405d9d502c15 to your computer and use it in GitHub Desktop.
Parse notAfter of P12 certificate
This file contains 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
import datetime | |
from OpenSSL.crypto import load_pkcs12 | |
with open("your.p12", "rb") as f: | |
content = f.read() | |
p = load_pkcs12(content, "YOUR PASSSPHRASE") | |
cert = p.get_certificate() | |
format = "%Y%m%d%H%M%SZ" | |
print(datetime.datetime.strptime(cert.get_notAfter(), format)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment