File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@ def generatePrivateKeyForUser(auth: Authetication,username: str, user_passphrase
|
|||||||
with open(auth.CONFIG_FILE_LOCATION) as json_file:
|
with open(auth.CONFIG_FILE_LOCATION) as json_file:
|
||||||
data = json.load(json_file)
|
data = json.load(json_file)
|
||||||
|
|
||||||
private_key = RSA.generate(2048)
|
private_key = RSA.generate(8192)
|
||||||
public_key = private_key.publickey()
|
public_key = private_key.publickey()
|
||||||
private_key_value = bytes.hex(private_key.exportKey('DER', passphrase=user_passphrase, pkcs=8))
|
private_key_value = bytes.hex(private_key.exportKey('DER', passphrase=user_passphrase, pkcs=8))
|
||||||
public_key_value = bytes.hex(public_key.exportKey('DER', pkcs=8))
|
public_key_value = bytes.hex(public_key.exportKey('DER', pkcs=8))
|
||||||
@@ -44,7 +44,7 @@ def generatePrivateKeyForServer(auth: Authetication,passphrase: str) -> str:
|
|||||||
data = json.load(json_file)
|
data = json.load(json_file)
|
||||||
json_file.close()
|
json_file.close()
|
||||||
|
|
||||||
private_key = RSA.generate(2048)
|
private_key = RSA.generate(8192)
|
||||||
public_key = private_key.publickey()
|
public_key = private_key.publickey()
|
||||||
private_key_value = bytes.hex(private_key.exportKey('DER', passphrase=passphrase, pkcs=8, protection="scryptAndAES128-CBC"))
|
private_key_value = bytes.hex(private_key.exportKey('DER', passphrase=passphrase, pkcs=8, protection="scryptAndAES128-CBC"))
|
||||||
public_key_value = bytes.hex(public_key.exportKey('DER', pkcs=8))
|
public_key_value = bytes.hex(public_key.exportKey('DER', pkcs=8))
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class NetWrapper:
|
|||||||
self.currentClientPublicKey = "".encode('UTF-8')
|
self.currentClientPublicKey = "".encode('UTF-8')
|
||||||
self.serverPrivateKey = serverPrivateKey
|
self.serverPrivateKey = serverPrivateKey
|
||||||
self.cipherkey = "".encode('UTF-8')
|
self.cipherkey = "".encode('UTF-8')
|
||||||
self.network = network_interface('./', 'A')
|
self.network = network_interface('./../../netsim/network/', 'A')
|
||||||
self.clientAddr = ""
|
self.clientAddr = ""
|
||||||
self.currentUser = ""
|
self.currentUser = ""
|
||||||
self.authenticationInstance = authenticationInstance
|
self.authenticationInstance = authenticationInstance
|
||||||
@@ -64,6 +64,7 @@ class NetWrapper:
|
|||||||
serverpubkey = int(cipher_rsa.decrypt(b64decode(decodedmsg['message'])).decode('UTF-8'))
|
serverpubkey = int(cipher_rsa.decrypt(b64decode(decodedmsg['message'])).decode('UTF-8'))
|
||||||
self.cipherkey = dh.gen_shared_key(serverpubkey).encode('UTF-8')
|
self.cipherkey = dh.gen_shared_key(serverpubkey).encode('UTF-8')
|
||||||
|
|
||||||
|
|
||||||
def login(self) -> bool:
|
def login(self) -> bool:
|
||||||
b64 = {'source': '', 'type': ''}
|
b64 = {'source': '', 'type': ''}
|
||||||
while not (b64['source'] == self.clientAddr and b64['type'] == 'AUT'):
|
while not (b64['source'] == self.clientAddr and b64['type'] == 'AUT'):
|
||||||
@@ -95,10 +96,15 @@ class NetWrapper:
|
|||||||
print("Incorrect decryption")
|
print("Incorrect decryption")
|
||||||
|
|
||||||
def initClientConnection(self, msg: bytes) -> bytes:
|
def initClientConnection(self, msg: bytes) -> bytes:
|
||||||
|
print('3')
|
||||||
try:
|
try:
|
||||||
|
print('4')
|
||||||
self.serverIdentify(msg)
|
self.serverIdentify(msg)
|
||||||
|
print('5')
|
||||||
self.keyExchange()
|
self.keyExchange()
|
||||||
|
print('6')
|
||||||
success = self.login()
|
success = self.login()
|
||||||
|
print('7')
|
||||||
if success:
|
if success:
|
||||||
return "LINOK".encode('UTF-8')
|
return "LINOK".encode('UTF-8')
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user