Class PepperApplicator
java.lang.Object
com.svenruppert.jsentinel.credential.password.pepper.PepperApplicator
Applies the optional post-KDF pepper as
HMAC-SHA-256(pepperKey, kdfOutput).
The construction is the one the Konzept §11 recommends: a stored hash on its own is useless to an attacker who does not also exfiltrate the pepper key. The key never travels with the password database.
When the supplied PepperReference is absent, the KDF output
is returned verbatim — the pepper application is a pure no-op so the
envelope shape stays the same.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classControl-flow exception for pepper-application failures. -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]apply(byte[] kdfOutput, Optional<PepperReference> pepper) ReturnsHMAC-SHA-256(pepper.key, kdfOutput)whenpepperis present, otherwise a copy of the KDF output.static byte[]Generates a fresh 32-byte pepper key fromSecureRandom.
-
Method Details
-
apply
ReturnsHMAC-SHA-256(pepper.key, kdfOutput)whenpepperis present, otherwise a copy of the KDF output.The supplied
kdfOutputarray is not zeroed here; the caller still owns it. -
generateKey
public static byte[] generateKey()Generates a fresh 32-byte pepper key fromSecureRandom. Helper for tests and bootstrap tools — never auto-rotate keys at runtime through this method (rotation arrives in Prompt 018).
-