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 / November 2006

Tip: Looking for answers? Try searching our database.

Adding certificate to trusted certificates using an applet?

Thread view: 
john.burton@jbmail.com - 22 Nov 2006 10:33 GMT
I have a question about using a signed applet. I have a specific
solution in mind I'll ask about but any other ideas for other
approaches would be welcome of course.

I have an applet which provides some information for putting on a web
page. It needs to be an applet as it's whole purpose is to obtain some
information from the local machine and put it on a web page with other
information. The information I need is on files on the user's machines
so in order to read them this needs to be a signed applet. Now, this is
just a private web page thing for a close group of users who are known
to me. They were previously happy running an .exe supplied by me so the
security implications of running a signed applet are not really
relevent - they'll be happy to do so.

But because this is a private thing I don't have any money to spend on
it so getting a "real" code siging certificate is out of the question
(Unless someone knows where I can get one for much less that the cost
that verisign etc charge...) so I'm using a self signed certificate. I
don't see this as a problem in itself in any way except that the applet
is supposed to blend into the web page and when it's run the dialog
saying it's a signed applet, and questioning the signers identity comes
up. Fair enough.. I can tell the users to check the certificate and
click the accept anyway button. But it destroys the look of the website
with a dialog box. I can tell the users to click on the always accept
this certificate checkbox and then everyone is happy, it will no longer
ask them when they run the application in future.

Okay, so my question - I'd like to be able to do one of two things...
1) Write an applet which installs the certificate into the trusted
certificates list. It would very clearly prompt the user and tell them
what it was doing and of course would have to be signed in the first
place to make this possible I image.
2) Detect if the certificate is already trusted. I'd ideally like to be
able to do this from an unsigned applet so that I can redirect the user
to a page of instructions if the certificate isn't trusted without
exposing them to a whole lot of popup warnings.

The first option I'm sure is possible - but I can't seem to find any
java API to add a trusted certificate to the store that the browser
uses. Can someone point me in the right direction, if there is such an
API.
The second one I don't really think is possible, I'd almost hope that
an unsigned applet wouldn't be able to find out what cewrtificates the
user trusts, but it would make life easier for me.

Sorry for the long question, I hope someone can help, or suggest an
alternative approach.
Thank you for reading :)
sgoo - 24 Nov 2006 12:37 GMT
I don't exactly know which keystore in Java is used to store the
trusted certificate. It may be the cacerts file inside lib/securty of
the JRE, or somewhere inside the .java directory in your home
directory. You may find it out through some experiments.

When you locate the file. I believe you can use the KeyStore API to
open it and insert you cert and save it back. In order to load the
certificate, I think you can create a CertificateFactory and load the
cert from a stream. Read
http://javaalmanac.com/egs/java.security.cert/ImportCert.html for
details.

Most keystores inside JRE have either an empty password or something
like "changeit".

Goo


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.