mtien-apache commented on a change in pull request #4767:
URL: https://github.com/apache/nifi/pull/4767#discussion_r561433596



##########
File path: 
nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/KeyStoreUtils.java
##########
@@ -245,7 +322,7 @@ public static TrustManagerFactory 
loadTrustManagerFactory(TlsConfiguration tlsCo
      */
     public static TrustManagerFactory loadTrustManagerFactory(String 
truststorePath, String truststorePassword, String truststoreType) throws 
TlsException {
         // Legacy truststore passwords can be empty
-        final char[] truststorePasswordChars = 
StringUtils.isNotBlank(truststorePassword) ? truststorePassword.toCharArray() : 
null;
+        final char[] truststorePasswordChars = 
StringUtils.isNotBlank(truststorePassword) ? truststorePassword.toCharArray() : 
"".toCharArray();

Review comment:
       @exceptionfactory I received a Null Pointer Exception for an empty 
password when the truststore type is PKCS12, so I changed it to an empty 
string. But after some investigation, I found that the Bouncy Castle PKCS12 
store type does not allow empty passwords. 
   
   Since we allow passwordless truststores, I'll add a check for the truststore 
type. If it's PKCS12, then I'll throw an Illegal Argument Exception, otherwise 
I'll set it back to `null`.




----------------------------------------------------------------
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.

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


Reply via email to