2008-11-01 17:32:06 -04:00
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
package com.fsck.k9.mail;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2013-01-08 18:16:26 -05:00
|
|
|
import java.security.cert.CertPathValidatorException;
|
|
|
|
import java.security.cert.CertificateException;
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public class CertificateValidationException extends MessagingException {
|
2008-11-01 17:32:06 -04:00
|
|
|
public static final long serialVersionUID = -1;
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public CertificateValidationException(String message) {
|
2008-11-01 17:32:06 -04:00
|
|
|
super(message);
|
|
|
|
}
|
|
|
|
|
2013-01-17 09:24:22 -05:00
|
|
|
public CertificateValidationException(final String message, Throwable throwable) {
|
2008-11-01 17:32:06 -04:00
|
|
|
super(message, throwable);
|
2013-01-17 09:24:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean needsUserAttention() {
|
|
|
|
Throwable throwable = getCause();
|
|
|
|
|
|
|
|
/* user attention is required if the certificate was deemed invalid */
|
2013-01-08 18:16:26 -05:00
|
|
|
while (throwable != null
|
|
|
|
&& !(throwable instanceof CertPathValidatorException)
|
|
|
|
&& !(throwable instanceof CertificateException)) {
|
|
|
|
throwable = throwable.getCause();
|
|
|
|
}
|
2013-01-17 09:24:22 -05:00
|
|
|
|
|
|
|
return throwable != null;
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
}
|