This is a rebase of David Mansfields client certificate support

Squashed commit of the following:

commit 0e856981186777fff830974e37266c511ec8bc3e
Author: David Mansfield <david@cobite.com>
Date:   Sat Mar 9 10:13:36 2013 -0500

    - change enabling use of client certs for IMAP to an explicit checkbox
    (like for SMTP) instead of implicitly based on use of auth type EXTERNAL
    because some users may use ccerts with outher authentication types.
    implementation is almost identical to the way it works for outgoing
    server now, except for the extra logic that ccerts are _required_ when
    auth type EXTERNAL is selected.

commit 6adac0fe409cea7ba0e3dc353a3737dedae2cbb4
Author: David Mansfield <david@cobite.com>
Date:   Sat Mar 9 09:42:06 2013 -0500

    - if client certificates are not enabled, reset the saved alias value to
    prevent them from being used anyway

commit e1ae8a7c12d695296901a43cc5c0eac46d59c2ad
Author: David Mansfield <david@cobite.com>
Date:   Fri Mar 1 18:27:35 2013 -0500

    - hide the "use client certificates" checkbox in the UI if the platform
    doesn't support client certificates

commit a595661e56bed6b29e62f063eaf59967c8c302b1
Author: David Mansfield <david@cobite.com>
Date:   Fri Mar 1 18:20:56 2013 -0500

    - don't include imap auth type EXTERNAL if client certificates are not
    supported by the runtime platform, as they require them
    - eliminate ugly string array that duplicated the values in the
    ImapStore.AuthType enum

commit 7f50f9cb7b95aa6c4e9ecca4079625459254bb73
Author: David Mansfield <david@cobite.com>
Date:   Fri Mar 1 17:52:51 2013 -0500

    - refactor the test of whether client certificates are supported

commit 80b6190e062d820ca3cee73c078251b25942988b
Author: David Mansfield <david@cobite.com>
Date:   Wed Feb 27 23:20:38 2013 -0500

    - redo the way the interactive prompting is triggered removing some ugly
    global statics.  thanks to cketti for good suggestions

commit a345caf087cffd3a0e77b4acf58bd1e1857494a3
Author: David Mansfield <david@cobite.com>
Date:   Wed Feb 27 22:07:23 2013 -0500

    - some debug statement

commit b139879c645f4cef091a36c13ea0cf397112f04b
Author: David Mansfield <david@cobite.com>
Date:   Wed Feb 27 21:09:36 2013 -0500

    - imap capabilities must be refreshed after STARTTLS in order to notice
    that AUTH=EXTERNAL is now available

commit 3b661d5435c9eedb13b570a31c2bc79370155512
Author: David Mansfield <david@cobite.com>
Date:   Wed Feb 27 20:43:35 2013 -0500

    - test for AUTH=EXTERNAL capability before attempting it

commit 33f9bea317a4ad8cceea68e5e84366bf6874fcf3
Author: David Mansfield <david@cobite.com>
Date:   Wed Feb 27 20:36:19 2013 -0500

    - use MessagingException with permanent flag set if client certs. are
    not available.

commit 6f78edd51280687417baeb5e24c999aac33c8dcd
Author: David Mansfield <david@cobite.com>
Date:   Wed Feb 27 20:28:05 2013 -0500

    - api level 14 is required to access the KeyChain (via
    KeyChainKeyManager) so throw an exception in those cases

commit c42c621970503a292fee831a1730840b7df088b0
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 22:48:12 2013 -0500

    - when requested, enable the prompt for the user to select a client
    cert. alias during ssl/tls negotiation by setting the current Activity
    into the TrustManagerFactory (HACK).  after the settings-check is
    successful, grab the selected alias and save it to the Account object

commit a6ffb5869c5470dc43f92e866a8d63d2a6268e36
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 22:46:27 2013 -0500

    - support the checkbox to enable client cert. auth that was added to the
    outgoing server layout.  validate that connection security is selected
    when client certs are requested.
    - request that the 'check settings' prompt for the user to select a
    client cert alias when necessary

commit 76c81d938175eae0ad603e7b5ad4c98470a4ab11
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 22:44:13 2013 -0500

    - Add EXTERNAL auth to the incoming server config, and ensure that it's
    selection requires use of ssl or tls.
    - when EXTERNAL is selected, have the 'check settings' prompt for the
    user to choose a cert.

commit fc4c28af74d84676c59ee9320eccd47431f6494c
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 22:41:39 2013 -0500

    - AccountSetupBasics doesn't currently support any client. cert
    configuration so pass "false" as the new extra variable

commit 3fb66438d029e44d2b1495d65d79018492555a70
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 22:40:49 2013 -0500

    - use the configured client cert. alias for the transport ssl/tls
    sockets

commit c096126a99c13c88fac63c55a27cd2e6a8b873ca
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 22:40:18 2013 -0500

    - create the ssl/tls socket using the saved client cert alias
    - support "AUTHENTICATE EXTERNAL" imap command

commit fd9ef4c557c0b7c3b14a02f0b101f74b07dcd847
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 22:38:17 2013 -0500

    Use the KeyChainKeyManager class to select and access creds in the ICS
    private creds store.

    Note: two abuses of statics here:

    1) during the 'check settings' activity, we want to prompt the user to
    select the client certificates, which requires a reference to that
    Activity, so it is temporarily saved in a static variable in the
    TrustManagerFactory then cleared.

    2) simalarly, once a cert. has been chosen, the alias that was selected
    is held in a static String in the TrustManagerFactory to be grabbed
    later to use in updating the Account/preferences.

commit 3a0e1b69e84592af51773021ca39bb07b761a607
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 22:34:48 2013 -0500

    - ImapConnection doesn't directly access the account, so "proxy" the
    access to the client cert. alias preference through the ImapSettings

commit 14b42954d01bd6b128e28f1fa6d91aff1b8369ec
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 22:32:50 2013 -0500

    Add two Account properties/prefs:
    - storeClientCertificateAlias
    - transportClientCertificateAlias
    which save the alias of the client cert. chosen by user for each
    operation.

commit 5ecf0d3881d651fedef833e1200ab9b8c9e28b03
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 20:57:16 2013 -0500

    - label for the client cert. checkbox on outgoing server settings

commit 667885b57a8c0f7e2af888bf36b73d6b899e433c
Author: David Mansfield <david@cobite.com>
Date:   Mon Feb 25 20:56:42 2013 -0500

    - add checkbox to outgoing server settings layout to enable client cert.
    auth

commit 37115aa71dde59724cd0b7c7ff2e591a39ad660f
Author: David Mansfield <david@cobite.com>
Date:   Sun Feb 24 19:01:52 2013 -0500

    - use KeyChain to choose/supply client certificate creds to ssl socket
    context.
    - during checking of setup, supply the current Activity to the
    TrustManagerFactory so it can popup the "choose client certificate"
    screen
    - hardcode Imap to use auth EXTERNAL instead of auth PLAIN

commit fa554e9366a0204b9a9753d83411e3b70020e23b
Author: Linus Lotz <linus@lotz.li>
Date:   Sat Feb 22 12:58:40 2014 +0100

    Merged trustmanagers