The following is a sample encryption in asp sent to a .jsp page for decoding and processing the data,
requestparameter = "somedata";
Key = "someKey";
requestparameter = AES128Bit.encrypt(requestparameter, Key);
<form name="form1" method="post" action="https://someurl/somepage.jsp">
<input type="hidden" name=" requestparameter " value="<%= requestparameter %>">
<input type="submit" name="submit" value="Submit">
</form>
I am trying to do the similar encryption in PHP by following :-
$requestparameter = "somedata";
$Key = "someKey";
$method = 'aes128';
$requestparameter = openssl_encrypt ($requestparameter, $method, $Key);
<form name="form1" method="post" action="https://someurl/somepage.jsp">
<input type="hidden" name=" requestparameter " value="<?php echo $requestparameter ?>">
<input type="submit" name="submit" value="Submit">
</form>
I have enabled OpenSSL support.
But the target page always shows
Error while decoding
The url shows an errorcode like the following
pageUrl?errorCode=isDecoded
I think this means that the encryption method that I am using to encrypt in PHP can not be properly decoded by the .jsp page. My question is…
What will be the ASP equivalent PHP encryption method/code for this?
Try using the php mcrypt function instead, that might work. Mcrypt and and openssl_encrypt will return different results, even when using the same encryption methods as they work slightly differently. Compare the output of the ASP function to the results of the two methods in PHP and see if one of them returns the same results.