POP3 via SSL not working
kamilpMar 21 2011 — edited Mar 22 2011Hi,
I have pop3 ssl server with my own certificate. When I connect to it using the code below, I allways get error "unable to find valid certification path to requested target". From documentation I understand that mail.pop3.ssl.trust set to * should help, but I am still getting this error.
Properties pop3Props = new Properties();
pop3Props.setProperty("mail.pop3.ssl.trust", "*");
pop3Props.setProperty("mail.pop3.port", "995");
URLName url = new URLName("pop3", config.recvHost, 995, "", config.recvLogin, config.recvPassword);
session = Session.getInstance(pop3Props, null);
store = new POP3SSLStore(session, url);
store.connect();
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 was trying to create my own TrustManager, but cant get it working neither. Is there way how to connect to pop3 via ssl without valid certificate ? I definitely dont want to install the certificate using keytool.
Thanks for help