Claus Ibsen created CAMEL-27263:
-----------------------------------

             Summary: camel-ftp - FTPS key store and trust store options fail 
with a NullPointerException when the file or a password is not set
                 Key: CAMEL-27263
                 URL: https://issues.apache.org/jira/browse/CAMEL-27263
             Project: Camel
          Issue Type: Improvement
          Components: camel-ftp
            Reporter: Claus Ibsen


{{FtpsEndpoint}} builds the key store and the trust store of the FTPS client 
from the multi-value options {{ftpClient.keyStore.*}} and 
{{ftpClient.trustStore.*}}. When any of them is set, it reads {{file}} and 
calls {{password.toCharArray()}} (and {{keyPassword.toCharArray()}} for the key 
store), so:
* a trust store or key store option without {{file}} (only {{type}}, or only 
{{password}}) fails with a {{NullPointerException}};
* a trust store without {{password}} fails with a {{NullPointerException}}, 
though a JKS trust store, or a store without a password, can be read without 
one;
* a key store without {{keyPassword}} fails with a {{NullPointerException}}, 
though the key is usually protected with the password of the store.

Found with the camel-kamelets {{ftps-source}} and {{ftps-sink}}, which now 
expose a trust store ({{trustStoreFile}}, {{trustStorePassword}}, 
{{trustStoreType}}).

Improvement:
* without {{file}}, fail with an {{IllegalArgumentException}} that names 
{{ftpClient.trustStore.file}} or {{ftpClient.keyStore.file}};
* without {{password}}, load the store without a password; a trust store that 
then has no certificates (a PKCS12 store protects them with its password) fails 
with a message to set {{ftpClient.trustStore.password}};
* without {{keyPassword}}, use the password of the key store.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to