make sure all keys are allowed for transfer call
This commit is contained in:
@@ -121,7 +121,7 @@ public class ApiPendingIntentFactory {
|
|||||||
return createInternal(data, intent);
|
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 intent = new Intent(mContext, RequestKeyPermissionActivity.class);
|
||||||
intent.putExtra(RequestKeyPermissionActivity.EXTRA_PACKAGE_NAME, packageName);
|
intent.putExtra(RequestKeyPermissionActivity.EXTRA_PACKAGE_NAME, packageName);
|
||||||
intent.putExtra(RequestKeyPermissionActivity.EXTRA_REQUESTED_KEY_IDS, masterKeyIds);
|
intent.putExtra(RequestKeyPermissionActivity.EXTRA_REQUESTED_KEY_IDS, masterKeyIds);
|
||||||
|
|||||||
@@ -816,6 +816,19 @@ public class OpenPgpService extends Service {
|
|||||||
try {
|
try {
|
||||||
long[] masterKeyIds = data.getLongArrayExtra(OpenPgpApi.EXTRA_KEY_IDS);
|
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();
|
Passphrase autocryptTransferCode = Numeric9x4PassphraseUtil.generateNumeric9x4Passphrase();
|
||||||
CryptoInputParcel inputParcel = CryptoInputParcel.createCryptoInputParcel(autocryptTransferCode);
|
CryptoInputParcel inputParcel = CryptoInputParcel.createCryptoInputParcel(autocryptTransferCode);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user