sign.py 259 B

123456789101112
  1. import OpenPGP
  2. import OpenPGP.Crypto
  3. import sys
  4. wkey = OpenPGP.Message.parse(open('key').read())[0]
  5. data = OpenPGP.LiteralDataPacket('This is text.', 'u', 'text/plain')
  6. sign = OpenPGP.Crypto.Wrapper(wkey)
  7. m = sign.sign(data)
  8. sys.stdout.write(m.to_bytes())