aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-08-28 17:46:57 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2015-08-28 17:46:57 +0200
commit8a780c9c492711af915a1e37d6e90a3c1df50552 (patch)
tree3bc33b5515d0220cabacd93af31e61e37e9fa696 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
parentfaf23e4655d990e965b84f13397a53347812f6dc (diff)
downloadopen-keychain-8a780c9c492711af915a1e37d6e90a3c1df50552.tar.gz
open-keychain-8a780c9c492711af915a1e37d6e90a3c1df50552.tar.bz2
open-keychain-8a780c9c492711af915a1e37d6e90a3c1df50552.zip
Support OpenPGP API v9
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, 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);