public function __construct(string $cipher = null, string $hash = null, string $mode = null, bool $twoStep = true) { parent::__construct($cipher, $hash, $mode, $twoStep); if (!function_exists("mcrypt_list_algorithms")) { throw new Exception("Could not find the MCrypt module"); } elseif (!in_array($this->mCipher, mcrypt_list_algorithms())) { throw new Exception("The cipher '" . $this->mCipher . "' is not supported by this platform installation"); } elseif (!in_array($this->mMode, mcrypt_list_modes())) { throw new Exception("The block mode '" . $this->mMode . "' is not supported by this platform installation"); } }
public function __construct(string $cipher = null, string $hash = null, string $mode = null, bool $twoStep = false) { parent::__construct($cipher, $hash, $mode, $twoStep); $this->mCipher = $cipher ?? "AES-256"; $this->mMode = $mode ?? "CBC"; if (!function_exists("openssl_get_cipher_methods")) { throw new Exception("Could not find the OpenSSL module"); } elseif (!in_array(strtoupper($this->mCipher . "-" . $this->mMode), openssl_get_cipher_methods())) { throw new Exception("The cipher '" . strtoupper($this->mCipher . "-" . $this->mMode) . "' is not supported by this platform installation"); } }