Jump to content
thirty bees forum
  • 0

Rindjael with PHP 7 - SSL encrypt


Captain FLAM

Question

I think my correction is correct, but I don't have time to do check and to do better ... (I use TB 1.0.5 & PHP 7.1.9)

You have to select "Use Rijndael with the openssl extension" in the BO > Advanced Parameters > Performance > Encryption

in file : classes\Rijndael.php , line 68 ``` public function encrypt($plaintext) { if (mbstrlen($this->key, '8bit') !== 32) { return false; }

    if (function_exists('openssl_encrypt')) {
        // Correction of a BUG !!
        $ivsize = openssl_cipher_iv_length('aes-256-cbc');

        try {
            $iv = random_bytes($ivsize);
        } catch (Exception $e) {
            if (function_exists('openssl_random_pseudo_bytes(')) {
                $iv = openssl_random_pseudo_bytes($ivsize);
            } else {
                throw new Exception('No secure random number generator found on your system.');
            }
        }
        //**************************************//

        $ciphertext = openssl_encrypt(
            $plaintext,
            'aes-256-cbc',
            $this->_key,
            OPENSSL_RAW_DATA,
            $iv
        );
    } else {

```

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...