Documentation

CRM_Utils_Crypt
in package

Tags
copyright

CiviCRM LLC https://civicrm.org/licensing

Table of Contents

Methods

decrypt()  : string
Decrypts ciphertext encrypted with AES256 in ECB mode, if possible.
encrypt()  : string
Encrypts a string using AES256 in ECB mode, if encryption is enabled.

Methods

decrypt()

Decrypts ciphertext encrypted with AES256 in ECB mode, if possible.

public static decrypt(string $string) : string

If the mcrypt module is not available or if CIVICRM_SITE_KEY is not set, the provided ciphertext is only base64-decoded, not decrypted.

Parameters
$string : string

Ciphertext to be decrypted.

Return values
string

Plaintext, or base64-decoded ciphertext if encryption is disabled or unavailable.

encrypt()

Encrypts a string using AES256 in ECB mode, if encryption is enabled.

public static encrypt(string $string) : string

After encrypting the string, it is base64 encoded.

If encryption is not enabled, either due to CIVICRM_SITE_KEY being undefined or due to unavailability of the mcrypt module, the string is merely base64 encoded and is not encrypted at all.

Parameters
$string : string

Plaintext to be encrypted.

Return values
string

Base64-encoded ciphertext, or base64-encoded plaintext if encryption is disabled or unavailable.


        
On this page

Search results