PHPで共通鍵暗号を使った暗号化・復号化

$data = 'あいうえおかきくけこさしすせそ';

$ciphers = openssl_get_cipher_methods();
print_r($ciphers);

$method = 'AES-256-CBC';

$iv_length = openssl_cipher_iv_length($method);
$iv = openssl_random_pseudo_bytes($iv_length);

$option = 0;

$encrypted = openssl_encrypt($data, $method, $password, $options, $iv);
echo "暗号文": .$encrypted . "\n";

$decrypted = openssl_decrypt($ecnrypted, $method, $password, $options, $iv);
echo "平文" . $decrypted . "\n";