gpt4 book ai didi

java - Spring Web 服务客户端使用智能卡签名

转载 作者:行者123 更新时间:2023-12-02 09:46:42 25 4
gpt4 key购买 nike

我必须使用 Web 服务,并且请求必须如下所示:

<soapenv:Envelope xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
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"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pid="http://pid.purs.gov.rs">
<soapenv:Header>
<wsse:Security>
<ds:Signature>
<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="#X509-sertifikatId">
<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>...</ds:DigestValue>
</ds:Reference>
<ds:Reference URI="#id-1">
<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>...</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>...</ds:SignatureValue>
<ds:KeyInfo>
<wsse:SecurityTokenReference>
<wsse:Reference URI="#X509-sertifikatId"/>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature>
<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-sertifikatId">...</wsse:BinarySecurityToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body wsu:Id="id-1">
...
</soapenv:Body>
</soapenv:Envelope>

整个正文部分必须签名。

我找到了很多示例,但它们都使用本地磁盘上的 keystore ,并且我必须使用智能卡签署消息。据我了解,我可以将证书从智能卡导出到 .cer 文件,但其中没有私钥。那么有没有办法做到这一点以及如何做到这一点?

任何帮助将不胜感激。

最佳答案

我建议您使用WSS4J ,以下是解决您的问题的良好起点的示例:

Link 1

Link 2

我知道这对我有帮助;)

关于java - Spring Web 服务客户端使用智能卡签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21332118/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com