SSL Handshake error when connect to Watson API’s

Share

I start a new java project on eclipse using the SDK for Watson.
When i try to connect on any watson service i got the error:

CWPKI0022E: SSL HANDSHAKE FAILURE: A signer with SubjectDN CN=*.watsonplatform.net, O=International Business Machines Corporation,
L=Armonk, ST=New York, C=US was sent from the target host

This error means, that the local Liberty trust store does not have the correct signer certificate from the remote WATSON website where you tries to connect to.
It’s a certificate error. To solve the problem on my MAC i just do the following:

1 – Download the cetificate. The easy way i found was:

openssl s_client -host https://gateway.watsonplatform.net -port 443 -prexit -showcerts

2 – Create a text file with the first certificate

3 – Import the certificate on the truststore

keytool -import -alias watsonsigner -file cert1.pem -keystore /Users/[pathto key.jks]/key.jks -storepass password -storetype jks