how to not to verify certificate in ldap ssl connection - java

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

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)

HTTPS vs HTTP in 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?

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();

HTTPS Certificate issue

I am getting following error while using certificate file, I have generated truststore of the same and passing it to XmlRpcCommonsTransportFactory
org.apache.xmlrpc.XmlRpcException: I/O error while communicating with HTTP server: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
What I think you're dealing with is a certificate chain issue and not an XML-RPC specific issue.
You will need to look up how to get your XML-RPC client to implicitly trust the certificate and not do more than a cursory validation.
There are examples of this, I'm just not sure how to tie it to your particular XML-RPC client.
The issue here is that your truststore doesn't trust the certificate provided by the peer.
I have generated truststore of the same
What exactly do you mean by that?

Axis over SSL and 2-way authentication with a PKCS#12 keystore

I have PKCS#12 keystore that I've sucessfully imported in my browser for accessing a server that needs 2-way SSL authentication. Works perfectly reaching any https URL there.
However, I'm unable to access an URL in the same server, and from the same host when using Axis 1.4. The given Axis faultString is:
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
My javax.net.ssl.{keyStore,keyStorePassword,keyStoreType} properties seem to be set up fine.
How can I resolve this?
I came across a simpler answer if all you want is for your client to be able to call the SSL web service and ignore SSL certificate errors. (Of course you would NOT do this in production!, but it sure is handy for testing.)
Just put this statement before you invoke any web services:
System.setProperty("axis.socketSecureFactory",
"org.apache.axis.components.net.SunFakeTrustSocketFactory");
I found this at the Axis wiki.
Finally, importing the certificates into my own truststore, using Andreas Sterbenz's InstallCert, and setting the trustStore properties as indicated here did the trick!

Categories

Resources