Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / February 2004

Tip: Looking for answers? Try searching our database.

client authentication in tomcat fails: java.security.cert.CertificateException: Couldn't find trusted certificate

Thread view: 
hitectahir - 15 Feb 2004 09:38 GMT
Hi,

I have been trying to get client authentication running with Tomcat.
However, I keep getting the following exception from tomcat:

java.security.cert.CertificateException: Couldn't find trusted
certificate

I have set clientAuth=true in server.xml of Tomcat. Also Ive created a
keystore file and specified it correctly in server.xml. I say
"correctly" because with clientAuth=false, everything's working fine.
I have also configured the client to send the certificate to the
server during the handshake using the following code:

try{

SSLContext ctx;
KeyManagerFactory kmf;
KeyStore ks;
char[] passphrase = "changeit".toCharArray();

kmf = KeyManagerFactory.getInstance("SunX509");
ks = KeyStore.getInstance("JKS");

ks.load(new FileInputStream("/home/ahsan/jakarta-tomcat-4.1.29/webapps/jclarens/webapp/WEB-INF/classes/pk/edu/niit/clarens/client/testkeys"),
passphrase);

kmf.init(ks, passphrase);

ctx = SSLContext.getInstance("TLS");

ctx.init(kmf.getKeyManagers(), null, null);

HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
setup();

System.out.println("SSL prepared");
System.setProperty("javax.net.ssl.keyStorePassword","changeit");
System.setProperty("javax.net.ssl.keyStore","/home/ahsan/jakarta-tomcat-4.1.29/webapps/jclarens/webapp/WEB-INF/classes/pk/edu/niit/clarens/client/testkeys");

System.out.println(System.getProperties());
}
catch(Exception e){
System.out.println("Unable to set up SSL Connection");
e.printStackTrace();
}

I am pretty sure the correct client certificate is being send to
Tomcat, as the CN, OU fields etc. of the client certificate are
correctly displayed in packets filtered by Ethereal. What I think is
that some kind of trust store has to be set up on the server side? Ive
been trying to do this for almost two days now, but am unable to make
it work. How can this be set up, and configured with Tomcat? Please
help.

regards,
tahir.
Bill Harrelson - 15 Feb 2004 18:26 GMT
Have you imported your client's certificate into Tomcats keystore?  And, do you have
the cacerts file for Tomcat in a place that it can find it?  And, is your cert
chained to a trusted cert in the cacert file that Tomcat can find?

> Hi,
>
[quoted text clipped - 53 lines]
> regards,
> tahir.
Bill Harrelson - 15 Feb 2004 18:27 GMT
Have you imported your client's certificate into Tomcats keystore?  And, do you have
the cacerts file for Tomcat in a place that it can find it?  And, is your cert
chained to a trusted cert in the cacert file that Tomcat can find?

> Hi,
>
[quoted text clipped - 53 lines]
> regards,
> tahir.
Bill Harrelson - 15 Feb 2004 18:27 GMT
Have you imported your client's certificate into Tomcats keystore?  And, do you have
the cacerts file for Tomcat in a place that it can find it?  And, is your cert
chained to a trusted cert in the cacert file that Tomcat can find?

> Hi,
>
[quoted text clipped - 53 lines]
> regards,
> tahir.
Bill Harrelson - 15 Feb 2004 18:28 GMT
Have you imported your client's certificate into Tomcats keystore?  And, do you have
the cacerts file for Tomcat in a place that it can find it?  And, is your cert
chained to a trusted cert in the cacert file that Tomcat can find?

> Hi,
>
[quoted text clipped - 53 lines]
> regards,
> tahir.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.