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;
009
010
011/**
012 * JSON Web Encryption (JWE) decrypter factory.
013 *
014 * @author Vladimir Dzhuvinov
015 * @version 2015-06-08
016 */
017public interface JWEDecrypterFactory {
018
019
020        /**
021         * Creates a new JWE decrypter for the specified header and key.
022         *
023         * @param header The JWE header. Not {@code null}.
024         * @param key    The key intended to verify the JWS message. Not
025         *               {@code null}.
026         *
027         * @return The JWE decrypter.
028         *
029         * @throws JOSEException If the JWE algorithm / encryption method is
030         *                       not supported or the key type or length
031         *                       doesn't match expected for the JWE algorithm.
032         */
033        JWEDecrypter createJWEDecrypter(final JWEHeader header, final Key key)
034                throws JOSEException;
035}