I have implemented RC4 encryption/decryption in my application as given below. at the end of the line exception coming.
string sFNToBase64String = Convert.ToBase64String(Encoding.ASCII.GetBytes("Malhotra")); string sEnFirstName = CommonFunction.RC4EncryptDecrypt(sKey, sFNToBase64String); //calling webservice localhost.LoginRequest objRQ = new localhost.LoginRequest(); string sIsValidate = objRQ.ValidateRequest(sEnFirstName); //Exception coming on this line Exception comes
//Exception coming The request failed with HTTP status 400: Bad Request. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The request failed with HTTP status 400: Bad Request. How can we resolve it.
-----------UPDATE-------------------
Actually the problem is only with encrypted text of "Malhotra"[ encrypted text: CX±£þÕlêÁ$]. i think there are some special characters that web service call doesn't allow.
How can we handle this one?
-----------------------Encrypted/Decrypted Process---------------------
//Encrypte string sEnLastName = CommonFunction.RC4EncryptDecrypt(sKey, "Malhotra"); //Encode string sLNToBase64String = Convert.ToBase64String(Encoding.ASCII.GetBytes(sEnLastName)); //Decode string sDecodeLastName = Encoding.ASCII.GetString(Convert.FromBase64String(sLNToBase64String)); //Decrypte string sDeLastName = CommonFunction.RC4EncryptDecrypt(sKey, sDecodeLastName);