Enum Class HmacDataContentBuilder.Mode
- All Implemented Interfaces:
Serializable, Comparable<HmacDataContentBuilder.Mode>, Constable
- Enclosing class:
HmacDataContentBuilder
The active mode is set by HmacDataContentBuilder.mac() or HmacDataContentBuilder.verify() and governs how
the builder interprets the selected output. In MAC mode, the pipeline
produces or strips an HMAC trailer computed over the input. In VERIFY
mode, the pipeline checks an expected tag supplied explicitly or taken from
the input trailer.
Typical flows
// Compute HMAC and emit hex tag:
PlainContent c1 = HmacDataContentBuilder.builder()
.mac()
.sha256()
.emitHexTag()
.build(true);
// Verify HMAC carried as input trailer and pass the body through:
PlainContent c2 = HmacDataContentBuilder.builder()
.verify()
.sha256()
.passThrough()
.build(true);
- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic HmacDataContentBuilder.ModeReturns the enum constant of this class with the specified name.static HmacDataContentBuilder.Mode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MAC
Compute an HMAC tag over the input stream.Use with
HmacDataContentBuilder.passThrough()to output the body while stripping the tag, or with one ofHmacDataContentBuilder.emitRawTag(),HmacDataContentBuilder.emitHexTag(), orHmacDataContentBuilder.emitBase64Tag()to output only the finalized tag. -
VERIFY
Verify an expected HMAC tag against the input stream.The expected tag can be provided via
HmacDataContentBuilder.expectedTag(byte[]),HmacDataContentBuilder.expectedTagHex(String), orHmacDataContentBuilder.expectedTagBase64(String). If no expected tag is supplied, the pipeline reads it from the input trailer. UseHmacDataContentBuilder.passThrough()to output the body and throw on mismatch, orHmacDataContentBuilder.emitVerificationBoolean()to output a textual"true"or"false"result.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-