hynek / pem

PEM file parsing in Python.

Home Page:https://pem.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SHA1 digest to be a property of _Base class

vladak opened this issue · comments

I use the pem library to compare 2 sets of certificate bundles. To quickly see what are the differences, it would be handy if the SHA1 digest was part of the _Base class so it does not have to be recomputed, i.e. so this is possible:

import pem
certs = pem.parse_file("cacert-2018-03-07.pem")
# print(hashlib.sha1(certs[0].as_bytes()).hexdigest())
print(certs[0].sha1) # avoids double digest computation

Hm computing them unconditionally seems unwise, maybe make it a cached property?