public static String getPasswdFromKeystore(String keystore, String key) throws IOException {
    String passwd = null;
    if (keystore != null && key != null) {
      Configuration conf = new Configuration();
      conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, keystore);
      char[] pwdCharArray = conf.getPassword(key);
      if (pwdCharArray != null) {
        passwd = new String(pwdCharArray);
      }
    }
    return passwd;
  }
Checks if path passed in exists and has writable permissions.
The path will be created if it does not exist.
@param rootHDFSDirPath
@param conf
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java