Crypt
Crypt is a Joomla Framework class for handling basic encryption/decryption of data.
| since |
1.0 |
|---|---|
| package |
Joomla Framework |
Methods
__construct
Object Constructor takes an optional key to be used for encryption/decryption. If no key is given then the secret word from the configuration object is used.
__construct(\Joomla\Crypt\CipherInterface cipher = null, \Joomla\Crypt\Key key = null) :
| since |
1.0 |
|---|
Arguments
- cipher
CipherInterface|nullThe encryption cipher object.- key
Key|nullThe encryption key[/pair)].
Response
mixed
decrypt
Method to decrypt a data string.
decrypt( data) :
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- data
stringThe encrypted string to decrypt.
Response
stringThe decrypted data string.
encrypt
Method to encrypt a data string.
encrypt( data) :
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- data
stringThe data string to encrypt.
Response
stringThe encrypted data string.
generateKey
Method to generate a new encryption key[/pair] object.
generateKey(mixed||string|int options = []) : \Joomla\Crypt\Key
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- options
array<string|int, mixed>Key generation options.
Response
genRandomBytes
Generate random bytes.
genRandomBytes( length = 16) :
| since |
1.0 |
|---|
Arguments
- length
intLength of the random data to generate
Response
stringRandom binary data
setKey
Method to set the encryption key[/pair] object.
setKey(\Joomla\Crypt\Key key) : \Joomla\Crypt\Crypt