PHP Class PHPSecureSession\SecureHandler

Inheritance: extends SessionHandle\SessionHandler
Show file Open project: ezimuel/php-secure-session

Protected Properties

Property Type Description
$key string Encryption and authentication key

Public Methods

Method Description
__construct ( ) Constructor
open ( string $save_path, string $session_name ) : boolean Open the session
read ( string $id ) Read from session and decrypt
write ( string $id, string $data ) Encrypt the data and write into the session

Protected Methods

Method Description
decrypt ( string $data, string $key ) : string Authenticate and decrypt
encrypt ( string $data, string $key ) : string Encrypt and authenticate
getKey ( string $name ) : string Get the encryption and authentication keys from cookie
hash_equals ( string $expected, string $actual ) : boolean Hash equals function for PHP 5.5+

Method Details

__construct() public method

Constructor
public __construct ( )

decrypt() protected method

Authenticate and decrypt
protected decrypt ( string $data, string $key ) : string
$data string
$key string
return string

encrypt() protected method

Encrypt and authenticate
protected encrypt ( string $data, string $key ) : string
$data string
$key string
return string

getKey() protected method

Get the encryption and authentication keys from cookie
protected getKey ( string $name ) : string
$name string
return string

hash_equals() protected method

Hash equals function for PHP 5.5+
protected hash_equals ( string $expected, string $actual ) : boolean
$expected string
$actual string
return boolean

open() public method

Open the session
public open ( string $save_path, string $session_name ) : boolean
$save_path string
$session_name string
return boolean

read() public method

Read from session and decrypt
public read ( string $id )
$id string

write() public method

Encrypt the data and write into the session
public write ( string $id, string $data )
$id string
$data string

Property Details

$key protected property

Encryption and authentication key
protected string $key
return string