• Register
0 votes
52 views

Problem :

I have the Java web service client, which consumes the web service via HTTPS.

When I try to connect to the service URL (https://AAA.BBB.CCC.DDD:9443/ISomeService ), I get the exception as below:

“ Java.security.cert.CertificateException: No subject alternative names present.”

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I had faced the same problem and solved with below code. I put this code before my first call to the webservices.

javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
new javax.net.ssl.HostnameVerifier(){

    public boolean verify(String hostname,
            javax.net.ssl.SSLSession sslSession) {
        return hostname.equals("localhost");
    }
});

It is very simple and it works fine for me.

OR

The verification of a certificate identity is performed against what a client requests.

When your client uses the https://xxx.xxx.xxx.xxx/something (where xxx.xxx.xxx.xxx is an IP address), a certificate identity is checked against your IP address (in theory, only using the IP SAN extension).

If the certificate has no IP SAN, but DNS SANs (or if no DNS SAN, the Common Name in a Subject DN), you can get this to work by just making your client use the URL with that host name instead (or the host name for which a cert would be valid, if there are multiple possible values). For example, if you cert has the name for www.example.com, use the https://www.example.com/something.

Of course, you will need that the host name to resolve to that of the IP address.

9 7 4
38,600 points

Related questions

0 votes
1 answer 124 views
124 views
Problem : I have a Java web service client, which consumes a web service via HTTPS. When I connect to the service URL, I get the exception java.security.cert.CertificateException: No subject alternative names present.
asked Oct 22, 2019 peterlaw 6.9k points
0 votes
2 answers 247 views
247 views
Problem : I am getting bellow error while using keytool keytool error: java.lang.exception: public keys in reply and keystore don't match
asked Oct 19, 2019 peterlaw 6.9k points
0 votes
2 answers 317 views
317 views
Problem : I am trying to consume a RESTful service from url https://someurl.com. But I am getting the following error: java security cert certpathvalidatorexception certificate chaining error
asked Oct 23, 2019 peterlaw 6.9k points
0 votes
1 answer 360 views
360 views
Problem : I have a java complied package and it is sopposed to communicate with https server on net. But when i try running the compilation gives the following exception: javax.net.ssl.sslexception: unrecognized ssl message, plaintext connection?
asked Oct 23, 2019 peterlaw 6.9k points
0 votes
1 answer 154 views
154 views
Problem : I can push by clone project using ssh but it is not working for me getting following error server certificate verification failed. cafile: /etc/ssl/certs/ca-certificates.crt crlfile: none
asked Nov 12, 2019 peterlaw 6.9k points
0 votes
1 answer 57 views
57 views
Problem : I guess Chrome have released an update over the past week. And this update has caused at least 100 of our internal applications to throw the exception shown below. The solutions I have found over the Internet, talk about updating the ... there anyone who is aware of a similar fix in Chrome? Error Server has a weak ephemeral Diffie-Hellman public key ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY
asked Nov 25, 2019 alecxe 7.5k points
1 vote
1 answer 15 views
15 views
I am trying to open an https URL using the urlopen method in Python 3's urllib.request module. It seems to work fine, but the documentation warns that "[i]f neither cafile nor capath is specified, an HTTPS request will not do any verification of the server’s ... get this list from? Is there any simple and cross-platform way to use the same list of certificates that my OS or browser uses?
asked Sep 13, 2020 Marivoke 530 points
0 votes
1 answer 40 views
40 views
Problem: I am trying to consume a PHP webservice which has the SSL certificate. I have the .net 3.5 Class library it references the webservice with a 'Add Service references' in Visualstudio 2010 If I try calling the main method of my webservice then I ... SslPolicyErrors sslPolicyErrors) { return true; } But somehow it is not working. Also I have already a certificate installed on my own pc.
asked Aug 12, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 72 views
72 views
Problem : I want to retrieve some of the information from the ABB G13 gateway that offer the RESTful JSON API. API is hosted by a gateway via the https endpoint. Basic authentication mechanism is used for the authentication. However all the traffic goes through ... line 522, in send raise SSLError(e, request=request) requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:680)
asked Jan 2, 2020 alecxe 7.5k points