◆ __construct()
__construct |
( |
|
$key, |
|
|
|
$strength = 128 , |
|
|
|
$mode = 'cbc' , |
|
|
FOFUtilsPhpfunc |
$phpfunc = null , |
|
|
|
$priority = 'openssl' |
|
) |
| |
Initialise the AES encryption object.
Note: If the key is not 16 bytes this class will do a stupid key expansion for legacy reasons (produce the SHA-256 of the key string and throw away half of it).
- Paramètres
-
string | $key | The encryption key (password). It can be a raw key (16 bytes) or a passphrase. |
int | $strength | Bit strength (128, 192 or 256) – ALWAYS USE 128 BITS. THIS PARAMETER IS DEPRECATED. |
string | $mode | Encryption mode. Can be ebc or cbc. We recommend using cbc. |
FOFUtilsPhpfunc | $phpfunc | For testing |
string | $priority | Priority which adapter we should try first |
Références $key, et $mode.
◆ decryptString()
decryptString |
( |
|
$stringToDecrypt, |
|
|
|
$base64encoded = true |
|
) |
| |
Decrypts a ciphertext into a plaintext string using AES
- Paramètres
-
string | $stringToDecrypt | The ciphertext to decrypt. The first 16 bytes of the raw string must contain the IV (initialisation vector). |
bool | $base64encoded | Should I Base64-decode the data before decryption? |
- Renvoie
- string The plain text string
Références $key.
◆ encryptString()
encryptString |
( |
|
$stringToEncrypt, |
|
|
|
$base64encoded = true |
|
) |
| |
Encrypts a string using AES
- Paramètres
-
string | $stringToEncrypt | The plaintext to encrypt |
bool | $base64encoded | Should I Base64-encode the result? |
- Renvoie
- 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.
Références $key.
◆ getExpandedKey()
getExpandedKey |
( |
|
$blockSize, |
|
|
|
$iv |
|
) |
| |
- Paramètres
-
- Renvoie
- string
Références $key.
◆ isSupported()
Is AES encryption supported by this PHP installation?
- Paramètres
-
- Renvoie
- boolean
◆ setPassword()
setPassword |
( |
|
$password, |
|
|
|
$legacyMode = false |
|
) |
| |
Sets the password for this instance.
WARNING: Do not use the legacy mode, it's insecure
- Paramètres
-
string | $password | The password (either user-provided password or binary encryption key) to use |
bool | $legacyMode | True to use the legacy key expansion. We recommend against using it. |
Références $password.
◆ $adapter
◆ $key
La documentation de cette classe a été générée à partir du fichier suivant :