001package com.nimbusds.jose;
002
003
004import com.nimbusds.jose.util.Base64URL;
005
006
007/**
008 * JSON Web Encryption (JWE) decrypter.
009 *
010 * @author Vladimir Dzhuvinov
011 * @version 2015-04-21
012 */
013public interface JWEDecrypter extends JWEProvider {
014
015
016        /**
017         * Decrypts the specified cipher text of a {@link JWEObject JWE Object}.
018         *
019         * @param header       The JSON Web Encryption (JWE) header. Must
020         *                     specify a supported JWE algorithm and method.
021         *                     Must not be {@code null}.
022         * @param encryptedKey The encrypted key, {@code null} if not required
023         *                     by the JWE algorithm.
024         * @param iv           The initialisation vector, {@code null} if not
025         *                     required by the JWE algorithm.
026         * @param cipherText   The cipher text to decrypt. Must not be
027         *                     {@code null}.
028         * @param authTag      The authentication tag, {@code null} if not
029         *                     required.
030         *
031         * @return The clear text.
032         *
033         * @throws JOSEException If the JWE algorithm or method is not
034         *                       supported, if a critical header parameter is
035         *                       not supported or marked for deferral to the
036         *                       application, or if decryption failed for some
037         *                       other reason.
038         */
039        byte[] decrypt(final JWEHeader header,
040                       final Base64URL encryptedKey,
041                       final Base64URL iv,
042                       final Base64URL cipherText,
043                       final Base64URL authTag)
044                throws JOSEException;
045}