gpt4 book ai didi

Javamail java.security.cert.CertPathValidatorException 从 pop3 接收邮件时

转载 作者:太空宇宙 更新时间:2023-11-03 14:54:25 27 4
gpt4 key购买 nike

所以我正在尝试构建一个 Android 应用程序来检查来 self 大学服务器的电子邮件。它适用于 Gmail。我将证书(.cer 文件)添加到 keystore ,我尝试使用以下属性:

        Properties properties = new Properties();
properties.put("mail.store.protocol", "pop3");
properties.put("mail.pop3.host", pop3Host);
properties.put("mail.pop3.port", "995");
properties.put("mail.pop3.starttls.enable", "true");
properties.put("mail.pop3.ssl.checkserveridentity", "false");
properties.put("mail.pop3.ssl.trust", "*");
Session emailSession = Session.getDefaultInstance(properties);

...什么都没有:(

调试:

stefan.studmail I/System.out﹕ DEBUG: setDebug: JavaMail version 1.5.3
stefan.studmail I/System.out﹕ DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle]
stefan.studmail W/art﹕ Before Android 4.1, method javax.mail.Session com.sun.mail.pop3.POP3Store.getSession() would have incorrectly overridden the package-private method in javax.mail.Service
stefan.studmail I/System.out﹕ DEBUG POP3: mail.pop3s.rsetbeforequit: false
stefan.studmail I/System.out﹕ DEBUG POP3: mail.pop3s.disabletop: false
stefan.studmail I/System.out﹕ DEBUG POP3: mail.pop3s.forgettopheaders: false
stefan.studmail I/System.out﹕ DEBUG POP3: mail.pop3s.cachewriteto: false
stefan.studmail I/System.out﹕ DEBUG POP3: mail.pop3s.filecache.enable: false
stefan.studmail I/System.out﹕ DEBUG POP3: mail.pop3s.keepmessagecontent: false
stefan.studmail I/System.out﹕ DEBUG POP3: mail.pop3s.starttls.enable: false
stefan.studmail I/System.out﹕ DEBUG POP3: mail.pop3s.starttls.required: false
stefan.studmail I/System.out﹕ DEBUG POP3: mail.pop3s.apop.enable: false
stefan.studmail I/System.out﹕ DEBUG POP3: mail.pop3s.disablecapa: false
stefan.studmail I/System.out﹕ DEBUG POP3: connecting to host "stud.usv.ro", port 995, isSSL true
stefan.studmail I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@37e721f4 time:14882263
stefan.studmail E/StudMail:﹕ Connect failed
stefan.studmail W/System.err﹕ javax.mail.MessagingException: Connect failed;
stefan.studmail W/System.err﹕ nested exception is:
stefan.studmail W/System.err﹕ javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
stefan.studmail W/System.err﹕ at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:213)
stefan.studmail W/System.err﹕ at javax.mail.Service.connect(Service.java:364)
stefan.studmail W/System.err﹕ at javax.mail.Service.connect(Service.java:245)
stefan.studmail W/System.err﹕ at senegeac.stefan.studmail.FetchPop.fetch(FetchPop.java:75)
stefan.studmail W/System.err﹕ at senegeac.stefan.studmail.FetchPop.doInBackground(FetchPop.java:145)
stefan.studmail W/System.err﹕ at senegeac.stefan.studmail.FetchPop.doInBackground(FetchPop.java:39)
stefan.studmail W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:297)
stefan.studmail W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
stefan.studmail W/System.err﹕ at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
stefan.studmail W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
stefan.studmail W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
stefan.studmail W/System.err﹕ at java.lang.Thread.run(Thread.java:818)
stefan.studmail W/System.err﹕ Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
stefan.studmail W/System.err﹕ at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:306)
stefan.studmail W/System.err﹕ at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:574)
stefan.studmail W/System.err﹕ at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:369)
stefan.studmail W/System.err﹕ at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:236)
stefan.studmail W/System.err﹕ at com.sun.mail.pop3.Protocol.<init>(Protocol.java:112)
stefan.studmail W/System.err﹕ at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:264)
stefan.studmail W/System.err﹕ at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:207)
stefan.studmail W/System.err﹕ ... 11 more
stefan.studmail W/System.err﹕ Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
stefan.studmail W/System.err﹕ at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:323)
stefan.studmail W/System.err﹕ at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:224)
stefan.studmail W/System.err﹕ at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:113)
stefan.studmail W/System.err﹕ at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:525)
stefan.studmail W/System.err﹕ at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
stefan.studmail W/System.err﹕ at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:302)
stefan.studmail W/System.err﹕ ... 17 more
stefan.studmail W/System.err﹕ Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
stefan.studmail W/System.err﹕ ... 23 more

最佳答案

尝试使用 Session.getInstance .

如果这没有帮助,请发布 debug output .

关于Javamail java.security.cert.CertPathValidatorException 从 pop3 接收邮件时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30958142/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com