使用x509创建签名的SOAP1.2请求

时间:2013-12-30 11:05:15

标签: java asp.net xml web-services soap

我有xml请求,只有x509“.p12”证书,我想创建签名的SOAP 1.2 xml请求。该服务是用java开发的,想从asp.net访问。请给我解决这个问题。 这是请求xml

<soap:Envelope xmlns:get="http://www.abc.com/GCST/" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body wsu:Id="id-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<get:getAuthorizationSummary>
  <get:Request>
    <get:authorizationSummaryReq>
      <get:ac>XXXXXXXXXXXXXX</get:ac>
      <get:PoolID>xxx</get:PoolID>
      <get:sender>xxx</get:sender>
      <get:rec>xxxx</get:rec>
    </get:authorizationSummaryReq>
  </get:Request>
</get:getAuthorizationSummary>

我想创建以下签名的xml

<soap:Envelope xmlns:get="http://www.abc.com/GCST/" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap: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-26F72BFC485DA34D761355972749631103">MIIC1TC..</wsse:BinarySecurityToken>
  <ds:Signature Id="SIG-35" 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="get soap" 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-1">
        <ds:Transforms>
          <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
            <ec:InclusiveNamespaces PrefixList="get" 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>y7jj..</ds:DigestValue>
      </ds:Reference>
    </ds:SignedInfo>
    <ds:SignatureValue>
      hhPRZ5R..
    </ds:SignatureValue>
    <ds:KeyInfo Id="KI-26F72BF56C485DA34D761355972749631104">
      <wsse:SecurityTokenReference wsu:Id="STR-26656775F72BFC485DA34D761355972749631105">
        <wsse:Reference URI="#X509-26F72BFC485DA34D761355972749631103" 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>
</soap:Header>
<soap:Body wsu:Id="id-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
 <get:getAuthorizationSummary>
 <get:Request>
     <get:authorizationSummaryReq>
       <get:ac>XXXXXXXXXXXXXX</get:ac>
       <get:PoolID>xxx</get:PoolID>
       <get:sender>xxx</get:sender>
       <get:rec>xxxx</get:rec>
     </get:authorizationSummaryReq>
  </get:Request>
</get:getAuthorizationSummary>
</soap:Body>
</soap:Envelope>

0 个答案:

没有答案