You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2022/08/30 20:19:23 UTC

[GitHub] [hbase] anmolnar commented on a diff in pull request #4747: HBASE-27342 Use Hadoop Credentials API to retrieve passwords of TLS key/trust stores

anmolnar commented on code in PR #4747:
URL: https://github.com/apache/hbase/pull/4747#discussion_r958892912


##########
hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/tls/X509Util.java:
##########
@@ -225,27 +226,26 @@ public static SslContext createSslContextForServer(Configuration config)
    * @return the key manager.
    * @throws KeyManagerException if something goes wrong.
    */
-  static X509KeyManager createKeyManager(String keyStoreLocation, String keyStorePassword,
+  static X509KeyManager createKeyManager(String keyStoreLocation, char[] keyStorePassword,
     String keyStoreType) throws KeyManagerException {
 
-    if (keyStorePassword == null) {
-      keyStorePassword = "";
-    }
-
     if (keyStoreType == null) {
       keyStoreType = "jks";
     }
 
+    if (keyStorePassword == null) {
+      keyStorePassword = EMPTY_CHAR_ARRAY;
+    }
+
     try {
-      char[] password = keyStorePassword.toCharArray();
       KeyStore ks = KeyStore.getInstance(keyStoreType);
       try (InputStream inputStream =
         new BufferedInputStream(Files.newInputStream(new File(keyStoreLocation).toPath()))) {

Review Comment:
   Why should we use unbuffered stream here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org