Ejemplo n.º 1
0
def convert():
    c = Crypto()
    input = txt.get("1.0", tk.END)
    res.delete("1.0", tk.END)
    if (operation.get() == "encrypt"):
        cipher = c.encrypt(input[0:len(input) - 1])
        res.insert("1.0", cipher)
    elif (operation.get() == "decrypt"):
        plaintext = c.decrypt(input)
        res.insert("1.0", plaintext)
Ejemplo n.º 2
0
 def test_encrypt_decrypt(self):
     crypto = Crypto(public_exponent=65537, key_size=2048)
     plain = b'test'
     cipher = crypto.encrypt(plain)
     output = crypto.decrypt(cipher)
     self.assertEqual(plain, output)