diff --git a/.auth_server_test/client/.known_hosts b/.auth_server_test/client/.known_hosts
new file mode 100644
index 0000000..8afe0d7
--- /dev/null
+++ b/.auth_server_test/client/.known_hosts
@@ -0,0 +1 @@
+monster 15e6534f-25ed-4ca4-abe5-487566bcd7b4 Aj_4lrs-82x0cq8i-J88XdETavUh3kPJO5UfleYZomk=
diff --git a/.auth_server_test/client/id_rsa b/.auth_server_test/client/id_rsa
new file mode 100644
index 0000000..43f87a2
--- /dev/null
+++ b/.auth_server_test/client/id_rsa
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDraRhBIudHq/dp
+tkHBR0Hbns2+onuvjgvCjEcPVISW9yg2w2u3VXPYA/UfW5bwDhipvDs/vThKzmkU
+Pr+Q4rIQnPvP2rtbweMGnxYuSineYk6iNRqFnVWerh6t+6OU/3/t2nYX6y/I2y6c
+Yjb32vM7NT2ixsyRe7BFNqTPnBlaA+W/A/df5Y/g+iys06wnnghHzVdQ8REgKwv2
+QHSKr5fgyh1BiarjWgWD1Gt7iSaY2jM6jUVyf21KwvWj7UmWuyHx/wgSVLx/lvtz
+M3+tjGPjasra9O9V44z7Q6gaLaW9cBXInGGtRVIzmdgC/1XDaOifu7OZHkqFL+Gv
+rqegkn9ZAgMBAAECggEBAJ6Tve3qyCdElTaVunerO5bow6m+JFle81cLTbbq9SII
+vgMd4wqtuopyKAYGmYd9x2lXTgYiva/OmYQ0vLCptM9yIEKlEn69/eNw+O0XslqG
+mHe2E/abxJhOrIYAs/HjptafydtU52yDEUPw+Rw/Voe01p83EYiS7GvDYoQjoAQ8
+vwDIViw1Ey6aAU9+xpr/gA/ef1OSKknoa9UpWZCzsaxnncOg5AeAHiQRn6aY302q
+UpHo2TjncfwvNLz11qu8ePiwOHDPm1PFgWd2iZ7g8AwNpv7E1ujgFvTAMUXqBQh8
+BYkhGHwXmBClpHQmWUHolzDk2cV8HQ21+j/yNeDyK60CgYEA/I2lkqNBa0Zppgav
+L57zWJyn4a7fF5uQuhvOrVFL3X/hZdM6vv9l2TN6g/7JP4PMu9RuwOWTuGeTVQcO
+RtIZcNMbZUb7PrjNJK7E/Y/n+2AoWjD81iP8/VHxLs4Cac/cCn4d1GAj0o/XGePV
+bCNwTHt1uN7SyUL7t4rEUUsdBisCgYEA7p+OQ080YtalGcSFoKTz5VQdVBSuScXn
+pfqh8FxR8OAL1sQn5b9K+kBt1KDYG4MO5DxCz88QWZNksVdka5tymHyEAcvIwg+j
+zDgumV9VbFEaATVZqkzXhp2/M4sFPZhdTxzsdAXwPJ8YKJVQyo8mUMiKsQFphbCe
+Yy6FdlGzcosCgYBL+kEJcFvJ7hDyhahGZ0dGLTrERluPOpm7o4n10jNEm6gvffB6
+bVMymK4O76OTnA8Hosz+8xIRs/c66Th+Tc6hhqEDQutq3yW4F2vj7FsZ4L/DAmHN
++l2tx+0K66cGNiY4ceB/d7zPJ77KZyRZt/+cwreTulUnfyNDAFg3LKW6qQKBgA/D
+GFmX3MT+mq9GDPGck8O9N6a7KvwSh4euM441+u+nTQDluiDx7tjy8o5OBZhjotMu
+q9cgPVs9YjRYqnh1Ly+lYe7gcCVpdQ9jUqis5G6gONCFnqOiKcZpmxyjfTghXWCB
+b5kGX2URuT3NByYqKITDim3AwyCilwPEKeqz4N+bAoGBANZVi2vTzRTcApI9H3P5
+3JRUYsv0b0Iul0MjfwBduL0NEmsOCnaML9VZVhl3ejiyolkQd4tKlEWF7wAg0MAn
+D/y0y+qR62nzzQ9IIsYfORl90e0TFKhFwBjWum3a8t/6D5Y6JUQjtfzaekSqSBhy
+QIdT2n9gC6BiaUM86Xe8qIF4
+-----END PRIVATE KEY-----
diff --git a/.auth_server_test/client/id_rsa.pub b/.auth_server_test/client/id_rsa.pub
new file mode 100644
index 0000000..1e492fc
--- /dev/null
+++ b/.auth_server_test/client/id_rsa.pub
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA62kYQSLnR6v3abZBwUdB
+257NvqJ7r44LwoxHD1SElvcoNsNrt1Vz2AP1H1uW8A4Yqbw7P704Ss5pFD6/kOKy
+EJz7z9q7W8HjBp8WLkop3mJOojUahZ1Vnq4erfujlP9/7dp2F+svyNsunGI299rz
+OzU9osbMkXuwRTakz5wZWgPlvwP3X+WP4PosrNOsJ54IR81XUPERICsL9kB0iq+X
+4ModQYmq41oFg9Rre4kmmNozOo1Fcn9tSsL1o+1Jlrsh8f8IElS8f5b7czN/rYxj
+42rK2vTvVeOM+0OoGi2lvXAVyJxhrUVSM5nYAv9Vw2jon7uzmR5KhS/hr66noJJ/
+WQIDAQAB
+-----END PUBLIC KEY-----
diff --git a/.auth_server_test/client/public_keys_servers/15e6534f-25ed-4ca4-abe5-487566bcd7b4.pub b/.auth_server_test/client/public_keys_servers/15e6534f-25ed-4ca4-abe5-487566bcd7b4.pub
new file mode 100644
index 0000000..f466edc
--- /dev/null
+++ b/.auth_server_test/client/public_keys_servers/15e6534f-25ed-4ca4-abe5-487566bcd7b4.pub
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAn//c9+fFvE8eML+a3Kmb
+Oq3+fEHiMH9YTeSyl5ydz4wYqd0EFYJTojO6YoAOfeERd9AEcEdVv/HEgA4OPdt/
+2CURlybLRwO2XYbIVyx4Lnc9I78utc8W3IxVnFc0eYPyguWgrM/lTPIUnu6vjw8X
+KTKzXPr3NuvIITeWAnEjCGePnqC8MfupcgQ0LrZfDDUfcftxutbQNbP8WW08jDDG
+srQNoa5+JzcSKW7Yz2RtipjpbEwjk1y3wUtjVXg/DtTAp7btEJ3RmyfQos1Pnu6q
+cTUTbXLdmFmtzHNg2cSRlICcBhNU2hX5O2krbJsf5CKrC6O92a2JdaCMvNvaD2FL
+TQIDAQAB
+-----END PUBLIC KEY-----
diff --git a/.auth_server_test/server/.known_clients b/.auth_server_test/server/.known_clients
new file mode 100644
index 0000000..9159939
--- /dev/null
+++ b/.auth_server_test/server/.known_clients
@@ -0,0 +1 @@
+15e6534f-25ed-4ca4-abe5-487566bcd7b4 Aj_4lrs-82x0cq8i-J88XdETavUh3kPJO5UfleYZomk= 0
diff --git a/.auth_server_test/server/id_rsa b/.auth_server_test/server/id_rsa
new file mode 100644
index 0000000..514af65
--- /dev/null
+++ b/.auth_server_test/server/id_rsa
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCf/9z358W8Tx4w
+v5rcqZs6rf58QeIwf1hN5LKXnJ3PjBip3QQVglOiM7pigA594RF30ARwR1W/8cSA
+Dg4923/YJRGXJstHA7ZdhshXLHgudz0jvy61zxbcjFWcVzR5g/KC5aCsz+VM8hSe
+7q+PDxcpMrNc+vc268ghN5YCcSMIZ4+eoLwx+6lyBDQutl8MNR9x+3G61tA1s/xZ
+bTyMMMaytA2hrn4nNxIpbtjPZG2KmOlsTCOTXLfBS2NVeD8O1MCntu0QndGbJ9Ci
+zU+e7qpxNRNtct2YWa3Mc2DZxJGUgJwGE1TaFfk7aStsmx/kIqsLo73ZrYl1oIy8
+29oPYUtNAgMBAAECggEBAIQLvwrdvmROC4WB7EXmuBSymk9kdE9AGdmXQAk+GUO7
+xHMT05YIzAsWk+FM/CjJQghWpgMf7FYQKvLgJsLIT3dMCHttaeB+4NfJL7g6HCmF
+APFqjBtCAQUd0F3J3qXWzqNW7ccRgJWDSJ9uL3dqpdu7WyoGeVZbOvynCmeTha0d
+tKfCU6/GekEgTG0HvnK702GFFqAx3kEH8dd4Yjo1ojtArmHYBaVMkdoVMFnkSKJN
+bOacn3KZwPllnWRmVl6E92hwiB01LI6rWqMbqfE595Bpt+kx0ywM/EqKFCl124EG
+be3mvv6nLlp9/5BmXEm5QlRa6q942Gn2Lv72a55D9YUCgYEA0qGKJttYbvBoUDbr
+cqAVIQSb6AT9NK/1fF1jCR86XlBxyptxC7+GPb0NoY246PQYROwad+yxf2eqoDfw
+W7wL+n8pNi+jUlWkNJoEQshsCS2SBFG8usOf2keyIthk+YDtxzw1BEMHYwLIhcKU
+KxjWmF7IhUocSFZ6FJFOWVVfFuMCgYEAwnZvl5roQ/+AoT+Wp0nI8R23ph808yRw
+l+1p2CittHu/QDvtA8bDiMox02pyj9XzG3ZzZ1sai4UKxBmKxYPQImen3yY/DEf/
+2Pw1QiXER3wT+H5r/XV4oD86dqOnJQxRaQmhNyvdg4qITLof9nbq1eiYtzs4hLr8
+Of/97jWzfA8CgYBNuBl32Pu6g66Z2onqE7N4KXE1nZGofTzBlNvUI9evsVMrhUuj
+IBpycW20LM0L9/V0iQIDOi0Ma74DvGBOGQb6eS1FtzI2US9z0Vi9I6LpiA0W1uoi
+p8g2DLpoLRylC7OxDkApwGnbWM2QvYlalaGpO2AV/pCNCIunRy53vA6ILQKBgQC7
+mLPopjkBOB/n7scwVR7zdD6xlJNpKDMybYdZT0zbuzFyDx2EMiB5+sz8bklcdwKS
+8L896wZ9p/gN27Ii/xkvx52LyYKzH1YzBoN+b56dc5Z0d8lH9yZKORT2VMQvGmYD
+FZYf+kI03tTEaB3jjy7W8w84XHoWmagvb8SRI98lgwKBgBTuZHiiAs1RSASB4FIW
+I8F+d38nNvBonzjf6fbiizL7wLomrZt/7uLQyIDEPqPoeVefYdgiMDly9IbS731y
+a3kujhOhiysCu8oparaUze0C/MOqeLhS0OfyUd/wc9hX0FMBB22f++3Lvr4OZp7A
+YUSHkUwm9UuPpI3IFgcsxeDU
+-----END PRIVATE KEY-----
diff --git a/.auth_server_test/server/id_rsa.pub b/.auth_server_test/server/id_rsa.pub
new file mode 100644
index 0000000..f466edc
--- /dev/null
+++ b/.auth_server_test/server/id_rsa.pub
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAn//c9+fFvE8eML+a3Kmb
+Oq3+fEHiMH9YTeSyl5ydz4wYqd0EFYJTojO6YoAOfeERd9AEcEdVv/HEgA4OPdt/
+2CURlybLRwO2XYbIVyx4Lnc9I78utc8W3IxVnFc0eYPyguWgrM/lTPIUnu6vjw8X
+KTKzXPr3NuvIITeWAnEjCGePnqC8MfupcgQ0LrZfDDUfcftxutbQNbP8WW08jDDG
+srQNoa5+JzcSKW7Yz2RtipjpbEwjk1y3wUtjVXg/DtTAp7btEJ3RmyfQos1Pnu6q
+cTUTbXLdmFmtzHNg2cSRlICcBhNU2hX5O2krbJsf5CKrC6O92a2JdaCMvNvaD2FL
+TQIDAQAB
+-----END PUBLIC KEY-----
diff --git a/.auth_server_test/server/public_keys_clients/15e6534f-25ed-4ca4-abe5-487566bcd7b4.pub b/.auth_server_test/server/public_keys_clients/15e6534f-25ed-4ca4-abe5-487566bcd7b4.pub
new file mode 100644
index 0000000..1e492fc
--- /dev/null
+++ b/.auth_server_test/server/public_keys_clients/15e6534f-25ed-4ca4-abe5-487566bcd7b4.pub
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA62kYQSLnR6v3abZBwUdB
+257NvqJ7r44LwoxHD1SElvcoNsNrt1Vz2AP1H1uW8A4Yqbw7P704Ss5pFD6/kOKy
+EJz7z9q7W8HjBp8WLkop3mJOojUahZ1Vnq4erfujlP9/7dp2F+svyNsunGI299rz
+OzU9osbMkXuwRTakz5wZWgPlvwP3X+WP4PosrNOsJ54IR81XUPERICsL9kB0iq+X
+4ModQYmq41oFg9Rre4kmmNozOo1Fcn9tSsL1o+1Jlrsh8f8IElS8f5b7czN/rYxj
+42rK2vTvVeOM+0OoGi2lvXAVyJxhrUVSM5nYAv9Vw2jon7uzmR5KhS/hr66noJJ/
+WQIDAQAB
+-----END PUBLIC KEY-----
diff --git a/.client_test_3.py.swp b/.client_test_3.py.swp
deleted file mode 100644
index b8a671a..0000000
Binary files a/.client_test_3.py.swp and /dev/null differ
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index 15a15b2..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 65531ca..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index d95276c..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/pj_crypto_1_v2.iml b/.idea/pj_crypto_1_v2.iml
deleted file mode 100644
index 6711606..0000000
--- a/.idea/pj_crypto_1_v2.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index a534146..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1573564637760
-
-
- 1573564637760
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.server_test_3.py.swp b/.server_test_3.py.swp
deleted file mode 100644
index 40c5603..0000000
Binary files a/.server_test_3.py.swp and /dev/null differ
diff --git a/README.md b/README.md
old mode 100644
new mode 100755
diff --git a/client_test_3.py b/client_test_3.py
old mode 100644
new mode 100755
index 4b4a812..bc90f13
--- a/client_test_3.py
+++ b/client_test_3.py
@@ -1,3 +1,23 @@
+#===========================================================================================
+# _____ _____ _ _ _ __ __ ___ ____ _____ _____ ____ _ _
+# |_ _| ____| \ | | / \ | \/ |/ _ \| _ \_ _| ____/ ___| | | |
+# | | | _| | \| | / _ \ | |\/| | | | | |_) || | | _|| | | |_| |
+# | | | |___| |\ |/ ___ \| | | | |_| | _ < | | | |__| |___| _ |
+# |_| |_____|_| \_/_/ \_\_| |_|\___/|_| \_\|_| |_____\____|_| |_|
+#
+# Minimalist Auth Server V3 (Python 3.6)
+# (This file contains the client code)
+#
+# Sources:
+# https://nitratine.net/blog/post/asymmetric-encryption-and-decryption-in-python/
+# https://stackoverflow.com/questions/8933237/how-to-find-if-directory-exists-in-python
+# https://stackoverflow.com/questions/273192/how-can-i-safely-create-a-nested-directory
+#
+#
+# ROMANET Valentin
+#===========================================================================================
+
+
# Python TCP Client A
import socket
@@ -16,7 +36,6 @@ from utils.symmetric_keys_manager_1 import *
host = socket.gethostname()
port = 2004
BUFFER_SIZE = 2000
-#MESSAGE = input("tcpClientA: Enter message/ Enter exit:").encode('utf-8')
MESSAGE = ""
tcpClientA = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcpClientA.connect((host, port))
@@ -25,6 +44,7 @@ got_pub_key_server = False
(private_key,public_key) = check_for_existing_keys()
public_key_pem = public_key_serializer(public_key)
+
def de_serialize_pub_key(public_key_pem):
return serialization.load_pem_public_key(public_key_pem,backend=default_backend())
@@ -39,6 +59,8 @@ while MESSAGE != 'exit':
got_pub_key_server = True
print("[DEBUG] SessionID Found ! [ OK ]")
else:
+ print("[DEBUG] SessionID Found ! [ FAIL ]")
+ print("[DEBUG] Waiting for new SessionID [ ... ]")
#if find sessionID load it and negociate with server
#else send public key ...
print("[DEBUG] Receiving Server Public Key [ ... ]")
@@ -60,6 +82,7 @@ while MESSAGE != 'exit':
print("[DEBUG] Waiting for new Symmetric Key and New SessionID [ OK ] ")
print("[DEBUG] Symmetric Key: [" + str(new_symmetric_key) + "]")
print("[DEBUG] SessionID : [" + new_session_id + "]")
+ print("[DEBUG] Waiting for new SessionID [ OK ]")
print("[DEBUG] Saving basic HandShake infos [ ... ] ")
save_sym_key_by_host(host, new_session_id, new_symmetric_key, public_key_server)
diff --git a/.clients_keys b/draft/.clients_keys
old mode 100644
new mode 100755
similarity index 100%
rename from .clients_keys
rename to draft/.clients_keys
diff --git a/.hosts_keys b/draft/.hosts_keys
old mode 100644
new mode 100755
similarity index 100%
rename from .hosts_keys
rename to draft/.hosts_keys
diff --git a/client_test_1.py b/draft/client_test_1.py
old mode 100644
new mode 100755
similarity index 100%
rename from client_test_1.py
rename to draft/client_test_1.py
diff --git a/client_test_2.py b/draft/client_test_2.py
old mode 100644
new mode 100755
similarity index 100%
rename from client_test_2.py
rename to draft/client_test_2.py
diff --git a/decrypted_file.txt b/draft/decrypted_file.txt
old mode 100644
new mode 100755
similarity index 100%
rename from decrypted_file.txt
rename to draft/decrypted_file.txt
diff --git a/encrypted_file.data b/draft/encrypted_file.data
old mode 100644
new mode 100755
similarity index 100%
rename from encrypted_file.data
rename to draft/encrypted_file.data
diff --git a/not_encrypted_file.txt b/draft/not_encrypted_file.txt
old mode 100644
new mode 100755
similarity index 100%
rename from not_encrypted_file.txt
rename to draft/not_encrypted_file.txt
diff --git a/private_key.key b/draft/private_key.key
old mode 100644
new mode 100755
similarity index 100%
rename from private_key.key
rename to draft/private_key.key
diff --git a/public_key.pub b/draft/public_key.pub
old mode 100644
new mode 100755
similarity index 100%
rename from public_key.pub
rename to draft/public_key.pub
diff --git a/server_test_1.py b/draft/server_test_1.py
old mode 100644
new mode 100755
similarity index 100%
rename from server_test_1.py
rename to draft/server_test_1.py
diff --git a/server_test_2.py b/draft/server_test_2.py
old mode 100644
new mode 100755
similarity index 100%
rename from server_test_2.py
rename to draft/server_test_2.py
diff --git a/keys_manager_1.py b/keys_manager_1.py
old mode 100644
new mode 100755
diff --git a/server_test_3.py b/server_test_3.py
old mode 100644
new mode 100755
index 533caa3..39debb9
--- a/server_test_3.py
+++ b/server_test_3.py
@@ -1,3 +1,22 @@
+#===========================================================================================
+# _____ _____ _ _ _ __ __ ___ ____ _____ _____ ____ _ _
+# |_ _| ____| \ | | / \ | \/ |/ _ \| _ \_ _| ____/ ___| | | |
+# | | | _| | \| | / _ \ | |\/| | | | | |_) || | | _|| | | |_| |
+# | | | |___| |\ |/ ___ \| | | | |_| | _ < | | | |__| |___| _ |
+# |_| |_____|_| \_/_/ \_\_| |_|\___/|_| \_\|_| |_____\____|_| |_|
+#
+# Minimalist Auth Server V3 (Python 3.6)
+# (This file contains the server code)
+#
+# Sources:
+# https://nitratine.net/blog/post/asymmetric-encryption-and-decryption-in-python/
+# https://stackoverflow.com/questions/8933237/how-to-find-if-directory-exists-in-python
+# https://stackoverflow.com/questions/273192/how-can-i-safely-create-a-nested-directory
+#
+#
+# ROMANET Valentin
+#===========================================================================================
+
import socket
from threading import Thread
from socketserver import ThreadingMixIn
@@ -6,7 +25,7 @@ from utils.server_keys_manager import *
from utils.symmetric_keys_manager_1 import *
from utils.rsa_tenamortech_utils import *
# --- Init keys ---
-()
+
def de_serialize_pub_key(public_key_pem):
return serialization.load_pem_public_key(public_key_pem,backend=default_backend())
@@ -72,7 +91,6 @@ class ClientThread(Thread):
print("[DEBUG] I'm all yours... [ :) ]")
conn.send(encrypt_msg("login:".encode('utf-8'), public_key_client))
- #print("Server received data:", data)
MESSAGE = input("Multithreaded Python server : Enter Response from Server/Enter exit:").encode('utf-8')
if MESSAGE == 'exit':
break
diff --git a/utils/__init__.py b/utils/__init__.py
old mode 100644
new mode 100755
diff --git a/utils/__pycache__/__init__.cpython-36.pyc b/utils/__pycache__/__init__.cpython-36.pyc
old mode 100644
new mode 100755
diff --git a/utils/__pycache__/client_keys_manager.cpython-36.pyc b/utils/__pycache__/client_keys_manager.cpython-36.pyc
old mode 100644
new mode 100755
diff --git a/utils/__pycache__/keys_manager_1.cpython-36.pyc b/utils/__pycache__/keys_manager_1.cpython-36.pyc
old mode 100644
new mode 100755
diff --git a/utils/__pycache__/rsa_tenamortech_utils.cpython-36.pyc b/utils/__pycache__/rsa_tenamortech_utils.cpython-36.pyc
index a87b88e..13c296a 100644
Binary files a/utils/__pycache__/rsa_tenamortech_utils.cpython-36.pyc and b/utils/__pycache__/rsa_tenamortech_utils.cpython-36.pyc differ
diff --git a/utils/__pycache__/server_keys_manager.cpython-36.pyc b/utils/__pycache__/server_keys_manager.cpython-36.pyc
old mode 100644
new mode 100755
diff --git a/utils/__pycache__/symmetric_keys_manager_1.cpython-36.pyc b/utils/__pycache__/symmetric_keys_manager_1.cpython-36.pyc
index 9c1f4bf..eeb0ac2 100644
Binary files a/utils/__pycache__/symmetric_keys_manager_1.cpython-36.pyc and b/utils/__pycache__/symmetric_keys_manager_1.cpython-36.pyc differ
diff --git a/utils/client_keys_manager.py b/utils/client_keys_manager.py
old mode 100644
new mode 100755
diff --git a/utils/key.key b/utils/key.key
deleted file mode 100644
index 8551253..0000000
--- a/utils/key.key
+++ /dev/null
@@ -1 +0,0 @@
-c8Vo7OdLcNQJL2aDeLVepcGwOkXxnibd_BiOL6r42TM=
\ No newline at end of file
diff --git a/utils/keys_manager_1.py b/utils/keys_manager_1.py
old mode 100644
new mode 100755
diff --git a/utils/rsa_tenamortech_utils.py b/utils/rsa_tenamortech_utils.py
old mode 100644
new mode 100755
index c58d519..c96b30c
--- a/utils/rsa_tenamortech_utils.py
+++ b/utils/rsa_tenamortech_utils.py
@@ -74,7 +74,7 @@ def save_key(key, key_type, host):
path = root_file_path + 'client'
keys_dir_path = Path.home() / path
# Path exists ? If not we will create it
- keys_dir_path.mkdir(exist_ok=True)
+ keys_dir_path.mkdir(parents=True, exist_ok=True)
if(key_type == 0):
key_pem = private_key_serializer(key)
key_path = keys_dir_path / 'id_rsa'
diff --git a/utils/send_receive.py b/utils/send_receive.py
deleted file mode 100644
index 6ea5ad7..0000000
--- a/utils/send_receive.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#===============================================================
-# --- (Un)Pack msg length and msg itself ---
-#===============================================================
-from struct import *
-import asyncio, socket
-
-def send_msg(sock, msg):
- # Prefix each message with a 4-byte length (network byte order)
- msg = struct.pack('>I', len(msg)) + msg
- sock.sendall(msg)
-
-def send_msg_async(writer, msg):
- # Prefix each message with a 4-byte length (network byte order)
- msg = struct.pack('>I', len(msg)) + msg
- writer.write(msg)
- #sock.sendall(msg)
-
-def recv_msg(reader):
- # Read message length and unpack it into an integer
- raw_msglen = reader.read(255)
- if not raw_msglen:
- return None
- msglen = unpack('>I', raw_msglen)[0]
- # Read the message data
- return recvall(reader)
-
-def recvall(reader, n):
- # Helper function to recv n bytes or return None if EOF is hit
- data = bytearray()
- while len(data) < n:
- packet = reader.read(n - len(data))
- if not packet:
- return None
- data.extend(packet)
- return data
diff --git a/utils/server_keys_manager.py b/utils/server_keys_manager.py
old mode 100644
new mode 100755
diff --git a/utils/symmetric_keys_manager_1.py b/utils/symmetric_keys_manager_1.py
old mode 100644
new mode 100755
index 7575aff..379af22
--- a/utils/symmetric_keys_manager_1.py
+++ b/utils/symmetric_keys_manager_1.py
@@ -6,7 +6,7 @@ import uuid
# To get user home directory
from pathlib import Path
-
+import os
# Home made RSA Keys lib
from utils.rsa_tenamortech_utils import *
@@ -86,17 +86,18 @@ def reload_session_by_host(host):
host_found = False
- # --- Open session file
- with open(str(root_file_path) + "/.known_hosts") as f:
- line = f.readline().rstrip()
- while(line and host_found == False):
- # each line contains (host session_id, sym_key)
- # Those infos are spaced with "space" char, so we use 'split' fuction to get an array
- cur_server_infos = line.split()
- # If we find the given host:
- if(cur_server_infos[0] == host): # cur_client_info[0] is the host stored in the cur line
- host_found = True
+ # --- Open session file
+ if os.path.isfile(str(root_file_path) + "/.known_hosts"):
+ with open(str(root_file_path) + "/.known_hosts") as f:
line = f.readline().rstrip()
+ while(line and host_found == False):
+ # each line contains (host session_id, sym_key)
+ # Those infos are spaced with "space" char, so we use 'split' fuction to get an array
+ cur_server_infos = line.split()
+ # If we find the given host:
+ if(cur_server_infos[0] == host): # cur_client_info[0] is the host stored in the cur line
+ host_found = True
+ line = f.readline().rstrip()
# --- We found the given host, so we will now load the corresponding server public key we previously stored.
if host_found == True: