001package com.nimbusds.jose;
002
003
004/**
005 * JSON Web Encryption (JWE) encrypter.
006 *
007 * @author Vladimir Dzhuvinov
008 * @version 2015-05-21
009 */
010public interface JWEEncrypter extends JWEProvider {
011
012
013        /**
014         * Encrypts the specified clear text of a {@link JWEObject JWE object}.
015         *
016         * @param header    The JSON Web Encryption (JWE) header. Must specify
017         *                  a supported JWE algorithm and method. Must not be
018         *                  {@code null}.
019         * @param clearText The clear text to encrypt. Must not be {@code null}.
020         *
021         * @return The resulting JWE crypto parts.
022         *
023         * @throws JOSEException If the JWE algorithm or method is not
024         *                       supported or if encryption failed for some
025         *                       other internal reason.
026         */
027        JWECryptoParts encrypt(final JWEHeader header, final byte[] clearText)
028                throws JOSEException;
029}