Wednesday, May 14, 2008

Java SSLHandshakeException

Sometime you get SSLHandshakeException in Java when sending HTTPS requests. Most likely your JVM can not verify SSL certificate because it was given by unknown authority. You can install this authority public key, first download it here. Now install it in your keystore, for example:

x29:~ # /opt/jdk/bin/keytool -keystore /opt/jdk/jre/lib/security/cacerts -import -alias usertrust -file /home/yura/UTN-USERFirst-Hardware.crt -trustcacerts
Enter keystore password: changeit
Owner: CN=UTN-USERFirst-Hardware, OU=http://www.usertrust.com, O=The USERTRUST Network, L=Salt Lake City, ST=UT, C=US
Issuer: CN=UTN-USERFirst-Hardware, OU=http://www.usertrust.com, O=The USERTRUST Network, L=Salt Lake City, ST=UT, C=US
Serial number: 44be0c8b500024b411d3362afe650afd
Valid from: Sat Jul 10 01:10:42 NOVST 1999 until: Wed Jul 10 01:19:22 NOVST 2019
Certificate fingerprints:
MD5: 4C:56:41:E5:0D:BB:2B:E8:CA:A3:ED:18:08:AD:43:39
SHA1: 04:83:ED:33:99:AC:36:08:05:87:22:ED:BC:5E:46:00:E3:BE:F9:D7
Trust this certificate? [no]: yes
Certificate was added to keystore


Check webapper.net blog for additional details.

0 comments: