aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java16
1 files changed, 6 insertions, 10 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 cc4a08fb4..57dd068ef 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
@@ -66,8 +66,10 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
+import java.util.List;
public class OpenPgpService extends RemoteService {
@@ -813,19 +815,14 @@ 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, 4, 5, 6
- if (data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 3
- && data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 4
- && data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 5
- && data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 6
- && data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 7
- && data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != 8) {
+ // History of versions in openpgp-api's CHANGELOG.md
+ List<Integer> supportedVersions = Arrays.asList(3, 4, 5, 6, 7, 8, 9);
+ if (!supportedVersions.contains(data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1))) {
Intent result = new Intent();
OpenPgpError error = new OpenPgpError
(OpenPgpError.INCOMPATIBLE_API_VERSIONS, "Incompatible API versions!\n"
+ "used API version: " + data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) + "\n"
- + "supported API versions: 3-8");
+ + "supported API versions: " + supportedVersions.toString());
result.putExtra(OpenPgpApi.RESULT_ERROR, error);
result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR);
return result;
@@ -855,7 +852,6 @@ public class OpenPgpService extends RemoteService {
}
-
protected Intent executeInternal(Intent data, ParcelFileDescriptor input, ParcelFileDescriptor output) {
try {
Intent errorResult = checkRequirements(data);