1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-10 11:35:11 -05:00
k-9/src/com/fsck/k9/crypto/CryptoProvider.java
cketti bbcc4988ba Converted message view to a fragment
The fragment should be fully functional. The only thing missing is the
animation when showing the next/previous message.
2012-10-05 18:14:07 +02:00

49 lines
2.1 KiB
Java

package com.fsck.k9.crypto;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.Fragment;
import com.fsck.k9.mail.Message;
/**
* A CryptoProvider provides functionalities such as encryption, decryption, digital signatures.
* It currently also stores the results of such encryption or decryption.
* TODO: separate the storage from the provider
*/
abstract public class CryptoProvider {
static final long serialVersionUID = 0x21071234;
abstract public boolean isAvailable(Context context);
abstract public boolean isEncrypted(Message message);
abstract public boolean isSigned(Message message);
abstract public boolean onActivityResult(Activity activity, int requestCode, int resultCode,
Intent data, PgpData pgpData);
abstract public boolean onDecryptActivityResult(CryptoDecryptCallback callback,
int requestCode, int resultCode, Intent data, PgpData pgpData);
abstract public boolean selectSecretKey(Activity activity, PgpData pgpData);
abstract public boolean selectEncryptionKeys(Activity activity, String emails, PgpData pgpData);
abstract public boolean encrypt(Activity activity, String data, PgpData pgpData);
abstract public boolean decrypt(Fragment fragment, String data, PgpData pgpData);
abstract public long[] getSecretKeyIdsFromEmail(Context context, String email);
abstract public long[] getPublicKeyIdsFromEmail(Context context, String email);
abstract public boolean hasSecretKeyForEmail(Context context, String email);
abstract public boolean hasPublicKeyForEmail(Context context, String email);
abstract public String getUserId(Context context, long keyId);
abstract public String getName();
abstract public boolean test(Context context);
public static CryptoProvider createInstance(String name) {
if (Apg.NAME.equals(name)) {
return Apg.createInstance();
}
return None.createInstance();
}
public interface CryptoDecryptCallback {
void onDecryptDone(PgpData pgpData);
}
}