### Eclipse Workspace Patch 1.0 #P org.eclipse.dstore.core Index: src/org/eclipse/dstore/internal/core/util/ssl/DStoreSSLContext.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/internal/core/util/ssl/DStoreSSLContext.java,v retrieving revision 1.4 diff -u -r1.4 DStoreSSLContext.java --- src/org/eclipse/dstore/internal/core/util/ssl/DStoreSSLContext.java 5 Jan 2009 15:26:36 -0000 1.4 +++ src/org/eclipse/dstore/internal/core/util/ssl/DStoreSSLContext.java 21 Jan 2009 21:12:13 -0000 @@ -14,6 +14,7 @@ * Contributors: * David McKnight (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types * Noriaki Takatsu (IBM) - [259905][api] Provide a facility to use its own keystore + * David McKnight (IBM) - [259905][api] provide public API for getting/setting key managers for SSLContext *******************************************************************************/ package org.eclipse.dstore.internal.core.util.ssl; @@ -25,18 +26,13 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; +import org.eclipse.dstore.core.util.ssl.BaseSSLContext; import org.eclipse.dstore.core.util.ssl.DStoreKeyStore; import org.eclipse.dstore.core.util.ssl.IDataStoreTrustManager; public class DStoreSSLContext { - private static KeyManager[] _keyManagers; - - public static void setKeyManager(KeyManager[] keyManagers) - { - _keyManagers = keyManagers; - } public static SSLContext getServerSSLContext(String filePath, String password) { @@ -44,7 +40,8 @@ try { - if (_keyManagers == null) + KeyManager[] keyManagers = BaseSSLContext.getKeyManagers(); + if (keyManagers == null) { KeyStore ks = DStoreKeyStore.getKeyStore(filePath, password); String keymgrAlgorithm = KeyManagerFactory.getDefaultAlgorithm(); @@ -57,7 +54,7 @@ else { serverContext = SSLContext.getInstance("SSL"); //$NON-NLS-1$ - serverContext.init(_keyManagers, null, null); + serverContext.init(keyManagers, null, null); } } @@ -81,7 +78,8 @@ mgrs[0] = trustManager; - clientContext.init(_keyManagers, mgrs, null); + KeyManager[] keyManagers = BaseSSLContext.getKeyManagers(); + clientContext.init(keyManagers, mgrs, null); } catch (Exception e) { Index: src/org/eclipse/dstore/core/util/ssl/BaseSSLContext.java =================================================================== RCS file: src/org/eclipse/dstore/core/util/ssl/BaseSSLContext.java diff -N src/org/eclipse/dstore/core/util/ssl/BaseSSLContext.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/dstore/core/util/ssl/BaseSSLContext.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,33 @@ +/******************************************************************************** + * Copyright (c) 20089 IBM Corporation. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Initial Contributors: + * The following IBM employees contributed to the Remote System Explorer + * component that contains this file: David McKnight. + * + * Contributors: + * David McKnight (IBM) - [259905][api] provide public API for getting/setting key managers for SSLContext + ********************************************************************************/ + +package org.eclipse.dstore.core.util.ssl; + +import javax.net.ssl.KeyManager; + + +/** + * @since 3.1 + */ +public class BaseSSLContext { + private static KeyManager[] _keyManagers; + + public static void setKeyManagers(KeyManager[] keyManagers){ + _keyManagers = keyManagers; + } + + public static KeyManager[] getKeyManagers(){ + return _keyManagers; + } +}