/php_crypt.php

Description

PHP Security Library

Copyright (C) 2004 Jose Antonio Coret

E-Mail: joxeankoret@yahoo.es

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Constants
ENCRYPTION_ALGORITHM = MCRYPT_RIJNDAEL_256 (line 57)

The algorith that we will use

Tested algorithms :

MCRYPT_3DES, MCRYPT_BLOWFISH, MCRYPT_CAST_128, MCRYPT_CAST_256, MCRYPT_DES (Please, don't use this), MCRYPT_GOST, MCRYPT_LOKI97, MCRYPT_RIJNDAEL_128, MCRYPT_RIJNDAEL_192, MCRYPT_RIJNDAEL_256, MCRYPT_RC2, MCRYPT_SAFERPLUS, MCRYPT_SERPENT, MCRYP_TRIPLEDES, MCRYPT_TWOFISH, MCRYPT_XTEA

ENCRYPTION_KEY = "your secret key" (line 30)

The encryption key that we will use. MODIFY IT!

Functions
internal_decrypt (line 81)

++ INTERNAL USE ++

Use sec_decrypt instead.

void internal_decrypt (mixed $decrypt)
internal_encrypt (line 64)

++ INTERNAL USE ++

Use sec_encrypt instead.

void internal_encrypt (mixed $encrypt)
sec_decrypt (line 152)

Return an string decrypted

void sec_decrypt (mixed $data)
sec_encrypt (line 146)

Return an encrypted string

void sec_encrypt (mixed $data)
sec_put (line 111)

Return an encrypted string

void sec_put (mixed $param)
sec_read_cookie (line 105)

Read a param passed in a Cookie and decrypt it

void sec_read_cookie (mixed $param)
sec_read_get (line 93)

Read a param passed using GET method and decrypt it

void sec_read_get (mixed $param)
sec_read_post (line 99)

Read a param passed using POST method and decrypt it

void sec_read_post (mixed $param)
sec_write_cookie (line 123)

Send an encrypted cookie. To decrypt cookie use the function sec_read_cookie.

This is the complex version. To store a single cookie use sec_write_simple_cookie instead, if you will not use path, domain and secure options.

void sec_write_cookie (mixed $param, mixed $value, mixed $expire, mixed $path, mixed $domain, mixed $secure)
sec_write_simple_cookie (line 135)

Send an encrypted cookie. To decrypt cookie use the function sec_read_cookie.

This is the simple version. To store a more complex cookie use sec_write_cookie, if you need to specify path, domain and secure options.

void sec_write_simple_cookie (mixed $param, mixed $value, [mixed $expire = -1])

Documentation generated on Fri, 1 Oct 2004 17:46:17 +0200 by phpDocumentor 1.3.0RC3