Tomson
Tomson

Reputation: 163

javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

Simple codes

public class Demo {
public static void main(String[] args) {
    HttpClient httpclient = new DefaultHttpClient();
    try {
        HttpGet httpget = new HttpGet("https://banweb.cityu.edu.hk/");
        HttpResponse response = httpclient.execute(httpget);
    } catch (Exception e) {
        e.printStackTrace();
    }       
}
}

I have 2 desktops (A and B), 2 laptops (A and B), 3 android devices (A, B and C) and 3 android emulators (SDK v2.1, v4.0 and v4.03). When above code is run in desktop A, android emulator v4.0 and v4.0.3, it throws "javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated". But the code works fine in other devices and emulators.

Can anyone tell me why the same code shows different results in different machines?

Your help is appreciated.

Upvotes: 1

Views: 2743

Answers (2)

user1738890
user1738890

Reputation: 31

See this message post: SSL "Peer Not Authenticated" error with HttpClient 4.1

I think the issue is related to whether the machine/environment that you are using has access to the system wide root certificates. If the OS is newer it may recognize ( and verify/trust?) your signed certificate. However, if the JRE/JDK is not aware of the root CA store then it may not work.

I have a basic app that is working in Netbeans but not after I deploy the JavaFX project. I have added my root certificate to the keystore but it is still not working.

Upvotes: 3

Yusufk
Yusufk

Reputation: 1172

It may be that one of the machines is behind a proxy and the other is not?

Upvotes: 0

Related Questions