]> git.datanom.net - securemail.git/blobdiff - user.py
Make backwards compatible with nacl 1.0.x
[securemail.git] / user.py
diff --git a/user.py b/user.py
index 7c1632e71129e5db64aaacca827b9312a16a3130..a4ab2f73e08fe3d5e7e20b95c17377be40ef9497 100644 (file)
--- a/user.py
+++ b/user.py
@@ -120,7 +120,6 @@ if __name__ == '__main__':
             for attr, value in u.__dict__.items():
                 print ('{0}: {1}'.format(attr, value))
             print ('{0} - {1} - {2}'.format(u.name, u.email, u.pubkeys))
-#        from nacl.public import Box
         c = Cryptonize()
         keypair1 = c.get_key_pair()
         keypair2 = c.get_key_pair()
@@ -128,20 +127,12 @@ if __name__ == '__main__':
             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())
+        print ("Message to encrypt: {0}".format(message))
         encrypted = c.asymmetric_encrypt(keypair1[0], u.get_pubkey('test'), message)
-#        alice_box = Box(keypair2[0], keypair1[1])
-#        plaintext = alice_box.decrypt(encrypted)
+        print ("Message encrypted: {0}".format(encrypted))
         plaintext = c.asymmetric_decrypt(keypair2[0], keypair1[1], 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 decrypted: {0}".format(plaintext.decode()))
     except NoSuchUser:
         u = User()
         u.name = 'testname'
This page took 0.041122 seconds and 5 git commands to generate.