aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain-API-Demo
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2013-10-02 19:08:33 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2013-10-02 19:08:33 +0200
commit2a0df5b75abc35978abbe669177662b4d66fbf18 (patch)
treed69198bf734255cb2d5229674554ee9d2b0e96bd /OpenPGP-Keychain-API-Demo
parent224faa42ac855776a8494decfcac9d23dbfcec09 (diff)
downloadopen-keychain-2a0df5b75abc35978abbe669177662b4d66fbf18.tar.gz
open-keychain-2a0df5b75abc35978abbe669177662b4d66fbf18.tar.bz2
open-keychain-2a0df5b75abc35978abbe669177662b4d66fbf18.zip
API update
Diffstat (limited to 'OpenPGP-Keychain-API-Demo')
-rw-r--r--OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/IOpenPgpCallback.aidl17
-rw-r--r--OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/IOpenPgpService.aidl43
-rw-r--r--OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/OpenPgpSignatureResult.java6
-rw-r--r--OpenPGP-Keychain-API-Demo/src/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java8
4 files changed, 49 insertions, 25 deletions
diff --git a/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/IOpenPgpCallback.aidl b/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/IOpenPgpCallback.aidl
index e0ac43d22..ca00c8ce1 100644
--- a/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/IOpenPgpCallback.aidl
+++ b/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/IOpenPgpCallback.aidl
@@ -22,10 +22,23 @@ import org.openintents.openpgp.OpenPgpError;
interface IOpenPgpCallback {
/**
- * CryptoSignatureResult is only returned if the Callback was used from decryptAndVerify
- *
+ * onSuccess returns on successful OpenPGP operations.
+ *
+ * @param outputBytes
+ * contains resulting output bytes (decrypted content (when input was encrypted)
+ * or content without signature (when input was signed-only))
+ * @param signatureResult
+ * signatureResult is only non-null if decryptAndVerify() was called and the content
+ * was encrypted or signed-and-encrypted.
*/
oneway void onSuccess(in byte[] outputBytes, in OpenPgpSignatureResult signatureResult);
+ /**
+ * onError returns on errors or when allowUserInteraction was set to false, but user interaction
+ * was required execute an OpenPGP operation.
+ *
+ * @param error
+ * See OpenPgpError class for more information.
+ */
oneway void onError(in OpenPgpError error);
} \ No newline at end of file
diff --git a/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/IOpenPgpService.aidl b/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/IOpenPgpService.aidl
index ca291469c..ab7ec8b1a 100644
--- a/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/IOpenPgpService.aidl
+++ b/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/IOpenPgpService.aidl
@@ -23,61 +23,67 @@ import org.openintents.openpgp.IOpenPgpCallback;
* Results are returned to the callback, which has to be implemented on client side.
*/
interface IOpenPgpService {
-
+
/**
* Encrypt
*
+ * After successful encryption, callback's onSuccess will contain the resulting output bytes.
+ *
* @param inputBytes
* Byte array you want to encrypt
* @param encryptionUserIds
* User Ids (emails) of recipients
* @param asciiArmor
- * Encode for ASCII (Radix-64, 33 percent overhead compared to binary)
+ * Encode result for ASCII (Radix-64, 33 percent overhead compared to binary)
* @param allowUserInteraction
* Allows the OpenPGP Provider to handle missing keys by showing activities
* @param callback
* Callback where to return results
*/
- oneway void encrypt(in byte[] inputBytes, in String[] encryptionUserIds,
- in boolean asciiArmor, in boolean allowUserInteraction, in IOpenPgpCallback callback);
+ oneway void encrypt(in byte[] inputBytes, in String[] encryptionUserIds, in boolean asciiArmor,
+ in IOpenPgpCallback callback);
/**
* Sign
+ *
+ * After successful signing, callback's onSuccess will contain the resulting output bytes.
*
* @param inputBytes
- * Byte array you want to encrypt
+ * Byte array you want to sign
* @param asciiArmor
- * Encode for ASCII (Radix-64, 33 percent overhead compared to binary)
+ * Encode result for ASCII (Radix-64, 33 percent overhead compared to binary)
* @param allowUserInteraction
* Allows the OpenPGP Provider to handle missing keys by showing activities
* @param callback
* Callback where to return results
*/
- oneway void sign(in byte[] inputBytes, in boolean asciiArmor, in boolean allowUserInteraction,
- in IOpenPgpCallback callback);
+ oneway void sign(in byte[] inputBytes, in boolean asciiArmor, in IOpenPgpCallback callback);
/**
* Sign then encrypt
+ *
+ * After successful signing and encryption, callback's onSuccess will contain the resulting output bytes.
*
* @param inputBytes
- * Byte array you want to encrypt
+ * Byte array you want to sign and encrypt
* @param encryptionUserIds
* User Ids (emails) of recipients
- * @param signatureUserId
- * User Ids (email) of sender
* @param asciiArmor
- * Encode for ASCII (Radix-64, 33 percent overhead compared to binary)
+ * Encode result for ASCII (Radix-64, 33 percent overhead compared to binary)
* @param allowUserInteraction
* Allows the OpenPGP Provider to handle missing keys by showing activities
* @param callback
* Callback where to return results
*/
- oneway void signAndEncrypt(in byte[] inputBytes, in String[] encryptionUserIds,
- in boolean asciiArmor, in boolean allowUserInteraction, in IOpenPgpCallback callback);
+ oneway void signAndEncrypt(in byte[] inputBytes, in String[] encryptionUserIds, in boolean asciiArmor,
+ in IOpenPgpCallback callback);
/**
- * Decrypts and verifies given input bytes. If no signature is present this method
- * will only decrypt.
+ * Decrypts and verifies given input bytes. This methods handles encrypted-only, signed-and-encrypted,
+ * and also signed-only inputBytes.
+ *
+ * After successful decryption/verification, callback's onSuccess will contain the resulting output bytes.
+ * The signatureResult in onSuccess is only non-null if signed-and-encrypted or signed-only inputBytes were given.
*
* @param inputBytes
* Byte array you want to decrypt and verify
@@ -86,7 +92,8 @@ interface IOpenPgpService {
* @param callback
* Callback where to return results
*/
- oneway void decryptAndVerify(in byte[] inputBytes, in boolean allowUserInteraction,
- in IOpenPgpCallback callback);
+ oneway void decryptAndVerify(in byte[] inputBytes, in IOpenPgpCallback callback);
+
+ boolean isKeyAvailable(in String[] userIds);
} \ No newline at end of file
diff --git a/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/OpenPgpSignatureResult.java b/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/OpenPgpSignatureResult.java
index 0d24e7bd4..4446614dd 100644
--- a/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/OpenPgpSignatureResult.java
+++ b/OpenPGP-Keychain-API-Demo/src/org/openintents/openpgp/OpenPgpSignatureResult.java
@@ -20,9 +20,13 @@ import android.os.Parcel;
import android.os.Parcelable;
public class OpenPgpSignatureResult implements Parcelable {
+ // generic error on signature verification
public static final int SIGNATURE_ERROR = 0;
+ // successfully verified signature, with trusted public key
public static final int SIGNATURE_SUCCESS_TRUSTED = 1;
- public static final int SIGNATURE_UNKNOWN = 2;
+ // no public key was found for this signature verification
+ public static final int SIGNATURE_UNKNOWN_PUB_KEY = 2;
+ // successfully verified signature, but with untrusted public key
public static final int SIGNATURE_SUCCESS_UNTRUSTED = 3;
int signatureStatus;
diff --git a/OpenPGP-Keychain-API-Demo/src/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java b/OpenPGP-Keychain-API-Demo/src/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java
index 94c68ce5a..8f56c124a 100644
--- a/OpenPGP-Keychain-API-Demo/src/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java
+++ b/OpenPGP-Keychain-API-Demo/src/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java
@@ -139,7 +139,7 @@ public class OpenPgpProviderActivity extends Activity {
try {
mCryptoServiceConnection.getService().encrypt(inputBytes,
- mEncryptUserIds.getText().toString().split(","), true, true, encryptCallback);
+ mEncryptUserIds.getText().toString().split(","), true, encryptCallback);
} catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoProviderDemo", e);
}
@@ -149,7 +149,7 @@ public class OpenPgpProviderActivity extends Activity {
byte[] inputBytes = mMessage.getText().toString().getBytes();
try {
- mCryptoServiceConnection.getService().sign(inputBytes, true, true, encryptCallback);
+ mCryptoServiceConnection.getService().sign(inputBytes, true, encryptCallback);
} catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoProviderDemo", e);
}
@@ -160,7 +160,7 @@ public class OpenPgpProviderActivity extends Activity {
try {
mCryptoServiceConnection.getService().signAndEncrypt(inputBytes,
- mEncryptUserIds.getText().toString().split(","), true, true, encryptCallback);
+ mEncryptUserIds.getText().toString().split(","), true, encryptCallback);
} catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoProviderDemo", e);
}
@@ -170,7 +170,7 @@ public class OpenPgpProviderActivity extends Activity {
byte[] inputBytes = mCiphertext.getText().toString().getBytes();
try {
- mCryptoServiceConnection.getService().decryptAndVerify(inputBytes, true,
+ mCryptoServiceConnection.getService().decryptAndVerify(inputBytes,
decryptAndVerifyCallback);
} catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoProviderDemo", e);