644c7359771d67de1f2e59ba1aa075038512e613
[pub/Android/ownCloud.git] / src / com / owncloud / android / network / CertificateCombinedException.java
1 package com.owncloud.android.network;
2
3 import java.security.cert.CertPathValidatorException;
4 import java.security.cert.CertificateException;
5 import java.security.cert.CertificateExpiredException;
6 import java.security.cert.CertificateNotYetValidException;
7 import java.security.cert.X509Certificate;
8
9 import javax.net.ssl.SSLPeerUnverifiedException;
10
11 public class CertificateCombinedException extends CertificateException {
12
13 private X509Certificate mServerCert = null;
14 private CertificateExpiredException mCertificateExpiredException = null;
15 private CertificateNotYetValidException mCertificateNotYetValidException = null;
16 private CertPathValidatorException mCertPathValidatorException = null;
17 private CertificateException mOtherCertificateException = null;
18 private SSLPeerUnverifiedException mSslPeerUnverifiedException = null;
19
20 public CertificateCombinedException(X509Certificate x509Certificate) {
21 mServerCert = x509Certificate;
22 }
23
24 public X509Certificate getServerCertificate() {
25 return mServerCert;
26 }
27
28 public CertificateExpiredException getCertificateExpiredException() {
29 return mCertificateExpiredException;
30 }
31
32 public void setCertificateExpiredException(CertificateExpiredException c) {
33 mCertificateExpiredException = c;
34 }
35
36 public CertificateNotYetValidException getCertificateNotYetValidException() {
37 return mCertificateNotYetValidException;
38 }
39
40 public void setCertificateNotYetException(CertificateNotYetValidException c) {
41 mCertificateNotYetValidException = c;
42 }
43
44 public CertPathValidatorException getCertPathValidatorException() {
45 return mCertPathValidatorException;
46 }
47
48 public void setCertPathValidatorException(CertPathValidatorException c) {
49 mCertPathValidatorException = c;
50 }
51
52 public CertificateException getOtherCertificateException() {
53 return mOtherCertificateException;
54 }
55
56 public void setOtherCertificateException(CertificateException c) {
57 mOtherCertificateException = c;
58 }
59
60 public SSLPeerUnverifiedException getSslPeerUnverifiedException() {
61 return mSslPeerUnverifiedException ;
62 }
63
64 public void setSslPeerUnverifiedException(SSLPeerUnverifiedException s) {
65 mSslPeerUnverifiedException = s;
66 }
67
68 public boolean isException() {
69 return (mCertificateExpiredException != null ||
70 mCertificateNotYetValidException != null ||
71 mCertPathValidatorException != null ||
72 mOtherCertificateException != null);
73 }
74
75 public boolean isRecoverable() {
76 return (mCertificateExpiredException != null ||
77 mCertificateNotYetValidException != null ||
78 mCertPathValidatorException != null);
79 }
80
81 }