示例#1
0
def pack_message(message, crypto_dict, verbose = False):

	if verbose:
		print "\n"
		
	# Compile message
	client_message = encodeMessage(message) + ";" + crypto_dict["rsa_user_public_key_hash"]

	return util.pack_message_general(client_message, crypto_dict, "client", verbose)
示例#2
0
def pack_message(message, crypto_dict, verbose = False):
	
	if verbose:
		print "\n"

	# Update AES session key
	try:
		crypto_dict["aes_session_ids"][crypto_dict["rsa_user_public_key_hash"]] = str(rand.rand_byte(32))[:32]
	except Exception as inst:
		return [False, "Error [ " + str(inspect.stack()[0][3]) + " -> rand ]: " + str(inst)]

	util.debug(verbose, "aes_session_id", crypto_dict["aes_session_ids"][crypto_dict["rsa_user_public_key_hash"]])

		
	server_message = message + ";" + crypto_dict["aes_session_ids"][crypto_dict["rsa_user_public_key_hash"]]

	return util.pack_message_general(server_message, crypto_dict, "server", verbose)