I am trying to do AES encryption.
However, the encrypted string needs to be decrypted in PHP, and I don't know how to encrypt it in PureBasic.
I thought this page might be helpful, but I am not sure how to generate the key and IV.
The decryption in PHP is done as follows.
Code: Select all
<?php
$password = 'test';
$encrypted_text = $_POST["text"]; // Get base64 encoded text from POST request.
$salt = "1234567890";
$keyiv = openssl_pbkdf2($password, $salt, 32+16, 1000);
$key = substr($keyiv, 0, 32);
$iv = substr($keyiv, 32, 16);
$decrypted_text = openssl_decrypt($encrypted_text, 'AES-256-CBC', $key, 0, $iv);
echo $decrypted_text;
?>