001package com.nimbusds.jose;
002
003
004
005
006/**
007 * Interface for encrypting JSON Web Encryption (JWE) objects.
008 *
009 * <p>Callers can query the encrypter to determine its algorithm capabilities.
010 *
011 * @author Vladimir Dzhuvinov
012 * @version $version$ (2012-10-04)
013 */
014public interface JWEEncrypter extends JWEAlgorithmProvider {
015
016
017        /**
018         * Encrypts the specified clear text of a {@link JWEObject JWE object}.
019         *
020         * @param header    The JSON Web Encryption (JWE) header. Must specify a
021         *                  supported JWE algorithm and must not be
022         *                  {@code null}.
023         * @param clearText The clear text to encrypt. Must not be {@code null}.
024         *
025         * @return The resulting JWE crypto parts.
026         *
027         * @throws JOSEException If the JWE algorithm is not supported or if
028         *                       encryption failed for some other reason.
029         */
030        public JWECryptoParts encrypt(final JWEHeader header, final byte[] clearText)
031                throws JOSEException;
032}