Long key
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DESKTOP-DPA61F8\Benedek 2021-04-25 19:15:08 +02:00
parent c5d4859326
commit 45bab9c9f3
5 changed files with 12 additions and 4 deletions

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

View File

@ -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))

View File

@ -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: