dotfiles
bugabingas dorkfiles
owned by bugabinga
pi/skill-library/java/java-kdf-api/examples/jep-510.md
Raw
Source: https://openjdk.org/jeps/510
KDF hkdf = KDF.getInstance("HKDF-SHA256");
AlgorithmParameterSpec params = HKDFParameterSpec.ofExtract()
.addIKM(initialKeyMaterial)
.addSalt(salt)
.thenExpand(info, 32);
SecretKey key = hkdf.deriveKey("AES", params);
Markdown source
File outline
# [JEP 510](https://openjdk.org/jeps/510) example
Source: https://openjdk.org/jeps/510
```java
KDF hkdf = KDF.getInstance("HKDF-SHA256");
AlgorithmParameterSpec params = HKDFParameterSpec.ofExtract()
.addIKM(initialKeyMaterial)
.addSalt(salt)
.thenExpand(info, 32);
SecretKey key = hkdf.deriveKey("AES", params);
```