HTTPS client throws "javax.net.ssl.SSLHandshakeException: unknowncertificate"

S

someone

Hello!

How can I bypass the "unknown certificate" exception? Is there a way to
define the certificate locally so that client recognizes it?

Thanks in advance,
 
C

Chris Smith

someone said:
How can I bypass the "unknown certificate" exception? Is there a way to
define the certificate locally so that client recognizes it?

There are a number of ways to handle this. If it's acceptable, you can
install the certificate locally on the client using the keytool utility.
See the docs for keytool; there are gazillions of options on how to do
it.

If that's not an acceptable method (because you don't have access to the
clients), then you can modify the code by creating a new socket factory.
You would do this by getting an SSLContext, calling SSLContext.init with
a different set of trust or key managers, and then calling its
getSocketFactory method. You could then specify that new socket factory
to create SSL sockets.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
S

someone

Chris said:
There are a number of ways to handle this. If it's acceptable, you can
install the certificate locally on the client using the keytool utility.
See the docs for keytool; there are gazillions of options on how to do
it.

By client, do you mean the local host or the HTTPS client class itself?
If that's not an acceptable method (because you don't have access to the
clients), then you can modify the code by creating a new socket factory.
You would do this by getting an SSLContext, calling SSLContext.init with
a different set of trust or key managers, and then calling its
getSocketFactory method. You could then specify that new socket factory
to create SSL sockets.

Could you give me more details on that approach, please?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top