1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#!/usr/bin/env vpython3
# *-* coding: utf-8 *-*
from endesive import plain
def main():
trusted_cert_pems = (open('ca/demo2_ca.crt.pem', 'rb').read(),)
datau = open('plain-unsigned.txt', 'rb').read()
for fname in (
'plain-ssl-signed-attr.txt',
'plain-ssl-signed-noattr.txt',
'plain-signed-attr.txt',
'plain-signed-noattr.txt',
'plain-signed-pss.txt',
):
print('*' * 20, fname)
try:
datas = open(fname, 'rb').read()
except FileNotFoundError:
print("no such file", fname)
continue
(hashok, signatureok, certok) = plain.verify(datas, datau, trusted_cert_pems)
print('signature ok?', signatureok)
print('hash ok?', hashok)
print('cert ok?', certok)
main()
|