Pure-Java HKDF-SHA256 (RFC 5869). Shared by ICrypto adapters so that
crypto-derive-key returns byte-identical bytes regardless of which
adapter resolves the call.
Public surface: hkdf-sha256 (extract-then-expand) and its two RFC
steps, hkdf-extract (§2.2) and hkdf-expand (§2.3). The steps are
public because callers pin them to the RFC 5869 Appendix A vectors,
which state the intermediate PRK as well as the OKM.
Composed from javax.crypto.Mac HMAC-SHA256 — no native dependency.
Pure-Java HKDF-SHA256 (RFC 5869). Shared by ICrypto adapters so that `crypto-derive-key` returns byte-identical bytes regardless of which adapter resolves the call. Public surface: `hkdf-sha256` (extract-then-expand) and its two RFC steps, `hkdf-extract` (§2.2) and `hkdf-expand` (§2.3). The steps are public because callers pin them to the RFC 5869 Appendix A vectors, which state the intermediate PRK as well as the OKM. Composed from `javax.crypto.Mac` HMAC-SHA256 — no native dependency.
(hkdf-expand prk info length)RFC 5869 §2.3 — OKM expansion. length ≤ 255 * HashLen.
prk is a pseudorandom key of at least HashLen bytes, normally the
output of hkdf-extract; a shorter one is rejected, as the RFC requires.
RFC 5869 §2.3 — OKM expansion. length ≤ 255 * HashLen. `prk` is a pseudorandom key of at least HashLen bytes, normally the output of `hkdf-extract`; a shorter one is rejected, as the RFC requires.
(hkdf-extract salt ikm)RFC 5869 §2.2 — PRK = HMAC-SHA256(salt, IKM). nil or zero-length salt ⇒ HashLen zero bytes (RFC 5869 default). HMAC-SHA256 rejects empty keys outright, so we substitute the default.
Public so a caller can check the intermediate PRK against the RFC 5869
Appendix A vectors, and can expand one PRK into several OKMs with
hkdf-expand without extracting again.
RFC 5869 §2.2 — PRK = HMAC-SHA256(salt, IKM). nil or zero-length salt ⇒ HashLen zero bytes (RFC 5869 default). HMAC-SHA256 rejects empty keys outright, so we substitute the default. Public so a caller can check the intermediate PRK against the RFC 5869 Appendix A vectors, and can expand one PRK into several OKMs with `hkdf-expand` without extracting again.
(hkdf-sha256 salt ikm info length)RFC 5869 full HKDF-SHA256 = extract-then-expand.
RFC 5869 full HKDF-SHA256 = extract-then-expand.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |