mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
Move SSL code into package
This commit is contained in:
parent
2536719749
commit
9f16b9f465
@ -13,7 +13,6 @@ import android.content.Context;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.mail.Store;
|
|
||||||
import com.fsck.k9.mail.store.local.LocalStore;
|
import com.fsck.k9.mail.store.local.LocalStore;
|
||||||
import com.fsck.k9.preferences.Editor;
|
import com.fsck.k9.preferences.Editor;
|
||||||
import com.fsck.k9.preferences.Storage;
|
import com.fsck.k9.preferences.Storage;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package com.fsck.k9.net.ssl;
|
package com.fsck.k9.mail.ssl;
|
||||||
|
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
@ -29,7 +29,7 @@ import com.fsck.k9.mail.MessagingException;
|
|||||||
* For client certificate authentication! Provide private keys and certificates
|
* For client certificate authentication! Provide private keys and certificates
|
||||||
* during the TLS handshake using the Android 4.0 KeyChain API.
|
* during the TLS handshake using the Android 4.0 KeyChain API.
|
||||||
*/
|
*/
|
||||||
public class KeyChainKeyManager extends X509ExtendedKeyManager {
|
class KeyChainKeyManager extends X509ExtendedKeyManager {
|
||||||
|
|
||||||
private static PrivateKey sClientCertificateReferenceWorkaround;
|
private static PrivateKey sClientCertificateReferenceWorkaround;
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package com.fsck.k9.net.ssl;
|
package com.fsck.k9.mail.ssl;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.fsck.k9.net.ssl;
|
package com.fsck.k9.mail.ssl;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
@ -90,7 +90,7 @@ import com.fsck.k9.mail.store.ImapResponseParser.ImapList;
|
|||||||
import com.fsck.k9.mail.store.ImapResponseParser.ImapResponse;
|
import com.fsck.k9.mail.store.ImapResponseParser.ImapResponse;
|
||||||
import com.fsck.k9.mail.store.imap.ImapUtility;
|
import com.fsck.k9.mail.store.imap.ImapUtility;
|
||||||
import com.fsck.k9.mail.transport.imap.ImapSettings;
|
import com.fsck.k9.mail.transport.imap.ImapSettings;
|
||||||
import com.fsck.k9.net.ssl.TrustedSocketFactory;
|
import com.fsck.k9.mail.ssl.TrustedSocketFactory;
|
||||||
|
|
||||||
import com.beetstra.jutf7.CharsetProvider;
|
import com.beetstra.jutf7.CharsetProvider;
|
||||||
import com.jcraft.jzlib.JZlib;
|
import com.jcraft.jzlib.JZlib;
|
||||||
|
@ -12,7 +12,7 @@ import com.fsck.k9.mail.*;
|
|||||||
import com.fsck.k9.mail.filter.Base64;
|
import com.fsck.k9.mail.filter.Base64;
|
||||||
import com.fsck.k9.mail.filter.Hex;
|
import com.fsck.k9.mail.filter.Hex;
|
||||||
import com.fsck.k9.mail.internet.MimeMessage;
|
import com.fsck.k9.mail.internet.MimeMessage;
|
||||||
import com.fsck.k9.net.ssl.TrustedSocketFactory;
|
import com.fsck.k9.mail.ssl.TrustedSocketFactory;
|
||||||
|
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import org.apache.http.conn.ConnectTimeoutException;
|
|||||||
import org.apache.http.conn.scheme.LayeredSocketFactory;
|
import org.apache.http.conn.scheme.LayeredSocketFactory;
|
||||||
import org.apache.http.params.HttpParams;
|
import org.apache.http.params.HttpParams;
|
||||||
|
|
||||||
import com.fsck.k9.net.ssl.TrustManagerFactory;
|
import com.fsck.k9.mail.ssl.TrustManagerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
@ -1,6 +1,40 @@
|
|||||||
|
|
||||||
package com.fsck.k9.mail.store.local;
|
package com.fsck.k9.mail.store.local;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import com.fsck.k9.Account;
|
||||||
|
import com.fsck.k9.K9;
|
||||||
|
import com.fsck.k9.Preferences;
|
||||||
|
import com.fsck.k9.controller.MessageRetrievalListener;
|
||||||
|
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||||
|
import com.fsck.k9.helper.Utility;
|
||||||
|
import com.fsck.k9.mail.Flag;
|
||||||
|
import com.fsck.k9.mail.Folder;
|
||||||
|
import com.fsck.k9.mail.MessagingException;
|
||||||
|
import com.fsck.k9.mail.Store;
|
||||||
|
import com.fsck.k9.mail.store.RemoteStore;
|
||||||
|
import com.fsck.k9.mail.store.StorageManager;
|
||||||
|
import com.fsck.k9.mail.store.StorageManager.StorageProvider;
|
||||||
|
import com.fsck.k9.mail.store.StoreConfig;
|
||||||
|
import com.fsck.k9.mail.store.UnavailableStorageException;
|
||||||
|
import com.fsck.k9.mail.store.local.LockableDatabase.DbCallback;
|
||||||
|
import com.fsck.k9.mail.store.local.LockableDatabase.WrappedException;
|
||||||
|
import com.fsck.k9.provider.EmailProvider;
|
||||||
|
import com.fsck.k9.provider.EmailProvider.MessageColumns;
|
||||||
|
import com.fsck.k9.search.LocalSearch;
|
||||||
|
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||||
|
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||||
|
import com.fsck.k9.search.SqlQueryBuilder;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -13,41 +47,6 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.content.ContentResolver;
|
|
||||||
import android.content.ContentValues;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.database.Cursor;
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.Account;
|
|
||||||
import com.fsck.k9.K9;
|
|
||||||
import com.fsck.k9.Preferences;
|
|
||||||
import com.fsck.k9.controller.MessageRetrievalListener;
|
|
||||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
|
||||||
import com.fsck.k9.helper.Utility;
|
|
||||||
import com.fsck.k9.mail.Flag;
|
|
||||||
import com.fsck.k9.mail.Folder;
|
|
||||||
import com.fsck.k9.mail.MessagingException;
|
|
||||||
import com.fsck.k9.mail.Store;
|
|
||||||
import com.fsck.k9.mail.store.RemoteStore;
|
|
||||||
import com.fsck.k9.mail.store.StoreConfig;
|
|
||||||
import com.fsck.k9.mail.store.local.LockableDatabase.DbCallback;
|
|
||||||
import com.fsck.k9.mail.store.local.LockableDatabase.WrappedException;
|
|
||||||
import com.fsck.k9.mail.store.StorageManager;
|
|
||||||
import com.fsck.k9.mail.store.StorageManager.StorageProvider;
|
|
||||||
import com.fsck.k9.mail.store.UnavailableStorageException;
|
|
||||||
import com.fsck.k9.provider.EmailProvider;
|
|
||||||
import com.fsck.k9.provider.EmailProvider.MessageColumns;
|
|
||||||
import com.fsck.k9.search.LocalSearch;
|
|
||||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
|
||||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
|
||||||
import com.fsck.k9.search.SqlQueryBuilder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* Implements a SQLite database backed local store for Messages.
|
* Implements a SQLite database backed local store for Messages.
|
||||||
@ -209,17 +208,17 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeAccount(StoreConfig storeConfig) {
|
public static void removeAccount(Account account) {
|
||||||
try {
|
try {
|
||||||
RemoteStore.removeInstance(storeConfig);
|
RemoteStore.removeInstance(account);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Failed to reset remote store for account " + storeConfig.getUuid(), e);
|
Log.e(K9.LOG_TAG, "Failed to reset remote store for account " + account.getUuid(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
removeInstance(storeConfig);
|
removeInstance(account);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Failed to reset local store for account " + storeConfig.getUuid(), e);
|
Log.e(K9.LOG_TAG, "Failed to reset local store for account " + account.getUuid(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import com.fsck.k9.mail.filter.SmtpDataStuffing;
|
|||||||
import com.fsck.k9.mail.internet.MimeUtility;
|
import com.fsck.k9.mail.internet.MimeUtility;
|
||||||
import com.fsck.k9.mail.store.StoreConfig;
|
import com.fsck.k9.mail.store.StoreConfig;
|
||||||
import com.fsck.k9.mail.store.local.LocalMessage;
|
import com.fsck.k9.mail.store.local.LocalMessage;
|
||||||
import com.fsck.k9.net.ssl.TrustedSocketFactory;
|
import com.fsck.k9.mail.ssl.TrustedSocketFactory;
|
||||||
|
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.fsck.k9.net.ssl;
|
package com.fsck.k9.mail.ssl;
|
||||||
|
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
|
import com.fsck.k9.mail.ssl.TrustManagerFactory;
|
||||||
import com.fsck.k9.security.LocalKeyStore;
|
import com.fsck.k9.security.LocalKeyStore;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
Loading…
Reference in New Issue
Block a user