Programmatically specify client cert as part of web service call

  • Follow


I have several client certs in my certstore/cacert files and would
like to programmatically specify which should be included in a WS
call.  I would like to do this independent of the server requiring
SSL.

This is possible in .NET using the ClientCertificates collection of
the SoapHttpClientProtocol class.  I haven't found the java
equivalent.
0
Reply tkaupe 1/1/2004 8:41:49 PM

tkaupe@hotmail.com (Tom) wrote in message news:<c0deb3f7.0401011241.3f049b2c@posting.google.com>...
> I have several client certs in my certstore/cacert files and would
> like to programmatically specify which should be included in a WS
> call.  I would like to do this independent of the server requiring
> SSL.
> 
> This is possible in .NET using the ClientCertificates collection of
> the SoapHttpClientProtocol class.  I haven't found the java
> equivalent.

Ok, forget about selecting a specific cert to use; I can't even a
single cert to work.  Here's what I have so far:

<codeSnippet>
TrustManager[] trustManagers = <uses .pks file>
KeyManager[] keyManagers = <used .p12 file>
	
try
{
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(keyManagers, trustManagers, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} 
catch (Exception ex) { ... }
</codeSnippet>

I have confirmed that the TrustManager is using the certs in the .pks
for the SSL handshake.  However, no local cert is being sent.
0
Reply tkaupe 1/11/2004 8:11:32 AM


Tom wrote:
> tkaupe@hotmail.com (Tom) wrote in message news:<c0deb3f7.0401011241.3f049b2c@posting.google.com>...
> 
>>I have several client certs in my certstore/cacert files and would
>>like to programmatically specify which should be included in a WS
>>call.  I would like to do this independent of the server requiring
>>SSL.
>>
>>This is possible in .NET using the ClientCertificates collection of
>>the SoapHttpClientProtocol class.  I haven't found the java
>>equivalent.
> 
> 
> Ok, forget about selecting a specific cert to use; I can't even a
> single cert to work.  Here's what I have so far:
> 
> <codeSnippet>
> TrustManager[] trustManagers = <uses .pks file>
> KeyManager[] keyManagers = <used .p12 file>

   "used"? or "uses"?

> 	
> try
> {
> SSLContext sc = SSLContext.getInstance("SSL");
> sc.init(keyManagers, trustManagers, new java.security.SecureRandom());
> HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
> } 
> catch (Exception ex) { ... }
> </codeSnippet>
> 
> I have confirmed that the TrustManager is using the certs in the .pks
> for the SSL handshake.  However, no local cert is being sent.

--Mike Amling

0
Reply Michael 1/11/2004 1:31:01 PM

2 Replies
340 Views

(page loaded in 0.047 seconds)

Similiar Articles:












7/23/2012 7:15:18 PM


Reply: