I have an Apache Tomcat 6.x server running with a self-signed SSL certificate. I want the client to present their own certificate to the server so I can authenticate them based on a database of users. I have it all working based on an example I found online, but the example came with canned certificates and a pre-build JKS datastore. I want to create my own datastore with my own certs but am having no luck.
How do I create a datastore for Tomcat?
How do I create a self-signed certificate for Tomcat?
How do I create a self-signed certificate for the client?
How do I force Tomcat to trust the signature of the client?
I've been playing with java keytool for many hours now.
Best Answer
Finally got the solution to my problem, so I'll post the results here if anyone else gets stuck.
Thanks to Michael Martin of Michael's Software Thoughts & Ramblings I discovered that:
I simply set that flag, cleared all caches in FireFox and it worked like a charm! I am using this as a test-setup for my project and I need to share this with other people, so I wrote a little batch script that creates two SSL certificates. One can be dropped into the Tomcat setup and the other is a .p12 file that can be imported into FireFox/IE. Thanks!
Usage: first command-line argument is the username of the client. All passwords are "password" (with no quotations). Change any of the hard-coded bits to meet your needs.
The results are two files. One called server.jks that you drop into Tomcat and another file called {username}.p12 that you import into your browser. The server.jks file has the client certificate added as a trusted cert.
I hope someone else finds this useful.
And here is the the XML that needs to be added to your Tomcat conf/sever.xml file (only tested on on Tomcat 6.x)
For Tomcat 7: