HTTPS vs HTTP in java - java

We got an wsdl from a website and we generated the java code with Axis2. Works perfect but the site is HTTPS and has the SSL certificatite turned off.
When I make a request I get
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
The admin from the site told me to disable SSL
I can't seem to find a solution for this.
What do I need to call before the request to disable this?

Related

Want to upgrade the my java 8 to use TLSV2.0

I need to connect to a restful endpoint using okHttp3.
The endpoint that I was given no longer support TLSV1.2 so i need a way to upgrade my TLS version on my java 8 application/ embedded Tomcat to 2.0, I was told by the developers of the endpoint that the TLS version might be the reason I cannot connect.
I tried changing the TLS version using the sslContext and it gave me an error saying invalid algorighm
This is the error that I get when I try to connect to the endpoint
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
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)

Automaticly resolve Java SSL errors? - Unable to find valid certification path to requested target

I'm trying to put together a simple web crawler using the jsoup library.
However when calling "Jsoup.connect(url).get()" On some sites I'm getting the error below.
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
There are a number of other questions about this error, but all of them suggest resolving it by manually creating a cert for the site in question. Since I'm trying to do a web crawler that will connect to many sites, that's not really a solution.
Is there a recommended way to resolve this? For a simple web crawler security is not particularly a concern, so the authenticity of the cert does not matter.
Solution I'm using for now, Option 2 mentioned in a related question here. Accept server's self-signed ssl certificate in Java client
You should ignore TSL validation, set validateTLSCertificates(false):
Document document = Jsoup.connect(url).timeout(10000).validateTLSCertificates(false).get();

Facebook graph API /me/permissions?access_token=XYZ returns 500 response with error - unable to find valid certification path to requested target

My application validates user permissions based on the the access token and I am hitting - https://graph.facebook.com/me/permissions?access_token=XYZ URL with a valid token.
Things were working fine, however recently it has started breaking. HTTP GET on the mentioned URL returns 500 response with an error -
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
There are no changes on the code front.
Moreover,
The mentioned URL with a valid token works fine when I hit it in the browser. But in code it does not work.
Also when I run the application on my laptop this all works fine. But it fails with the mentioned error on the production.
Not sure what's going on .. Can anyone please help me in this ?
Thanks in advance.

how to not to verify certificate in ldap ssl connection

I'm using novell ldap api and I must use ssl connection but I'm searching for a way in which the client not verify the certificate when connection starts...I get the follow 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'm try to reproduce the behavior like when I open a web page in https and browser asks me if I want to accept the certificate...
I didn't find any method to do this with novell ldap api and I'm wondering if it is possibile to do in pure java programmatic way. Thanks
G

Ignore certification authentication on Axis client for WCF service

I created an axis client to WCF service (the client was generated by Eclipse, using the WSDL as an input).
The client works fine when using HTTP.
When using HTTPS I'm getting 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 understand the error, but I don't want to give it a place where the certificates are located.
I want to tell Axis to avoid this step (accept any certificate without checking it).
I know how to do it with HttpsURLConnection (create a custom validator which does nothing), but I don't know how to do it with axis... (How can I tell axis to use my custom validator, or better, how can I tell it to ignore this step at all).
Can someone help me?
Thanks,
Mattan
I had the same problem and fixed it using:
AxisProperties.setProperty("axis.socketSecureFactory","org.apache.axis.components.net.SunFakeTrustSocketFactory");
In case this doesn't work, have a look here.

Categories

Resources