When trying to send an email over smtp with SSL in Java code I get the following exception:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host:
This would make sense if the SMTP server I am approaching used some self-signed certificate that I simply didn't import but I don't think that is the case, because when my colleague (in another country) runs the exact same code it works just fine.
What could this mean?
- My laptop is compromised
- My internet provider is doing something fishy
- Something else
- All of the above
For the record, I'm living in Indonesia and there are some sites that are blocked.
I am able to ping, a password is needed for this smtp server, the settings are fine (it works for my colleague). I have tried this with both my VPN turned on and off.
-Djavax.net.ssl.trustStore*
settings without any difference in code. In j7+keytool -printcert -sslserver host[:port]
shows the certs received (without checking).