For an in-house project, I have a web server (Apache) with a
self-signed certificate. I can access everything via https: just fine.
The reason for wanting https is to add security to the .htaccess
passwords. This all works just fine.
FWIW, I'm using FireFox, and simply added the self-signed certificate.
However, no Java applets will load. I get the following when trying
to load InHouseApp (one of the applets):
load: class InHouseApp not found.
java.lang.ClassNotFoundException: javax.net.ssl.SSLException:
untrusted server cert chain
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
[rest deleted]
I have complete access to the various client machines (both desktops
on the lan, and laptops that will be out in the wild). What do I need
to add to prevent this exception? Also, as certificates aren't my
strong suit, are there any step-by-step detail instructions on what to
do?
TIA
KC Wong - 21 Jun 2004 05:00 GMT
> load: class InHouseApp not found.
> java.lang.ClassNotFoundException: javax.net.ssl.SSLException:
[quoted text clipped - 7 lines]
> strong suit, are there any step-by-step detail instructions on what to
> do?
Certificates are signed by known Certificates Authorities (CA). Their certs
are called the root certs. CAs used their root certs to sign an intermediate
cert, which are in turn used to sign certificates issued to companies.
Browsers and JVM have a list of those root and intermediate certs (public
key only), and will verify any certs that comes along with them. While
browsers will have a pop-up and ask you to trust the suspicious cert (your
self-signed cert) or not, JVM doesn't (since not all applications are
interactive, and not all platforms has display). So the exception is thrown.
So what you need to do is to import your self-signed cert into the "cacerts"
keystore of the JVM, so it will be trusted.
The tool to use is called "keytool". It is in the JDK bin directory.
A sample command line:
keytool -import -alias <alias> -file <certfile> -keypass
<password> -keystore <keystore> -storepass <storepass>
<alias> is the name to assign to the cert being imported. You can retrieve a
list of cert names with keytool -list. It is best to use something
meaningful so you can find your self-signed cert easily.
<certfile> is the path to the cert being imported.
<password> is the password of the cert being imported.
<keystore> is the keystore of the JVM to use. For my JRE, it is "C:\Program
Files\Java\j2re1.4.2_04\lib\security\cacerts" (no file extension). You can
create your own keystores, but for this purpose, you use the "cacert" one.
<storepass> is the password of the keystore. The JVM cacert keystore has a
default password of "changeit" (without the quotes).
HTH,
KC