A M
A M

Reputation: 849

SSL certificates in Codename One using Simulator

I created a custom SSL certificate through Java keytool command, in order to test the connection from my Codename one app and my HTTPS REST web service.

This is the complete command:

keytool -genkey -alias my_alias -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650

When the app (running on the simulator) tries to interact with the web service, it returns the following 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

I read here and I understood for a real mobile device is possible to add the custom certificate. My question is: using the simulator, how can I do? How can I use my "home-made" certificate?

Upvotes: 1

Views: 292

Answers (1)

Shai Almog
Shai Almog

Reputation: 52760

There is really no reason to do this anymore. You can but if you just don't want to pay for a certificate you can just use "lets encrypt" and it will work: http://letsencrypt.org/

Notice that it requires a recent version of JDK 8 (I think 128 or newer).

SSL will only work with proper domains and not with IP addresses etc.

Upvotes: 1

Related Questions