001package com.nimbusds.jose.proc;
002
003
004import java.security.Key;
005
006import com.nimbusds.jose.JOSEException;
007import com.nimbusds.jose.JWEDecrypter;
008import com.nimbusds.jose.JWEHeader;
009import com.nimbusds.jose.JWEProvider;
010
011
012/**
013 * JSON Web Encryption (JWE) decrypter factory.
014 *
015 * @author Vladimir Dzhuvinov
016 * @version 2015-11-16
017 */
018public interface JWEDecrypterFactory extends JWEProvider {
019
020
021        /**
022         * Creates a new JWE decrypter for the specified header and key.
023         *
024         * @param header The JWE header. Not {@code null}.
025         * @param key    The key intended to verify the JWS message. Not
026         *               {@code null}.
027         *
028         * @return The JWE decrypter.
029         *
030         * @throws JOSEException If the JWE algorithm / encryption method is
031         *                       not supported or the key type or length
032         *                       doesn't match expected for the JWE algorithm.
033         */
034        JWEDecrypter createJWEDecrypter(final JWEHeader header, final Key key)
035                throws JOSEException;
036}