Need help understanding the use of HTTPS/SSL with CN1

230 views
Skip to first unread message

Dan

unread,
Oct 15, 2014, 12:10:59 PM10/15/14
to codenameone...@googlegroups.com
This all stems from the following error I'm getting:

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

Note: I can access my https URL using a browser without any issue.

If I understand correctly, I should import my SSL cert info into a keystore that my JVM knows about.

My question: when I send a build, will this keystore be used to make sure that users of my application can access SSL URLs?




Shai Almog

unread,
Oct 15, 2014, 9:04:08 PM10/15/14
to codenameone...@googlegroups.com
That's a simulator only issue related to problems with the JDK that won't have a problem with the device.
Which JDK are you using to run the simulator?

Danny et Diane

unread,
Oct 15, 2014, 9:16:12 PM10/15/14
to codenameone...@googlegroups.com
1.7-ish

On Wed, Oct 15, 2014 at 10:04 PM, Shai Almog <shai....@gmail.com> wrote:
That's a simulator only issue related to problems with the JDK that won't have a problem with the device.
Which JDK are you using to run the simulator?

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/_SMs4jrGubg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/1645ae5a-a47b-4b63-814c-c076810a3732%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Shai Almog

unread,
Oct 16, 2014, 8:27:47 AM10/16/14
to codenameone...@googlegroups.com
Assuming this doesn't help:
https://groups.google.com/forum/#!searchin/codenameone-discussions/SSLHandshakeException/codenameone-discussions/GkJrNv9DO9k/TYIPeMeFvt0J

Take a look here:
http://stackoverflow.com/questions/9828414/receiving-sslhandshakeexception-handshake-failure-despite-my-client-ignoring-al

There are several suggestions for properties you can pass to the JVM to workaround this, you can use the -D command line argument to pass System properties to the JVM.

Danny et Diane

unread,
Oct 16, 2014, 2:34:09 PM10/16/14
to codenameone...@googlegroups.com
It works now.

I simply added my cert into the JRE keystore and rebooted Eclipse.

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/_SMs4jrGubg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.

Kaya TC

unread,
May 27, 2016, 10:18:51 AM5/27/16
to CodenameOne Discussions
I´d be happy if you guys could provide more info on this, i have installed keytool on eclipse etc. but still dont have a right clue what to do afterwards


Am Donnerstag, 16. Oktober 2014 20:34:09 UTC+2 schrieb Dan:
It works now.

I simply added my cert into the JRE keystore and rebooted Eclipse.
On Thu, Oct 16, 2014 at 9:27 AM, Shai Almog <shai....@gmail.com> wrote:
Assuming this doesn't help:
https://groups.google.com/forum/#!searchin/codenameone-discussions/SSLHandshakeException/codenameone-discussions/GkJrNv9DO9k/TYIPeMeFvt0J

Take a look here:
http://stackoverflow.com/questions/9828414/receiving-sslhandshakeexception-handshake-failure-despite-my-client-ignoring-al

There are several suggestions for properties you can pass to the JVM to workaround this, you can use the -D command line argument to pass System properties to the JVM.

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/_SMs4jrGubg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discussions+unsub...@googlegroups.com.

Dan

unread,
May 27, 2016, 10:26:14 AM5/27/16
to CodenameOne Discussions
Been a while :)

If I remember correctly, I visited the site using my browser and used it to extract the public cert. Then, using keytool, I imported said cert (ie. file exported on disk), into my Java keystore using commands found here:

HTH

Kaya TC

unread,
May 27, 2016, 10:40:35 AM5/27/16
to CodenameOne Discussions
Did you do any other steps?

i can see the keystore.jks in keytool on eclipse after opening it and typing password, but i still cant do a https connection.

Did it as you said, downloaded the cert from my site, used this command on command line: "keytool -import -trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks"

Dan

unread,
May 27, 2016, 10:45:40 AM5/27/16
to CodenameOne Discussions
There can be many versions of the JRE or JDK on your system. Are you sure that you updated the keystore on the appropriate one (ie. the one Eclipse is configured to use)?

Kaya TC

unread,
May 27, 2016, 10:50:02 AM5/27/16
to CodenameOne Discussions
Hey Dan,

i have indeed 2 JDKs installed, the JDK8 is the one i enabled in Eclipse, atleast it has the tick on it, i dont have a JRE installation beside of the JDKs because they may interfere with each other.

Right after your last message i went into the Keytool settings and loaded my keystore so it does now appear right after eclipse start.

I went further and put in the .pfx file in to the keystore beside of the steps i as described in the previous posting.

What i am beeing totally unsure is where i have to call that keytool command, i did it in the Windows command line without navigating to any eclipse directory etc...

Dan

unread,
May 27, 2016, 10:56:42 AM5/27/16
to CodenameOne Discussions
Honestly, this is all I remember at this point.

Maybe try to list the content of the keystore and see if it was imported correctly? I suspect the command can be run from anywhere, providing the full path to the keystore be provided in the call?

Kaya TC

unread,
May 27, 2016, 10:59:55 AM5/27/16
to CodenameOne Discussions

This is how it looks for me right now :\

Dan

unread,
May 27, 2016, 11:33:23 AM5/27/16
to CodenameOne Discussions
Shouldn't the keystore file path be the one in whatever JDK you're using?

See this:

Kaya TC

unread,
May 30, 2016, 3:46:29 AM5/30/16
to CodenameOne Discussions
Ok, that was the right link for me =)

The JDK Path as an example for the other people: C:\Program Files\Java\jdk1.8.0_74\jre\lib\security

But now i hit a different error


java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:792)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:789)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)

this is very annoying :(
Reply all
Reply to author
Forward
0 new messages