php - passing openssl_encrypt encrypted data as query string -


i using openssl_encrypt , openssl_decrypt functions encrypt , decrypt id passed querystring. in cases encrypted query string contains '+' character. causes problem in openssl_decrypt function , gets following warning.

$x = openssl_encrypt ('3', 'aes-256-cbc', $password,0, $iv); echo openssl_decrypt ($x, 'aes-256-cbc', $password,0, $iv); 

warning: openssl_decrypt(): failed base64 decode input

please let me know if there other method encrypt data without '+' characters. want limit character length of encrypted id below 100.

there characters must url-encoded in query string query string must un-encoded prior use. seeing space character being encoded "+".

see url encoding - wikipedia.

html 5 specifies following transformation submitting html forms "get" method web server:[1]

characters cannot converted correct charset replaced html numeric character references[11]

  • space encoded '+' or '%20'
  • letters (a–z , a–z), numbers (0–9) , characters '*','-','.' , '_' left as-is
  • all other characters encoded %hh hex representation non-ascii characters first encoded utf-8 (or other specified encoding)

Comments