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