Documentation

encryption_functions.php

Table of Contents

Functions

rsEncrypt()  : string
Encrypts data
rsDecrypt()  : false|string
Decrypts data
eval_check_signed()  : string
Prior to eval() checks to make sure the code has been signed first, by the offline script / migration script.
sign_code()  : string
Returns a signature for a given block of code.
resign_all_code()  : void
Returns a signature for a given block of code.
rs_validate_token()  : bool
Used to compare the user's provided token with the expected value derived from the given identifier

Functions

rsEncrypt()

Encrypts data

rsEncrypt(string $data, string $key[, string $keylength = 128 ]) : string
Parameters
$data : string

Data to be encypted

$key : string

Key to use

$keylength : string = 128

Optional key length

Tags
uses
generateSecureKey()
todo

Add a fourth parameter to use with custom metadata (NOT ResourceSpace metadata) for generating MAC. this should add extra security by making MAC harder to be forged

used-by
generateCSRFToken()
Return values
string

Encrypted data

rsDecrypt()

Decrypts data

rsDecrypt(string $data, string $key) : false|string
Parameters
$data : string

Data to be decrypted

$key : string
Tags
todo

Add a third parameter to use with custom metadata (NOT ResourceSpace metadata) for generating MAC. this should add extra security by making MAC harder to be forged

used-by
rs_validate_token()
Return values
false|string

Returns FALSE if MAC check failed, plaintext otherwise

eval_check_signed()

Prior to eval() checks to make sure the code has been signed first, by the offline script / migration script.

eval_check_signed(string $code) : string
Parameters
$code : string

The code to check

Return values
string

The code, if correctly signed, or an empty string if not.

sign_code()

Returns a signature for a given block of code.

sign_code(string $code) : string
Parameters
$code : string

The code to sign

Return values
string

The signature

resign_all_code()

Returns a signature for a given block of code.

resign_all_code([bool $confirm = true ][, bool $output = true ][, bool $output_changes_only = false ]) : void
Parameters
$confirm : bool = true

Require user to approve code changes when resigning from the server side.

$output : bool = true

Display output. $confirm will override this option to provide detail if approval needed.

$output_changes_only : bool = false

Output changes only - do not sign code.

rs_validate_token()

Used to compare the user's provided token with the expected value derived from the given identifier

rs_validate_token(string $token_data, string $id) : bool

Used by isValidCSRFToken() Also used on upload_batch to validate an upload session when user cookie not available (i.e. companion uploads)

Parameters
$token_data : string

Encrypted token data

$id : string

Identifier

Tags
uses
rsDecrypt()
used-by
isValidCSRFToken()
Return values
bool
On this page

Search results