|
@@ -1,25 +1,31 @@
|
|
|
import rsa
|
|
import rsa
|
|
|
-from cryptography.fernet import Fernet
|
|
|
|
|
|
|
+#from cryptography.fernet import Fernet
|
|
|
# create the symmetric key only for the JSON file - we are going to only encrypt the keys
|
|
# create the symmetric key only for the JSON file - we are going to only encrypt the keys
|
|
|
-key = Fernet.generate_key()
|
|
|
|
|
|
|
+#key = Fernet.generate_key()
|
|
|
|
|
|
|
|
# write the symmetric key to a file
|
|
# write the symmetric key to a file
|
|
|
-k = open('symmetric.key','wb')
|
|
|
|
|
-k.write(key)
|
|
|
|
|
-k.close()
|
|
|
|
|
|
|
+#k = open('symmetric.key','wb')
|
|
|
|
|
+#k.write(key)
|
|
|
|
|
+#k.close()
|
|
|
|
|
|
|
|
# create the pub & private keys for the parties
|
|
# create the pub & private keys for the parties
|
|
|
(pubkey_forParty1,privkey_forParty1)=rsa.newkeys(2048)
|
|
(pubkey_forParty1,privkey_forParty1)=rsa.newkeys(2048)
|
|
|
(pubkey_forParty2,privkey_forParty2)=rsa.newkeys(2048)
|
|
(pubkey_forParty2,privkey_forParty2)=rsa.newkeys(2048)
|
|
|
|
|
|
|
|
-# write the public key to a file
|
|
|
|
|
-pukey = open('publickeys.key','wb')
|
|
|
|
|
|
|
+#write the public key to a file
|
|
|
|
|
+pukey = open('publickey_Party1.key','wb')
|
|
|
pukey.write(pubkey_forParty1.save_pkcs1('PEM'))
|
|
pukey.write(pubkey_forParty1.save_pkcs1('PEM'))
|
|
|
|
|
+pukey.close()
|
|
|
|
|
+
|
|
|
|
|
+pukey = open('publickey_Party2.key','wb')
|
|
|
pukey.write(pubkey_forParty2.save_pkcs1('PEM'))
|
|
pukey.write(pubkey_forParty2.save_pkcs1('PEM'))
|
|
|
pukey.close()
|
|
pukey.close()
|
|
|
|
|
|
|
|
# write the private key to a file
|
|
# write the private key to a file
|
|
|
-prkey = open('privkeys.key','wb')
|
|
|
|
|
|
|
+prkey = open('privkey_Party1.txt','wb')
|
|
|
prkey.write(privkey_forParty1.save_pkcs1('PEM'))
|
|
prkey.write(privkey_forParty1.save_pkcs1('PEM'))
|
|
|
|
|
+prkey.close()
|
|
|
|
|
+
|
|
|
|
|
+prkey = open('privkey_Party2.txt','wb')
|
|
|
prkey.write(privkey_forParty2.save_pkcs1('PEM'))
|
|
prkey.write(privkey_forParty2.save_pkcs1('PEM'))
|
|
|
prkey.close()
|
|
prkey.close()
|