Package org.jose4j.keys.resolvers
Class JwksDecryptionKeyResolver
java.lang.Object
org.jose4j.keys.resolvers.JwksDecryptionKeyResolver
- All Implemented Interfaces:
DecryptionKeyResolver
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) booleanprivate final List<JsonWebKey>private final DecryptionJwkSelector -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionresolveKey(JsonWebEncryption jwe, List<JsonWebStructure> nestingContext) Choose the key to be used for decryption on the given JWE.voidsetDisambiguateWithAttemptDecrypt(boolean disambiguateWithAttemptDecrypt) Indicates whether to try decrypting to disambiguate when the normal key selection based on the JWE headers results in more than one key.
-
Field Details
-
jsonWebKeys
-
selector
-
disambiguateWithAttemptDecrypt
boolean disambiguateWithAttemptDecrypt
-
-
Constructor Details
-
JwksDecryptionKeyResolver
-
-
Method Details
-
resolveKey
public Key resolveKey(JsonWebEncryption jwe, List<JsonWebStructure> nestingContext) throws UnresolvableKeyException Description copied from interface:DecryptionKeyResolverChoose the key to be used for decryption on the given JWE.- Specified by:
resolveKeyin interfaceDecryptionKeyResolver- Parameters:
jwe- the JsonWebEncryption that's about to be decryptednestingContext- a list of JOSE objects, if any, in which the JWE was nested. The last item in the list is the outer most JOSE object (not including the current JWE).- Returns:
- the decryption key
- Throws:
UnresolvableKeyException- if no appropriate key can be found
-
setDisambiguateWithAttemptDecrypt
public void setDisambiguateWithAttemptDecrypt(boolean disambiguateWithAttemptDecrypt) Indicates whether to try decrypting to disambiguate when the normal key selection based on the JWE headers results in more than one key. Default is false.- Parameters:
disambiguateWithAttemptDecrypt- boolean indicating whether to use decrypting to disambiguate
-