diff --git a/res/values/ids.xml b/res/values/ids.xml index 65455b689..703c2df53 100644 --- a/res/values/ids.xml +++ b/res/values/ids.xml @@ -4,7 +4,6 @@ - diff --git a/res/values/strings.xml b/res/values/strings.xml index 5ab142dd1..2177dd92a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1124,11 +1124,7 @@ Please submit bug reports, contribute new features and ask questions at Use client certificate - - Client Certificate Authentication - Client certificates are not supported on Android versions below 4.0. This server requires a valid client certificate to be selected. - No client certificate Remove client certificate selection diff --git a/src/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java b/src/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java index 88e1f86e3..f0ad53c54 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java @@ -31,7 +31,6 @@ import com.fsck.k9.mail.Store; import com.fsck.k9.mail.Transport; import com.fsck.k9.mail.store.WebDavStore; import com.fsck.k9.mail.filter.Hex; -import com.fsck.k9.net.ssl.SslHelper; import com.fsck.k9.security.KeyChainKeyManager; import java.security.cert.CertificateException; @@ -201,21 +200,6 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList if (K9.DEBUG) Log.d(K9.LOG_TAG, "Client certificate alias required: " + ccr.getMessage()); - /* - * If the KeyChain API is not available on this Android - * version, inform user and abort - */ - if (!SslHelper.isClientCertificateSupportAvailable()) { - mHandler.post(new Runnable() { - public void run() { - showDialogFragment(R.id.dialog_client_certificate_not_supported); - } - }); - - // abort - return; - } - String alias = null; if (CheckDirection.INCOMING.equals(mDirection)) { ServerSettings storeSettings = Store.decodeStoreUri(mAccount.getStoreUri()); @@ -486,10 +470,6 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList }); } - private void showDialogFragment(int dialogId) { - showDialogFragment(dialogId, null); - } - private void showDialogFragment(int dialogId, String customMessage) { if (mDestroyed) { return; @@ -507,14 +487,6 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList ); break; } - case R.id.dialog_client_certificate_not_supported: { - fragment = ConfirmationDialogFragment.newInstance(dialogId, - getString(R.string.dialog_client_certificate_title), - getString(R.string.dialog_client_certificate_not_supported), - getString(android.R.string.ok) - ); - break; - } default: { throw new RuntimeException("Called showDialog(int) with unknown dialog id."); } @@ -546,8 +518,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList @Override public void doNegativeClick(int dialogId) { switch (dialogId) { - case R.id.dialog_account_setup_error: - case R.id.dialog_client_certificate_not_supported: { + case R.id.dialog_account_setup_error: { mCanceled = false; setResult(RESULT_OK); finish(); diff --git a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java index 0d03016ad..2ec24d32d 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java @@ -31,7 +31,6 @@ import com.fsck.k9.mail.store.WebDavStore; import com.fsck.k9.mail.store.ImapStore.ImapStoreSettings; import com.fsck.k9.mail.store.WebDavStore.WebDavStoreSettings; import com.fsck.k9.mail.transport.SmtpTransport; -import com.fsck.k9.net.ssl.SslHelper; import com.fsck.k9.service.MailService; import com.fsck.k9.view.ClientCertificateSpinner; import com.fsck.k9.view.ClientCertificateSpinner.OnClientCertificateChangedListener; @@ -140,7 +139,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener } }); - mAuthTypeAdapter = AuthType.getArrayAdapter(this, SslHelper.isClientCertificateSupportAvailable()); + mAuthTypeAdapter = AuthType.getArrayAdapter(this); mAuthTypeView.setAdapter(mAuthTypeAdapter); /* diff --git a/src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java b/src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java index ad8b387a1..a913ef1b1 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java @@ -24,7 +24,6 @@ import com.fsck.k9.mail.ConnectionSecurity; import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mail.Transport; import com.fsck.k9.mail.transport.SmtpTransport; -import com.fsck.k9.net.ssl.SslHelper; import com.fsck.k9.view.ClientCertificateSpinner; import com.fsck.k9.view.ClientCertificateSpinner.OnClientCertificateChangedListener; @@ -113,7 +112,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, mSecurityTypeView.setAdapter(ConnectionSecurity.getArrayAdapter(this)); - mAuthTypeAdapter = AuthType.getArrayAdapter(this, SslHelper.isClientCertificateSupportAvailable()); + mAuthTypeAdapter = AuthType.getArrayAdapter(this); mAuthTypeView.setAdapter(mAuthTypeAdapter); /* diff --git a/src/com/fsck/k9/mail/AuthType.java b/src/com/fsck/k9/mail/AuthType.java index 2c256c4d2..04b416c79 100644 --- a/src/com/fsck/k9/mail/AuthType.java +++ b/src/com/fsck/k9/mail/AuthType.java @@ -45,13 +45,8 @@ public enum AuthType { LOGIN(0); - static public ArrayAdapter getArrayAdapter(Context context, boolean includeExternal) { - AuthType[] authTypes; - if (includeExternal) { - authTypes = new AuthType[]{PLAIN, CRAM_MD5, EXTERNAL}; - } else { - authTypes = new AuthType[]{PLAIN, CRAM_MD5}; - } + static public ArrayAdapter getArrayAdapter(Context context) { + AuthType[] authTypes = new AuthType[]{PLAIN, CRAM_MD5, EXTERNAL}; ArrayAdapter authTypesAdapter = new ArrayAdapter(context, android.R.layout.simple_spinner_item, authTypes); authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); diff --git a/src/com/fsck/k9/net/ssl/SslHelper.java b/src/com/fsck/k9/net/ssl/SslHelper.java index 8f6833eb3..fbfc733db 100644 --- a/src/com/fsck/k9/net/ssl/SslHelper.java +++ b/src/com/fsck/k9/net/ssl/SslHelper.java @@ -11,8 +11,6 @@ import javax.net.ssl.KeyManager; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; -import android.annotation.SuppressLint; -import android.os.Build; import android.util.Log; import com.fsck.k9.K9; @@ -25,23 +23,8 @@ import com.fsck.k9.security.KeyChainKeyManager; */ public class SslHelper { - /** - * KeyChain API available on Android >= 4.0 - * - * @return true if API is available - */ - public static boolean isClientCertificateSupportAvailable() { - return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH); - } - - @SuppressLint("TrulyRandom") private static SSLContext createSslContext(String host, int port, String clientCertificateAlias) throws NoSuchAlgorithmException, KeyManagementException, MessagingException { - if (clientCertificateAlias != null && !isClientCertificateSupportAvailable()) { - throw new MessagingException( - "Client certificate support is only availble on Android >= 4.0", true); - } - if (K9.DEBUG) Log.d(K9.LOG_TAG, "createSslContext: Client certificate alias: " + clientCertificateAlias); diff --git a/src/com/fsck/k9/security/KeyChainKeyManager.java b/src/com/fsck/k9/security/KeyChainKeyManager.java index 79a45723d..67877886b 100644 --- a/src/com/fsck/k9/security/KeyChainKeyManager.java +++ b/src/com/fsck/k9/security/KeyChainKeyManager.java @@ -7,7 +7,6 @@ import java.security.PrivateKey; import java.security.cert.X509Certificate; import javax.net.ssl.X509ExtendedKeyManager; -import android.annotation.TargetApi; import android.app.Activity; import android.os.Build; import android.security.KeyChain; @@ -24,7 +23,6 @@ import com.fsck.k9.mail.ClientCertificateRequiredException; * selection is requested, we harvest the parameters during the handshake and * abort with a custom (runtime) ClientCertificateRequiredException. */ -@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public class KeyChainKeyManager extends X509ExtendedKeyManager { private static PrivateKey sClientCertificateReferenceWorkaround;