Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Certification problems

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

I'm working on a Tomcat installation that accesses various web services. I added an interface into a new web service using axis.

the code I used to add certification for that web service was like so:


System.setProperty("javax.net.ssl.trustStore",CERTIFICATE_STORE_FILENAME);

which works, but it stops all the other web services from authenticating.

However, all the other web services dont use the trustStore.

they generally do something like this:

KeyStore ks = KeyStore.getInstance("PKCS12", "SunJSSE");
ks.load(new FileInputStream(cert_name), cert_password.toCharArray());
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");

kmf.init(ks, cert_password.toCharArray());
SSLContext sslc = SSLContext.getInstance("SSLv3");
sslc.init(kmf.getKeyManagers(), null, null);
SSLSocketFactory ssf = sslc.getSocketFactory();

which use the keystore. I was under the impression that the trustStore and the keyStore were seperate, and wouldn't interfere with each other.

How can I resolve this?

John



 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
John if my understanding is correct.

You are creating a web service and deployed the same in axis in tomcat. Right?
You can use the tomcat/conf/server.xml file to refer the keystore file.
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keyAlias="myKey" keystoreFile="keystore.ks" keypass="tomcat"/>

And at client side, you can use set the following:
System.setProperty("javax.net.ssl.trustStore", url.getPath());
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");

Use your service with HTTPs and rest of the services on HTTP.




 
John Farrel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Alok,

No, I am not creating a web service. I have an application that is a client for many external web services.

For one client web service call, creating a keystore from one certificate and setting the keystore property stops all the other client web service calls from succeeding.

How can I use one service with HTTPs and the others with HTTP? The others are SSL as well.

reply
    Bookmark Topic Watch Topic
  • New Topic