Hi,
I'm having this problem, where I have this
const char * Decrypted_Message2 that contains a
certificate, browser nonce, and a Server Nonce (Separated by a delimiter ,).
I have this function that split them individually, using the delimiter "," character. And I want to retrieve the second and third items into the Array.
At first it works fine and I get the browser nonce, which is called
"Recovered_Browser_Nonce_from_Message2 ". But then when I call the split function again to get the server nonce
"Recovered_Server_Nonce_from_Message2", I find that the "Decrypted_Message" is empty!!!!!!
const char * Decrypted_Message2 = Decrypt_Message2(encrypted_message2, Shared_Session_Key_C );
cout<<"\n\nDECRYPTED MESSAGE2 {S,nb,ns}: "<<Decrypted_Message2;
const char * Recovered_Browser_Nonce_from_Message2 = Split_Server_Message2(Decrypted_Message2, true);
cout<<"\n\nRECOVERED_BROWSER_NONCE:"<<Recovered_Browser_Nonce_from_Message2;
cout<<"\n\ndecrypted message2:"<<Decrypted_Message2;
const char * Recovered_Server_Nonce_from_Message2 = Split_Server_Message2(Decrypted_Message2, false);
cout<<"\nRECOVERED SERVER NONCE: "<<Recovered_Server_Nonce_from_Message2;
the following is the split function:
const char * Client_Side::Split_Server_Message2(CkString Recieved_Message2_from_Server, bool flag)
{
const char * Recovered_nb = "";
const char * Recovered_ns = "";
bool exceptDoubleQuoted = true;
bool exceptEscaped = true; bool keepEmpty = false; char delimiter = ',';
CkStringArray *array = Recieved_Message2_from_Server.split(delimiter,exceptDoubleQuoted,exceptEscaped,keepEmpty);
if(flag == true)
{
for (int i=0; i<array->get_Count(); i++)
{
array->getString(i);
Recovered_nb = array->getString(1); }
return Recovered_nb;
}
else
{
for (int j=0; j<array->get_Count(); j++)
{
array->getString(j);
Recovered_ns = array->getString(2); }
return Recovered_ns;
}
}
I've been struggling with this issue for two whole days now, and I cant seem to find the problem!!!!
Can someone please help me with this.
Regards.
Rania
What I have tried:
1- I've tried copying the "Decrypted_Message2" into another string, it didn't work either.
I even tried writing another "split" function, only to retrieve the third item, but it didn't work.