def test_keyfile_nacl(): with tempdir() as tmpdir: keyfilename = os.path.join(tmpdir, "key") from nacl.secret import SecretBox from nacl.utils import random keyfile = KeyFile(SecretBox, random, keyfilename, pinentry) ctext = keyfile.encode(plaintext) keyfile = KeyFile(SecretBox, random, keyfilename, pinentry) dtext = keyfile.decode(ctext) assert dtext == plaintext
def test_keyfile(): with tempdir() as tmpdir: keyfilename = os.path.join(tmpdir, "key") from passbox.secret import SecretBox import Crypto.Random random = Crypto.Random.new().read keyfile = KeyFile(SecretBox, random, keyfilename, pinentry) ctext = keyfile.encode(plaintext) keyfile = KeyFile(SecretBox, random, keyfilename, pinentry) dtext = keyfile.decode(ctext) assert dtext == plaintext