bea ホーム | 製品 | dev2dev | support | askBEA |
![]() |
![]() |
|
![]() |
e-docs > Tuxedo > Tuxedo CORBA アプリケーションのセキュリティ機能 > セキュリティをインプリメントする CORBA アプリケーション |
Tuxedo CORBA アプリケーションのセキュリティ機能
|
セキュリティをインプリメントする CORBA アプリケーション
ここでは、以下の内容について説明します。
ブートストラップ処理メカニズムの使用
注記 このメカニズムは、BEA CORBA クライアント・アプリケーションで使用します。
BEA Tuxedo CORBA 環境の Bootstrap オブジェクトは機能拡張されており、指定した IIOP リスナ/ハンドラに対するすべての接続を保護するように指定できます。Bootstrap オブジェクトは、IIOP リスナ/ハンドラの場所を指定する際に使用する corbaloc および corbalocs の URL (Uniform Resource Locator) アドレス形式をサポートしています。提供されるセキュリティのタイプは、IIOP リスナ/ハンドラの場所の指定に使用する URL の形式によって異なります。
ホストとポートのアドレス形式の場合、URL アドレス形式を使用して IIOP リスナ/ハンドラの場所を指定しますが、ブートストラップ処理プロセスの動作は異なります。corbaloc または corbalocs URL アドレス形式を使用する場合、IIOP リスナ/ハンドラへの初期接続は、以下のいずれかに分かれます。
corbalocs URL アドレス形式を使用すると、最低限、プリンシパルと IIOP リスナ/ハンドラの間の接続の整合性を保護するために SSL プロトコルが使用されます。
表 10-1 では、2 つの URL アドレス形式の違いを説明します。
corbaloc および corbalocs URL アドレス形式は、TCP/IP とドメイン・ネーム・システム (DNS) の両方の環境で簡単に操作できる文字列化されたオブジェクト・リファレンスを提供します。corbaloc および corbalocs URL アドレス形式には、DNS スタイルのホスト名または IP アドレスおよびポートが含まれます。 URL アドレス形式は、インターオペラブル・ネーミング・サービスの一部として Object Management Group (OMG) によって適用されたオブジェクト URL の定義に基づいて、その定義を拡張します。BEA Tuxedo ソフトウェアは、WebLogic Enterprise 製品の旧リリースの機能をサポートすることに加えて、セキュリティ保護された HTTP の URL に従ってモデル化された安全な形式をサポートするために、OMG インターオペラブル・ネーミング・サービスで記述された URL 形式も拡張します。 リスト10-1 には、新しい URL アドレス形式の例があります。 コード リスト 10-1 corbaloc および corbalocs URL アドレス形式の例 BEA Tuxedo 製品は、異なるスキームの複数の URL の列挙をサポートする構文を拡張し、OMG インターオペラブル・ネーミング・サービスで記述した URL 構文の機能を向上しています。リスト10-2 に、複数の URL を指定する例を示します。 コード リスト 10-2 複数の URL アドレス形式の指定の例 リスト10-2 の例では、パーサは、URL corbaloc://force.com:1111 に達すると、安全な接続を試行しなかったものとして内部状態をリセットし、保護されていない接続を試行します。これは、クライアント・アプリケーションが Credential オブジェクトで SSL パラメータを設定していない場合に起こります。 以下の節では、Bootstrap オブジェクトの異なるアドレス形式を使用した場合の動作を説明します。 ホストとポートのアドレス形式の使用 CORBA クライアント・アプリケーションが、Bootstrap オブジェクトのホストとポートのアドレス形式を使用する場合、Bootstrap オブジェクトのコンストラクタ・メソッドは、指定したホスト名およびポート番号を基にオブジェクト・リファレンスを作成します。IIOP リスナ/ハンドラに対する呼び出しは、SSL プロトコルによる保護なしに行われます。 クライアント・アプリケーションは、パスワード認証による認証も実行できます。ただし、ブートストラップ処理は非保護および非検証リンクで実行されるので、すべての接続は、以下のセキュリティ攻撃に対して脆弱です。
corbaloc://555xyz.com:1024,corbaloc://555backup.com:1022,
corbaloc://555last.com:1999
corbalocs://555xyz.com:1024,(corbalocs://555backup.com:1022|corbalocs://555last.com:1999)
corbaloc://555xyz.com:1111
corbalocs://24.128.122.32:1011, corbalocs://24.128.122.34corbalocs://555xyz.com:1024,corbaloc://555xyz.com:1111
corbalocs://ctxobj.com:3434,corbalocs://mthd.com:3434,corbaloc://force.com:1111
注記 IIOP リスナ/ハンドラが SSL プロトコル用にコンフィギュレーションされ、Bootstrap オブジェクトのホストとポートのアドレス形式が使用されている場合、指定した CORBA オブジェクトに対する呼び出しによって INVALID_DOMAIN 例外が発生します。
corbaloc URL アドレス形式の使用
デフォルトでは、corbaloc URL アドレス形式およびパスワード認証を使用する場合に、IIOP リスナ/ハンドラに対する呼び出しは保護されていません。したがって、すべての通信は、以下のセキュリティ攻撃に対して脆弱です。
corbaloc URL アドレス形式を使用する際に、SecurityLevel2::PrincipalAuthenticator::authenticate() メソッドを使用して、証明書による認証を使用するように指定し、Credentials オブジェクトの invocation_methods_required メソッドを呼び出して、ブートストラップ処理を保護できます。
注記 IIOP リスナ/ハンドラが SSL プロトコル用にコンフィギュレーションされているものの、証明書による認証用にコンフィギュレーションされておらず、corbaloc URL アドレス形式が使用されている場合、指定した CORBA オブジェクトに対する呼び出しによって INVALID_DOMAIN 例外が発生します。
既存の CORBA アプリケーションを、ホストとポートのアドレス形式ではなく corbaloc URL 形式に移行することをお勧めします。
corbalocs URL アドレス形式の使用
corbalocs URL アドレス形式は、プリンシパルと IIOP リスナ/ハンドラの間の通信を保護する場合に推奨される形式です。corbalocs URL アドレス形式は、corbaloc URL アドレス形式とほぼ同じように機能しますが、使用する認証のタイプに関係なく、IIOP リスナ/ハンドラまたは CORBA C++ ORB を使用した通信を保護するために SSL プロトコルを使用する点が異なります。
デフォルトを corbalocs URL アドレス形式で使用する場合、通信は、サービス拒否攻撃に対してのみ脆弱です。SSL プロトコルおよび証明書による認証を使用すると、スニッファ、改ざん、リプレイ攻撃を防ぐことができます。さらに、デジタル証明書で指定したホストの検証によって、介在者の攻撃も防ぐことができます。
corbalocs URL アドレス形式を使用するには、SSL プロトコルの使用を有効にするように IIOP リスナ/ハンドラまたは CORBA C++ ORB をコンフィギュレーションする必要があります。IIOP リスナ/ハンドラまたは CORBA C++ ORB を SSL プロトコル用にコンフィギュレーションする際の詳細については、第 6 章の 1 ページ「SSL プロトコルのコンフィギュレーション」を参照してください。
パスワード認証の使用
ここでは、CORBA アプリケーションでのパスワード認証のインプリメントについて説明します。
Security サンプル・アプリケーション
Security サンプル・アプリケーションでは、パスワード認証を使用します。Security サンプル・アプリケーションでは、アプリケーションを使用している学生が固有の ID とパスワードを持っている必要があります。Security サンプル・アプリケーションは、以下のように動作します。
図10-1 では、Security サンプル・アプリケーションのしくみを示します。
図 10-1 Security サンプル・アプリケーション
Security サンプル・アプリケーションのソース・ファイルは、BEA Tuxedo ソフトウェアの ¥samples¥corba¥university ディレクトリにあります。Security サンプル・アプリケーションの作成と実行の詳細については、 『BEA Tuxedo CORBA University サンプル・アプリケーション』
クライアント・アプリケーションの記述
パスワード認証を使用する場合、以下を実行するクライアント・アプリケーション・コードを記述します。
SecurityLevel2::PrincipalAuthenticator インターフェイスは、CORBA サービス・セキュリティ・サービス仕様で定義されます。このインターフェイスには、プリンシパルの認証に使用する 2 つのメソッドがあります。メソッドが 2 つあるのは、プリンシパルの認証では複数の手順を必要とする可能性があるからです。authenticate() メソッドでは、呼び出し側は、認証を行い、必要に応じてこのセッションのプリンシパルの属性を選択できます。
CORBA 環境は、BEA Texudo 製品の ATMI 環境にあるものと同様のセキュリティをサポートする機能で PrincipalAuthenticator オブジェクトを拡張します。拡張機能は、Tobj::PrincipalAuthenticator インターフェイスによって提供されます。
Tobj::PrincipalAuthenticator インターフェイス用に定義されたメソッドは、同等の CORBA 定義のインターフェイスの特化および単純化した形式を提供します。CORBA アプリケーションを開発する場合、CORBA 定義の拡張か BEA Tuxedo 拡張のいずれかを使用できます。
Tobj::PrincipalAuthenticator インターフェイスは、SecurityLevel2::PrincipalAuthenticator インターフェイスと同じ機能を提供します。ただし、SecurityLevel2::PrincipalAuthenticator::authenticate() メソッドとは異なり、Tobj::PrincipalAuthenticator インターフェイスの logon() メソッドは、Credentials オブジェクトを返しません。結果として、複数のプリンシパル ID を使用する CORBA アプリケーションでは、ログオンの結果として Credentials オブジェクトを取得する logon() メソッドの直後に Current::get_credentials() メソッドを呼び出す必要があります。ログオン・メソッドの直後の Credentials オブジェクトの取得は、シリアル化されたアクセスで保護する必要があります。
注記 ログオンの一部として指定したユーザ・データには、NULL を含めることはできません。
次の節には、パスワード認証のインプリメントを示す C++ および Java のコード例があります。Visual Basic のコード例については、第 17 章の 1 ページ「オートメーション・セキュリティ・リファレンス」を参照してください。
SecurityLevel2::PrincipalAuthenticator::authenticate() メソッドを使用する C++ コード例
リスト10-3 には、SecurityLevel2::PrincipalAuthenticator::authenticate() メソッドを使用してパスワード認証を実行する C++ コード例があります。
コード リスト 10-3 SecurityLevel2::PrincipalAuthenticator::authenticate() メソッドを使用する C++ クライアント・アプリケーション
...
//Bootstrap オブジェクトを作成
Tobj_Bootstrap* bootstrap = new Tobj_Bootstrap(orb,
corbalocs://sling.com:2143);
//SecurityCurrent オブジェクトを取得
CORBA::Object_var var_security_current_oref =
bootstrap.resolve_initial_references(“SecurityCurrent”);
SecurityLevel2::Current_var var_security_current_ref =
SecurityLevel2::Current::_narrow(var_security_current_oref.in());
//PrincipalAuthenticator を取得
SecurityLevel2::PrincipalAuthenticator_var var_principal_authenticator =
var_security_current_oref->principal_authenticator();
const char * user_name = “john”
const char * client_name = “university”;
char system_password[31] = {‘¥0’};
char user_password[31] = {‘¥0’};
Tobj::PrincipalAuthenticator_ptr var_bea_principal_authenticator =
Tobj::PrincipalAuthenticator::_narrow(var_bea_principal_authenticator.in());
//セキュリティ・レベルを決定
Tobj::AuthType auth_type = var_bea_principal_authenticator->get_auth_type();
switch (auth_type)
{
case Tobj::TOBJ_NOAUTH;
break;
case Tobj::TOBJ_SYSAUTH
strcpy(system_password, “sys_pw”);
case Tobj::TOBJ_APPAUTH
strcpy(system_password, “sys_pw”);
strcpy(user_password, “john_pw”);
break;
}
if (auth_type != Tobj::TOBJ_NOAUTH)
{
SecurityLevel2::Credentials_var creds;
Security::Opaque_var auth_data;
Security::AttributeList_var privileges;
Security::Opaque_var cont_data;
Security::Opaque_var auth_spec_data;
var_bea_principalauthenticator->build_auth_data(user_name,
client_name,
system_password,
user_password,
NULL,
auth_data,
privileges);
Security::AuthenticationStatus status =
var_bea_principalauthenticator->authenticate(
Tobj::TuxedoSecurity,
user_name,
auth_data,
privileges,
creds,
cont_data, auth_spec_data);
if (status != Security::SecAuthSuccess)
{
//認証に失敗
return;
}
}
//アプリケーションに進む
...
Java Code Example That Uses the SecurityLevel2.PrincipalAuthenticator.authenticate() Method
リスト10-4 には、SecurityLevel2.PrincipalAuthenticator.authenticate() メソッドを使用してパスワード認証を実行する Java コード例があります。
コード リスト 10-4 SecurityLevel2.PrincipalAuthenticator.authenticate() メソッドを使用する Java クライアント・アプリケーション
...
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bs =
new Tobj_Bootstrap(orb, corbalocs://sling.com:2143);
//SecurityCurrent オブジェクトを取得
org.omg.CORBA.Object secCurObj =
bs.resolve_initial_references( "SecurityCurrent" );
org.omg.SecurityLevel2.Current secCur2Obj =
org.omg.SecurityLevel2.CurrentHelper.narrow(secCurObj);
//Principal Authenticator を取得
org.omg.Security.PrincipalAuthenticator princAuth =
secCur2Obj.principal_authenticator();
com.beasys.Tobj.PrincipalAuthenticator auth =
Tobj.PrincipalAuthenticatorHelper.narrow(princAuth);
//認証タイプを取得
com.beasys.Tobj.AuthType authType = auth.get_auth_type();
//引数を初期化
String userName = "John";
String clientName = "Teller";
String systemPassword = null;
String userPassword = null;
byte[] userData = new byte[0];
//要求されたセキュリティ・レベルに従って引数を準備
switch(authType.value())
{
case com.beasys.Tobj.AuthType._TPNOAUTH:
break;
case com.beasys.Tobj.AuthType._TPSYSAUTH:
systemPassword = "sys_pw";
break;
case com.beasys.Tobj.AuthType._TPAPPAUTH:
systemPassword = "sys_pw";
userPassword = "john_pw";
break;
}
//セキュリティ・データを構築
org.omg.Security.OpaqueHolder auth_data =
new org.omg.Security.OpaqueHolder();
org.omg.Security.AttributeListHolder privs =
new Security.AttributeListHolder();
auth.build_auth_data(userNname, clientName, systemPassword,
userPassword, userData, authData,
privs);
//ユーザを認証
org.omg.SecurityLevel2.CredentialsHolder creds =
new org.omg.SecurityLevel2.CredentialHolder();
org.omg.Security.OpaqueHolder cont_data =
new org.omg.Security.OpaqueHolder();
org.omg.Security.OpaqueHolder auth_spec_data =
new org.omg.Security.OpaqueHolder();
org.omg.Security.AuthenticationStatus status =
auth.authenticate(com.beasys.Tobj.TuxedoSecurity.value,
0, userName, auth_data.value(),
privs.value(), creds, cont_data,
auth_spec_data);
if (status != AuthenticatoinStatus.SecAuthSuccess)
System.exit(1);
}
...
Tobj::PrincipalAuthenticator::logon() メソッドを使用する C++ コード例
リスト10-5 には、Tobj::PrincipalAuthenticator::logon() メソッドを使用してパスワード認証を実行する C++ コード例があります。
コード リスト 10-5 Tobj::PrincipalAuthenticator::logon() メソッドを使用する C++ クライアント・アプリケーション
...
CORBA::Object_var var_security_current_oref =
bootstrap.resolve_initial_references(“SecurityCurrent”);
SecurityLevel2::Current_var var_security_current_ref =
SecurityLevel2::Current::_narrow(var_security_current_oref.in());
//PrincipalAuthenticator を取得
SecurityLevel2::PrincipalAuthenticator_var var_principal_authenticator_oref =
var_security_current_oref->principal_authenticator();
//PrincipalAuthenticator をナロー変換
Tobj::PrincipalAuthenticator_var var_bea_principal_authenticator =
Tobj::PrincipalAuthenticator::_narrow
var_principal_authenticator_oref.in());
const char * user_name = “john”
const char * client_name = “university”;
char system_password[31] = {‘¥0’};
char user_password[31] = {‘¥0’};
//セキュリティ・レベルを決定
Tobj::AuthType auth_type = var_bea_principal_authenticator->get_auth_type();
switch (auth_type)
{
case Tobj::TOBJ_NOAUTH;
break;
case Tobj::TOBJ_SYSAUTH
strcpy(system_password, “sys_pw”);
case Tobj::TOBJ_APPAUTH
strcpy(system_password, “sys_pw”);
strcpy(user_password, “john_pw”);
break;
}
if (auth_type != Tobj::TOBJ_NOAUTH)
{
SecurityLevel2::Credentials_var creds;
Security::Opaque_var auth_data;
Security::AttributeList_var privileges;
Security::Opaque_var cont_data;
Security::Opaque_var auth_spec_data;
//セキュリティ・レベルを決定
Tobj::AuthType auth_type = var_bea_principal_authenticator->get_auth_type();
Security::AuthenticationStatus status = var_bea_principal_authenticator->logon(
user_name,
client_name,
system_password,
user_password,
0);
if (status != Security::SecAuthSuccess)
{
//認証に失敗
return;
}
}
//アプリケーションに進む
...
//ログオフ
try
{
logoff();
}
...
Java Code Example That Uses the Tobj.PrincipalAuthenticator.logon() Method
リスト10-6 には、Tobj.PrincipalAuthenticator.logon() メソッドを使用してパスワード認証を実行する Java コード例があります。
コード リスト 10-6 Tobj.PrincipalAuthenticator.logon() メソッドを使用する Java クライアント・アプリケーション
...
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bs =
new Tobj_Bootstrap(orb, corbaloc://sling.com;2143);
//SecurityCurrent オブジェクトを取得
org.omg.CORBA.Object secCurObj =
bs.resolve_initial_references( "SecurityCurrent" );
org.omg.SecurityLevel2.Current secCur2Obj =
org.omg.SecurityLevel2.CurrentHelper.narrow(secCurObj);
//Principal Authenticator を取得
org.omg.Security.PrincipalAuthenticator princAuth =
secCur2Obj.principal_authenticator();
com.beasys.Tobj.PrincipalAuthenticator auth =
Tobj.PrincipalAuthenticatorHelper.narrow(princAuth);
//認証タイプを取得
com.beasys.Tobj.AuthType authType = auth.get_auth_type();
//引数を初期化
String userName = "John";
String clientName = "Teller";
String systemPassword = null;
String userPassword = null;
byte[] userData = new byte[0];
//要求されたセキュリティ・レベルに従って引数を準備
switch(authType.value())
{
case com.beasys.Tobj.AuthType._TPNOAUTH:
break;
case com.beasys.Tobj.AuthType._TPSYSAUTH:
systemPassword = "sys_pw";
break;
case com.beasys.Tobj.AuthType._TPAPPAUTH:
systemPassword = "sys_pw";
userPassword = "john_pw";
break;
}
//Tuxedo 型の認証
org.omg.Security.AuthenticationStatus status =
auth.logon(userName, clientName, systemPassword,
userPassword, userData);
...
//アプリケーションに進む
//ログオフ
try
{
auth.logoff();
}
...
証明書による認証の使用
ここでは、CORBA アプリケーションでの証明書による認証のインプリメントについて説明します。
Secure Simpapp サンプル・アプリケーション
Secure Simpapp サンプル・アプリケーションは、既存の Simpapp サンプル・アプリケーションを使用し、SSL プロトコルおよび証明書による認証で保護された通信をサポートするようにコードおよびコンフィギュレーション・ファイルを変更します。
Secure Simpapp サンプル・アプリケーションのサーバ・アプリケーションは、以下の 2 つのメソッドを持つ CORBA オブジェクトのインプリメンテーションを提供します。
Simpapp サンプル・アプリケーションは、証明書による認証と SSL プロトコルをサポートするために以下のように変更されました。
C++ Secure Simpapp サンプル・アプリケーションのソース・ファイルは、BEA Tuxedo ソフトウェアの ¥samples¥corba¥simpappSSL ディレクトリにあります。Secure Simpapp サンプル・アプリケーションの作成と実行の手順については、第 11 章の 1 ページ「CORBA サンプル・アプリケーションのビルドと実行」を参照してください。
CORBA クライアント・アプリケーションの記述
証明書による認証を使用する場合、以下を実行するクライアント・アプリケーション・コードを記述します。
次の節には、証明書による認証のインプリメントを示す C++ および Java のコード例があります。
証明書による認証の C++ コード例
リスト10-7 では、C++ CORBA クライアント・アプリケーションでの証明書による認証の使用を示します。
コード リスト 10-7 証明書による認証を使用する CORBA C++ クライアント・アプリケーション
....
// ORB の初期化
CORBA::ORB_var v_orb = CORBA::ORB_init(argc, argv, "");
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bootstrap(v_orb.in(), corbalocs://sling.com:2143);
//SecurityCurrent を解決
CORBA::Object_ptr seccurobj =
bootstrap.resolve_initial_references("SecurityCurrent");
SecurityLevel2::Current_ptr seccur =
SecurityLevel2::Current::_narrow(seccurobj);
//証明書ベースの認証を実行
SecurityLevel2::Credentials_ptr the_creds;
Security::AttributeList_var privileges;
Security::Opaque_var continuation_data;
Security::Opaque_var auth_specific_data;
Security::Opaque_var response_data;
//プリンシパルの電子メール・アドレス
char emailAddress[] = “milozzi@bigcompany.com;”
//プリンシパルのデジタル証明書のパス・フレーズ
char password[] = “asdawrewe98infldi7;”
//証明書プライベート・キー・パスワードをオペークに変換
unsigned long password_len = strlen(password);
Security::Opaque ssl_auth_data(password_len);
//Principal Authenticator でプリンシパルの証明書を認証
for(int i = 0; (unsigned long) i < password_len; i++)
ssl_auth_data[i] = password[i];
Security::AuthenticationStatus auth_status;
SecurityLevel2::PrincipalAuthenticator_var PA =
seccur->principal_authenticator();
auth_status = PA->authenticate(Tobj::CertificateBased,
emailAddress,
ssl_auth_data,
privileges,
the_creds,
continuation_data,
auth_specific_data);
while(auth_status == Security::SecAuthContinue) {
auth_status = PA->continue_authentication(
response_data,
the_creds,
continuation_data,
auth_specific_data);
}
...
証明書による認証の Java コード例
リスト10-8 では、CORBA Java クライアント・アプリケーションでの証明書による認証の使用を示します。
コード リスト 10-8 証明書による認証を使用する CORBA Java クライアント・アプリケーション
...
//ORB を初期化
Properties Prop;
Prop = new Properties(System.getProperties());
Prop.put("org.omg.CORBA.ORBClass","com.beasys.CORBA.iiop.ORB");
Prop.put("org.omg.CORBA.ORBSingletonClass",
"com.beasys.CORBA.idl.ORBSingleton");
ORB orb = ORB.init(args, Prop);
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bs = new Tobj_Bootstrap(orb,
corbalocs://foo:2501);
//SecurityCurrent を解決
org.omg.CORBA.object ocurr =
bs.resolve_initial_references(“SecurityCurrent”);
org.omg.SecurityLevel2.Current curr =
org.omg.SecurityLevel2.CurrentHelper.narrow(occur);
//Principal Authenticator を取得
com.beasys.Tobj.PrincipalAuthenticator pa =
(com.beasys.Tobj.PrincipalAuthenticator)
curr.principal_authenticator();
OpaqueHolder auth_data = new OpaqueHolder();
AttributeListHolder privileges = new AttributeListHolder();
org.omg.SecurityLevel2.CredentialsHolder creds =
new org.omg.SecurityLevel2.CredentialsHolder();
OpaqueHolder continuation_data = new OpaqueHolder();
OpaqueHolder auth_specific_data = new OpaqueHolder();
auth_data.value=new String (“deathstar”).getbytes(“UTF8);
if(pa.authenticate(com.beasys.Tobj.CertificateBased.value,
“vader@largecompany.com”,
auth_data.value,
privileges.value,
the_creds,
continuation_data,
auth_specific_data)
!AuthenticationStatus.SecAuthSuccess) {
System.err.println(“logon failed”);
System.exit(1);
}
...
インターオペラブル・ネーミング・サービス・メカニズムの使用
注記 このメカニズムは、サード・パーティのクライアント ORB で使用します。
インターオペラブル・ネーミング・サービス・メカニズムを使用し、適切なクリデンシャルで BEA Tuxedo ドメインにアクセスするには、次の手順を実行します。
CORBA インターオペラブル・ネーミング・サービス (INS) メカニズム使用の詳細については、「CORBA ブートストラップ処理のプログラミング・リファレンス」の SecurityLevel2::PrincipalAuthenticator インターフェイスの項目を参照してください。
invocations_options_required() メソッドの使用
証明書による認証を使用する場合、プリンシパルで必要なセキュリティ属性を定義しなければならない場合があります。たとえば、銀行取引アプリケーションでは、データをデータベースに転送する前に、特定のセキュリティ要件を満たさなければならない可能性があります。SecurityLevel2::Credentials インターフェイスの invocation_options_required() メソッドを使用すると、プリンシパルは、SSL 接続のセキュリティ特性を明示的に制御できるようになります。corbaloc URL アドレス形式を使用する場合、SecurityLevel2::Credentials インターフェイスの authenticate() メソッドと invocation_options_required() メソッドを使用し、ブートストラップ処理をセキュリティで保護できます。
invocation_options_required() メソッドを使用するには、次の手順を実行します。
リスト10-9 では、invocation_options_required() メソッドを使用した C++ の例を示します。
コード リスト 10-9 invocation_options_required() メソッドを使用した C++ の例
// ORB の初期化
CORBA::ORB_var v_orb = CORBA::ORB_init(argc, argv, "");
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bootstrap(v_orb.in(), corbalocs://sling.com:2143);
//SecurityCurrent を解決
CORBA::Object_ptr seccurobj =
bootstrap.resolve_initial_references("SecurityCurrent");
SecurityLevel2::Current_ptr seccur =
SecurityLevel2::Current::_narrow(seccurobj);
//証明書ベースの認証を実行
SecurityLevel2::Credentials_ptr the_creds;
Security::AttributeList_var privileges;
Security::Opaque_var continuation_data;
Security::Opaque_var auth_specific_data;
Security::Opaque_var response_data;
//プリンシパルの電子メール・アドレス
char emailAddress[] = “milozzi@bigcompany.com;”
//プリンシパルのデジタル証明書のパス・フレーズ
char password[] = “asdawrewe98infldi7;”
//証明書プライベート・キー・パスワードをオペークに変換
unsigned long password_len = strlen(password);
Security::Opaque ssl_auth_data(password_len);
//Principal Authenticator でプリンシパルの証明書を認証
for(int i = 0; (unsigned long) i < password_len; i++)
ssl_auth_data[i] = password[i];
Security::AuthenticationStatus auth_status;
SecurityLevel2::PrincipalAuthenticator_var PA =
seccur->principal_authenticator();
auth_status = PA->authenticate(Tobj::CertificateBased,
emailAddress,
ssl_auth_data,
privileges,
the_creds,
continuation_data,
auth_specific_data);
the_creds->invocation_options_required(
Security::Integrity|
Security::DetectReplay|
Security::DetectMisordering|
Security::EstablishTrustInTarget|
Security::EstalishTrustInClient|
Security::SimpleDelegation);
while(auth_status == Security::SecAuthContinue) {
auth_status = PA->continue_authentication(
response_data,
the_creds,
continuation_data,
auth_specific_data);
}
...
リスト10-10 では、invocation_options_required() メソッドを使用した Java の例を示します。
コード リスト 10-10 invocation_options_required() メソッドを使用した Java の例
...
//ORB を初期化
Properties Prop;
Prop = new Properties(System.getProperties());
Prop.put("org.omg.CORBA.ORBClass","com.beasys.CORBA.iiop.ORB");
Prop.put("org.omg.CORBA.ORBSingletonClass",
"com.beasys.CORBA.idl.ORBSingleton");
ORB orb = ORB.init(args, Prop);
//Bootstrap オブジェクトを作成
Tobj_Bootstrap bs = new Tobj_Bootstrap(orb,
corbalocs://foo:2501);
//SecurityCurrent を解決
org.omg.CORBA.object ocurr =
bs.resolve_initial_references(“SecurityCurrent”);
org.omg.SecurityLevel2.Current curr =
org.omg.SecurityLevel2.CurrentHelper.narrow(occur);
//Principal Authenticator を取得
com.beasys.Tobj.PrincipalAuthenticator pa =
(com.beasys.Tobj.PrincipalAuthenticator)
curr.principal_authenticator();
OpaqueHolder auth_data = new OpaqueHolder();
AttributeListHolder privileges = new AttributeListHolder();
org.omg.SecurityLevel2.CredentialsHolder creds =
new org.omg.SecurityLevel2.CredentialsHolder();
OpaqueHolder continuation_data = new OpaqueHolder();
OpaqueHolder auth_specific_data = new OpaqueHolder();
auth_data.value=new String (“deathstar”).getbytes(“UTF8);
if(pa.authenticate(com.beasys.Tobj.CertificateBased.value,
“vader@largecompany.com”,
auth_data.value,
privileges.value,
the_creds,
continuation_data,
auth_specific_data)
org.omg.SecurityLevel2.Credentials credentials = curr.get_credentials(
org.omg.Security.CredentialType.SecInvocationCredentials);
credentials.invocation_options_required(
(short) (org.omg.Security.Integrity.value |
org.omg.Security.DetectReplay.value|
org.omg.Security.DetectMisordering.value|
org.omg.Security.EstablishTrustInTarget.value|
org.omg.Security.EstablishTrustInClient.value|
org.omg.Security.SimpleDelegation.value)
);
!AuthenticationStatus.SecAuthSuccess) {
System.err.println(“logon failed”);
System.exit(1);
}
...
![]() |
![]() |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |