如何使用HTTP客户端传递客户端证书?
我想在服务A和B之间使用相互SSL身份验证。我目前正在实现从Java中的服务A传递客户端证书。我正在使用Apache DefaultHttpClient来执行我的请求。我能够从内部凭证管理器检索我的服务A的客户端证书,并将其保存为字节数组。
I want to use mutual SSL authentication between service A and B. I'm currently implementing passing the client certificate from service A in Java. I'm using Apache DefaultHttpClient to execute my requests. I was able to retrieve the client certificate for my service A from an internal credential manager and I keep it as an array of bytes.
DefaultHttpClient client = new DefaultHttpClient();
byte [] certificate = localCertManager.retrieveCert();
我在这方面的经验很少,我很感谢你的帮助!
I have very little experience in this area and I'd appreciate your help!
我想也许它应该以某种方式通过HTTP客户端中的参数传递,或者可能在标题中传递。
I thought maybe it should be somehow passed through arguments in the HTTP client or maybe in the headers.
我如何通过HTTP客户端的客户端证书?
How do I pass the client certificate with HTTP client?
你需要告诉SSLSocketFactory(org.apache.http,而不是javax)你的密钥库,并配置您的DefaultHTTPClient以将其用于https连接。
You need to tell an SSLSocketFactory (org.apache.http, not javax) about your keystore, and configure your DefaultHTTPClient to use it for https connections.