Example #1
0
def encrypt(pubkeypath, filepath):
    pubkey = crypto.open_keypair(pubkeypath)
    content = readFile(filepath)

    crypto = crypto.encrypt(pubkey, content)

    writeFile(filepath + ".secret", crypto, True)
Example #2
0
def decrypt(prvkeypath, filepath):
    try:
        prvkey = crypto.open_keypair(prvkeypath)
        content = readFile(filepath, True)

        plain = crypto.decrypt(prvkey, content).decode()

        writeFile(filepath + ".plain", plain)
    except ValueError:
        print("Could not decrypt [" + filepath + "]")