Files
CyberPanel/plogical/test.py

8 lines
418 B
Python
Raw Normal View History

2019-12-04 19:42:38 +05:00
import OpenSSL
from datetime import datetime
filePath = '/etc/letsencrypt/live/%s/fullchain.pem' % ('hello.com')
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
open(filePath, 'r').read())
expireData = x509.get_notAfter().decode('ascii')
finalDate = datetime.strptime(expireData, '%Y%m%d%H%M%SZ')
print x509.get_issuer().get_components()[1][1]