如何在Soap UI 5.0.0中解密来自WSO2安全代理服务的消息

时间:2015-02-18 11:41:33

标签: encryption soap wso2 wso2esb soapui

我正在尝试在WSO2 ESB中调用安全代理服务。我跟着这个tutorial。我已成功调用代理服务。我也收到了代理服务“Out”序列中的响应。但是当我将此响应发送回SOAPUI时。我正面临着一些问题。

我已经完成了教程中提到的所有配置。

第一种方法:

当我尝试发送请求并按以下方式定义“身份验证”属性时。其中我包括Outgoing WSS和Incoming WSS,First SoapUI要求输入密码(密码为“wso2carbon”),然后显示错误。

enter image description here

enter image description here

错误:

Error Getting Response :null

第二种方式:

当我只在“身份验证属性”中包含传出WSS时,SoapUI没有要求输入密码并且也得到了响应。但响应是加密的,不包含我的结果。 enter image description here

响应:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsu:Timestamp wsu:Id="Timestamp-174" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsu:Created>2015-02-18T16:18:38.284Z</wsu:Created>
            <wsu:Expires>2015-02-18T16:23:38.284Z</wsu:Expires>
         </wsu:Timestamp>
         <xenc:EncryptedKey Id="EncKeyId-F8FEAAA25C72C38AF11424276318297215">
            <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
            <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
               <wsse:SecurityTokenReference>
                  <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/oasis-wss-soap-message-security-1.1#ThumbprintSHA1">a/jhNus21KVuoFx65LmkW2O/l10=</wsse:KeyIdentifier>
               </wsse:SecurityTokenReference>
            </ds:KeyInfo>
            <xenc:CipherData>
               <xenc:CipherValue>R4aI0V2uS7h64n7qEMwzvs6iFN9YCTM7iMW7N+L3IxMP+Z7R9wwzlJpJ4vE3+tunVZyqdHzuOxGP0b3LLhNUsc7ys9QByvJoID3RkfkBlSz4AstOffL4t4CKIepx4fGXccFj0cvKxDrv/4SNREO2cQsHtYnsl/LOktxsq3Cd3kc=</xenc:CipherValue>
            </xenc:CipherData>
            <xenc:ReferenceList>
               <xenc:DataReference URI="#EncDataId-177"/>
            </xenc:ReferenceList>
         </xenc:EncryptedKey>
         <wsse11:SignatureConfirmation Value="ZhUpeBE6eupgRfq+ZBKCb7lvdNeSfC/XP+9q9pgr41u53oFa93+yJ0lM5E+nqlK/8NvW4We8RYUSLwNZiJZnZ5bHBXADR9+mGsWi+mGv2grpSNS1/x40bsTSfbe+YTL1azQQNrdyFUBZHazX9I6VXaau1rYS6Wak1MC7Ndtmas4=" wsu:Id="SigConf-175" xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"/>
         <ds:Signature Id="Signature-176" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <ds:SignedInfo>
               <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
               <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
               <ds:Reference URI="#Id-1240651390">
                  <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>E9q9gvsO64SKD7LFluO62pEpFIM=</ds:DigestValue>
               </ds:Reference>
               <ds:Reference URI="#Timestamp-174">
                  <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>Y8ICfco6fqwNx0SC6eVN+fWGo6M=</ds:DigestValue>
               </ds:Reference>
               <ds:Reference URI="#SigConf-175">
                  <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>VJe/lgh2CALKbFN1B+YKif6HJVM=</ds:DigestValue>
               </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>FbmcmvnHalQH14UiN9m6sVNsFoy0/IAS5tsdg2hg7n5kxD/MiNz/MS9w/q0VESAT61eV4/u8p+ho
HP0ehudU2s+U/PjGNU2M2eG7hI4T43gfdXLaOOemv4LcOeJwLTTp0at2AC2CRexUNmUMQ1UhQsoU
qrDYb/fHh47p+sOkbGE=</ds:SignatureValue>
            <ds:KeyInfo Id="KeyId-F8FEAAA25C72C38AF11424276318286212">
               <wsse:SecurityTokenReference wsu:Id="STRId-F8FEAAA25C72C38AF11424276318286213" 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/oasis-wss-soap-message-security-1.1#ThumbprintSHA1">a/jhNus21KVuoFx65LmkW2O/l10=</wsse:KeyIdentifier>
               </wsse:SecurityTokenReference>
            </ds:KeyInfo>
         </ds:Signature>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body wsu:Id="Id-1240651390" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <xenc:EncryptedData Id="EncDataId-177" Type="http://www.w3.org/2001/04/xmlenc#Content">
         <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
         <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <wsse:SecurityTokenReference xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
               <wsse:Reference URI="#EncKeyId-F8FEAAA25C72C38AF11424276318297215"/>
            </wsse:SecurityTokenReference>
         </ds:KeyInfo>
         <xenc:CipherData>
            <xenc:CipherValue>Jg/EODedQJtbgBYc7xUa86fAtgALcbsHoiwDLJkyoPLOq1+Se+A/HEQOnmYwJhl7prw7pVK0ap3N
4F3Yvw3gZu0cdS+AUEAikrUzYdMwJAbQ8BYGSqK5IFdHourk74cFsshMYaMLqkwIgN+ZvmPuHxI8
tZCv+DF0kHecsq7qLXIfjxvI87TNygkzaj9gOex/</xenc:CipherValue>
         </xenc:CipherData>
      </xenc:EncryptedData>
   </soapenv:Body>
</soapenv:Envelope>

注意:

在任何情况下,ESB日志都没有错误。我正在使用WSO2 ESB 4.8.1。和SoapUI 5.0.0。如果您需要有关我的代理服务代码和我的请求的更多信息,它与本教程中提到的完全相同。它工作正常,因为ESB的顺序响应。

问题:

我想了解两件事,首先是为什么我的加密形式的响应以及如何解密它。 第二个为什么在包含“传入WSS”时,根本没有回应?

2 个答案:

答案 0 :(得分:1)

从SoapUI 4.5(有效)升级到5.1.3(没有)后,我花了一段时间才发现同样的问题。

错误在此文件中: C:\ Program Files \ SmartBear \ SoapUI-5.1.3 \ bin \ soapui-errors.log

最容易解决的问题是:

  1. 转到C:\ Program Files \ SmartBear \ SoapUI-5.1.3 \ lib
  2. 重命名 wss4j-1.6.16.jar to wss4j-1.6.16.jar.old
  3. 将wss4j-1.6.2.jar从SoapUI 4.5的同一位置复制到此文件夹。
  4. 重新启动它现在可以正常工作。

    基于此链接的回答让Thorsten相信我指向了正确的方向: http://community.smartbear.com/t5/SoapUI-NG/SoapUI-4-5-difference-Getting-Error-getting-response-NULL/m-p/41816/highlight/true#M21455

答案 1 :(得分:0)

我有一个非常类似的问题,我通过将xmlsec-1.4.5.jar与更新的一个交换来解决它,例如xmlsec-1.5.8.jar 希望这会有所帮助...