001package com.nimbusds.jose;
002
003
004import java.security.Provider;
005import java.security.SecureRandom;
006import java.util.Set;
007
008
009/**
010 * Common interface for JSON Web Encryption (JWE) {@link JWEEncrypter 
011 * encrypters} and {@link JWEDecrypter decrypters}.
012 *
013 * <p>Callers can query the JWE provider to determine its algorithm
014 * capabilities.
015 *
016 * @author  Vladimir Dzhuvinov
017 * @version $version$ (2014-04-20)
018 */
019public interface JWEAlgorithmProvider extends AlgorithmProvider {
020
021
022        /**
023         * Returns the names of the supported JWE algorithms. These correspond
024         * to the {@code alg} JWE header parameter.
025         *
026         * @return The supported JWE algorithms, empty set if none.
027         */
028        public Set<JWEAlgorithm> supportedAlgorithms();
029
030
031        /**
032         * Returns the names of the supported encryption methods. These
033         * correspond to the {@code enc} JWE header parameter.
034         *
035         * @return The supported encryption methods, empty set if none.
036         */
037        public Set<EncryptionMethod> supportedEncryptionMethods();
038
039
040        /**
041         * Sets a specific JCA provider for the key encryption.
042         *
043         * @param provider The JCA provider, or {@code null} to use the default
044         *                 one.
045         */
046        public void setKeyEncryptionProvider(final Provider provider);
047
048
049        /**
050         * Sets a specific JCA provider for the content encryption.
051         *
052         * @param provider The JCA provider, or {@code null} to use the default
053         *                 one.
054         */
055        public void setContentEncryptionProvider(final Provider provider);
056
057
058        /**
059         * Sets a specific JCA provider for MAC computation (where required by
060         * the JWE encryption method).
061         *
062         * @param provider The JCA provider, or {@code null} to use the default
063         *                 one.
064         */
065        public void setMACProvider(final Provider provider);
066
067
068        /**
069         * Sets a specific secure random generator for the initialisation
070         * vector and other purposes requiring a random number.
071         *
072         * @param randomGen The secure random generator, or {@code null} to use
073         *                  the default one.
074         */
075        public void setSecureRandom(final SecureRandom randomGen);
076}