Skip to content

Commit

Permalink
Fix for usnistgov#44
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirralev committed Jan 13, 2019
1 parent eba9caf commit 6e8d425
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/gov/nist/core/net/DefaultSecurityManagerProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ public void init(Properties properties)
keyManagerFactory = KeyManagerFactory.getInstance(algorithm);
if(keyStoreFilename != null) {
final KeyStore ks = KeyStore.getInstance(keyStoreType);
ks.load(new FileInputStream(new File(keyStoreFilename)), keyStorePassword.toCharArray());

if(keyStorePassword != null) {
ks.load(new FileInputStream(new File(keyStoreFilename)), keyStorePassword.toCharArray());
} else {
ks.load(new FileInputStream(new File(keyStoreFilename)), null);
}
keyManagerFactory.init(ks, keyStorePassword.toCharArray());
} else {
keyManagerFactory.init(null, null);
Expand All @@ -95,7 +98,11 @@ public void init(Properties properties)
trustManagerFactory = TrustManagerFactory.getInstance(algorithm);
if(trustStoreFilename != null) {
final KeyStore ts = KeyStore.getInstance(trustStoreType);
ts.load(new FileInputStream(new File(trustStoreFilename)), trustStorePassword.toCharArray());
if(trustStorePassword != null) {
ts.load(new FileInputStream(new File(trustStoreFilename)), trustStorePassword.toCharArray());
} else {
ts.load(new FileInputStream(new File(trustStoreFilename)), null);
}

trustManagerFactory.init((KeyStore) ts);
} else {
Expand Down

0 comments on commit 6e8d425

Please sign in to comment.