|
@@ -95,7 +95,7 @@ class Mitigator : public Php::Base
|
|
|
plaintext_length = base64_client_ciphertext_length;
|
|
|
memcpy(plaintext_user_data, base64_client_ciphertext, base64_client_ciphertext_length);
|
|
|
plaintext_user_data_str = std::string((char*) plaintext_user_data, base64_client_ciphertext_length);
|
|
|
-
|
|
|
+/*
|
|
|
printf("Base64 encoded key:\n");
|
|
|
for(counter=0; counter < base64_client_public_key_length; counter++)
|
|
|
printf("%c", base64_client_public_key[counter]);
|
|
@@ -105,52 +105,52 @@ class Mitigator : public Php::Base
|
|
|
for(counter=0; counter < base64_client_ciphertext_length; counter++ )
|
|
|
printf("%c", base64_client_ciphertext[counter]);
|
|
|
printf("\n"); fflush(stdout);
|
|
|
-
|
|
|
+*/
|
|
|
client_data = (unsigned char*) malloc(base64_client_ciphertext_length + base64_client_public_key_length);
|
|
|
ret_status = base64_decoding_wrapper(client_data, base64_client_public_key, base64_client_public_key_length);
|
|
|
if(ret_status<=0)
|
|
|
{
|
|
|
- printf("Could not do base64 decoding correctly.\n"); fflush(stdout);
|
|
|
+// printf("Could not do base64 decoding correctly.\n"); fflush(stdout);
|
|
|
free(plaintext_user_data);
|
|
|
free(client_data);
|
|
|
return plaintext_user_data_str;
|
|
|
}
|
|
|
client_data_length = ret_status;
|
|
|
old_client_data_length=client_data_length;
|
|
|
- printf("Client public key:\n");
|
|
|
+/* printf("Client public key:\n");
|
|
|
for(counter=0; counter<client_data_length; counter++)
|
|
|
printf("%d ", client_data[counter]);
|
|
|
-
|
|
|
+*/
|
|
|
|
|
|
ret_status = base64_decoding_wrapper(client_data + client_data_length, base64_client_ciphertext, base64_client_ciphertext_length);
|
|
|
if(ret_status<=0)
|
|
|
{
|
|
|
- printf("Could not do base64 decoding correctly.\n"); fflush(stdout);
|
|
|
+// printf("Could not do base64 decoding correctly.\n"); fflush(stdout);
|
|
|
free(plaintext_user_data);
|
|
|
free(client_data);
|
|
|
return plaintext_user_data_str;
|
|
|
}
|
|
|
client_data_length += ret_status;
|
|
|
|
|
|
- printf("\n Ciphertext from client:\n");
|
|
|
+/* printf("\n Ciphertext from client:\n");
|
|
|
for(counter=old_client_data_length; counter<client_data_length; counter++)
|
|
|
printf("%d ", client_data[counter]);
|
|
|
printf("\n"); fflush(stdout);
|
|
|
-
|
|
|
+*/
|
|
|
ret_status=decrypt_client_data_through_decryptor(client_data, client_data_length, (unsigned char*) plaintext_user_data, &plaintext_length);
|
|
|
if(ret_status != 0)
|
|
|
{
|
|
|
- printf("Received error code: 0x%02x\n", ret_status); fflush(stdout);
|
|
|
+// printf("Received error code: 0x%02x\n", ret_status); fflush(stdout);
|
|
|
free(client_data);
|
|
|
free(plaintext_user_data);
|
|
|
return plaintext_user_data_str;
|
|
|
}
|
|
|
|
|
|
- printf("Going to return this plaintext:\n");
|
|
|
+/* printf("Going to return this plaintext:\n");
|
|
|
for(counter=0;counter<plaintext_length;counter++)
|
|
|
printf("%c", plaintext_user_data[counter]);
|
|
|
fflush(stdout);
|
|
|
-
|
|
|
+*/
|
|
|
plaintext_user_data_str = std::string((char*) plaintext_user_data, plaintext_length);
|
|
|
free(plaintext_user_data);
|
|
|
free(client_data);
|