You need to sign in to do that
Don't have an account?

Encrypt in C# and decrypt using Apex.
I want to pass a field in the query string from asp .net to Apex . I want to encrypt the value of the field and then pass it in the query string. I am not sure how to approach this, are there any example code /links for same ? Basically i want to encrypt in C# and decrypt using Apex.
Hi,
I am not sure but you can't directly pass your querystring data to Apex page. You can try with HTTPPOST method to pass C# encrypt data to Apex. Please check encrypt and decrypt algorithm to support both side(C# and Apex).
Input Parameter :
URL : Your Apex URL
Parameters: Your Encrypt Data
Method : HttpPost
publicstring HttpPost(string URI, string Parameters)
{
System.Net.
WebRequest req = System.Net.WebRequest.Create(URI);
req.ContentType =
"application/x-www-form-urlencoded";
req.Method =
"POST";
// Add parameters to post
byte[] data = System.Text.Encoding.ASCII.GetBytes(Parameters);
req.ContentLength = data.Length;
System.IO.
Stream os = req.GetRequestStream();
os.Write(data, 0, data.Length);
os.Close();
// Do the post and get the response.
System.Net.
WebResponse resp = req.GetResponse();
if (resp == null) returnnull;
System.IO.
StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
return sr.ReadToEnd().Trim();
}
2) Second suggestion, you can also pass your data using Json or webservice
Regards,
Keyur Patel