PKIX path building Failed error while establishing SSL connection - ssl

I was trying to establish a ssl connection to the sever in my application. for this, I generated self-signed certificates and added them to the keystore as well as the java cacerts which is the trust store.
But When I launch my application, I keep getting PKIX path building failed validatorException: unable to find valid path to requested target error
Hence unable to login to my java application.I use java1.8.0_144 version.

Try to login to the website which IDE is complaining about, and see if you are able to access it through the browser.
If so, then check for the certificate being used in the browser and check that certificate is present in your java cacerts.

Hi i usually generated the root CA with openssl and never worked importing that into the cacerts with keytools. You can instead generate it with this application i made out of desperation (it's a Java 11 app):
https://github.com/kendarorg/JavaCaCertGenerator
Its only purpose is to replace the generation of the private key and the root certificate, in a form "fit" for cacerts. From there you can produce the various certificates for the addresses

Related

Firefox is not prompting for client certificate

Firefox 91.12.0
Windows 10 Enterprise for Virtual Desktops version 21H2 build 19044.1766
Visual Studio 2022 V 17.1.6
C#
.NET Core 6.0
System.Security,Cryptography.OpenSsl 5.0.0 nuget package
I am creating a certificate authority to programmatically generate client certificates. The CA (and the intermediate CA) is imported into windows. I have created an website in IIS that uses that certificate, and it works fine with all three browsers (edge, chrome, firefox).
I created another website in IIS to require client certificates, and I used my CA application to generate a client certificate. I imported that certificate using chrome, and I see that cert in MMC "Certificates - Current User" under Personal->Certificates. Both Chrome and Edge prompt for the certificate, and when I select it, it grants me access to the site, and I can see the index.html content.
Firefox does not prompt me for the certificate. In Firefox advanced preferences:
security.osclientcerts.autoload = true
security.enterprise_roots.enabled = true
I have tried to import the PFX file my app generates, within Firefox, and it prompts me for a password, but it issues the error message "The PKCS #12 operation failed for unknown reasons" ... which tells me precisely nothing.
In my research I have seen comments about certificate fields being encoded with "printable
strings" rather than UTF8, but I can find no way to control this, or even control it in anyway.
So what am I doing wrong? What special thing is it that Firefox needs that it isn't getting?
Edit: The issue I mentioned before, here, was that the cert did not contain PrintableStrings. I confirmed using ASN.1 Decoder that my cert does in fact use PrintableStrings for everything in the cert.
The problem was that when I generated the certificate it had the same serial number as the certificate from the CA. I changed the number to 9, and restarted Firefox, and it prompted me for the cert.
So ... apparently duplicate serial numbers among certs from the same CA are a problem for Firefox.

WebSphere unable to find valid certification path to requested target

I've got a WebSphere 9 server for testing web apps on my laptop. I also have Hybris running under Tomcat on my laptop (for testing also). I wrote a Java web app to test punchout functions in Hybris, that runs on my WebSphere server. It had been working, but I had to reinstall WebSphere. Since then, when I try to run my web app in WebSphere, I get this error in WebSphere:
javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.h: PKIX path
building failed: java.security.cert.CertPathBuilderException: unable
to find valid certification path to requested target
whenever my app tries to post to Hybris.
In the administrative console of WebSphere, I used the "receive from port" button to get the self-signed certificate from Hybris into the nodedefaultTrustStore in WebSphere. Hybris is at applied.local:9002 on my laptop and the certificate looks like this:
CN=applied.local, OU=applied.local, O=applied.local, L=applied.local,
ST=WI, C=us Valid from Jul 17, 2019 to Apr 11, 2022.
All of this was working previously, but I must have broken something. I must be missing something. I don't understand why it can't "find a valid certification path" to applied.local, since the CN is applied.local, and the certificate is in the trust store in WebSphere.
I got it working, but I don't know why I had to do this to get it working. If someone can explain why - that would be great. Anyway here's what I did:
Added custom variables to WebSphere to define where cacerts was, but default values should have worked, so not sure if this had any effect. In admin console, application servers > server1 > Java and Process Management, process definition, Java Virtual Machine, Customer properties: javax.net.ssl.truststore (path to cacerts in WebSphere), javax.net.ssl.truststoretype jks, and javax.net.ssl.trustStorePassword changeit.
Used a browser to export the self-signed certificate Hybris was using to a file.
Used Ikeyman to import the certificate into cacerts. (There are instructions on how to do this in IBM's pages).
Restarted WebSphere and Hybris and posting from WebSphere to Hybris worked again.
What doesn't make sense to me is that I had previously imported the Hybris self-signed certificate using the "Retrieve from port" button in the admin console for the NodeDefaultTrustStore. That used to work, but now apparently I have to import it into cacerts also or instead?

MeteorJS on Windows 7: error: self signed certificate in certificate chain

I try to test MeteorJS on Windows. I downloaded the last version of Meteor (1.5.2).
At my workplace, when I tryed to create a new project with "meteor create simple-todos", as Admin or not, I had an error:
C:\DEV\METEORJS>meteor create simple-todos
=> Errors while creating your project
While downloading blaze#2.3.2...: error: self signed certificate in
certificate chain
While downloading blaze-html-templates#1.1.2...: error: self signed
certificate in certificate chain
While downloading blaze-tools#1.0.10...: error: self signed
certificate in certificate chain
...
At home, I retry this test as Admin, and it run well :
C:\DEV\METEORJS>meteor create simple-todos
Created a new Meteor app in
'simple-todos'.
To run your new app: cd simple-todos meteor
...
What could explain this error?
Could this affect the operation or reliability of an application built with Meteor?
Problem resolved with my "network manager" !
There isn't any proxy on the office's firewall, but there was a module that decrypted the SSL stream. After deactivating it, I was able to create my Meteor project.
Thank you #Styx for giving me the right track (with your first answer).

EppLib.net - Which SSL Certificate to use

When using EppLib.net (and as per the Nominet instructions - http://registrars.nominet.uk/namespace/uk/registration-and-domain-management/registrar-systems/epp/testbed)
In order to verify the identity of the secure server you will need the 'Verisign Class 3 Public Primary Certification Authority' root certificate available free from www.verisign.com (the certificate is also distributed with most web browsers).
I am supplying the Verisign Class 3 PPCA Certs in .crt format (I can't export as a pfx) within the code (and have tried every cert installed on the server).
However each one fails with the error (when trying to negotiate the connection):
An existing connection was forcibly closed by the remote host.
I've confirmed that I can connect from the server to Nominet by running cURL
curl -v https://testbed-epp.nominet.org.uk:700
and that responds as I would expect - or at least without an error!
I have also tried to use the same cert that curl appears to be using without success.
Can anyone help with pointing me in the right direction with the SSL that I should be using or how to get hold of the correct certificate?
thanks in advance
For anyone having a similar issue, it wasn't a question of which SSL certificate to use, but to ensure the correct protocol was being used. Incidentally, I got it working initially using the curl-ca-bundle.crt provided with cURL.
This certificate, in combination with a change to the target .net framework for the EppLib.net project resolved my issue.
On cloning from Github the target was .net 4.0 and Nominet needs at least TLS1.1, which wasn't available in v4.
Therefore I also updated the target to 4.5.1 for the EppLib.net project and changed the SslProtocol from
SslProtocol.Tls to
SslProtocol.Tls12

jaspersoft studio 6.2 XML Data source ssl error

I am trying to add an "XML File" datasource in Jaspersoft Studio 6.2 to a report which is actually a call to a REST service requiring a single parameter as part of the path.
if the image doesn't display here is a description:
The URL I use is like so : http://.../service/rest/report/
Options:
GET
Parameter:
name=id
value=$P{ReportID} (the parameter is already created with a default value)
When I try to test it, this is what happens
net.sf.jasperreports.engine.JRRuntimeException: 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 net.sf.jasperreports.data.http.HttpDataConnection.getInputStream(HttpDataConnection.java:101)
at net.sf.jasperreports.data.DataFileStream.<init>(DataFileStream.java:47)
at net.sf.jasperreports.data.DataFileUtils.getDataStream(DataFileUtils.java:62)
at net.sf.jasperreports.data.xml.XmlDataAdapterService.loadDataDocument(XmlDataAdapterService.java:140)
at net.sf.jasperreports.data.xml.XmlDataAdapterService.contributeParameters(XmlDataAdapterService.java:70)
at net.sf.jasperreports.data.AbstractDataAdapterService.test(AbstractDataAdapterService.java:105)
at com.jaspersoft.studio.data.wizard.AbstractDataAdapterWizard$3.runOperations(AbstractDataAdapterWizard.java:162)
at com.jaspersoft.studio.utils.jobs.CheckedRunnableWithProgress$1.run(CheckedRunnableWithProgress.java:59)
at java.lang.Thread.run(Thread.java:745)
I know this should work. I can call the service in a browser using .../report/?id=xx and I get back the expected XML data. I have also tested this using the "WebService Data Source" plug-in found on the community.jaspersoft.com site - that works as well in the Studio app (but I am unable to configure it on the server).
So the question is, how do I get around this SSL exception? My app server is internal and does not use SSL (still under development).
There a two ways to tackle this:
Ignore the certificate all together (Be aware that ignoring the error makes you vulnerable to MITM attacks)
Add the certificate to your keystore of the corresponding JVM
For more details take a look here: How to ignore PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException?