gnupg_encrypt.py 629 B

1234567891011121314151617181920
  1. import gnupg
  2. def encrypt(source_file):
  3. base_dir = '/home/robert/projekte/python/planner/gnupg/'
  4. gpg = gnupg.GPG(homedir=base_dir)
  5. # gpg.import_keys(base_dir + 'export.gpg')
  6. # public_keys = gpg.list_keys()
  7. # print(public_keys)
  8. with open(source_file, 'rb') as frh:
  9. result = gpg.encrypt(frh, '942170BF95EA785E8D4A5C94D1839587F0E1C01C', output=source_file + '.gpg')
  10. # 'BV_IFC; BMW Group <BV_IFC@softlab.de>'
  11. print(result.stderr)
  12. # , verbose=True
  13. if __name__ == '__main__':
  14. encrypt('/home/robert/projekte/python/planner/HBV/HB0014432021000103351024032021112656.dat')