diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index 50aa4c480..21ccf0b9c 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -859,6 +859,11 @@ android:exported="false" android:theme="@style/Theme.Keychain.Transparent" android:label="@string/app_name" /> + = Build.VERSION_CODES.M) { + //noinspection ResourceType, looks like lint is missing FLAG_IMMUTABLE + return PendingIntent.getActivity(mContext, 0, intent, + PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE); + } else { + return PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); + } + } + private PendingIntent createInternal(Intent data, Intent intent) { // re-attach "data" for pass through. It will be used later to repeat pgp operation intent.putExtra(RemoteSecurityTokenOperationActivity.EXTRA_DATA, data); @@ -175,5 +191,4 @@ public class ApiPendingIntentFactory { PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT); } } - } 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 4ee644664..46192a4d4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java @@ -60,6 +60,7 @@ import org.sufficientlysecure.keychain.pgp.PgpSignEncryptData; import org.sufficientlysecure.keychain.pgp.PgpSignEncryptInputParcel; import org.sufficientlysecure.keychain.pgp.PgpSignEncryptOperation; import org.sufficientlysecure.keychain.pgp.Progressable; +import org.sufficientlysecure.keychain.pgp.SecurityProblem; import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException; import org.sufficientlysecure.keychain.provider.ApiDataAccessObject; import org.sufficientlysecure.keychain.provider.KeyRepository; @@ -400,6 +401,7 @@ public class OpenPgpService extends Service { processDecryptionResultForResultIntent(targetApiVersion, result, pgpResult.getDecryptionResult()); processMetadataForResultIntent(result, pgpResult.getDecryptionMetadata()); processSignatureResultForResultIntent(targetApiVersion, data, result, pgpResult); + processSecurityProblemsPendingIntent(result, pgpResult); result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS); return result; @@ -427,6 +429,20 @@ public class OpenPgpService extends Service { } } + private void processSecurityProblemsPendingIntent(Intent result, DecryptVerifyResult decryptVerifyResult) { + List securityProblems = decryptVerifyResult.getSecurityProblems(); + if (securityProblems.isEmpty()) { + return; + } + + // TODO what if there is multiple? + SecurityProblem keySecurityProblem = securityProblems.get(0); + + String packageName = mApiPermissionHelper.getCurrentCallingPackage(); + result.putExtra(OpenPgpApi.RESULT_INSECURE_DETAIL_INTENT, + mApiPendingIntentFactory.createSecurityProblemIntent(packageName, keySecurityProblem)); + } + private void processDecryptionResultForResultIntent(int targetApiVersion, Intent result, OpenPgpDecryptionResult decryptionResult) { if (targetApiVersion < API_VERSION_WITH_DECRYPTION_RESULT) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityProblemDialogActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityProblemDialogActivity.java new file mode 100644 index 000000000..b03c693b5 --- /dev/null +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/RemoteSecurityProblemDialogActivity.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2016 Dominik Schürmann + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.sufficientlysecure.keychain.remote.ui; + + +import android.support.v4.app.FragmentActivity; + + +public class RemoteSecurityProblemDialogActivity extends FragmentActivity { + public static final String EXTRA_PACKAGE_NAME = "package_name"; + public static final String EXTRA_SECURITY_PROBLEM = "security_problem"; +} diff --git a/extern/openpgp-api-lib b/extern/openpgp-api-lib index f28cb9294..d19cfacde 160000 --- a/extern/openpgp-api-lib +++ b/extern/openpgp-api-lib @@ -1 +1 @@ -Subproject commit f28cb92944efbf56fa0582769a97b23c4272f6ac +Subproject commit d19cfacdeed6b4e9a9aed5ecae978b6c9268dd05