Skip to content

Java 25: Key Derivation Function API (JEP 510) - #124

Open
mperor wants to merge 1 commit into
masterfrom
DAILY/112-kdf-api
Open

mperor wants to merge 1 commit into
masterfrom
DAILY/112-kdf-api

Conversation

@mperor

@mperor mperor commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

What you'll learn

  • How to derive key material with javax.crypto.KDF using HKDF (extract-then-expand)
  • Building the derivation parameters with HKDFParameterSpec.ofExtract().addIKM(...).addSalt(...).thenExpand(info, length)
  • Why HKDF is deterministic for identical inputs, and how the info parameter binds a derived key to a specific context
  • The difference between deriveKey(alg, spec) (wraps the bytes in a SecretKey) and deriveData(spec) (returns the raw bytes)

Why it matters

HKDF lets you turn one shared secret into many independent, purpose-bound keys (e.g. separate keys for encryption vs. authentication) without running extra key-exchange rounds - a pattern used throughout modern protocols like TLS 1.3 and Signal.

Read more

JEP 510: Key Derivation Function API

Quiz

You derive two keys from the same ikm and salt, but pass "key-a" as the info for the first and "key-b" for the second. Are the two derived keys equal?

AnswerNo. `info` binds the derived key to its context: even with identical `ikm`/`salt`, a different `info` produces an unrelated key. This is what lets you safely derive several independent keys from one shared secret.

Closes #112

@mperor mperor added the daily Queued for the daily learning PR label Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Test Results

309 tests  +3   306 ✅ +3   5s ⏱️ -1s
 84 suites ±0     3 💤 ±0 
 84 files   ±0     0 ❌ ±0 

Results for commit 8e93373. ± Comparison against base commit 40465e6.

This pull request skips 1 and un-skips 1 tests.
pl.mperor.lab.java.design.pattern.creational.singleton.SingletonTest ‑ testLazyInitialized()
pl.mperor.lab.java.design.pattern.creational.singleton.SingletonTest ‑ testSerializationSafe()

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

@mperor ⏰ This daily topic is still waiting for your review.

5 similar comments
@github-actions

Copy link
Copy Markdown

@mperor ⏰ This daily topic is still waiting for your review.

@github-actions

Copy link
Copy Markdown

@mperor ⏰ This daily topic is still waiting for your review.

@github-actions

Copy link
Copy Markdown

@mperor ⏰ This daily topic is still waiting for your review.

@github-actions

Copy link
Copy Markdown

@mperor ⏰ This daily topic is still waiting for your review.

@github-actions

Copy link
Copy Markdown

@mperor ⏰ This daily topic is still waiting for your review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

daily Queued for the daily learning PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Java 25: Key Derivation Function API (JEP 510)

2 participants