Documentation

Mage_Core_Model_Encryption
in package

Table of Contents

Constants

HASH_VERSION_LATEST  : mixed = 3
Encryption method bcrypt
HASH_VERSION_MD5  : mixed = 0
HASH_VERSION_SHA256  : mixed = 1
HASH_VERSION_SHA512  : mixed = 2
KEY_LENGTH_BINARY  : mixed = \SODIUM_CRYPTO_SECRETBOX_KEYBYTES
Encryption key length, as stored in app/etc/local.xml (hex) and as used by libsodium (binary)
KEY_LENGTH_HEX  : mixed = self::KEY_LENGTH_BINARY * 2
MAXIMUM_PASSWORD_LENGTH  : mixed = 256
Maximum Password Length

Properties

$_helper  : Mage_Core_Helper_Data

Methods

decrypt()  : string
encrypt()  : string
getHash()  : string
Generate a [salted] hash.
getHashPassword()  : string
Generate a credential hash in the current hash version, for admin users, customers and API keys
hash()  : bool|string
Hash a string
setHelper()  : $this
Set helper instance
validateHash()  : bool
Validate hash against hashing method (with or without salt)
validateHashByVersion()  : bool
Validate hash by specified version
validateKey()  : bool
Validate a raw binary key. Keys exist in hex form everywhere a store touches them (local.xml, the installer), so those callers want validateKeyAsHex().
validateKeyAsHex()  : bool
Validate a key in the form it is stored in app/etc/local.xml, which is what Mage::getEncryptionKeyAsHex() returns. Anything else (a Magento/OpenMage mcrypt key, most of all) makes Mage::getEncryptionKeyAsBinary() throw.

Constants

HASH_VERSION_LATEST

Encryption method bcrypt

public mixed HASH_VERSION_LATEST = 3

HASH_VERSION_MD5

public mixed HASH_VERSION_MD5 = 0

HASH_VERSION_SHA256

public mixed HASH_VERSION_SHA256 = 1

HASH_VERSION_SHA512

public mixed HASH_VERSION_SHA512 = 2

KEY_LENGTH_BINARY

Encryption key length, as stored in app/etc/local.xml (hex) and as used by libsodium (binary)

public mixed KEY_LENGTH_BINARY = \SODIUM_CRYPTO_SECRETBOX_KEYBYTES

KEY_LENGTH_HEX

public mixed KEY_LENGTH_HEX = self::KEY_LENGTH_BINARY * 2

MAXIMUM_PASSWORD_LENGTH

Maximum Password Length

public mixed MAXIMUM_PASSWORD_LENGTH = 256

Properties

Methods

decrypt()

public decrypt(string|null $data) : string
Parameters
$data : string|null
Return values
string

encrypt()

public encrypt(string $data) : string
Parameters
$data : string
Return values
string

getHash()

Generate a [salted] hash.

public getHash(string $password[, mixed $salt = false ]) : string

$salt can be: false - a random will be generated integer - a random with specified length will be generated string

Parameters
$password : string
$salt : mixed = false
Return values
string

getHashPassword()

Generate a credential hash in the current hash version, for admin users, customers and API keys

public getHashPassword(string $password) : string
Parameters
$password : string
Return values
string

hash()

Hash a string

public hash(string $data[, int $version = self::HASH_VERSION_MD5 ]) : bool|string
Parameters
$data : string
$version : int = self::HASH_VERSION_MD5
Return values
bool|string

validateHash()

Validate hash against hashing method (with or without salt)

public validateHash(string $password, string $hash) : bool
Parameters
$password : string
$hash : string
Tags
throws
Exception
Return values
bool

validateHashByVersion()

Validate hash by specified version

public validateHashByVersion(string $password, string $hash[, int $version = self::HASH_VERSION_MD5 ]) : bool
Parameters
$password : string
$hash : string
$version : int = self::HASH_VERSION_MD5
Return values
bool

validateKey()

Validate a raw binary key. Keys exist in hex form everywhere a store touches them (local.xml, the installer), so those callers want validateKeyAsHex().

public validateKey(string $key) : bool
Parameters
$key : string
Return values
bool

validateKeyAsHex()

Validate a key in the form it is stored in app/etc/local.xml, which is what Mage::getEncryptionKeyAsHex() returns. Anything else (a Magento/OpenMage mcrypt key, most of all) makes Mage::getEncryptionKeyAsBinary() throw.

public validateKeyAsHex(string $key) : bool
Parameters
$key : string
Return values
bool
On this page

Search results