I am trying to encrypt and then decrypt "AES-256-ECB" , This is how I am encrypting the plain text :
$string = "This is a test string";
$cipher = 'AES-256-ECB';
$key = 'FFVgT4ThOPzglvcaFDc21mg5hZsY73Tc';
$plaintext = $string;
if (strlen($plaintext) % 16)
{
$plaintext = str_pad($plaintext, strlen($plaintext) + 16 - strlen($plaintext) % 16, "\0");
}
$chiperRaw = openssl_encrypt($plaintext, $cipher, $key, OPENSSL_NO_PADDING);
$ciphertext = trim(base64_encode($chiperRaw));
But How can I decrypt the cyphertext back to plain text ?