Class JwksDecryptionKeyResolver

java.lang.Object
org.jose4j.keys.resolvers.JwksDecryptionKeyResolver
All Implemented Interfaces:
DecryptionKeyResolver

public class JwksDecryptionKeyResolver extends Object implements DecryptionKeyResolver
  • Constructor Details

    • JwksDecryptionKeyResolver

      public JwksDecryptionKeyResolver(List<JsonWebKey> jsonWebKeys)
  • Method Details

    • resolveKey

      public Key resolveKey(JsonWebEncryption jwe, List<JsonWebStructure> nestingContext) throws UnresolvableKeyException
      Description copied from interface: DecryptionKeyResolver
      Choose the key to be used for decryption on the given JWE.
      Specified by:
      resolveKey in interface DecryptionKeyResolver
      Parameters:
      jwe - the JsonWebEncryption that's about to be decrypted
      nestingContext - 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