クライアントの応答署名検査方式の構成

WSSVerification API と WSSVerifyPart API を使用して署名検査方式を選択します。 要求署名検査方式には、ダイジェスト・アルゴリズム方式とトランスポート方式が含まれます。

始める前に

シグニチャー検査情報の構成を完了して SOAP メッセージをセキュアにするには、 以下のアルゴリズム・タスクを実行する必要があります。
  • 正規化方式およびシグニチャー方式を構成するには、 WSSVerification API を使用します。
  • ダイジェスト方式および変換方式を構成するには、 WSSVerifyPart API を使用します。
クライアントを要求署名用に構成する際に使用するアルゴリズム方式を構成する場合。

このタスクについて

以下の表で、この情報の目的を説明しています。これらの定義の一部は、XML-Signature 仕様 (Web サイト http://www.w3.org/TR/xmldsig-core にあります) を基にしています。

表 1. 要求署名検査方式. 署名検査情報を使用して、メッセージを保護します。
方式の名前 目的
ダイジェスト・アルゴリズム <DigestValue> エレメントを生成するために、 変換の適用後にデータに適用されます (指定されている場合)。 <DigestValue> エレメントの署名は、 リソース・コンテンツを署名者鍵に結合します。クライアント要求送信側の構成用に選択したアルゴリズムは、クライアント要求受信側の構成で選択したアルゴリズムと一致している必要があります。
変換アルゴリズム <Transform> エレメントに適用します。
署名アルゴリズム シグニチャー検査方式の URI (Uniform Resource Identifiers) を指定します。
正規化アルゴリズム 正規化方式の URI (Uniform Resource Identifiers) を指定します。

メッセージをデジタル署名するようにクライアントを構成した後、 デジタル署名を検査するようにクライアントを構成する必要があります。 WSS API を使用するか、または管理コンソールでポリシー・セットを構成するかして、 デジタル署名を検査し、検査を選択してパーツのアルゴリズムを確認できます。 WSS API を引き続き使用する場合は、 WSSVerification API と WSSVerifyPart API を使用して、検査するデジタル署名済みメッセージ・パーツを指定し、 クライアントを要求署名用に構成するときに使用するアルゴリズム方式を指定します。

WSSVerification API と WSSVerifyPart API では、以下のステップを実行して、 シグニチャー検査を構成し、パーツ・アルゴリズム方式を検査します。

手順

  1. コンシューマー・バインディングの場合、WSSVerification API でシグニチャー方式を指定して、シグニチャー検査を行えるようにします。 WebSphere® Application Server は、 以下の事前構成済みシグニチャー方式をサポートしています。
    • WSSVerification.RSA_SHA1 (デフォルト値): http://www.w3.org/2000/09/xmldsig#rsa-sha1
    • WSSVerification.HMAC_SHA1: http://www.w3.org/2000/09/xmldsig#hmac-sha1
    DSA-SHA1 デジタル署名方式 (http://www.w3.org/2000/09/xmldsig#dsa-sha1) はサポートされません。
  2. コンシューマー・バインディングの場合、WSSVerification API で正規化方式を指定して、シグニチャー検査を行えるようにします。 WebSphere Application Server は、デフォルトで以下の事前構成済み正規化メソッドをサポートしています。
    • WSSVerification.EXC_C14N (デフォルト値): http://www.w3.org/2001/10/xml-exc-c14n#
    • WSSVerification.C14N: http://www.w3.org/2001/10/xml-c14n#
  3. コンシューマー・バインディングの場合、必要に応じて WSSVerifyPart API でダイジェスト方式を指定します。 WebSphere Application Server は、 署名済みパーツの検査用に以下のダイジェスト・メソッド・アルゴリズムをサポートしています。
    • WSSVerifyPart.SHA1 (デフォルト値): http://www.w3.org/2000/09/xmldsig#sha1
    • WSSVerifyPart.SHA256: http://www.w3.org/2001/04/xmlenc#sha256
    • WSSVerifyPart.SHA512: http://www.w3.org/2001/04/xmlenc#sha512
  4. コンシューマー・バインディングの場合、WSSVerifyPart API で変換方式を指定します。 WebSphere Application Server は、パーツの検査用に以下の変換アルゴリズムをサポートしています。
    • WSSVerifyPart.TRANSFORM_EXC_C14N (デフォルト値): http://www.w3.org/2001/10/xml-exc-c14n#
    • WSSVerifyPart.TRANSFORM_XPATH2_FILTER: http://www.w3.org/2002/06/xmldsig-filter2
    • WSSVerifyPart.TRANSFORM_STRT10: http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform
    • WSSVerifyPart.TRANSFORM_ENVELOPED_SIGNATURE: http://www.w3.org/2000/09/xmldsig#enveloped-signature

    WSS API の場合、WebSphere Application Server は以下のアルゴリズムをサポートしません。

    • http://www.w3.org/2002/07/decrypt#XML
    • http://www.w3.org/TR/1999/REC-xpath-19991116

タスクの結果

クライアントがメッセージを送信する際にデジタル署名の検査に使用する方式が指定されました。

以下の例は、WSS API のサンプル・コードです。検査情報、検査対象パーツとして本体、シグニチャー方式として HMAC_SHA1、 正規化方式の候補として C14N および EXC_C14N、変換方式として TRANSFORM_STRT10、およびダイジェスト方式として SHA256 を指定しています。

// Get the message context
   Object msgcontext = getMessageContext();

// Generate the WSSFactory instance
   WSSFactory factory = WSSFactory.getInstance();

// Generate the WSSConsumingContext instance
   WSSConsumingContext concont = factory.newWSSConsumingContext();

// Generate the certificate list
   String certpath = "intca2.cer";
// The location of the X509 certificate file
      X509Certificate x509cert = null;
      try {
            InputStream is = new FileInputStream(certpath);
            CertificateFactory cf = CertificateFactory.getInstance("X.509");
	          x509cert = (X509Certificate)cf.generateCertificate(is);
      } catch(FileNotFoundException e1){
	         throw new WSSException(e1);
      } catch (CertificateException e2) {
	         throw new WSSException(e2);
      }

      Set<Object> eeCerts = new HashSet<Object>();
      eeCerts.add(x509cert);  
// Create the certStore
   java.util.List<CertStore> certList = new 
        java.util.ArrayList<CertStore>();
   CollectionCertStoreParameters certparam = new 
        CollectionCertStoreParameters(eeCerts);
   CertStore cert = null;
      try {
	           	           cert = CertStore.getInstance("Collection", 
                                           certparam, 
                                          "IBMCertPath");
      } catch (NoSuchProviderException e1) {
	          throw new WSSException(e1);
      } catch (InvalidAlgorithmParameterException e2) {
	          throw new WSSException(e2);
      } catch (NoSuchAlgorithmException e3) {
	          throw new WSSException (e3);
      }
      if(certList != null ){
	           certList.add(cert);
      }

// Generate the callback handler
   X509ConsumeCallbackHandler callbackHandler = new
      X509ConsumeCallbackHandler(
                                 "dsig-receiver.ks", 
                                 "jks",
                                 "server".toCharArray(), 
                                 certList, 
                                 java.security.Security.getProvider(
                                       "IBMCertPath")
                                 );

// Generate the WSSVerification instance
   WSSVerification ver = factory.newWSSVerification(X509Token.class,
                                                    callbackHandler);

// Set one or more candidates of the signature method used for 
//    verification (step. 1)
// DEFAULT : WSSVerification.RSA_SHA1
      ver.addAllowedSignatureMethod(WSSVerification.HMAC_SHA1);

// Set one or more candidates of the canonicalization method used for 
//    verification (step. 2)
// DEFAULT : WSSVerification.EXC_C14N 
      ver.addAllowedCanonicalizationMethod(WSSVerification.C14N);
      ver.addAllowedCanonicalizationMethod(WSSVerification.EXC_C14N);

// Set the part to be specified by WSSVerifyPart
   WSSVerifyPart verPart = factory.newWSSVerifyPart();

// Set the part to be specified by the keyword
      verPart.setRequiredVerifyPart(WSSVerification.BODY);

// Set the candidates of digest methods to use for verification (step. 3)
// DEFAULT : WSSVerifypart.TRANSFORM_EXC_C14N : String
      verPart.addAllowedTransform(WSSVerifyPart.TRANSFORM_STRT10);

// Set the candidates of digest methods to use for verification (step. 4)
// DEFAULT : WSSVerifyPart.SHA1
      verPart.addAllowedDigestMethod(WSSVerifyPart.SHA256);

// Set WSSVerifyPart to WSSVerification
      ver.addRequiredVerifyPart(verPart);

// Add the WSSVerification to the WSSConsumingContext
   concont.add(ver);

// Validate the WS-Security header
concont.process(msgcontext);

次のタスク

署名検証アルゴリズムの構成を完了しました。 暗号化または暗号化解除アルゴリズムの構成がまだであれば、次に構成してください。 または必要に応じて、セキュリティー・トークンの情報を構成してください。


トピックのタイプを示すアイコン タスク・トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=twbs_confwssverifyalgorithms
ファイル名:twbs_confwssverifyalgorithms.html