Class JWEJCAContext


  • public final class JWEJCAContext
    extends JCAContext
    Java Cryptography Architecture (JCA) context intended specifically for JSON Web Encryption (JWE) providers. Allows setting of more specific JCA providers for key encryption, content encryption and MAC computation.
    Version:
    2015-06-08
    Author:
    Vladimir Dzhuvinov
    • Constructor Detail

      • JWEJCAContext

        public JWEJCAContext()
        Creates a new default JCA context for JWE.
      • JWEJCAContext

        public JWEJCAContext​(Provider generalProvider,
                             Provider keProvider,
                             Provider ceProvider,
                             Provider macProvider,
                             SecureRandom randomGen)
        Creates a new JCA context for JWE with the specified JCA providers and secure random generator.
        Parameters:
        generalProvider - The general JCA provider to be used for all operations where a more specific one is absent, null to use the default system provider.
        keProvider - The specific JCA provider to be used for the key encryption, null to fall back to the general one, and if that is not specified to the default system provider.
        ceProvider - The specific JCA provider to be used for the content encryption, null to fall back to the general one, and if that is not specified to the default system provider.
        macProvider - The specific JCA provider to be used for the MAC computation (where required by the JWE encryption method), null to fall back to the general one, and if that is not specified to the default system provider.
        randomGen - The specific secure random generator for the initialisation vector and other purposes requiring a random number, null to use the default system one.
    • Method Detail

      • setKeyEncryptionProvider

        public void setKeyEncryptionProvider​(Provider keProvider)
        Sets a specific JCA provider for the key encryption.
        Parameters:
        keProvider - The specific JCA provider to be used for the key encryption, null to fall back to the general one, and if that is not specified to the default system provider.
      • getKeyEncryptionProvider

        public Provider getKeyEncryptionProvider()
        Gets the specific JCA provider for the key encryption.
        Returns:
        The applicable JCA provider, null implies the default system provider.
      • setContentEncryptionProvider

        public void setContentEncryptionProvider​(Provider ceProvider)
        Sets a specific JCA provider for the content encryption.
        Parameters:
        ceProvider - The specific JCA provider to be used for the content encryption, null to fall back to the general one, and if that is not specified to the default system provider.
      • getContentEncryptionProvider

        public Provider getContentEncryptionProvider()
        Gets the specific JCA provider for the content encryption.
        Returns:
        The applicable JCA provider, null implies the default system provider.
      • setMACProvider

        public void setMACProvider​(Provider macProvider)
        Sets a specific JCA provider for the MAC computation (where required by the JWE encryption method).
        Parameters:
        macProvider - The specific JCA provider to be used for the MAC computation (where required by the JWE encryption method), null to fall back to the general one, and if that is not specified to the default system provider.
      • getMACProvider

        public Provider getMACProvider()
        Gets the specific JCA provider for the MAC computation (where required by the JWE encryption method).
        Returns:
        The applicable JCA provider, null implies the default system provider.