Class AsadminSecurityUtil


  • public class AsadminSecurityUtil
    extends Object
    Various utility methods related to certificate-based security.

    In particular, this class opens both the client-side keystore and the client-side truststore when either one is requested. This allows us to prompt only once for the master password (if necessary) without storing the password the user responds with which would be a security risk.

    Author:
    Tim Quinn (with portions refactored from elsewhere)
    • Method Detail

      • getInstance

        public static AsadminSecurityUtil getInstance​(char[] commandLineMasterPassword,
                                                      boolean isPromptable)
        Returns the usable instance, creating it if needed.
        Parameters:
        commandLineMasterPassword - password provided via the command line
        isPromptable - if the command requiring the object was run by a human who is present to respond to a prompt for the master password
        Returns:
        the usable instance
      • getInstance

        public static AsadminSecurityUtil getInstance​(boolean isPromptable)
        Returns the usable instance, creating it if needed.
        Parameters:
        isPromptable - if the command requiring the object was run by a human who is present to respond to a prompt for the master password
        Returns:
      • getAsadminTruststorePassword

        public static char[] getAsadminTruststorePassword()
        Returns the master password for the keystore and truststore, as set by the system property (defaulted if the property is not set).
        Returns:
      • getDefaultClientDir

        public static File getDefaultClientDir()
        Get the default location for client related files
      • getAsadminTruststore

        public AsadminTruststore getAsadminTruststore()
        Returns the opened AsadminTruststore object.
        Returns:
        the AsadminTruststore object
      • getAsadminKeystore

        public KeyStore getAsadminKeystore()
      • recreateDefaultTrustStore

        protected void recreateDefaultTrustStore​(char[] passwordToUse)
                                          throws IOException
        Method to recreate the default truststore file from the .gfclient folder
        Parameters:
        passwordToUse - password to use
        Throws:
        IOException