From 6345b5ce60e481c4e6c1d16110a14214e0374533 Mon Sep 17 00:00:00 2001 From: Alex Rukhlin Date: Wed, 30 Aug 2017 11:57:55 -0400 Subject: [PATCH] Fix the key store password issue --- .../internal/DefaultSSLProtocolSocketFactory.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/com.microsoft.tfs.core/src/com/microsoft/tfs/core/config/httpclient/internal/DefaultSSLProtocolSocketFactory.java b/source/com.microsoft.tfs.core/src/com/microsoft/tfs/core/config/httpclient/internal/DefaultSSLProtocolSocketFactory.java index 19070369a..1b37ea674 100644 --- a/source/com.microsoft.tfs.core/src/com/microsoft/tfs/core/config/httpclient/internal/DefaultSSLProtocolSocketFactory.java +++ b/source/com.microsoft.tfs.core/src/com/microsoft/tfs/core/config/httpclient/internal/DefaultSSLProtocolSocketFactory.java @@ -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()); @@ -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();