LimeSurvey API - Master branch

LSSodium
in package

Class LSSodium

Table of Contents

Properties

$bLibraryExists  : mixed
$sEncryptionNonce  : mixed
$sEncryptionSecretBoxKey  : mixed

Methods

checkIfLibraryExists()  : void
Check if Sodium library is installed
decrypt()  : string
Decrypt encrypted string.
encrypt()  : string
Encrypt input data using AES256 CBC encryption
init()  : mixed
checkIfKeyExists()  : void
Check if encryption key and nonce exist in configuration and generate it if missing
generateEncryptionKeys()  : void
Write encryption key to version.php config file
getEncryptionKey()  : string
Get encryption key from version.php config file
getEncryptionNonce()  : string
getEncryptionPublicKey()  : string
Get encryption key from version.php config file
getEncryptionSecretBoxKey()  : string
getEncryptionSecretKey()  : string
Get encryption key from version.php config file

Properties

$bLibraryExists

public mixed $bLibraryExists = \false

$sEncryptionNonce

protected mixed $sEncryptionNonce = \null

$sEncryptionSecretBoxKey

protected mixed $sEncryptionSecretBoxKey = \null

Methods

checkIfLibraryExists()

Check if Sodium library is installed

public checkIfLibraryExists() : void

decrypt()

Decrypt encrypted string.

public decrypt(string $sEncryptedString[, bool $bReturnFalseIfError = false ]) : string
Parameters
$sEncryptedString : string

Encrypted string to decrypt, if it string 'null', didn't try to decode

$bReturnFalseIfError : bool = false

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

Tags
throws
SodiumException
Return values
string —

Return decrypted value (string or unserialized object) if succeeded. Return FALSE if an error occurs (bad password/salt given) or input encryptedString

encrypt()

Encrypt input data using AES256 CBC encryption

public encrypt(string $sDataToEncrypt) : string
Parameters
$sDataToEncrypt : string

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

Tags
throws
SodiumException
Return values
string —

Return encrypted AES256 CBC value

checkIfKeyExists()

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

protected checkIfKeyExists() : void
Tags
throws
SodiumException

generateEncryptionKeys()

Write encryption key to version.php config file

protected generateEncryptionKeys() : void
Tags
throws
Exception

getEncryptionKey()

Get encryption key from version.php config file

protected getEncryptionKey() : string
Tags
throws
SodiumException
Return values
string —

Return encryption key string

getEncryptionNonce()

protected getEncryptionNonce() : string
Tags
throws
SodiumException
Return values
string

getEncryptionPublicKey()

Get encryption key from version.php config file

protected getEncryptionPublicKey() : string
Tags
throws
SodiumException
Return values
string —

Return encryption key string

getEncryptionSecretBoxKey()

protected getEncryptionSecretBoxKey() : string
Tags
throws
SodiumException
Return values
string

getEncryptionSecretKey()

Get encryption key from version.php config file

protected getEncryptionSecretKey() : string
Tags
throws
SodiumException
Return values
string —

Return encryption key string


        
On this page

Search results