gnupg_encrypt.py 494 B

12345678910111213141516
  1. import gnupg
  2. def encrypt(source_file):
  3. base_dir = '/home/robert/projekte/python/planner/gnupg/'
  4. gpg = gnupg.GPG(gnupghome=base_dir)
  5. # gpg.import_keys(base_dir + 'export.gpg')
  6. # public_keys = gpg.list_keys()
  7. with open(source_file, 'rb') as frh:
  8. gpg.encrypt_file(frh, 'BV_IFC; BMW Group <BV_IFC@softlab.de>', output=source_file + '.gpg')
  9. if __name__ == '__main__':
  10. encrypt('/home/robert/projekte/python/planner/HBV/HB0014432021000103351024032021112656.dat')