Class SecurityProviderTestSupport


  • public class SecurityProviderTestSupport
    extends Object
    Testing utility class which providers various support functionality related to security providers and Java version, useful for testing cryptographic components.

    One major feature is the ability to check and load the Bouncy Castle security provider for tests which require advanced crypto capabilities, and unload it afterwards, if it wasn't loaded originally. The goal of this is to preserve the pre-test condition of whether BC was originally loaded or not, so we don't muck with the environment of JVM in which the tests are running. For example, the JVM may actually have been configured with BC deliberately, so we don't want to unload it by mistake.

    • Constructor Detail

      • SecurityProviderTestSupport

        public SecurityProviderTestSupport()
    • Method Detail

      • loadBC

        public void loadBC()
        Conditionally load the Bouncy Castle provider, if it isn't already loaded.
      • unloadBC

        public void unloadBC()
        Conditionally unload the Bouncy Castle provider, if it wasn't loaded originally (outside of this class), and if it is currently loaded.
      • haveBC

        public boolean haveBC()
        Return whether the Bouncy Castle provider is currently available.
        Returns:
        true or false
      • haveSunEC

        public boolean haveSunEC()
        Return whether the SunEC provider is currently available.
        Returns:
        true or false
      • isOpenJDK

        public boolean isOpenJDK()
        Determine if we're running on OpenJDK.
        Returns:
        true or false