WebSphere Application Server には、アウトバウンド接続を行う前に、使用する Secure Sockets Layer (SSL) 構成をプログラマチックに指定する方法が用意されています。 com.ibm.websphere.ssl.JSSEHelper インターフェースには、SSL 構成を処理するためのアプリケーション・プログラミング・インターフェース (API) の完全セットが用意されています。
com.ibm.websphere.ssl.JSSEHelper jsseHelper = com.ibm.websphere.ssl.JSSEHelper.getInstance();
try { String alias = "NodeAServer1SSLSettings"; // As specified in the WebSphere SSL configuration Properties sslProps = jsseHelper.getProperties(alias); } catch (com.ibm.websphere.ssl.SSLException e) { e.printStackTrace(); // handle exception }
最後に、セルを有効範囲とする SSL 構成 (Network Deployment) またはノードを有効範囲とする SSL 構成 (基本アプリケーション・サーバー) を選択します。 com.ibm.websphere.ssl.SSLConfigChangeListener パラメーターは、getProperties API への呼び出しによって選択された SSL 構成が変更された場合に通知されます。 プロトコルは、再度 API を呼び出して、以下の例のように新しいプロパティーを取得することができます。
try { String sslAlias = null; // The sslAlias is not specified directly at this time. String host = "myhost.austin.ibm.com"; // the target host String port = "443"; // the target port HashMap connectionInfo = new HashMap(); connectionInfo.put(JSSEHelper.CONNECTION_INFO_DIRECTION, JSSEHelper.DIRECTION_OUTBOUND); connectionInfo.put(JSSEHelper.CONNECTION_INFO_REMOTE_HOST, host); connectionInfo.put(JSSEHelper.CONNECTION_INFO_REMOTE_PORT, Integer.toString(port)); connectionInfo.put(JSSEHelper.CONNECTION_INFO_ENDPOINT_NAME, JSSEHelper.ENDPOINT_IIOP); java.util.Properties props = jsseHelper.getProperties(sslAlias, connectionInfo, null); } catch (com.ibm.websphere.ssl.SSLException e) { e.printStackTrace(); // handle exception }
try { // This is the recommended "minimum" set of SSL properties. The trustStore can // be the same as the keyStore. Properties sslProps = new Properties(); sslProps.setProperty("com.ibm.ssl.trustStore", "some value"); sslProps.setProperty("com.ibm.ssl.trustStorePassword", "some value"); sslProps.setProperty("com.ibm.ssl.trustStoreType", "some value"); sslProps.setProperty("com.ibm.ssl.keyStore", "some value"); sslProps.setProperty("com.ibm.ssl.keyStorePassword", "some value"); sslProps.setProperty("com.ibm.ssl.keyStoreType", "some value"); jsseHelper.setSSLPropertiesOnThread(sslProps); } catch (com.ibm.websphere.ssl.SSLException e) { e.printStackTrace(); // handle exception }
try { Properties sslProps = jsseHelper.getProperties(null, connectionInfo, null); jsseHelper.setSSLPropertiesOnThread(sslProps); } catch (com.ibm.websphere.ssl.SSLException e) { e.printStackTrace(); // handle exception }
try { jsseHelper.setSSLPropertiesOnThread(null); } catch (com.ibm.websphere.ssl.SSLException e) { e.printStackTrace(); // handle exception }
アウトバウンド接続を行う前に、使用する Secure Sockets Layer (SSL) 構成をプログラマチックに指定する際は、接続状況に最も適合するアプローチを選択してください。