Hello

 

I would like to connect on a web service with SSL and mutual
authentication (my application is the client one) by XFire. I did some
codes using org.apache.commons project (httpclient and ssl), as follows:

 

KeyStore ks = KeyStore.getInstance("Windows-MY");

ks.load(null, null); 

Certificate cert = ks.getCertificate("alias");

HttpSecureProtocol protocolSocketFactory = new HttpSecureProtocol();

protocolSocketFactory.addTrustMaterial(new
TrustMaterial(cert.getEncoded()));

protocolSocketFactory.setKeyMaterial(new
KeyMaterial(cert.getEncoded(),"password"));

protocolSocketFactory.addTrustMaterial(TrustMaterial.TRUST_ALL);

Protocol trustHttps = new Protocol("https", (ProtocolSocketFactory)
protocolSocketFactory, certificate.getPort());

Protocol.registerProtocol("https", trustHttps);

 

The problem is that to do this I always need the private key password.
In my case I have a hardware that stores the private keys and when I
need to use then, I must invoke the public key. The application of
hardware installed at Windows automatically uses the private key stored
in the hardware. Then I need to develop a code using just the public
key, instead of KeyMaterial(privateKey, password). 

 

How can I do this? Someone can help me?

 

Thanks



Robson Romeo Schneider

NeoGrid - Your Product On-Demand
Desenvolvimento de Produto
[EMAIL PROTECTED]
Tel. +55 (47) 2101-6534
www.neogrid.com <http://www.neogrid.com> 

 

Reply via email to