Class JwtMacKey

  • Direct Known Subclasses:
    JwtHmacKey

    public abstract class JwtMacKey
    extends Key
    Represents a key to compute JWT using symmetric cryptography (i.e., using the JwtMac interface).
    • Constructor Summary

      Constructors 
      Constructor Description
      JwtMacKey()  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      abstract java.util.Optional<java.lang.String> getKid()
      Returns the "kid" to be used for this key (https://www.rfc-editor.org/rfc/rfc7517#section-4.5).
      abstract JwtMacParameters getParameters()
      Returns a Parameters object containing all the information about the key which is not randomly chosen.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JwtMacKey

        public JwtMacKey()
    • Method Detail

      • getKid

        public abstract java.util.Optional<java.lang.String> getKid()
        Returns the "kid" to be used for this key (https://www.rfc-editor.org/rfc/rfc7517#section-4.5).

        Note that the "kid" is not necessarily related to Tink's "Key ID" in the keyset.

        If present, this kid will be written into the kid header during computeMacAndEncode. If absent, no kid will be written.

        If present, and the kid header is present, the contents of the kid header needs to match the return value of this function.

        Note that getParameters.allowKidAbsent() specifies if omitting the kid header is allowed. Of course, if getParameters.allowKidAbsent() is false, then getKid must not return an empty Optional.

      • getParameters

        public abstract JwtMacParameters getParameters()
        Description copied from class: Key
        Returns a Parameters object containing all the information about the key which is not randomly chosen.

        Implementations need to ensure that getParameters().hasIdRequirement() returns true if and only if getIdRequirementOrNull is non-null.

        Specified by:
        getParameters in class Key