Class JCAContext

  • Direct Known Subclasses:
    JWEJCAContext

    public class JCAContext
    extends java.lang.Object
    Java Cryptography Architecture (JCA) context, consisting of a JCA provider and secure random generator.
    Version:
    2015-06-08
    Author:
    Vladimir Dzhuvinov
    • Constructor Summary

      Constructors 
      Constructor Description
      JCAContext()
      Creates a new default JCA context.
      JCAContext​(java.security.Provider provider, java.security.SecureRandom randomGen)
      Creates a new JCA context.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.security.Provider getProvider()
      Gets the JCA provider to be used for all operations.
      java.security.SecureRandom getSecureRandom()
      Gets the secure random generator.
      void setProvider​(java.security.Provider provider)
      Sets the JCA provider to be used for all operations.
      void setSecureRandom​(java.security.SecureRandom randomGen)
      Sets a specific secure random generator for the initialisation vector and other purposes requiring a random number.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JCAContext

        public JCAContext()
        Creates a new default JCA context.
      • JCAContext

        public JCAContext​(java.security.Provider provider,
                          java.security.SecureRandom randomGen)
        Creates a new JCA context.
        Parameters:
        provider - The JCA provider, null to use the default system one.
        randomGen - The specific secure random generator, null to use the default system one.
    • Method Detail

      • getProvider

        public java.security.Provider getProvider()
        Gets the JCA provider to be used for all operations.
        Returns:
        The JCA provider to be used for all operations where a more specific one is absent, null implies the default system provider.
      • setProvider

        public void setProvider​(java.security.Provider provider)
        Sets the JCA provider to be used for all operations.
        Parameters:
        provider - The JCA provider to be used for all operations where a more specific one is absent, null to use the default system provider.
      • getSecureRandom

        public java.security.SecureRandom getSecureRandom()
        Gets the secure random generator. Intended for generation of initialisation vectors and other purposes that require a secure random generator.
        Returns:
        The specific secure random generator (if available), else the default system one.
      • setSecureRandom

        public void setSecureRandom​(java.security.SecureRandom randomGen)
        Sets a specific secure random generator for the initialisation vector and other purposes requiring a random number.
        Parameters:
        randomGen - The secure random generator, null to use the default system one.