LSSodium

Class LSSodium

package

Default

Methods

Check if encryption key and nonce exist in configuration and generate it if missing

checkIfKeyExists(): void
Throws
\SodiumException

Check if Sodium library is installed

checkIfLibraryExists(): void

Decrypt encrypted string.

decrypt(string $sEncryptedString,boolean $bReturnFalseIfError = false): string
Throws
\SodiumException

Arguments

$sEncryptedString

string

Encrypted string to decrypt

$bReturnFalseIfError

boolean

false by default. If TRUE, return false in case of error (bad decryption). Else, return given $encryptedInput value

Response

string

Return decrypted value (string or unsezialized object) if suceeded. Return FALSE if an error occurs (bad password/salt given) or inpyt encryptedString

Encrypt input data using AES256 CBC encryption

encrypt(string $sDataToEncrypt): string
Throws
\SodiumException

Arguments

$sDataToEncrypt

string

Data to encrypt. Could be a string or a serializable PHP object

Response

string

Return encrypted AES256 CBC value

Write encryption key to version.php config file

generateEncryptionKeys(): void
Throws
\Exception

Get encryption key from version.php config file

getEncryptionKey(): string
Throws
\SodiumException

Response

string

Return encryption key string

getEncryptionNonce

getEncryptionNonce(): string
Throws
\SodiumException

Response

string

Get encryption key from version.php config file

getEncryptionPublicKey(): string
Throws
\SodiumException

Response

string

Return encryption key string

getEncryptionSecretBoxKey

getEncryptionSecretBoxKey(): string
Throws
\SodiumException

Response

string

Get encryption key from version.php config file

getEncryptionSecretKey(): string
Throws
\SodiumException

Response

string

Return encryption key string

init

init()

Properties

bLibraryExists

bLibraryExists :

Type(s)

sEncryptionNonce

sEncryptionNonce :

Type(s)

sEncryptionSecretBoxKey

sEncryptionSecretBoxKey :

Type(s)