mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-20 11:02:05 +01:00
SMACK-444 Allow 'null' for options in ServerTrustManager
Allow 'null' for TruststorePath and TruststorePassword in ServerTrustManager git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_2@13766 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
9a7bf4a4c3
commit
b253203cfb
1 changed files with 13 additions and 2 deletions
|
@ -59,6 +59,7 @@ class ServerTrustManager implements X509TrustManager {
|
|||
this.server = server;
|
||||
|
||||
InputStream in = null;
|
||||
char[] password = null;
|
||||
synchronized (stores) {
|
||||
KeyStoreOptions options = new KeyStoreOptions(configuration.getTruststoreType(),
|
||||
configuration.getTruststorePath(), configuration.getTruststorePassword());
|
||||
|
@ -67,8 +68,18 @@ class ServerTrustManager implements X509TrustManager {
|
|||
} else {
|
||||
try {
|
||||
trustStore = KeyStore.getInstance(options.getType());
|
||||
in = new FileInputStream(options.getPath());
|
||||
trustStore.load(in, options.getPassword().toCharArray());
|
||||
if (options.getPassword() != null) {
|
||||
password = options.getPassword().toCharArray();
|
||||
}
|
||||
|
||||
if (options.getPath() == null) {
|
||||
trustStore.load(null, password);
|
||||
}
|
||||
else {
|
||||
in = new FileInputStream(options.getPath());
|
||||
trustStore.load(in, password);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
trustStore = null;
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in a new issue