예제 #1
0
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
예제 #2
0
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