Class Crypto


  • public final class Crypto
    extends java.lang.Object
    Provides diagnostic information about Commons Crypto and keys for native class loading.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CONF_PREFIX
      The prefix of all crypto configuration keys.
      static java.lang.String LIB_NAME_KEY
      The configuration key of the file name for loading crypto library.
      static java.lang.String LIB_PATH_KEY
      The configuration key of the path for loading crypto library.
      static java.lang.String LIB_TEMPDIR_KEY
      The configuration key of temp directory for extracting crypto library.
      private static boolean quiet  
    • Constructor Summary

      Constructors 
      Constructor Description
      Crypto()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getComponentName()
      Gets the component version of Apache Commons Crypto.
      static java.lang.String getComponentVersion()
      Gets the component version of Apache Commons Crypto.
      static java.lang.Throwable getLoadingError()
      The loading error throwable, if loading failed.
      private static void info​(java.lang.String format, java.lang.Object... args)
      Logs info-level messages.
      static boolean isNativeCodeLoaded()
      Checks whether the native code has been successfully loaded for the platform.
      static void main​(java.lang.String[] args)
      The Main of Crypto.
      • Methods inherited from class java.lang.Object

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

      • CONF_PREFIX

        public static final java.lang.String CONF_PREFIX
        The prefix of all crypto configuration keys.
        See Also:
        Constant Field Values
      • LIB_NAME_KEY

        public static final java.lang.String LIB_NAME_KEY
        The configuration key of the file name for loading crypto library.
        See Also:
        Constant Field Values
      • LIB_PATH_KEY

        public static final java.lang.String LIB_PATH_KEY
        The configuration key of the path for loading crypto library.
        See Also:
        Constant Field Values
      • LIB_TEMPDIR_KEY

        public static final java.lang.String LIB_TEMPDIR_KEY
        The configuration key of temp directory for extracting crypto library. Defaults to "java.io.tempdir" if not found.
        See Also:
        Constant Field Values
      • quiet

        private static boolean quiet
    • Constructor Detail

      • Crypto

        public Crypto()
    • Method Detail

      • getComponentName

        public static java.lang.String getComponentName()
        Gets the component version of Apache Commons Crypto.

        This implementation relies on the VERSION properties file which must be set up with the correct contents by the build process. This is done automatically by Maven.

        Returns:
        the version; may be null if not found
      • getComponentVersion

        public static java.lang.String getComponentVersion()
        Gets the component version of Apache Commons Crypto.

        This implementation relies on the VERSION properties file which must be set up with the correct contents by the build process. This is done automatically by Maven.

        Returns:
        the version; may be null if not found
      • getLoadingError

        public static java.lang.Throwable getLoadingError()
        The loading error throwable, if loading failed.
        Returns:
        null, unless loading failed.
      • info

        private static void info​(java.lang.String format,
                                 java.lang.Object... args)
        Logs info-level messages.
        Parameters:
        format - See String.format(String, Object...).
        args - See String.format(String, Object...).
      • isNativeCodeLoaded

        public static boolean isNativeCodeLoaded()
        Checks whether the native code has been successfully loaded for the platform.
        Returns:
        true if the native code has been loaded successfully.
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        The Main of Crypto.
        Parameters:
        args - Not used.
        Throws:
        java.lang.Exception - if getCryptoRandom or getCryptoCipher get error.