PHP Класс Neos\Flow\Security\Cryptography\HashService

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$cache Neos\Cache\Frontend\StringFrontend
$encryptionKey string A private, unique key used for encryption tasks
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$passwordHashingStrategies array
$strategySettings array

Открытые методы

Метод Описание
appendHmac ( string $string ) : string Appends a hash (HMAC) to a given string and returns the result
generateHmac ( string $string ) : string Generate a hash (HMAC) for a given string
hashPassword ( string $password, string $strategyIdentifier = 'default' ) : string Hash a password using the configured password hashing strategy
injectSettings ( array $settings ) : void Injects the settings of the package this controller belongs to.
validateAndStripHmac ( string $string ) : string Tests if the last 40 characters of a given string $string matches the HMAC of the rest of the string and, if true, returns the string without the HMAC. In case of a HMAC validation error, an exception is thrown.
validateHmac ( string $string, string $hmac ) : boolean Tests if a string $string matches the HMAC given by $hash.
validatePassword ( string $password, string $hashedPasswordAndSalt ) : boolean Validate a hashed password using the configured password hashing strategy

Защищенные методы

Метод Описание
getEncryptionKey ( ) : string Returns the encryption key from the persistent cache or Data/Persistent directory. If none exists, a new encryption key will be generated and stored in the cache.
getPasswordHashingStrategyAndIdentifier ( string $strategyIdentifier = 'default' ) : array Get a password hashing strategy

Описание методов

appendHmac() публичный Метод

Appends a hash (HMAC) to a given string and returns the result
См. также: generateHmac()
public appendHmac ( string $string ) : string
$string string The string for which a hash should be generated
Результат string The original string with HMAC of the string appended

generateHmac() публичный Метод

Generate a hash (HMAC) for a given string
public generateHmac ( string $string ) : string
$string string The string for which a hash should be generated
Результат string The hash of the string

getEncryptionKey() защищенный Метод

Returns the encryption key from the persistent cache or Data/Persistent directory. If none exists, a new encryption key will be generated and stored in the cache.
protected getEncryptionKey ( ) : string
Результат string The configured encryption key stored in Data/Persistent/EncryptionKey

getPasswordHashingStrategyAndIdentifier() защищенный Метод

Get a password hashing strategy
protected getPasswordHashingStrategyAndIdentifier ( string $strategyIdentifier = 'default' ) : array
$strategyIdentifier string
Результат array

hashPassword() публичный Метод

Hash a password using the configured password hashing strategy
public hashPassword ( string $password, string $strategyIdentifier = 'default' ) : string
$password string The cleartext password
$strategyIdentifier string An identifier for a configured strategy, uses default strategy if not specified
Результат string A hashed password with salt (if used)

injectSettings() публичный Метод

Injects the settings of the package this controller belongs to.
public injectSettings ( array $settings ) : void
$settings array Settings container of the current package
Результат void

validateAndStripHmac() публичный Метод

Tests if the last 40 characters of a given string $string matches the HMAC of the rest of the string and, if true, returns the string without the HMAC. In case of a HMAC validation error, an exception is thrown.
См. также: validateHmac()
public validateAndStripHmac ( string $string ) : string
$string string The string with the HMAC appended (in the format 'string')
Результат string the original string without the HMAC, if validation was successful

validateHmac() публичный Метод

Tests if a string $string matches the HMAC given by $hash.
public validateHmac ( string $string, string $hmac ) : boolean
$string string The string which should be validated
$hmac string The hash of the string
Результат boolean TRUE if string and hash fit together, FALSE otherwise.

validatePassword() публичный Метод

Validate a hashed password using the configured password hashing strategy
public validatePassword ( string $password, string $hashedPasswordAndSalt ) : boolean
$password string The cleartext password
$hashedPasswordAndSalt string The hashed password with salt (if used) and an optional strategy identifier
Результат boolean TRUE if the given password matches the hashed password

Описание свойств

$cache защищенное свойство

protected StringFrontend,Neos\Cache\Frontend $cache
Результат Neos\Cache\Frontend\StringFrontend

$encryptionKey защищенное свойство

A private, unique key used for encryption tasks
protected string $encryptionKey
Результат string

$objectManager защищенное свойство

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
Результат Neos\Flow\ObjectManagement\ObjectManagerInterface

$passwordHashingStrategies защищенное свойство

protected array $passwordHashingStrategies
Результат array

$strategySettings защищенное свойство

protected array $strategySettings
Результат array