Class PasswordHashCodec
java.lang.Object
com.svenruppert.jsentinel.credential.password.envelope.PasswordHashCodec
Self-describing envelope codec for Phase-1a password-hash strings.
The wire format is a stable, human-readable string built from
$-separated fields:
$pwh$v=1$ct=PASSWORD$alg=PBKDF2WithHmacSHA256$prov=pbkdf2-jdk
$pol=1[$pep=<keyId>]$p=k=v(,k=v)*$h=<innerHash>
The codec performs no cryptographic work. It does not run
key-derivation functions, validate algorithm strength or look up
providers. It only parses, validates the envelope structure, and
serialises a PasswordHashEnvelope back to a string.
Exception messages emitted from this codec are deliberately structural and must not embed user-supplied substrings, salts, inner hashes or pepper key identifiers.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionParses the given wire-form string into aPasswordHashRecord.encode(PasswordHashEnvelope envelope) Serialises the given envelope into its canonical wire form.
-
Field Details
-
DEFAULT
Shared default instance. The codec is stateless.
-
-
Constructor Details
-
PasswordHashCodec
public PasswordHashCodec()
-
-
Method Details
-
encode
Serialises the given envelope into its canonical wire form.- Throws:
PasswordHashFormatException- if any field carries a separator character that would corrupt the wire format
-
decode
Parses the given wire-form string into aPasswordHashRecord.- Throws:
PasswordHashFormatException- on every structural error, including unknown newer format versions, duplicate fields, unknown fields, missing required fields and forbidden characters
-