1234567891011121314151617 |
- import gnupg
- from pathlib import Path
- def encrypt(source_file):
- config_dir = Path().cwd() / 'config/gnupg'
- gpg = gnupg.GPG(homedir=config_dir)
- # gpg.import_keys(base_dir + 'export.gpg')
- # public_keys = gpg.list_keys()
- # print(public_keys)
- with open(source_file, 'rb') as frh:
- result = gpg.encrypt(frh, '942170BF95EA785E8D4A5C94D1839587F0E1C01C', output=str(source_file) + '.gpg')
- # 'BV_IFC; BMW Group <BV_IFC@softlab.de>'
- print(result.stderr)
- # , verbose=True
|