openssl.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:nova 作者: hubblestack 项目源码 文件源码
def _get_x509_days_left(x509):
    date_fmt = '%Y%m%d%H%M%SZ'
    current_datetime = datetime.datetime.utcnow()
    not_after = time.strptime(x509.get_notAfter(), date_fmt)
    not_before = time.strptime(x509.get_notBefore(), date_fmt)

    ret = {'not_after': (datetime.datetime(*not_after[:6]) - current_datetime).days,
           'not_before': (datetime.datetime(*not_before[:6]) - current_datetime).days}

    return ret
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号