4.10 SSLの使用
Joltでは、デフォルトのリンク・レベルの暗号化のかわりに、安全な優先トランスポート・メカニズムとしてSSLを使用できます。JoltでSSLを使用できるようにするには、JSL
に対してTUXEDO UBBCONFIG
ファイルで-s secure_port
を構成する必要があります。
JSL
接続ポートがSSLポートである場合、Joltクライアント・ライブラリは自動的にSSLを選択します。SSLの場合、Joltクライアントは、X.509証明書の場所、秘密キー、パスフレーズの暗号化に使用されるパスフレーズなどの情報を提示する必要があります。
これらの要件に対応するために、JoltSessionAttributes
に5つの属性が追加されています。
-
KEYSTORE
- クライアントの秘密キーとX.509証明書のファイル・パス -
KSPASSPHRASE
- キーストアのパスフレーズ -
TRUSTSTORE
- 信頼性のあるX.509証明書の信頼ストアのファイル・パス -
TSPASSPHRASE
- 信頼ストアのパスフレーズ -
KEYPASSPHRASE
- 秘密キーのパスフレーズ
Joltクライアント・ライブラリでは、SSL通信に対応するサード・パーティのJava Secure Socket Extension (JSSE)実装を使用します。以下のJSSE実装がテスト済です。
- Sun JRE 8.0にバンドルされているJSSE実装
- HP JRE 8.0にバンドルされているSun JSSE実装
- IBM JRE 8.0にバンドルされているIBM JSSE実装
ノート:
JDKリリース8u31以降、SSLv3
プロトコルは無効になっており、デフォルトでは使用できません。SSLv3
が必要な場合は、"SSLv3
"を<JRE_HOME>/lib/security/java.security
ファイルのjdk.tls.disabledAlgorithms
プロパティから削除するか、JSSEが初期化される前にこのセキュリティ・プロパティを動的に"true
"に設定することでプロトコルを再度アクティブにできます。
次のリスト4-15は、JSL
/JSH
との通信時にSSLを使用できるようにするJoltクライアント・コードのサンプルを示します。
Joltクライアント・コードでのSSLの使用のリスト
import java.util.*;
import bea.jolt.*;
public class simpcl extends Object {
private String userName = null;
private String userRole = null;
private String appPassword = null;
private String userPassword = null;
private JoltSessionAttributes attr = null;
private JoltSession session = null;
private JoltRemoteService toupper = null;
private JoltTransaction trans = null;
// JSL is configured with '-s 5555'
// the communication between jolt client and JSH will use SSL
private String address = new String('//cerebrum:5555');
public static void main(String args[]) {
simpcl c = new simpcl();
c.doTest();
}
public void doTest() {
attr = new JoltSessionAttributes();
// adding these session attribute
attr.setString(attr.APPADDRESS, address);
attr.setString(attr.TRUSTSTORE,'c:\\samples\\samplecacerts');
attr.setString(attr.KEYSTORE, 'c:\\samples\\client\\testkeys');
// Only key store and key will be protected by passphrase in this
sample.
// But optionly the trust store can also be protected by a passphrase
// although it is not in this sample.
attr.setString(attr.KSPASSPHRASE, 'passphrase');
attr.setString(attr.KEYPASSPHRASE, 'passphrase');
attr.setInt(attr.IDLETIMEOUT, 300);
userName = 'juser';
userRole = 'JUSER';
userPassword = 'abcd';
appPassword = 'abcd';
session = new JoltSession(attr, userName, userRole, userPassword,
appPassword);
// access a Tuxedo TOUPPER service
toupper = new JoltRemoteService('TOUPPER', session);
toupper.addString('STRING', 'string');
trans = new JoltTransaction(60, session);
try {
toupper.call(trans);
} catch (ApplicationException ae) {
ae.printStackTrace();
System.exit(1);
}
String retString = toupper.getStringDef('STRING', null);
trans.commit();
System.out.println(' returned: ' + retString);
session.endSession();
return;
}
}
親トピック: Joltクラス・ライブラリの使用