import gnupg


def encrypt(source_file):
    base_dir = '/home/robert/projekte/python/planner/gnupg/'

    gpg = gnupg.GPG(homedir=base_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=source_file + '.gpg')
        # 'BV_IFC; BMW Group <BV_IFC@softlab.de>'
        print(result.stderr)
        #  , verbose=True


if __name__ == '__main__':
    encrypt('/home/robert/projekte/python/planner/HBV/HB0014432021000103351024032021112656.dat')
