java - 如何使用 Apache Httpclient 3 检索 Websphere TrustStore

标签 java keystore websphere-8 apache-commons-httpclient truststore

我正在使用 Apache Httpclient(commons httpclient 3.1)。截至目前,我们通过指定 keystore 和 Trustsore 文件的物理路径来进行客户端调用。 同时这些也在Websphere 8.5中进行了配置。

例如: SSL 证书和 key 管理 > key 存储和证书 > CellDefaultTrustStore > 签名者证书

如何在我的代码中指定使用 webshphere 中的 Keystore 和 Trustsore,而不是作为物理文件获取。

我正在使用 here 中指定的类似代码:

最佳答案

您可以检索默认的 SSL 套接字工厂(将由 WAS 管理)并要求 httpclient 将其用于 https,而不是检索 keystore 的路径。在以后的 httpclient 版本中,这会更容易。

在较旧的版本中,您需要注册 https 协议(protocol)和默认套接字工厂 javax.net.ssl.SSLSocketFactory.getDefault(),然后配置客户端以使用它。

关于java - 如何使用 Apache Httpclient 3 检索 Websphere TrustStore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51969200/

相关文章:

java - Android Espresso 测试在物理设备上失败(PerformException)

java - Jetty 中的 keyStorePassword 和 keyManagerPassword 有什么区别?

ssl - 更新别名下的其中一个证书

java-ee-6 - 如何取消或删除 Persistent EJBTimers

maven - 使用maven远程部署到WebSphere 8.5

java - 在 Websphere 8.5.5 上部署 Solr 时出现错误类版本错误

java - 控制 Firefox 部分的客户端 jar

java - 可完成的 future - 完整的方法

ssl - Spring-Boot 客户端认证配置。

java - Google 天气 api,读取 xml 时出现问题