Class JwtHmacParameters.KidStrategy

  • Enclosing class:
    JwtHmacParameters

    @Immutable
    public static final class JwtHmacParameters.KidStrategy
    extends java.lang.Object
    Specifies how the "kid" header is handled.
    • Field Detail

      • BASE64_ENCODED_KEY_ID

        public static final JwtHmacParameters.KidStrategy BASE64_ENCODED_KEY_ID
        The "kid" is the URL safe (RFC 4648 Section 5) base64-encoded big-endian key_id in the keyset.

        In computeMacAndEncode Tink always adds the KID.

        In verifyMacAndDecode Tink checks that the kid is present and equal to this value.

        This strategy is recommended by Tink.

      • IGNORED

        public static final JwtHmacParameters.KidStrategy IGNORED
        The "kid" header is ignored.

        In computeMacAndEncode Tink does not write a "kid" header.

        In verifyMacAndDecode Tink ignores the "kid" header.

      • CUSTOM

        public static final JwtHmacParameters.KidStrategy CUSTOM
        The "kid" is fixed. It can be obtained from parameters.getCustomKid().

        In computeMacAndEncode Tink writes the "kid" header to the value given by parameters.getCustomKid().

        In verifyMacAndDecode If the kid is present, it needs to match parameters.getCustomKid(). If the kid is absent, it will be accepted.

        Note: Tink does not allow to randomly generate new JwtHmacKey objects from parameters objects with KidStrategy equals to CUSTOM.

    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object