diff options
Diffstat (limited to 'org_apg_integration_lib/src/org')
6 files changed, 171 insertions, 10 deletions
diff --git a/org_apg_integration_lib/src/org/thialfihar/android/apg/integration/ApgIntentHelper.java b/org_apg_integration_lib/src/org/thialfihar/android/apg/integration/ApgIntentHelper.java index d38f1d3cc..05763ec30 100644 --- a/org_apg_integration_lib/src/org/thialfihar/android/apg/integration/ApgIntentHelper.java +++ b/org_apg_integration_lib/src/org/thialfihar/android/apg/integration/ApgIntentHelper.java @@ -184,7 +184,7 @@ public class ApgIntentHelper { apgData.setEncryptionKeys(null); break; } - apgData.setEncryptionKeys(data.getLongArrayExtra(Constants.EXTRA_SELECTION)); + apgData.setEncryptionKeys(data.getLongArrayExtra(Constants.RESULT_EXTRA_MASTER_KEY_IDS)); break; case Constants.ENCRYPT_MESSAGE: diff --git a/org_apg_integration_lib/src/org/thialfihar/android/apg/integration/Constants.java b/org_apg_integration_lib/src/org/thialfihar/android/apg/integration/Constants.java index 1ab11154d..f14dbc4fc 100644 --- a/org_apg_integration_lib/src/org/thialfihar/android/apg/integration/Constants.java +++ b/org_apg_integration_lib/src/org/thialfihar/android/apg/integration/Constants.java @@ -70,6 +70,10 @@ public class Constants { public static final String EXTRA_NO_PASSPHRASE = "noPassphrase"; public static final String EXTRA_GENERATE_DEFAULT_KEYS = "generateDefaultKeys"; public static final String EXTRA_INTENT_VERSION = "intentVersion"; + + + public static final String RESULT_EXTRA_MASTER_KEY_IDS = "masterKeyIds"; + public static final String RESULT_EXTRA_USER_IDS = "userIds"; public static final String INTENT_VERSION = "1"; @@ -79,13 +83,4 @@ public class Constants { public static final int SELECT_SECRET_KEY = 0x21070004; public static final int CREATE_KEY = 0x21070005; public static final int EDIT_KEY = 0x21070006; - - - // public static Pattern PGP_MESSAGE = Pattern.compile( - // ".*?(-----BEGIN PGP MESSAGE-----.*?-----END PGP MESSAGE-----).*", Pattern.DOTALL); - - // public static Pattern PGP_SIGNED_MESSAGE = Pattern - // .compile( - // ".*?(-----BEGIN PGP SIGNED MESSAGE-----.*?-----BEGIN PGP SIGNATURE-----.*?-----END PGP SIGNATURE-----).*", - // Pattern.DOTALL); } diff --git a/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgEncryptDecryptHandler.aidl b/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgEncryptDecryptHandler.aidl new file mode 100644 index 000000000..ff6b7254c --- /dev/null +++ b/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgEncryptDecryptHandler.aidl @@ -0,0 +1,16 @@ +package org.thialfihar.android.apg.service; + +interface IApgEncryptDecryptHandler { + /** + * Either output or streamUri is given. One of them is null + * + */ + oneway void onSuccessEncrypt(in byte[] outputBytes, in String outputUri); + + oneway void onSuccessDecrypt(in byte[] outputBytes, in String outputUri, in boolean signature, + in long signatureKeyId, in String signatureUserId, in boolean signatureSuccess, + in boolean signatureUnknown); + + + oneway void onException(in int exceptionNumber, in String message); +}
\ No newline at end of file diff --git a/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgHelperHandler.aidl b/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgHelperHandler.aidl new file mode 100644 index 000000000..bb405329a --- /dev/null +++ b/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgHelperHandler.aidl @@ -0,0 +1,9 @@ +package org.thialfihar.android.apg.service; + +interface IApgHelperHandler { + + oneway void onSuccessGetDecryptionKey(in long secretKeyId, in boolean symmetric); + + + oneway void onException(in int exceptionNumber, in String message); +}
\ No newline at end of file diff --git a/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgService.aidl b/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgService.aidl new file mode 100644 index 000000000..71c6a9e42 --- /dev/null +++ b/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgService.aidl @@ -0,0 +1,130 @@ +package org.thialfihar.android.apg.service; + +import org.thialfihar.android.apg.service.IApgEncryptDecryptHandler; +import org.thialfihar.android.apg.service.IApgSignVerifyHandler; +import org.thialfihar.android.apg.service.IApgHelperHandler; + +/** + * All methods are oneway, which means they are asynchronous and non-blocking. + * Results are returned into given Handler, which has to be implemented on client side. + */ +interface IApgService { + + /** + * Encrypt + * + * Either inputBytes or inputUri is given, the other should be null. + * + * @param inputBytes + * Byte array you want to encrypt + * @param inputUri + * Blob in ContentProvider you want to encrypt + * @param useAsciiArmor + * Convert bytes to ascii armored text to guard against encoding problems + * @param compression + * Compression: 0x21070001: none, 1: Zip, 2: Zlib, 3: BZip2 + * @param encryptionKeyIds + * Ids of public keys used for encryption + * @param symmetricEncryptionAlgorithm + * 7: AES-128, 8: AES-192, 9: AES-256, 4: Blowfish, 10: Twofish, 3: CAST5, + * 6: DES, 2: Triple DES, 1: IDEA + * @param handler + * Results are returned to this IApgEncryptDecryptHandler Handler + * to onSuccessEncrypt(in byte[] output), after successful encryption + */ + oneway void encryptAsymmetric(in byte[] inputBytes, in String inputUri, in boolean useAsciiArmor, + in int compression, in long[] encryptionKeyIds, in int symmetricEncryptionAlgorithm, + in IApgEncryptDecryptHandler handler); + + /** + * Same as encryptAsymmetric but using a passphrase for symmetric encryption + * + * @param encryptionPassphrase + * Passphrase for direct symmetric encryption using symmetricEncryptionAlgorithm + */ + oneway void encryptSymmetric(in byte[] inputBytes, in String inputUri, in boolean useAsciiArmor, + in int compression, in String encryptionPassphrase, in int symmetricEncryptionAlgorithm, + in IApgEncryptDecryptHandler handler); + + /** + * Encrypt and sign + * + * Either inputBytes or inputUri is given, the other should be null. + * + * @param inputBytes + * Byte array you want to encrypt + * @param inputUri + * Blob in ContentProvider you want to encrypt + * @param useAsciiArmor + * Convert bytes to ascii armored text to guard against encoding problems + * @param compression + * Compression: 0x21070001: none, 1: Zip, 2: Zlib, 3: BZip2 + * @param encryptionKeyIds + * Ids of public keys used for encryption + * @param symmetricEncryptionAlgorithm + * 7: AES-128, 8: AES-192, 9: AES-256, 4: Blowfish, 10: Twofish, 3: CAST5, + * 6: DES, 2: Triple DES, 1: IDEA + * @param signatureKeyId + * Key id of key to sign with + * @param signatureHashAlgorithm + * 1: MD5, 3: RIPEMD-160, 2: SHA-1, 11: SHA-224, 8: SHA-256, 9: SHA-384, + * 10: SHA-512 + * @param signatureForceV3 + * Force V3 signatures + * @param signaturePassphrase + * Passphrase to unlock signature key + * @param handler + * Results are returned to this IApgEncryptDecryptHandler Handler + * to onSuccessEncrypt(in byte[] output), after successful encryption and signing + */ + oneway void encryptAndSignAsymmetric(in byte[] inputBytes, in String inputUri, + in boolean useAsciiArmor, in int compression, in long[] encryptionKeyIds, + in int symmetricEncryptionAlgorithm, in long signatureKeyId, in int signatureHashAlgorithm, + in boolean signatureForceV3, in String signaturePassphrase, + in IApgEncryptDecryptHandler handler); + + /** + * Same as encryptAndSignAsymmetric but using a passphrase for symmetric encryption + * + * @param encryptionPassphrase + * Passphrase for direct symmetric encryption using symmetricEncryptionAlgorithm + */ + oneway void encryptAndSignSymmetric(in byte[] inputBytes, in String inputUri, + in boolean useAsciiArmor, in int compression, in String encryptionPassphrase, + in int symmetricEncryptionAlgorithm, in long signatureKeyId, in int signatureHashAlgorithm, + in boolean signatureForceV3, in String signaturePassphrase, + in IApgEncryptDecryptHandler handler); + + /** + * Decrypts and verifies given input bytes. If no signature is present this method + * will only decrypt. + * + * @param inputBytes + * Byte array you want to decrypt and verify + * @param inputUri + * Blob in ContentProvider you want to decrypt and verify + * @param keyPassphrase + * Passphrase to unlock secret key for decryption. + * @param handler + * Handler where to return results to after successful encryption + */ + oneway void decryptAndVerifyAsymmetric(in byte[] inputBytes, in String inputUri, + in String keyPassphrase, in IApgEncryptDecryptHandler handler); + + /** + * Same as decryptAndVerifyAsymmetric but for symmetric decryption. + * + * @param encryptionPassphrase + * Passphrase to decrypt + */ + oneway void decryptAndVerifySymmetric(in byte[] inputBytes, in String inputUri, + in String encryptionPassphrase, in IApgEncryptDecryptHandler handler); + + /** + * + */ + oneway void getDecryptionKey(in byte[] inputBytes, in String inputUri, + in IApgHelperHandler handler); + + +}
\ No newline at end of file diff --git a/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgSignVerifyHandler.aidl b/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgSignVerifyHandler.aidl new file mode 100644 index 000000000..1375d1548 --- /dev/null +++ b/org_apg_integration_lib/src/org/thialfihar/android/apg/service/IApgSignVerifyHandler.aidl @@ -0,0 +1,11 @@ +package org.thialfihar.android.apg.service; + +interface IApgSignVerifyHandler { + oneway void onSuccessSign(in byte[] outputBytes, in String outputUri); + + oneway void onSuccessVerify(in boolean signature, in long signatureKeyId, + in String signatureUserId, in boolean signatureSuccess, in boolean signatureUnknown); + + + oneway void onException(in int exceptionNumber, in String message); +}
\ No newline at end of file |