PHP Class FOF30\Encrypt\Aes

Afficher le fichier Open project: akeeba/fof Class Usage Examples

Méthodes publiques

Méthode Description
__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?

Method Details

__construct() public méthode

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() public méthode

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?
Résultat string The plain text string

encryptString() public méthode

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?
Résultat 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() public static méthode

Is AES encryption supported by this PHP installation?
public static isSupported ( Phpfunc $phpfunc = null ) : boolean
$phpfunc FOF30\Utils\Phpfunc
Résultat boolean