Support OpenPGP API v9
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user