Java webservice (soap) 客户端 - 使用证书

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/196566/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 11:22:41  来源:igfitidea点击:

Java webservice (soap) client - use certificates

javaweb-servicessoapcertificate

提问by Gilgad

I am trying to connect to a webservice over ssl with a client certificate. Is there an elegant way of doing this apart from shoving things like "javax.net.ssl.keyStore" into System.properties.

我正在尝试使用客户端证书通过 ssl 连接到网络服务。除了将诸如“javax.net.ssl.keyStore”之类的东西推送到 System.properties 之外,是否有一种优雅的方法可以做到这一点。

Any pointers to code examples would be appreciated.

任何指向代码示例的指针将不胜感激。

采纳答案by tunaranch

You could just install the cert into the system keystore. (Location varies across platforms, and you will need admin rights).

您可以将证书安装到系统密钥库中。(位置因平台而异,您将需要管理员权限)。

回答by anjanb

you might get some samples from the website for this book : http://www.manning.com/kanneganti/

您可能会从本书的网站上获得一些示例:http: //www.manning.com/kanneganti/

回答by Sergey Mikhanov

Not sure if thisis fully relevant, but still. This entry describes the way of generating the certificate and installing it on a local system without using the keytool. Probably you could reuse some parts of the (very simple) source code.

不确定是否完全相关,但仍然如此。本条目介绍了在不使用 keytool 的情况下生成证书并将其安装在本地系统上的方法。也许您可以重用(非常简单的)源代码的某些部分。

回答by Jakub

See example code in my article. It shows how to dynamically provide the custom keystore to the HTTPS server as for the WS client. http://jakubneubauer.wordpress.com/2011/09/06/java-webservice-over-ssl/

请参阅我文章中的示例代码。它展示了如何像 WS 客户端一样向 HTTPS 服务器动态提供自定义密钥库。http://jakubneubauer.wordpress.com/2011/09/06/java-webservice-over-ssl/