Class Crypt

Description

class Crypt

This class provides a simple interface to the mcrypt library. It can be used to encrypt and decrypt data. mcrypt was chosen because it supports a wide variety of block algorithms and cipher modes. For a complete list of supported algorithms and modes refer to the documentation of mcrypt.

Located in /crypt.class.php (line 21)

Exception
   |
   --PException
      |
      --Crypt
Variable Summary
Method Summary
Crypt __construct ()
void CloseModule ()
string Decrypt (ciphertext $ciphertext)
string Encrypt (plaintext $plaintext)
integer GetBlockSize ()
integer GetIvSize ()
integer GetKeySize ()
mixed GetRandomIv ()
mixed OpenModule ()
string SetEncryptionKey (plaintext $plaintext)
mixed SetRandomIv ()
Variables
mixed $blockAlgorithm (line 30)
  • access: private
mixed $blockAlgorithmMode (line 31)
  • access: private
mixed $Convert (line 25)
  • access: private
mixed $Crypt (line 23)
  • static:
  • access: private
mixed $encryptionDescriptor (line 27)
  • access: private
mixed $encryptionKey (line 32)
  • access: private
mixed $initializationVector (line 28)
  • access: private
mixed $randomDevice (line 29)
  • access: private
mixed $XmlConfigDao (line 24)
  • access: private
Methods
Constructor __construct (line 41)

function __construct

This method is executed when an object is instantiated from this class. Preprocessing can be done here before the object is put into service.

  • access: public
Crypt __construct ()
CloseModule (line 250)

function CloseModule

This method closes the mcrypt module.

  • access: private
void CloseModule ()
Decrypt (line 234)

function Decrypt

This method initializes all buffers needed for decryption, decrypts data and deinitializes a decryption module.

  • return: Stripped plaintext
  • access: public
string Decrypt (ciphertext $ciphertext)
  • ciphertext $ciphertext: Ciphertext
Encrypt (line 215)

function Encrypt

This method initializes all buffers needed for encryption, encrypts data and deinitializes an encryption module.

  • return: Hexadecimal encoded ciphertext
  • access: public
string Encrypt (plaintext $plaintext)
  • plaintext $plaintext: Plaintext
GetBlockSize (line 103)

function GetBlockSize

This method retrieves the blocksize of the opened algorithm.

  • return: Block size
  • access: private
integer GetBlockSize ()
GetInstance (line 65)

function GetInstance

This method instantiates a new object from this class; more specifically, it's a singleton instance.

  • return: object instance
  • static:
  • access: public
Crypt GetInstance ()
GetIvSize (line 81)

function GetIvSize

This method retrieves the size of the Initialization Vector (IV) belonging to a specific cipher/mode combination.

  • return: Size of IV
  • access: private
integer GetIvSize ()
GetKeySize (line 92)

function GetKeySize

This method retrieves the maximum supported key size of the opened mode.

  • return: Key size
  • access: private
integer GetKeySize ()
GetRandomIv (line 135)

function GetRandomIv

This method retrieves the Initialization Vector (IV) from a registered session.

  • return: Initialization Vector (IV)|FALSE
  • access: private
mixed GetRandomIv ()
OpenModule (line 114)

function OpenModule

This method opens the module of the algorithm and the mode to be used.

  • return: Encryption descriptor|FALSE
  • access: private
mixed OpenModule ()
SetEncryptionKey (line 195)

function SetEncryptionKey

This method creates a encryption key according to the maximum supported key size of the opened mode and stores it in the XML configuration file.

  • return: Encryption key
  • access: public
string SetEncryptionKey (plaintext $plaintext)
  • plaintext $plaintext: Plaintext password
SetRandomIv (line 159)

function SetRandomIv

This method creates the Initialization Vector (IV) from a random source and stores it in a registered session.

  • return: Initialization Vector (IV)|FALSE
  • access: private
mixed SetRandomIv ()

Inherited Methods

Inherited From PException

PException::Display()

Documentation generated on Thu, 9 Sep 2004 09:03:34 -0400 by phpDocumentor 1.3.0RC3