|
@@ -127,6 +127,10 @@
|
|
|
if(internal_return_status != 0)
|
|
|
return internal_return_status;
|
|
|
|
|
|
+// hybridEncryptionBoxClient.get_symmetric_key(plaintext_client_data);
|
|
|
+// *plaintext_client_data_length = 16;
|
|
|
+// return 0;
|
|
|
+
|
|
|
// and then I will decrypt the rest of the client data with that key.
|
|
|
ciphertext_plus_tag = plaintext_client_public_key_plus_encrypted_data_plus_tag + ECDH_PUBLIC_KEY_SIZE;
|
|
|
ciphertext_plus_tag_length = total_length - ECDH_PUBLIC_KEY_SIZE;
|
|
@@ -250,7 +254,7 @@
|
|
|
{
|
|
|
free(first_decryption_output);
|
|
|
return internal_return_status;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
plaintext_client_data = (uint8_t*) malloc(first_decryption_output_length); // you will need less than this coz public key size.
|
|
|
internal_return_status = initialize_symmetric_key_decrypt_client_data(first_decryption_output, first_decryption_output_length, plaintext_client_data, &plaintext_client_data_length);
|
|
@@ -260,19 +264,11 @@
|
|
|
free(plaintext_client_data);
|
|
|
return internal_return_status;
|
|
|
}
|
|
|
+
|
|
|
// then I will encrypt the resulting first_decryption_output to the apache enclave.
|
|
|
- final_encryption_output = (uint8_t*) malloc(1000);
|
|
|
- internal_return_status = symmetricEncryptionBoxApache.encrypt_decrypt(1, plaintext_client_data, plaintext_client_data_length, final_encryption_output, &final_encryption_output_length);
|
|
|
- if(internal_return_status == 0)
|
|
|
- {
|
|
|
- for(counter=0;counter<final_encryption_output_length;counter++)
|
|
|
- output_ciphertext_plus_tag[counter]=final_encryption_output[counter];
|
|
|
- *output_ciphertext_plus_tag_length=final_encryption_output_length;
|
|
|
- }
|
|
|
+ internal_return_status = symmetricEncryptionBoxApache.encrypt_decrypt(1, plaintext_client_data, plaintext_client_data_length, output_ciphertext_plus_tag, output_ciphertext_plus_tag_length);
|
|
|
free(plaintext_client_data);
|
|
|
- free(final_encryption_output);
|
|
|
-
|
|
|
- return internal_return_status;
|
|
|
+ return internal_return_status;
|
|
|
}
|
|
|
|
|
|
// INTERNAL.
|