- 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))
- except NoSuchUserException:
+ keypair1 = c.get_key_pair()
+ keypair2 = c.get_key_pair()
+ try:
+ u.add_pubkey('test', keypair2[1])
+ except KeyError:
+ u.update_pubkey('test', keypair2[1])
+ bob_box = Box(keypair1[0], u.get_pubkey('test'))
+ message = "Kill all humans æøåÅØÆ"
+ 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))
+ except NoSuchUser: