- encrypted = bob_box.encrypt(message.encode())
- alice_box = Box(keypair2[0], keypair1[1])
- plaintext = alice_box.decrypt(encrypted)
- print (plaintext.decode())
-# c = Cryptonize()
-# key = 'æselØre' #c.get_random_key()
-# cipher = c.symmetric_encrypt(key, pickle.dumps(u))
-# obj = pickle.loads(c.symmetric_decrypt(key, cipher))
-# for attr, value in obj.__dict__.items():
-# print ('{0}: {1}'.format(attr, value))
+ print ("Message to encrypt: {0}".format(message))
+ encrypted = c.asymmetric_encrypt(keypair1[0], u.get_pubkey('test'), message)
+ print ("Message encrypted: {0}".format(encrypted))
+ plaintext = c.asymmetric_decrypt(keypair2[0], keypair1[1], encrypted)
+ print("Message decrypted: {0}".format(plaintext.decode()))