Package com.google.crypto.tink.jwt
Class JwtMacKey
- java.lang.Object
-
- com.google.crypto.tink.Key
-
- com.google.crypto.tink.jwt.JwtMacKey
-
- Direct Known Subclasses:
JwtHmacKey
public abstract class JwtMacKey extends Key
Represents a key to compute JWT using symmetric cryptography (i.e., using theJwtMacinterface).
-
-
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 JwtMacParametersgetParameters()Returns aParametersobject containing all the information about the key which is not randomly chosen.-
Methods inherited from class com.google.crypto.tink.Key
equalsKey, getIdRequirementOrNull
-
-
-
-
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
kidheader duringcomputeMacAndEncode. If absent, no kid will be written.If present, and the
kidheader is present, the contents of thekidheader needs to match the return value of this function.Note that
getParameters.allowKidAbsent()specifies if omitting thekidheader is allowed. Of course, ifgetParameters.allowKidAbsent()is false, thengetKidmust not return an emptyOptional.
-
getParameters
public abstract JwtMacParameters getParameters()
Description copied from class:KeyReturns aParametersobject containing all the information about the key which is not randomly chosen.Implementations need to ensure that
getParameters().hasIdRequirement()returns true if and only ifgetIdRequirementOrNullis non-null.- Specified by:
getParametersin classKey
-
-