2011-07-05 6 views
6

私はしばらくの間WS-Securityに苦労しており、徐々に進歩しています。最初にセットアップを簡単に説明しましょう。私はJavaアプリケーションをWebサービスエンドポイント(Springを使用しています)を提供するtomcatで実行しています。私は入ってくるメッセージに署名したい。私はSoapUIでテストしています。だから、長い闘いの後、私は受信メッセージの署名を調べるまでサーバーを手に入れました。また、送信メッセージに署名するためにSoapUIも取得しました。しかし、サーバーは証明書を拒否し続けます。私は何か間違ったことをしています。つまり、テストリクエストで間違った証明書情報を送信していますか、トラストストアで証明書を正しく管理していません。続いて、要求の例です。今、私が持っているコンテンツは、私は私のトラストストア(証明書のbase64でエンコードされたバージョン)から証明書をエクスポートするとき、私は、取得したものと同じであるJavaアプリケーションがWS-Security証明書を受け入れる方法

<soapenv:Envelope xmlns="http://movilitas.com/movilizer/v7" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soapenv:Header> 
     <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
     <wsu:Timestamp wsu:Id="Timestamp-7" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
      <wsu:Created>2011-06-30T12:51:33.407Z</wsu:Created> 
      <wsu:Expires>2011-06-30T12:53:13.407Z</wsu:Expires> 
     </wsu:Timestamp> 
     <ds:Signature Id="Signature-6" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> 
      <ds:SignedInfo> 
       <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/> 
       <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> 
       <ds:Reference URI="#id-2"> 
        <ds:Transforms> 
        <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> 
        </ds:Transforms> 
        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> 
        <ds:DigestValue>OiRQ2oXbajnnrSGsbOALT2i6brs=</ds:DigestValue> 
       </ds:Reference> 
      </ds:SignedInfo> 
      <ds:SignatureValue> 
       fmtFMSccFcwEfL1M8qgQ... 
      </ds:SignatureValue> 
      <ds:KeyInfo Id="KeyId-C3B38A939F7D63D51F13094382933988"> 
       <wsse:SecurityTokenReference wsu:Id="STRId-C3B38A939F7D63D51F13094382933989" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
        <wsse:KeyIdentifier EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" 
             ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3SubjectKeyIdentifier"> 
         MIICbzCCAdgCAQEwDQ... 
        </wsse:KeyIdentifier> 
       </wsse:SecurityTokenReference> 
      </ds:KeyInfo> 
     </ds:Signature> 
     </wsse:Security> 
    </soapenv:Header> 
    <soapenv:Body wsu:Id="id-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
     [...] 
    </soapenv:Body> 
</soapenv:Envelope> 

。リクエストを送信したときに表示されるエラーは、次のとおりです。

Jul 5, 2011 4:42:23 PM com.sun.xml.wss.impl.dsig.KeySelectorImpl resolve 
SEVERE: WSS1353: Error occurred while resolving key information 
com.sun.xml.wss.XWSSecurityException: No Matching public key for MIICbzCCAdgCAQEwDQ... subject key identifier found 
    at com.sun.xml.wss.impl.misc.DefaultSecurityEnvironmentImpl.getCertificate(DefaultSecurityEnvironmentImpl.java:617) 
    at com.sun.xml.wss.impl.dsig.KeySelectorImpl.resolve(KeySelectorImpl.java:385) 
    at com.sun.xml.wss.impl.dsig.KeySelectorImpl.select(KeySelectorImpl.java:232) 
    ... 

私に何か不足していますか?何か大きい?それとも小さい?私が実際にKeyIdentifierとして送るはずのものですか?どんな助けでも大歓迎です!

答えて

7

証明書自体を送信せず、証明書への参照 - サブジェクトキー識別子のみを送信します。パートナーのパブリック証明書をトラストストア(キーストア)に格納するか、メッセージ内にバイナリセキュリティトークンを含める必要があります。詳細については、http://www.oasis-open.org/committees/download.php/16785/wss-v1.1-spec-os-x509TokenProfile.pdfセクション3.3.2を参照してください。

関連する問題