Method | Description | |
---|---|---|
decrypt ( $data ) : string | Decrypts data with {@link getEncryptionKey EncryptionKey}. | |
encrypt ( $data ) : string | Encrypts data with {@link getEncryptionKey EncryptionKey}. | |
getCryptAlgorithm ( ) : mixed | ||
getEncryption ( ) : string | This method has been deprecated since version 3.2.1. | |
getEncryptionKey ( ) : string | ||
getHashAlgorithm ( ) : string | ||
getValidation ( ) : string | This method has been deprecated since version 3.2.1. | |
getValidationKey ( ) : string | ||
hashData ( $data ) : string | Prefixes data with an HMAC. | |
init ( $config ) | Initializes the module. | |
setCryptAlgorithm ( $value ) | Sets the crypt algorithm (also known as cipher or cypher) that will be used for {@link encrypt} and {@link decrypt}. | |
setEncryption ( $value ) | This method has been deprecated since version 3.2.1. | |
setEncryptionKey ( $value ) | ||
setHashAlgorithm ( $value ) | ||
setValidation ( $value ) | This method has been deprecated since version 3.2.1. | |
setValidationKey ( $value ) | ||
validateData ( $data ) : string | Validates if data is tampered. |
Method | Description | |
---|---|---|
computeHMAC ( $data ) : string | Computes the HMAC for the data with {@link getValidationKey ValidationKey}. | |
generateRandomKey ( ) | Generates a random key. | |
openCryptModule ( ) : resource | Opens the mcrypt module with the configuration specified in {@link cryptAlgorithm}. |
Method | Description | |
---|---|---|
strlen ( string $string ) : integer | Returns the length of the given string. | |
substr ( string $string, integer $start, integer $length ) : string | Returns the portion of string specified by the start and length parameters. |
protected computeHMAC ( $data ) : string | ||
return | string | the HMAC for the data |
public getCryptAlgorithm ( ) : mixed | ||
return | mixed | the algorithm used to encrypt/decrypt data. Defaults to the string 'rijndael-256'. |
public getEncryption ( ) : string | ||
return | string | the algorithm used to encrypt/decrypt data. |
public getEncryptionKey ( ) : string | ||
return | string | the private key used to encrypt/decrypt data. If the key is not explicitly set, a random one is generated and returned. |
public getHashAlgorithm ( ) : string | ||
return | string | hashing algorithm used to generate HMAC. Defaults to 'sha1'. |
public getValidation ( ) : string | ||
return | string | hashing algorithm used to generate HMAC. Defaults to 'sha1'. |
public getValidationKey ( ) : string | ||
return | string | the private key used to generate HMAC. If the key is not explicitly set, a random one is generated and returned. |
public init ( $config ) |
protected openCryptModule ( ) : resource | ||
return | resource | the mycrypt module handle. |
public setCryptAlgorithm ( $value ) |
public setEncryption ( $value ) |
public setValidation ( $value ) |
public validateData ( $data ) : string | ||
return | string | the real data with HMAC stripped off. False if the data is tampered. |