Gumbo_Encryption



Abstract Encryption Class

This class provides the foundation for creating encryption/decryption algorithms. The Encryption system is based on two complimentary classes. The first will Encrypt, the second Decrypt. Each class will define it's algorithm inside the 'parse' method.

The encoding option is responsible for formatting the data into a safe format, usually for saving inside a database. Typically, with the mcrypt library, the encrypted characters are not safe to input into a database. The Encode option replaces the characters with database safe ones, but does not lose any information.

Raw data indicates data that is not encrypted. An Encrypt class receives 'raw' data, a Decrypt class will generate 'raw' data. The 'parse' method should define the state of the data after completion.

Author(s): Michael Luster <mluster79@yahoo.com>
License:New BSD License
Copyright:Copyright (c) 2007, iBayou, Michael Luster
Link:http://sourceforge.net/projects/phpgumbo
Version:0.0.1

Child classes:

Class Variables

string $_cipher =  GUMBO_ENCRYPT_CIPHER [line 53]
string $_data [line 51]
bool $_encode =  GUMBO_ENCRYPT_ENCODE [line 59]
string $_key =  GUMBO_ENCRYPT_KEY [line 57]
string $_mode =  GUMBO_ENCRYPT_MODE [line 55]
bool $_raw =  true [line 62]

Class Methods

public string getCipher ( ) [line 287]

Returns the cipher


[ Top ]
public string getData ( ) [line 271]

Returns the encrypted/decrypted data


[ Top ]
public string getKey ( ) [line 279]

Returns the key


[ Top ]
public string getMode ( ) [line 295]

Returns the encryption mode


[ Top ]
public bool isRaw ( ) [line 263]

Returns if the data is raw


[ Top ]
public void parse ( ) [line 71]

Parses the data into an encrypted/decrypted format

  • abstract:  
  • postcondition:  isRaw() => [true|false]
Overridden in child classes as:
Gumbo_Decrypt::parse()
Parses the data by decryption
Gumbo_Encrypt::parse()
Parses the data by encryption


[ Top ]
public void setCipher ( string $cipher ) [line 146]

Sets the cipher

Parameter(s):

  • (string) $cipher
  • precondition:  must be a MCRYPT_* constant
  • throws:  Gumbo_Exception

[ Top ]
public void setData ( string $data ) [line 105]

Sets the data to be encrypted/decrypted

Parameter(s):

  • (string) $data
  • postcondition:  setRaw(true)
  • throws:  Gumbo_Exception

[ Top ]
public void setEncode ( bool $val ) [line 241]

Sets if the text should be encoded

Parameter(s):

  • (bool) $val
  • throws:  Gumbo_Exception

[ Top ]
public void setKey ( string $key ) [line 125]

Sets the key value

Parameter(s):

  • (string) $key
  • throws:  Gumbo_Exception

[ Top ]
public void setMode ( string $mode ) [line 211]

Sets the mode of encryption

Parameter(s):

  • (string) $mode
  • precondition:  must be a MCRYPT_MODE_* constant
  • throws:  Gumbo_Exception

[ Top ]
protected void setRaw ( bool $val ) [line 85]

Sets if the data is Raw, or encrypted/decrypted

Raw data is the initial data sent into an Encryption class. If using Encryption, this will be the data viewable to the user. If using Decryption, this would be the encrypted string.

Parameter(s):

  • (bool) $val
  • throws:  Gumbo_Exception

[ Top ]
public bool toEncode ( ) [line 303]

Returns if the text should be encoded


[ Top ]