PHP Класс FOF30\Encrypt\Aes

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $key, integer $strength = 256, string $mode = 'cbc' ) Initialise the AES encryption object
decryptString ( string $stringToDecrypt, boolean $base64encoded = true ) : string Decrypts a ciphertext into a plaintext string using AES
encryptString ( string $stringToEncrypt, boolean $base64encoded = true ) : string Encrypts a string using AES
isSupported ( Phpfunc $phpfunc = null ) : boolean Is AES encryption supported by this PHP installation?

Описание методов

__construct() публичный Метод

Initialise the AES encryption object
public __construct ( string $key, integer $strength = 256, string $mode = 'cbc' )
$key string The encryption key (password). It can be a raw key (32 bytes) or a passphrase.
$strength integer Bit strength (128, 192 or 256)
$mode string Ecnryption mode. Can be ebc or cbc. We recommend using cbc.

decryptString() публичный Метод

Decrypts a ciphertext into a plaintext string using AES
public decryptString ( string $stringToDecrypt, boolean $base64encoded = true ) : string
$stringToDecrypt string The ciphertext to decrypt. The first 16 bytes of the raw string must contain the IV (initialisation vector).
$base64encoded boolean Should I Base64-decode the data before decryption?
Результат string The plain text string

encryptString() публичный Метод

Encrypts a string using AES
public encryptString ( string $stringToEncrypt, boolean $base64encoded = true ) : string
$stringToEncrypt string The plaintext to encrypt
$base64encoded boolean Should I Base64-encode the result?
Результат string The cryptotext. Please note that the first 16 bytes of the raw string is the IV (initialisation vector) which is necessary for decoding the string.

isSupported() публичный статический Метод

Is AES encryption supported by this PHP installation?
public static isSupported ( Phpfunc $phpfunc = null ) : boolean
$phpfunc FOF30\Utils\Phpfunc
Результат boolean