|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/share/doc/m2crypto-0.16/demo/pgp/ |
Upload File : |
#!/usr/bin/python
"""PGP test program.
Copyright (c) 1999 Ng Pheng Siong. All rights reserved."""
from M2Crypto import EVP, PGP
from cStringIO import StringIO
def test1():
pkr = PGP.load_pubring('pubring.pgp')
daft = pkr['daft']
daft_pkt = daft._pubkey_pkt.pack()
s1 = EVP.MessageDigest('sha1')
s1.update(daft_pkt)
print `s1.final()`
buf = StringIO(daft_pkt)
ps = PGP.packet_stream(buf)
dift_pkt = ps.read()
s2 = EVP.MessageDigest('sha1')
s2.update(dift_pkt.pack())
print `s2.final()`
if __name__ == '__main__':
test1()