/sources/encryption.php

Description
Functions
decrypt_data (line 120)

Decrypt data using asymmetric encryption, and the site's private key (as unlocked by the given passphrase).

A fatal error will occur if the passphrase is empty, the key cannot be found, or if decryption fails for whatever reason.

  • return: Decrypted data
string decrypt_data (string $data, string $passphrase)
  • string $data: Data to be decrypted
  • string $passphrase: Passphrase to unlock the site's private key
encrypt_data (line 52)

Encrypt some data using asymmetric encryption and the site's public key. This will return the original data if encryption is disabled. It will add a magic marker to the start of the returned string to show it's been encrypted.

A fatal error will occur if the public key cannot be found, or if encryption fails for whatever reason. Note that this will blindly re-encrypt data which has already been encrypted. You should check data with is_data_encrypted() first.

  • return: Encrypted data, with magic marker
string encrypt_data (string $data)
  • string $data: Data to be encrypted
is_data_encrypted (line 93)

Determine if some data has already been encrypted: i.e. if it has a magic encryption marker.

  • return: Encrypted?
boolean is_data_encrypted (string $data)
  • string $data: Data to check
is_encryption_available (line 26)

Determine whether the necessary PHP extensions to support encryption are available. For normal use, you should probably use is_encryption_enabled() instead.

  • return: Encryption available?
boolean is_encryption_available ()
is_encryption_enabled (line 36)

Determine whether encryption support is available and enabled in the site's preferences, and the keys are in place.

  • return: Encryption enabled?
boolean is_encryption_enabled ()
remove_magic_encryption_marker (line 106)

Remove the magic encryption marker from some data. This should be used if the data is to be displayed or presented for editing, but not if it's to be put in the database.

If the data does not have a magic encryption marker, the original string will be returned.

  • return: Data, without the magic marker
string remove_magic_encryption_marker (string $data)
  • string $data: Data

Documentation generated on Sun, 02 Jan 2011 23:14:01 +0000 by phpDocumentor 1.4.3