aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain-API-Demo
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2013-07-01 23:19:53 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2013-07-01 23:19:53 +0200
commit202ccc2c36d191fbecdcc3098875dd075454c71a (patch)
tree77cbdca943719a051ff9a540390391b070f83185 /OpenPGP-Keychain-API-Demo
parent36cc814e84135296fc14d383e61e6b4fe8dfe269 (diff)
downloadopen-keychain-202ccc2c36d191fbecdcc3098875dd075454c71a.tar.gz
open-keychain-202ccc2c36d191fbecdcc3098875dd075454c71a.tar.bz2
open-keychain-202ccc2c36d191fbecdcc3098875dd075454c71a.zip
More work on crypto consumers
Diffstat (limited to 'OpenPGP-Keychain-API-Demo')
-rw-r--r--OpenPGP-Keychain-API-Demo/src/org/openintents/crypto/ICryptoCallback.aidl8
-rw-r--r--OpenPGP-Keychain-API-Demo/src/org/openintents/crypto/ICryptoService.aidl8
-rw-r--r--OpenPGP-Keychain-API-Demo/src/org/sufficientlysecure/keychain/demo/CryptoProviderDemoActivity.java25
3 files changed, 30 insertions, 11 deletions
diff --git a/OpenPGP-Keychain-API-Demo/src/org/openintents/crypto/ICryptoCallback.aidl b/OpenPGP-Keychain-API-Demo/src/org/openintents/crypto/ICryptoCallback.aidl
index 80c741a9e..1f910d4c6 100644
--- a/OpenPGP-Keychain-API-Demo/src/org/openintents/crypto/ICryptoCallback.aidl
+++ b/OpenPGP-Keychain-API-Demo/src/org/openintents/crypto/ICryptoCallback.aidl
@@ -20,10 +20,12 @@ import org.openintents.crypto.CryptoSignatureResult;
import org.openintents.crypto.CryptoError;
interface ICryptoCallback {
-
- oneway void onEncryptSignSuccess(in byte[] outputBytes);
- oneway void onDecryptVerifySuccess(in byte[] outputBytes, in CryptoSignatureResult signatureResult);
+ /**
+ * CryptoSignatureResult is only returned if the Callback was used from decryptAndVerify
+ *
+ */
+ oneway void onSuccess(in byte[] outputBytes, in CryptoSignatureResult signatureResult);
oneway void onError(in CryptoError error);
diff --git a/OpenPGP-Keychain-API-Demo/src/org/openintents/crypto/ICryptoService.aidl b/OpenPGP-Keychain-API-Demo/src/org/openintents/crypto/ICryptoService.aidl
index 53f39dffc..c84ca28fb 100644
--- a/OpenPGP-Keychain-API-Demo/src/org/openintents/crypto/ICryptoService.aidl
+++ b/OpenPGP-Keychain-API-Demo/src/org/openintents/crypto/ICryptoService.aidl
@@ -71,6 +71,12 @@ interface ICryptoService {
* @param callback
* Callback where to return results
*/
- oneway void decryptAndVerify(in byte[] inputBytes, in ICryptoCallback callback);
+ oneway void decryptAndVerify(in byte[] inputBytes, in ICryptoCallback callback);
+
+ /**
+ * Opens setup using default parameters
+ *
+ */
+ oneway void setup(boolean asciiArmor, boolean newKeyring, String newKeyringUserId);
} \ No newline at end of file
diff --git a/OpenPGP-Keychain-API-Demo/src/org/sufficientlysecure/keychain/demo/CryptoProviderDemoActivity.java b/OpenPGP-Keychain-API-Demo/src/org/sufficientlysecure/keychain/demo/CryptoProviderDemoActivity.java
index 831c269e1..a82c44c6a 100644
--- a/OpenPGP-Keychain-API-Demo/src/org/sufficientlysecure/keychain/demo/CryptoProviderDemoActivity.java
+++ b/OpenPGP-Keychain-API-Demo/src/org/sufficientlysecure/keychain/demo/CryptoProviderDemoActivity.java
@@ -71,17 +71,28 @@ public class CryptoProviderDemoActivity extends Activity {
/**
* Callback from remote crypto service
*/
- final ICryptoCallback.Stub callback = new ICryptoCallback.Stub() {
+ final ICryptoCallback.Stub encryptCallback = new ICryptoCallback.Stub() {
@Override
- public void onEncryptSignSuccess(byte[] outputBytes) throws RemoteException {
+ public void onSuccess(byte[] outputBytes, CryptoSignatureResult signatureResult)
+ throws RemoteException {
Log.d(Constants.TAG, "onEncryptSignSuccess");
// TODO
}
@Override
- public void onDecryptVerifySuccess(byte[] outputBytes, CryptoSignatureResult signatureResult)
+ public void onError(CryptoError error) throws RemoteException {
+ Log.e(Constants.TAG, "onError getErrorId:" + error.getErrorId());
+ Log.e(Constants.TAG, "onError getMessage:" + error.getMessage());
+ }
+
+ };
+
+ final ICryptoCallback.Stub decryptCallback = new ICryptoCallback.Stub() {
+
+ @Override
+ public void onSuccess(byte[] outputBytes, CryptoSignatureResult signatureResult)
throws RemoteException {
Log.d(Constants.TAG, "onDecryptVerifySuccess");
@@ -101,7 +112,7 @@ public class CryptoProviderDemoActivity extends Activity {
try {
mCryptoServiceConnection.getService().encrypt(inputBytes,
- new String[] { mEncryptUserId.getText().toString() }, callback);
+ new String[] { mEncryptUserId.getText().toString() }, encryptCallback);
} catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoProviderDemo", e);
}
@@ -112,7 +123,7 @@ public class CryptoProviderDemoActivity extends Activity {
try {
mCryptoServiceConnection.getService().sign(inputBytes,
- mSignUserId.getText().toString(), callback);
+ mSignUserId.getText().toString(), encryptCallback);
} catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoProviderDemo", e);
}
@@ -124,7 +135,7 @@ public class CryptoProviderDemoActivity extends Activity {
try {
mCryptoServiceConnection.getService().encryptAndSign(inputBytes,
new String[] { mEncryptUserId.getText().toString() },
- mSignUserId.getText().toString(), callback);
+ mSignUserId.getText().toString(), encryptCallback);
} catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoProviderDemo", e);
}
@@ -134,7 +145,7 @@ public class CryptoProviderDemoActivity extends Activity {
byte[] inputBytes = mCiphertext.getText().toString().getBytes();
try {
- mCryptoServiceConnection.getService().decryptAndVerify(inputBytes, callback);
+ mCryptoServiceConnection.getService().decryptAndVerify(inputBytes, decryptCallback);
} catch (RemoteException e) {
Log.e(Constants.TAG, "CryptoProviderDemo", e);
}