make sure all keys are allowed for transfer call
This commit is contained in:
parent
be58f2ff4c
commit
a63aca623d
|
@ -121,7 +121,7 @@ public class ApiPendingIntentFactory {
|
|||
return createInternal(data, intent);
|
||||
}
|
||||
|
||||
PendingIntent createRequestKeyPermissionPendingIntent(Intent data, String packageName, long[] masterKeyIds) {
|
||||
PendingIntent createRequestKeyPermissionPendingIntent(Intent data, String packageName, long... masterKeyIds) {
|
||||
Intent intent = new Intent(mContext, RequestKeyPermissionActivity.class);
|
||||
intent.putExtra(RequestKeyPermissionActivity.EXTRA_PACKAGE_NAME, packageName);
|
||||
intent.putExtra(RequestKeyPermissionActivity.EXTRA_REQUESTED_KEY_IDS, masterKeyIds);
|
||||
|
|
|
@ -816,6 +816,19 @@ public class OpenPgpService extends Service {
|
|||
try {
|
||||
long[] masterKeyIds = data.getLongArrayExtra(OpenPgpApi.EXTRA_KEY_IDS);
|
||||
|
||||
HashSet<Long> allowedKeyIds = getAllowedKeyIds();
|
||||
for (long masterKeyId : masterKeyIds) {
|
||||
if (!allowedKeyIds.contains(masterKeyId)) {
|
||||
Intent result = new Intent();
|
||||
String packageName = mApiPermissionHelper.getCurrentCallingPackage();
|
||||
result.putExtra(OpenPgpApi.RESULT_INTENT,
|
||||
mApiPendingIntentFactory.createRequestKeyPermissionPendingIntent(
|
||||
data, packageName, masterKeyId));
|
||||
result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Passphrase autocryptTransferCode = Numeric9x4PassphraseUtil.generateNumeric9x4Passphrase();
|
||||
CryptoInputParcel inputParcel = CryptoInputParcel.createCryptoInputParcel(autocryptTransferCode);
|
||||
|
||||
|
|
Loading…
Reference in a new issue