• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/security/cipher.php
  • Класс: BitrixMainSecurityCipher
  • Вызов: Cipher::__construct
public function __construct($cipherAlgorithm = 'aes-256-ctr', $hashAlgorithm = 'sha256', $calculateHash = true)
{
	if(!function_exists('openssl_get_cipher_methods'))
	{
		throw new SecurityException("Openssl extension is not available.");
	}
	if(!in_array($cipherAlgorithm, openssl_get_cipher_methods(true)))
	{
		throw new SecurityException("Unknown cipher algorithm {$cipherAlgorithm}.");
	}
	if(!in_array($hashAlgorithm, openssl_get_md_methods(true)))
	{
		throw new SecurityException("Unknown hash algorithm {$hashAlgorithm}.");
	}

	$this->cipherAlgorithm = $cipherAlgorithm;
	$this->hashAlgorithm = $hashAlgorithm;
	$this->ivLength = openssl_cipher_iv_length($cipherAlgorithm);
	$this->calculateHash = (bool)$calculateHash;
}