View | Details | Raw Unified | Return to bug 259905 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/dstore/internal/core/util/ssl/DStoreSSLContext.java (-9 / +7 lines)
Lines 14-19 Link Here
14
 * Contributors:
14
 * Contributors:
15
 * David McKnight   (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types
15
 * David McKnight   (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types
16
 * Noriaki Takatsu  (IBM) - [259905][api] Provide a facility to use its own keystore
16
 * Noriaki Takatsu  (IBM) - [259905][api] Provide a facility to use its own keystore
17
 * David McKnight  (IBM) - [259905][api] provide public API for getting/setting key managers for SSLContext
17
 *******************************************************************************/
18
 *******************************************************************************/
18
19
19
package org.eclipse.dstore.internal.core.util.ssl;
20
package org.eclipse.dstore.internal.core.util.ssl;
Lines 25-42 Link Here
25
import javax.net.ssl.SSLContext;
26
import javax.net.ssl.SSLContext;
26
import javax.net.ssl.TrustManager;
27
import javax.net.ssl.TrustManager;
27
28
29
import org.eclipse.dstore.core.util.ssl.BaseSSLContext;
28
import org.eclipse.dstore.core.util.ssl.DStoreKeyStore;
30
import org.eclipse.dstore.core.util.ssl.DStoreKeyStore;
29
import org.eclipse.dstore.core.util.ssl.IDataStoreTrustManager;
31
import org.eclipse.dstore.core.util.ssl.IDataStoreTrustManager;
30
32
31
33
32
public class DStoreSSLContext
34
public class DStoreSSLContext
33
{
35
{
34
	private static KeyManager[] _keyManagers;
35
36
	public static void setKeyManager(KeyManager[] keyManagers)
37
	{
38
		_keyManagers = keyManagers;
39
	}
40
	
36
	
41
	public static SSLContext getServerSSLContext(String filePath, String password)
37
	public static SSLContext getServerSSLContext(String filePath, String password)
42
	{
38
	{
Lines 44-50 Link Here
44
40
45
		try
41
		try
46
		{
42
		{
47
			if (_keyManagers == null)
43
			KeyManager[] keyManagers = BaseSSLContext.getKeyManagers();
44
			if (keyManagers == null)
48
			{
45
			{
49
				KeyStore ks = DStoreKeyStore.getKeyStore(filePath, password);
46
				KeyStore ks = DStoreKeyStore.getKeyStore(filePath, password);
50
				String keymgrAlgorithm = KeyManagerFactory.getDefaultAlgorithm();
47
				String keymgrAlgorithm = KeyManagerFactory.getDefaultAlgorithm();
Lines 57-63 Link Here
57
			else
54
			else
58
			{
55
			{
59
				serverContext = SSLContext.getInstance("SSL"); //$NON-NLS-1$
56
				serverContext = SSLContext.getInstance("SSL"); //$NON-NLS-1$
60
				serverContext.init(_keyManagers, null, null);
57
				serverContext.init(keyManagers, null, null);
61
			}
58
			}
62
			
59
			
63
		}
60
		}
Lines 81-87 Link Here
81
			mgrs[0] = trustManager;
78
			mgrs[0] = trustManager;
82
			
79
			
83
			
80
			
84
			clientContext.init(_keyManagers, mgrs, null);
81
			KeyManager[] keyManagers = BaseSSLContext.getKeyManagers();
82
			clientContext.init(keyManagers, mgrs, null);
85
			}
83
			}
86
		catch (Exception e)
84
		catch (Exception e)
87
		{
85
		{
(-)src/org/eclipse/dstore/core/util/ssl/BaseSSLContext.java (+33 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 20089 IBM Corporation. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight.
10
 * 
11
 * Contributors:
12
 * David McKnight  (IBM) - [259905][api] provide public API for getting/setting key managers for SSLContext
13
 ********************************************************************************/
14
15
package org.eclipse.dstore.core.util.ssl;
16
17
import javax.net.ssl.KeyManager;
18
19
20
/**
21
 * @since 3.1
22
 */
23
public class BaseSSLContext {
24
	private static KeyManager[] _keyManagers;
25
26
	public static void setKeyManagers(KeyManager[] keyManagers){
27
		_keyManagers = keyManagers;
28
	}
29
	
30
	public static KeyManager[] getKeyManagers(){
31
		return _keyManagers;
32
	}
33
}

Return to bug 259905