M
Marco
I want a web applet that begin an SSL connection with the server of his
site; but it work only if I set the following properties in the init method
of the main class:
System.setProperty("javax.net.ssl.trustStore", "C:\\pwdServer");
System.setProperty("javax.net.ssl.keyStore", "C:\\pwdServer");
System.setProperty("javax.net.ssl.keyStorePassword", "123456");
System.setProperty("javax.net.ssl.trustStorePassword", "123456");
But I don't like this: Microsoft Java (Windows 98-2000-XP) don't know
"System.setProperty", and generate an exception; moreover, the client is not
my friend, but an unknown visitor of a web site; can I write: download the
certificate, put it in c:\... and if my visitor'SO is Linux or OS? A
solution is tu put the certificate in jar file, or use that for signing
applet, but all my experiment are useless. Can you help me?
...............................................................................................
I used the following batch file for creating pwdServer e certificato.cer
files:
C:\jdk1.3.1_14\bin\keytool -genkey -keystore pwdS -keyalg rsa -alias
marco -storepass 123456
C:\jdk1.3.1_14\bin\keytool -genkey -keystore pwdS -dname
"cn=Marco" -storepass 123456
C:\jdk1.3.1_14\bin\jarsigner -keystore pwdServer -storepass
123456 -signedjar firmata.jar client.jar marco
C:\jdk1.3.1_14\bin\keytool -export -keystore pwdS -storepass 123456 -alias
marco -file certificato.cer
Now, the pwdServer files work ok: I can open server and client with the
commands (in cmd):
java -jar -D -Djavax.net.ssl.keyStore=pwdServer -Djavax.net.ssl.keyStorePassword=123456
server.jar
java -jar -Djavax.net.ssl.trustStore=pwdServer -Djavax.net.ssl.trustStorePassword=123456
client.jar
If I use the signed appled in an html page, and I import the certificate
(certificato.cer), I can read and write in my HD, but the SSLSocket don't
work.
The applet generates the exception:
javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target
and the server, open in cmd, the following error:
javax.net.ssl.SSLHandshakeException: Received fatal
alert: certificate_unknown
When I wrong?
Thank you
site; but it work only if I set the following properties in the init method
of the main class:
System.setProperty("javax.net.ssl.trustStore", "C:\\pwdServer");
System.setProperty("javax.net.ssl.keyStore", "C:\\pwdServer");
System.setProperty("javax.net.ssl.keyStorePassword", "123456");
System.setProperty("javax.net.ssl.trustStorePassword", "123456");
But I don't like this: Microsoft Java (Windows 98-2000-XP) don't know
"System.setProperty", and generate an exception; moreover, the client is not
my friend, but an unknown visitor of a web site; can I write: download the
certificate, put it in c:\... and if my visitor'SO is Linux or OS? A
solution is tu put the certificate in jar file, or use that for signing
applet, but all my experiment are useless. Can you help me?
...............................................................................................
I used the following batch file for creating pwdServer e certificato.cer
files:
C:\jdk1.3.1_14\bin\keytool -genkey -keystore pwdS -keyalg rsa -alias
marco -storepass 123456
C:\jdk1.3.1_14\bin\keytool -genkey -keystore pwdS -dname
"cn=Marco" -storepass 123456
C:\jdk1.3.1_14\bin\jarsigner -keystore pwdServer -storepass
123456 -signedjar firmata.jar client.jar marco
C:\jdk1.3.1_14\bin\keytool -export -keystore pwdS -storepass 123456 -alias
marco -file certificato.cer
Now, the pwdServer files work ok: I can open server and client with the
commands (in cmd):
java -jar -D -Djavax.net.ssl.keyStore=pwdServer -Djavax.net.ssl.keyStorePassword=123456
server.jar
java -jar -Djavax.net.ssl.trustStore=pwdServer -Djavax.net.ssl.trustStorePassword=123456
client.jar
If I use the signed appled in an html page, and I import the certificate
(certificato.cer), I can read and write in my HD, but the SSLSocket don't
work.
The applet generates the exception:
javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target
and the server, open in cmd, the following error:
javax.net.ssl.SSLHandshakeException: Received fatal
alert: certificate_unknown
When I wrong?
Thank you