LimeSurvey API - Master branch

LSSodiumOld
in package

Class LSSodiumOld

Table of Contents

Properties

$bLibraryExists  : mixed
$sEncryptionKeypair  : mixed
$sEncryptionPublicKey  : mixed
$sEncryptionSecretKey  : 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 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
getEncryptionPublicKey()  : string
Get encryption key from version.php config file
getEncryptionSecretKey()  : string
Get encryption key from version.php config file

Properties

$bLibraryExists

public mixed $bLibraryExists = \false

$sEncryptionKeypair

protected mixed $sEncryptionKeypair = \null

$sEncryptionPublicKey

protected mixed $sEncryptionPublicKey = \null

$sEncryptionSecretKey

protected mixed $sEncryptionSecretKey = \null

Methods

checkIfLibraryExists()

Check if Sodium library is installed

public checkIfLibraryExists() : void

decrypt()

Decrypt encrypted string.

public decrypt(string $sEncryptedString) : string
Parameters
$sEncryptedString : string

Encrypted string to decrypt

Tags
throws
SodiumException

If decryption fails (e.g. wrong key)

Return values
string —

Return decrypted value (string or unserialized object) if succeeded, or empty string if library is missing, or the input string itself if empty/null.

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 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

getEncryptionPublicKey()

Get encryption key from version.php config file

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

Return encryption key 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