Intellij IDEA - Webservices client from WSDL with certificates - java

I am somewhat new to SSL/TLS and Java trust/keystores. I am attempting to generate a client to consume a web service from a IIS-hosted WSDL file. This worked fine before the service was configured to require certificates. I now receive a Wsdl url connection exception.
In an attempt to bypass this, I saved a local copy of the WSDL via IE (with the appropriate certs in place via the Certificates MMC snap-in). I then attempted to point IDEA to that location (file:/C:/projects/wsdl/wsdlname.wsdl).
This fails with the following error messages:
parsing WSDL...
[ERROR] sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid
certification path to requested target unknown location
[ERROR] invalid entity name: "Auth" (in namespace: "******")
line 0 of unknown location
Note: I've starred out the namespace.
Is there a way to configure IntelliJ IDEA to be able to present a valid certificate if I want to use the generation utility/wizard?
Is there a potential issue with the web service that is causing even the local WSDL import to fail?
Thanks in advance.

It should help if you install the certificate into JVM that is used to run IDEA via keytool.

Related

How to disable SSL authentication when fetching Spark packages?

I am using pyspark and when I initiate my Spark session I fetch some packages from a Nexus internal repository using the spark.jars.package. To fetch the packages I set:
spark.jars.ivySettings to point to a XML file with the locations in the Nexus internal repo to fetch the packages
spark.driver.extraJavaOptions set to -Djavax.net.ssl.trustStore= to point to JKS file containing the certificates needed for SSL verification in the Nexus internal repo
This setup was working well for me until recently, when I started getting SSL authentication errors of the type:
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 am checking with platform team what is causing these errors, but meanwhile, I would like to simply disable SSL verification for the purpose of fetching packages using spark.jars.packages, since there is no security risk as the system is properly ringfenced and we already disable SSL authentication for other purposes such as installing pip packages or downloading files from Nexus using wget/curl.
Is there some way to do so via the Spark configuration?
You can pass in SPARK options:
-Dcom.sun.net.ssl.checkRevocation=false

How to deploy my code to App Engine behind proxy

I am using Eclipse Neon 6.4.3 and i am trying to deploy my project to App Engine using the Google Cloud Platform plugin for Eclipse. https://cloud.google.com/eclipse/docs/quickstart
Until the 1st of April i could deploy projects using this plugin. But after that date, i get the following error:
Failed to retrieve projects; An error occurred while retrieving projects:javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuiderException: unable to find valid certification path to requested target.
Reason: Failed to retrieve projects.
Details: Failed to retrieve projects
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
After I press OK, I get the same message again. Then I get the "Deploy to App Engine Standard" menu with my account but my project list is blank.
I am working in a company that uses proxies and it's doing a SSL Inspection. I imported these 2 certificates used for SSL Inspection in my Eclipse cacerts file but i get the same error. These two certificates are issued by our internal certificate authority.
I wanted to add this as a comment, but still don't have enough points:
Are you using maven or appcfg? Have you tried using appcfg with --proxy argument?
From Deploying a Java app documentation:
If you are using an HTTP proxy, include the --proxy argument to tell appcfg its address. If you use a different proxy for HTTPS, then also include the --proxy_https argument.
The current certificate for the URL used to retrieve the projects https://cloudresourcemanager.googleapis.com/ was issued on April 5 2017, this may be the reason for the error. If you open that url and check the certificate you can verify whether it's signing CA is in the truststore you use, or you need to add either the CA or the certificate itself to your truststore.

Self-signed Certificate - Unable to connect using ANT Build

I'm trying to connect to all the links in a particular webpage and get the response to see if the link is broken.
Some of the links are SSL that too self-certified.
So, I've followed the procedure of adding the certificate to trust store. After that it worked fine, when I tested the same in Eclipse(it returned OK/200).
But, when I build and run the project using ANT in command line, the same exception appears.
And it is weird that it doesn't happen when I build using the same xml through Eclipse; it simply works!
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
As per my previous comments Java installs a JRE alongside the JDK which in turn also has a JRE installed. Thus if you are not sure which one is used you can try to add the certificate into jre\lib\security\cacerts and jdk1.x.0_xx\jre\lib\security\cacerts.

SSL Handshake issue when running using a JAR

I am facing an issue while trying to run a RestClient through Java.
I am using Apache HttpClient for building a rest client
I have added the required certificates in the jdk cacerts file and also checked that they are present there.
Now when I am running my code from eclipse than the handshake is happening correctly without any error and I am able to send a POST request.
Now when I create a runnable jar file from eclipse with all jars packaged in it than while running I am encountering the error
Error Occurred: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Can you all please help me in resolving this.
Run your application with the following option:
java -Djava.security.debug=all ...
This will turn debugging on.
I'm assuming that your are running the jar file as a standalone application. If that is the case, the cacerts maybe different.

Getting error: PKIX path building failed: unable to find valid certification path to requested target

I'm trying to send a xml to another system via web service. But while trying to send i'm getting the following error. I've installed the certificate they gave to me. but still its not working.
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 two possible sources for this error:
either the opposite side is using genuinely untrusted certificate (self-signed or signed by untrusted CA),
or the opposite side is not sending certificate validation chain (e.g. there is intermediate signing certificate along the way to your trusted CA, but this ceriticate is not present in the SSL handshake).
Solution for the first case is to add the untrusted CA (or the ceriticate itself) to your JRE truststore (${java.home}/lib/security/cacerts) or better - create your own truststore (which will not get removed when upgrading Java) and provide that to your application via javax.net.ssl.trustStore JVM property.
Solution for the second case is either to go with the first case solution or better - convince the opposite side to send correct certificate chain.
Add certificate to JRE truststore # ${java.home}/lib/security/cacerts OR if you have your own trustStore & provide path to that in your application/JVM. For example one possible way could be
or via java code
import java.util.Properties;
...
Properties systemProps = System.getProperties();
systemProps.put("javax.net.ssl.keyStorePassword","passwordForKeystore");
systemProps.put("javax.net.ssl.keyStore","pathToKeystore.ks");
systemProps.put("javax.net.ssl.trustStore", "pathToTruststore.ts");
systemProps.put("javax.net.ssl.trustStorePassword","passwordForTrustStore");
System.setProperties(systemProps);
...
For more refer to details on RedHat site
May be it will help refer to question

Categories