public static void main(String args[]) {
    if (args != null && args.length > 0) {
      String action = args[0];
      String alias = null;
      String masterKey = null;
      CredentialProvider credentialProvider = null;
      Configuration configuration = new Configuration();
      if (args.length > 1 && !args[1].isEmpty()) {
        alias = args[1];
      } else {
        LOG.error("No valid arguments provided.");
        System.exit(1);
      }
      // None - To avoid incorrectly assuming redirection as argument
      if (args.length > 3 && !args[3].isEmpty() && !args[3].equalsIgnoreCase("None")) {
        masterKey = args[3];
        LOG.debug("Master key provided as an argument.");
      }
      try {
        credentialProvider = new CredentialProvider(masterKey, configuration);
      } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(1);
      }
      LOG.info("action => " + action + ", alias => " + alias);
      if (action.equalsIgnoreCase("PUT")) {
        String password = null;
        if (args.length > 2 && !args[2].isEmpty()) {
          password = args[2];
        }
        if (password != null && !password.isEmpty()) {
          try {
            credentialProvider.addAliasToCredentialStore(alias, password);
          } catch (AmbariException e) {
            e.printStackTrace();
          }
        } else {
          LOG.error("Alias and password are required arguments.");
          System.exit(1);
        }
      } else if (action.equalsIgnoreCase("GET")) {
        String writeFilePath = null;
        if (args.length > 2 && !args[2].isEmpty()) {
          writeFilePath = args[2];
        }
        if (writeFilePath != null && !writeFilePath.isEmpty()) {
          String passwd = "";
          try {
            char[] retPasswd = credentialProvider.getPasswordForAlias(alias);
            if (retPasswd != null) {
              passwd = new String(retPasswd);
            }
          } catch (AmbariException e) {
            LOG.error("Error retrieving password for alias.");
            e.printStackTrace();
          }
          FileOutputStream fo = null;
          try {
            fo = new FileOutputStream(writeFilePath);
            fo.write(passwd.getBytes());
          } catch (IOException e) {
            e.printStackTrace();
          } finally {
            Closeables.closeSilently(fo);
          }
        } else {
          LOG.error("Alias and file path are required arguments.");
        }
      }
    } else {
      LOG.error("No arguments provided to " + "CredentialProvider");
      System.exit(1);
    }
    System.exit(0);
  }
Credential Store entry point
args[0] => Action (GET/PUT)
args[1] => Alias
args[2] => Payload (FilePath for GET/Password for PUT)
args[3] => Master Key (Empty)

@param args
ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java