Skip to content

Commit

Permalink
Merge pull request #230 from Microsoft/users/arukhlin/client_cert
Browse files Browse the repository at this point in the history
Fix the key store password issue
  • Loading branch information
AlexRukhlin authored Aug 30, 2017
2 parents 844fb06 + 6345b5c commit 6ddd063
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ private KeyManager[] getDefaultKeyManagers() throws KeyStoreException, NoSuchAlg

if (!StringUtil.isNullOrEmpty(keyStorePath)) {
final String keyStoreType = System.getProperty("javax.net.ssl.keyStoreType", "JKS"); //$NON-NLS-1$ //$NON-NLS-2$
final String keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword", StringUtil.EMPTY); //$NON-NLS-1$
final char[] keyStorePassword =
System.getProperty("javax.net.ssl.keyStorePassword", StringUtil.EMPTY).toCharArray(); //$NON-NLS-1$

final KeyManagerFactory keyManagerFactory =
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
Expand All @@ -280,8 +281,8 @@ private KeyManager[] getDefaultKeyManagers() throws KeyStoreException, NoSuchAlg
try {
final InputStream keyStoreFile = new FileInputStream(keyStorePath);

keyStore.load(keyStoreFile, keyStorePassword.toCharArray());
keyManagerFactory.init(keyStore, null);
keyStore.load(keyStoreFile, keyStorePassword);
keyManagerFactory.init(keyStore, keyStorePassword);

KeyManager[] managers = keyManagerFactory.getKeyManagers();

Expand Down

0 comments on commit 6ddd063

Please sign in to comment.