X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/301b2760ba37347ad98e896058fceb0c0bc349e4..261aaf50019732a4e766d6b3e9e07576a64f5504:/src/com/owncloud/android/network/CertificateCombinedException.java diff --git a/src/com/owncloud/android/network/CertificateCombinedException.java b/src/com/owncloud/android/network/CertificateCombinedException.java new file mode 100644 index 00000000..644c7359 --- /dev/null +++ b/src/com/owncloud/android/network/CertificateCombinedException.java @@ -0,0 +1,81 @@ +package com.owncloud.android.network; + +import java.security.cert.CertPathValidatorException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateExpiredException; +import java.security.cert.CertificateNotYetValidException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.SSLPeerUnverifiedException; + +public class CertificateCombinedException extends CertificateException { + + private X509Certificate mServerCert = null; + private CertificateExpiredException mCertificateExpiredException = null; + private CertificateNotYetValidException mCertificateNotYetValidException = null; + private CertPathValidatorException mCertPathValidatorException = null; + private CertificateException mOtherCertificateException = null; + private SSLPeerUnverifiedException mSslPeerUnverifiedException = null; + + public CertificateCombinedException(X509Certificate x509Certificate) { + mServerCert = x509Certificate; + } + + public X509Certificate getServerCertificate() { + return mServerCert; + } + + public CertificateExpiredException getCertificateExpiredException() { + return mCertificateExpiredException; + } + + public void setCertificateExpiredException(CertificateExpiredException c) { + mCertificateExpiredException = c; + } + + public CertificateNotYetValidException getCertificateNotYetValidException() { + return mCertificateNotYetValidException; + } + + public void setCertificateNotYetException(CertificateNotYetValidException c) { + mCertificateNotYetValidException = c; + } + + public CertPathValidatorException getCertPathValidatorException() { + return mCertPathValidatorException; + } + + public void setCertPathValidatorException(CertPathValidatorException c) { + mCertPathValidatorException = c; + } + + public CertificateException getOtherCertificateException() { + return mOtherCertificateException; + } + + public void setOtherCertificateException(CertificateException c) { + mOtherCertificateException = c; + } + + public SSLPeerUnverifiedException getSslPeerUnverifiedException() { + return mSslPeerUnverifiedException ; + } + + public void setSslPeerUnverifiedException(SSLPeerUnverifiedException s) { + mSslPeerUnverifiedException = s; + } + + public boolean isException() { + return (mCertificateExpiredException != null || + mCertificateNotYetValidException != null || + mCertPathValidatorException != null || + mOtherCertificateException != null); + } + + public boolean isRecoverable() { + return (mCertificateExpiredException != null || + mCertificateNotYetValidException != null || + mCertPathValidatorException != null); + } + +}