Soap UI从soap信封使用什么来创建XMLDsig签名?

问题描述

Soap UI从soap信封使用什么来创建XMLDsig签名?或相反的问题,如何验证Soap XMLDsig响应的签名?我之所以问是因为我只能使用Soap UI来获得正确的响应。

让我们在SoapUI中生成此请愿书:

soapui config signature

<soapenv:Envelope xmlns:dat="..." xmlns:pet="..." 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" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:BinarySecurityToken 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#X509v3" wsu:Id="X509-...">{BinarySecurityToken}</wsse:BinarySecurityToken>
            <ds:Signature Id="SIG-..." xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                <ds:SignedInfo>
                    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <ec:InclusiveNamespaces PrefixList="dat pet soapenv" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                    </ds:CanonicalizationMethod>
                    <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
                    <ds:Reference URI="#id-...">
                        <ds:Transforms>
                            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <ec:InclusiveNamespaces PrefixList="dat pet" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                            </ds:Transform>
                        </ds:Transforms>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                        <ds:DigestValue>{Sha1Diest encoded base 64}</ds:DigestValue>
                    </ds:Reference>
                </ds:SignedInfo>
                <ds:SignatureValue>
                    {Signature encoded base 64}
                </ds:SignatureValue>
                <ds:KeyInfo Id="KI-...">
                    <wsse:SecurityTokenReference wsu:Id="STR-...">
                        <wsse:Reference URI="#X509-..." ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
                    </wsse:SecurityTokenReference>
                </ds:KeyInfo>
            </ds:Signature>
        </wsse:Security>
    </soapenv:Header>
    <soapenv:Body wsu:Id="id-..." xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <pet:Petition>
            ...data...
        </pet:Petition>
    </soapenv:Body>
</soapenv:Envelope>

我有这个Java代码生成二进制安全令牌(由于相同的证书而与soapui生成的令牌相匹配),但是使用相同的信封,我得到了不同的签名和摘要值:

Java代码https://pastebin.com/06NUwkLW

那么,在String plaintext中我应该使用什么来获得正确的签名和摘要值?

我已经尝试过使用cxf3.4和axis2客户端(使用wsdl2java),但是添加WS-Security非常复杂,我只找到用户名/密码auth,这不是我所需要的。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)