hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KOTA, KUMAR \(SBCSI\)" <kk9...@sbc.com>
Subject RE: Keystore and TrustStore
Date Wed, 24 Nov 2004 19:05:05 GMT
Hi Oleg,

   For some reason, my  getSSLContext() (in
AuthSSLProtocolSocketFactory) does not seem to be getting called and no
exceptions are being thrown.  Have you encountered this issue?  The code
below describes how I call my executeMethod().  I have changed nothing
in the AuthSSLProtocolSocketFactory() (I am using HttpClient 2.0.2).

//getting all the required fields
String baseDirectory = TAPConstants.sTAPBBTBASEDIRECTORY;
String keyStorePassword = TAPConstants.sTAPKEYSTOREPASSWORD; 
String keyStoreFile = TAPConstants.sTAPKEYSTOREFILE;
String trustStorePassword = keyStorePassword;  
String trustStoreFile = TAPConstants.sTAPTRUSTSTOREFILE; 

//creating string "file:C:/kumar/KEYSTORE" and
"file:C:/kumar/TRUSTSTORE"			
String keyStoreString = "file:" + baseDirectory + "\\" + keyStoreFile;
String trustStoreString = "file:" + baseDirectory + "\\" +
trustStoreFile;

//setting up protocol and registering it			
Protocol authhttps = new Protocol("https",  
           	new AuthSSLProtocolSocketFactory(
             	new URL(keyStoreString), keyStorePassword,
               	new URL(trustStoreString), trustStorePassword), 443); 
Protocol.registerProtocol("https", authhttps);
			
// Create an instance of HttpClient.
HttpClient client = new HttpClient();
		
//Setting timeout
client.setTimeout(timeoutVal);

// Create a method instance.
GetMethod method = new GetMethod(sURLString);

// Execute the method.
int statusCode = client.executeMethod(method);


Thank you,
Kumar


-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Tuesday, November 23, 2004 3:05 PM
To: HttpClient Project
Subject: RE: Keystore and TrustStore


Kumar,

This method will be called internally when establishing connection to
the target server. All you have to do is to set up the required key
store and/or trust store, create AuthSSLProtocolSocketFactory object,
create and register a Protocol object with the given socket factory.
HttpClient will do the rest

Oleg

On Tue, 2004-11-23 at 12:17 -0800, KOTA, KUMAR (SBCSI) wrote:
> Hi Oleg,
> 
>   Thank you, that is precisely what I am loooking for...just had a
quick
> question regarding the getSSLContext() (in
AuthSSLProtocolSocketFactory),
> this is the method I assume triggers the truststore and keystore set
up and
> validation.  Is this method called by executeMethod()? Or does this
need to
> be called explicitly?
> 
> Thank you,
> Kumar Kota
> SBC Information Technology
> kk9142@sbc.com
> (925) 901-6898
> 
> 
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org] 
> Sent: Tuesday, November 23, 2004 12:42 AM
> To: HttpClient Project
> Subject: Re: Keystore and TrustStore
> 
> 
> Kumar,
> 
> Have a look at the AuthSSLProtocolSocketFactory:
> 
>
http://cvs.apache.org/viewcvs.cgi/jakarta-commons/httpclient/src/contrib
/org
>
/apache/commons/httpclient/contrib/ssl/AuthSSLProtocolSocketFactory.java
?rev
> =1.1.2.1&only_with_tag=HTTPCLIENT_2_0_BRANCH&view=markup
> 
> This may be exactly what you want
> 
> Oleg
> 
> On Mon, Nov 22, 2004 at 04:21:29PM -0800, KOTA, KUMAR (SBCSI) wrote:
> > Hi,
> > 
> >    This is more of a features question, but I was wondering if
> > httpclient somehow can handle a keystore and truststore when making
> > secure SSL connections?
> > 
> > Thank you,
> > Kumar
> > 
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
httpclient-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
httpclient-dev-help@jakarta.apache.org
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
httpclient-dev-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
httpclient-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message