0

I am working with php and i am using "Openssl encryption",Whenever i am encrypt "id" and append with url and then click on that url then different "text/url" showing in browser ? where i am wrong ? For example here is my url

http://xxxxxx.com/wp-admin/response?useremail=347Dx7YeET0KiHV3XyYYrIwZ0bYahglDhxzag0VM+D8=

And whenever i am use above url in my browser then it convert with

http://xxxxxx.com/response/?useremail=347Dx7YeET0KiHV3XyYYrIwZ0bYahglDhxzag0VM%20D8%3D

Here is my code

$encryptedText2 = openssl_encrypt($email_encrypt,"AES-128-CBC",$secretKey,OPENSSL_RAW_DATA,$iv);
$useremails_encrypts = base64_encode($encryptedText2);
Amy
  • 186
  • 8
  • `url encoding` - the browser will convert particular characters in a querystring... you need to `urldecode` before attempting to decrypt is my guess – Professor Abronsius Jun 10 '22 at 06:03
  • @ProfessorAbronsius: Actually whenever i am getting this "URL" using "GET" Method then "+" sign is missing Encrypted id i passed is - " H93WSYmMu+2/spFe7GHBBg== " Encrypted id i am getting is - H93WSYmMu 2/spFe7GHBBg== – Amy Jun 10 '22 at 06:13
  • And that's because `+` _is_ the encoding for a space character, in the older RFC 1630 encoding specification. You need to apply URL encoding to this parameter value, so that the `+` becomes `%2B` - then it will not be mistaken for an encoded space character any more, but will properly decode to a `+` again. – CBroe Jun 10 '22 at 06:17
  • @CBroe: which thing should i change in code ? please explain so i can check – Amy Jun 10 '22 at 06:28
  • https://stackoverflow.com/questions/4744888/how-to-properly-url-encode-a-string-in-php – CBroe Jun 10 '22 at 06:30
  • @CBroe: can you edit in my code please – Amy Jun 10 '22 at 06:45
  • You have just been referred to an extensive explanation of the issue, including code samples that show how to handle this. Please show a bit of effort yourself first now at this point - read the explanation, make sure you have understood it, and then try to apply it. If you still have problems, then show what you tried. – CBroe Jun 10 '22 at 07:02

0 Answers0