我可以让 HttpClient 使用 Weblogic 的自定义密钥库/信任库设置吗?
我的应用程序使用部署在 Weblogic 10.3 上的 Apache HttpClient 3.1 来执行使用 SSL 相互身份验证的 POST。我可以使用以下系统属性来配置密钥库并使其正常工作。 truststore:-
-Djavax.net.ssl.keyStore=C:\Keystore\KEYSTORE.jks
-Djavax.net.ssl.keyStorePassword=changeit
-Djavax.net.ssl.trustStore=C:\Truststore\TRUSTSTORE.jks
-Djavax.net.ssl.trustStorePassword=changeit
有什么方法可以让 HttpClient 识别并使用 Weblogic 自定义 keystore 和密钥库吗? 信任库设置(在控制台/config.xml中配置)。除此之外,这将提供保持密码“隐藏”并且在配置文件/控制台等中不以纯文本形式可见的能力。
任何人都可以启发我吗?
My application is using Apache's HttpClient 3.1 deployed on Weblogic 10.3 to perform a POST using SSL mutual authentication. I can get this to work using the following system properties to configure the keystore & truststore:-
-Djavax.net.ssl.keyStore=C:\Keystore\KEYSTORE.jks
-Djavax.net.ssl.keyStorePassword=changeit
-Djavax.net.ssl.trustStore=C:\Truststore\TRUSTSTORE.jks
-Djavax.net.ssl.trustStorePassword=changeit
Is there any way to get HttpClient to recognize and use the Weblogic custom keystore & truststore settings (as configured in the console / config.xml). Amongst other things this would provide the ability to keep the passwords "hidden" and not visible as plain text in config files / console etc.
Can anyone enlighten me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经能够通过实现自定义 TrustStrategy:
此代码基于 Weblogic 文档。该策略可以通过 SSLSocketFactory 传递给 HttpClient:
唯一未知的参数是 Weblogic 领域名称,可以从 Weblogic JMX API 获取,或者简单地预先配置。这样就不需要实例化信任存储或重新配置 Weblogic 启动参数。
I have been able to get HttpClient to use the custom weblogic trust store certificates for SSL connection by implementing custom TrustStrategy:
This code is based on Weblogic documentation. The strategy can be passed to HttpClient via SSLSocketFactory:
The only unknown parameter is the Weblogic Realm name, which can be taken from Weblogic JMX API, or simply preconfigured. This way it does not require to instantiate the trust store or to reconfigure Weblogic startup parameters.
您可以使用 KeyStoreMBean。但请预先警告,由于以下原因,这可能不是一项简单的练习:
You might be able to obtain these values via JMX using the KeyStoreMBean. Be forewarned though, this might not be a trivial exercise due to the following: