mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
604aa87ccf
If you attempted to use SSL to connect to a server that speaks STARTTLS, you should get an SSL protocol error. Instead, you were likely to get an "Unrecognized Certificate" error that shows you an unrelated certificate chain and asks you to accept it or reject it. Neither action would work because the actual problem had nothing to do with certificates. The unrelated certificate chain that popped up had been statically stored when validating a prior connection to a different server. With this patch, certificate chains are no longer stored statically when validating server connections. Issue 5886 is an example of a user experiencing this problem.
35 lines
889 B
Java
35 lines
889 B
Java
package com.fsck.k9.mail;
|
|
|
|
import java.security.cert.CertificateException;
|
|
import java.security.cert.X509Certificate;
|
|
|
|
/**
|
|
* A {@link CertificateException} extension that provides access to
|
|
* the pertinent certificate chain.
|
|
*
|
|
*/
|
|
public class CertificateChainException extends CertificateException {
|
|
|
|
private static final long serialVersionUID = 1103894512106650107L;
|
|
private X509Certificate[] mCertChain;
|
|
|
|
public CertificateChainException(String msg, X509Certificate[] chain) {
|
|
super(msg);
|
|
setCertChain(chain);
|
|
}
|
|
|
|
public CertificateChainException(CertificateException ce,
|
|
X509Certificate[] chain) {
|
|
super.initCause(ce);
|
|
setCertChain(chain);
|
|
}
|
|
|
|
public void setCertChain(X509Certificate[] chain) {
|
|
mCertChain = chain;
|
|
}
|
|
public X509Certificate[] getCertChain() {
|
|
return mCertChain;
|
|
}
|
|
|
|
}
|