generatePrivateKeyForUser now accept the server's public key for easier testing (the output file will contain the keyphrase, client_private_key, server_public_key)
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@@ -11,7 +11,6 @@ from Crypto.Protocol.KDF import bcrypt, bcrypt_check
 | 
			
		||||
auth_logger = logging.getLogger('AUTH APPLICATION ')
 | 
			
		||||
auth_logger.root.setLevel(logging.INFO)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Authetication:
 | 
			
		||||
    ABSOLUTE_PATH = os.path.abspath(os.path.dirname(sys.argv[0]))
 | 
			
		||||
    HOME_DIRECTORY_LOCATION = ABSOLUTE_PATH + "\\home"
 | 
			
		||||
@@ -71,7 +70,7 @@ class Authetication:
 | 
			
		||||
        os.mkdir(self.PRIVATE_KEY_DIRECTORY_LOCATION)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def generatePrivateKeyForUser(self, username:str, user_passphrase:str) -> bool:
 | 
			
		||||
    def generatePrivateKeyForUser(self, username:str, user_passphrase:str, public_server_key='') -> bool:
 | 
			
		||||
        if self.checkUserExists(username):
 | 
			
		||||
            with open(self.CONFIG_DIRECTORY_LOCATION + '\\config.txt') as json_file:
 | 
			
		||||
                data = json.load(json_file)
 | 
			
		||||
@@ -82,7 +81,7 @@ class Authetication:
 | 
			
		||||
            public_key_value = str(public_key.export_key('DER', pkcs=8))
 | 
			
		||||
 | 
			
		||||
            ##Save private key in separate file
 | 
			
		||||
            user_privatekey = {'passphrase': user_passphrase, 'privateKey': private_key_value}
 | 
			
		||||
            user_privatekey = {'passphrase': user_passphrase, 'privateClientKey': private_key_value, 'publicServerKey': public_server_key}
 | 
			
		||||
            with open(self.PRIVATE_KEY_DIRECTORY_LOCATION + '\\' + str(data['index']) + '.txt', 'w+') as outfile:
 | 
			
		||||
                json.dump(user_privatekey, outfile)
 | 
			
		||||
 | 
			
		||||
@@ -93,7 +92,6 @@ class Authetication:
 | 
			
		||||
                    with open(self.CONFIG_DIRECTORY_LOCATION + '\\config.txt', 'w') as outfile:
 | 
			
		||||
                        json.dump(data, outfile)
 | 
			
		||||
                    break
 | 
			
		||||
 | 
			
		||||
            return True
 | 
			
		||||
        else:
 | 
			
		||||
            return False
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user