aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-08-31 23:50:04 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-08-31 23:50:04 +0200
commit40e6b24b144a795dc14922e68d90bd2be8d0fc40 (patch)
tree7bc0b6fc10dae3003fc42f394bcbc665ac0d35d5 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
parent0fc1a09bfca79c9047fca852f84a69ddf81e7674 (diff)
downloadopen-keychain-40e6b24b144a795dc14922e68d90bd2be8d0fc40.tar.gz
open-keychain-40e6b24b144a795dc14922e68d90bd2be8d0fc40.tar.bz2
open-keychain-40e6b24b144a795dc14922e68d90bd2be8d0fc40.zip
Prepare API for OpenPgpSignatureResult extensions
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
index 20dfac36d..cc9912c30 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
@@ -31,7 +31,6 @@ import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.OpenPgpSignatureResult;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openkeychain.nfc.NfcActivity;
-import org.spongycastle.util.Arrays;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify;
@@ -447,7 +446,15 @@ public class OpenPgpService extends RemoteService {
if (signatureResult != null) {
result.putExtra(OpenPgpApi.RESULT_SIGNATURE, signatureResult);
- if (signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY) {
+ if (data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) < 5) {
+ // SIGNATURE_KEY_REVOKED and SIGNATURE_KEY_EXPIRED have been added in version 5
+ if (signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_KEY_REVOKED
+ || signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_KEY_EXPIRED) {
+ signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_ERROR);
+ }
+ }
+
+ if (signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_KEY_MISSING) {
// If signature is unknown we return an _additional_ PendingIntent
// to retrieve the missing key
Intent intent = new Intent(getBaseContext(), ImportKeysActivity.class);
@@ -577,9 +584,10 @@ public class OpenPgpService extends RemoteService {
// version code is required and needs to correspond to version code of service!
// History of versions in org.openintents.openpgp.util.OpenPgpApi
- // we support 3 and 4
+ // we support 3, 4, 5
if (data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 3
- && data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 4) {
+ && data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 4
+ && data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 5) {
Intent result = new Intent();
OpenPgpError error = new OpenPgpError
(OpenPgpError.INCOMPATIBLE_API_VERSIONS, "Incompatible API versions!\n"