Web 服务安全和 Windows 证书
我想使用 Apache CXF 和 WSS4J 签署 Web 服务请求。据我所知,我需要一个包含我想要用于签名的证书的 JKS 存储。 要求能够使用 Windows 证书存储中的 X.509 证书。签署 Web 服务请求时应从存储中读取证书。 我知道如何访问商店并获取证书。但是我如何使用它来代替我自己的 JKS 商店中的证书进行签名?
I want to sign webservice requests using Apache CXF and WSS4J. As far as I know, I would need a JKS store containing the certificate I want to use for signing.
There's the requirement to be able to use a X.509 certificate from the Windows certificate store. The certificate shall be read from the store at the time of signing the webservice request.
I know how to access the store and get the certificate. But how can I use it for signing instead of the certificate from my own JKS store?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
KeyStore 不必是 JKS 密钥库。您可以编写自己的 JCA 提供程序并实现 KeyStoreSpi,并让它访问 Windows 证书存储。
The KeyStore need not be a JKS one. You might write your own JCA Provider and implement KeyStoreSpi, and have it access the Windows certificate store.
刚刚发现可以使用
MerlinDevice
类来实现。它是这样完成的:
1) 配置
WSS4JOutInterceptor
的属性:2)
client_sign.properties
文件如下所示:3) 并且
StupidCallback
只是返回常量字符串作为密码(它的值并不重要):仅此而已。
Just found it's possible to achieve using
MerlinDevice
class.That's how its done:
1) Configuring properties for
WSS4JOutInterceptor
:2) The
client_sign.properties
file looks like this:3) And
StupidCallback
just returns constant string as a password (its value doesn't really matter):That's all.
查看 此内容,其中解释了如何使用 Windows 密钥库。然后您必须配置 CXF 以使用该密钥库。
Look at this that explains how to use the windows keystore. Then you have to configure CXF to use that keystore.