I have this code :
<?php
$key = 'thisisakey';
$iv = '1234567812345678';
$plaintext = 'Hello World';
$ciphertext = openssl_encrypt($plaintext, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
echo $ciphertext . '<br>';
$plaintext = openssl_decrypt($ciphertext, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
echo $plaintext . '<br>';
?>
The idea behind this code was encrypt the data to be used on the URL. So, I'm expecting output which URL friendly. I mean, it contains alpha-numeric characters only. But when I use this openssl_encrypt
function, I got weird characters, which I don't think URL friendly.
it produces output like this :
^‘-7Ⱦ®l¿ô¾áÙ
how to generate URL friendly characters from openssl_encrypt
? thank you