This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//the key & iv should be generated with php | |
// Generate a random key | |
$key_length = 32; // 256 bits for AES-256 | |
$key = openssl_random_pseudo_bytes($key_length); | |
// Encode the key in base64 format for storage or transmission | |
$encoded_key = base64_encode($key); | |
echo "Generated Key: " . $encoded_key . "\n"; |