[PR][php-src][#1105][master] - Add hash_hkdf() to ext/hash
| From: | noreply@php.net | Date: | Thu, 26 Feb 2015 10:23:05 +0000 |
| Subject: | [PR][php-src][#1105][master] - Add hash_hkdf() to ext/hash | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-2494@lists.php.net to get a copy of this message | ||
You can view the Pull Request on github:
https://github.com/php/php-src/pull/1105
Pull Request Description:
This patch adds a HMAC-based Key Derivation Function (HKDF), as defined by [RFC
5869](http://tools.ietf.org/rfc/rfc5869.txt).
It has its use-cases in encryption algorithms, and is very similar to PBKDF2, except it is not
suitable for password storage and its inputs are supposed to be cryptographically strong and already
suitable for usage as encryption keys.
The most common use case for HKDF would be to deriving a pair of keys for encrypt-and-HMAC when you
already have a single key. And that is useful in PHP mostly for two reasons:
- We don't yet have authenticated encryption modes (at least not outside of unstable PECL
extensions with poor adoption rates).
- It is significantly faster than PBKDF2, making it more suitable for usage in web applications.
Here's an example usage scenario:
1. Derive a cryptographically strong
$inputKey via PBKDF2 from a user password input.
2. Derive a pair of keys from $inputKey via HKDF: $hmacKey,
$encryptionKey
3. You can now encrypt and HMAC with the produced keys, asking only for a single password from your
users.
I can link to other (but similar) use cases with my own userland code if necessary, but I believe
that this is enough. I hope that this can get merged before PHP7's feature freeze, if at all.