Beispiel #1
0
def test_normal_login_long_password():

    ctx = client.context() 
    clientSock = client.clientSocket(ctx)
    
    connection(clientSock)
    assert registration(clientSock, user_name = 'david', password ='******') == SUCCESS
Beispiel #2
0
def test_empty_login_password():

    ctx = client.context() 
    clientSock = client.clientSocket(ctx)
    
    connection(clientSock)
    assert registration(clientSock, user_name = '', password = '') == SUCCESS
Beispiel #3
0
def test_normal_login_empty_password():

    ctx = client.context()
    clientSock = client.clientSocket(ctx)

    connection(clientSock)
    assert registration(clientSock, user_name='david', password='') == SUCCESS
Beispiel #4
0
def test_normal_login_normal_password():

    ctx = client.context() 
    clientSock = client.clientSocket(ctx)
    
    connection(clientSock)
    assert registrate_by_normal_login_password(clientSock, user_name = 'david', password ='******') != FAILURE
Beispiel #5
0
def test_long_login_password():

    ctx = client.context() 
    clientSock = client.clientSocket(ctx)
    
    connection(clientSock) #long than 20 symbol
    assert registration(clientSock, user_name = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa', password =
    '******') == SUCCESS
Beispiel #6
0
def test_normal_login_normal_password():

    ctx = client.context()
    clientSock = client.clientSocket(ctx)

    connection(clientSock)
    assert registrate_by_normal_login_password(
        clientSock, user_name='david', password='******') != FAILURE
Beispiel #7
0
def test_long_login_password():

    ctx = client.context()
    clientSock = client.clientSocket(ctx)

    connection(clientSock)  #long than 20 symbol
    assert registration(
        clientSock,
        user_name='aaaaaaaaaaaaaaaaaaaaaaaaaaaa',
        password='******') == SUCCESS
Beispiel #8
0
def test_empty_login_long_password():

    ctx = client.context()
    clientSock = client.clientSocket(ctx)

    connection(clientSock)
    assert registration(
        clientSock,
        user_name='',
        password='******'
    ) == SUCCESS
def test_RSA_key():
    
    ctx = client.context() 
    clientSock = client.clientSocket(ctx)
    
    connection(clientSock)
   
    registration(clientSock, 'DavidRSA', 'david')
    
    demand_services(clientSock)
    
    t0 = time.time()
    
    for i in range (0, 500):
	RSA_key(clientSock)
 	demand_services(clientSock)

        
    print 'time: ', time.time() - t0
    
    assert 1	
Beispiel #10
0
def test_AES_key():

    ctx = client.context()
    clientSock = client.clientSocket(ctx)

    connection(clientSock)

    registration(clientSock, 'DavidAES', 'david')

    demand_services(clientSock)

    t0 = time.time()

    for i in range(0, 500):
        #    while time.time() - t0 < 1.0:
        get_key_ID(clientSock)
        demand_services(clientSock)

    print 'time: ', time.time() - t0

    assert 1
def test_AES_encryption():
   
    ctx = client.context() 
    clientSock = client.clientSocket(ctx)
    
    connection(clientSock)
   
    registration(clientSock, 'DavidAES', 'david')
    
    demand_services(clientSock)
    
       
    t0 = time.time()

    for i in range(1,100):
	key_ID = get_key_ID(clientSock)
	demand_services(clientSock)
	res = AES_encryption( clientSock, key_ID, '/home/davidt/workspace/CSP/src/python_client/AES_test_file')   
	demand_services(clientSock)
    
    print time.time() - t0
    assert  res == 0#-1
def test_AES_key():
    
    ctx = client.context() 
    clientSock = client.clientSocket(ctx)
    
    connection(clientSock)
   
    registration(clientSock, 'DavidAES', 'david')
    
    demand_services(clientSock)
    
    t0 = time.time()
    
    for i in range (0, 500):
#    while time.time() - t0 < 1.0:
	get_key_ID(clientSock)
 	demand_services(clientSock)

        
    print 'time: ', time.time() - t0
    
    assert 1	
Beispiel #13
0
def test_AES_encryption():

    ctx = client.context()
    clientSock = client.clientSocket(ctx)

    connection(clientSock)

    registration(clientSock, 'DavidAES', 'david')

    demand_services(clientSock)

    t0 = time.time()

    for i in range(1, 100):
        key_ID = get_key_ID(clientSock)
        demand_services(clientSock)
        res = AES_encryption(
            clientSock, key_ID,
            '/home/davidt/workspace/CSP/src/python_client/AES_test_file')
        demand_services(clientSock)

    print time.time() - t0
    assert res == 0  #-1
Beispiel #14
0
import getpass
import sys
import time

from OpenSSL import SSL, crypto

parser = argparse.ArgumentParser()
parser.add_argument("--host", help="specify the host to connect with", default="127.0.0.1")
parser.add_argument("--port", help="specify the port of the host", type=int, default=8888)

args = parser.parse_args()

# Initialize context
ctx = client.context()

clientSock = client.clientSocket(ctx)

clientSock.connect(args.host, args.port)

print "Secure connection established"

#time.sleep(0.5) # In order to ....

options = {
        1 : clientSock.get_sha1_file,  2 : clientSock.get_sha1_string, 3 :
	clientSock.symmetric_key,      4 : clientSock.symmetric_key,  5  :
	clientSock.symmetric_key,      6 : clientSock.symmetric_key,  7  :
	clientSock.symmetric_key,      8 : clientSock.DES_encr_decr, 9  : clientSock.DES_encr_decr,
	10 : clientSock.AES_encr_decr, 11 : clientSock.AES_encr_decr, 12 :
	clientSock.AES_encr_decr, 13 : clientSock.DES_encr_decr, 14 : clientSock.DES_encr_decr, 15 :
	clientSock.AES_encr_decr, 16 : clientSock.AES_encr_decr, 17 : clientSock.AES_encr_decr,
Beispiel #15
0
parser = argparse.ArgumentParser()
parser.add_argument("--host",
                    help="specify the host to connect with",
                    default="127.0.0.1")
parser.add_argument("--port",
                    help="specify the port of the host",
                    type=int,
                    default=8888)

args = parser.parse_args()

# Initialize context
ctx = client.context()

clientSock = client.clientSocket(ctx)

clientSock.connect(args.host, args.port)

print "Secure connection established"

#time.sleep(0.5) # In order to ....

options = {
    1: clientSock.get_sha1_file,
    2: clientSock.get_sha1_string,
    3: clientSock.symmetric_key,
    4: clientSock.symmetric_key,
    5: clientSock.symmetric_key,
    6: clientSock.symmetric_key,
    7: clientSock.symmetric_key,