Skip to content

Commit

Permalink
Merge pull request usnistgov#45 from vladimirralev/issue44
Browse files Browse the repository at this point in the history
Fix for usnistgov#44
  • Loading branch information
vladimirralev authored Jan 13, 2019
2 parents eba9caf + 6e8d425 commit 13ede11
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 13ede11

Please sign in to comment.