From 6e326fb000e4fbe11452671d14dce02cade1d292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sun, 10 May 2015 03:00:42 +0200 Subject: Add self-encrypt for old API --- .../sufficientlysecure/keychain/remote/OpenPgpService.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 badc3c131..4a8bf9332 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java @@ -417,6 +417,20 @@ public class OpenPgpService extends RemoteService { .setAdditionalEncryptId(signKeyId); // add sign key for encryption } + // OLD: Even if the message is not signed: Do self-encrypt to account key id + if (data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) < 7) { + String accName = data.getStringExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME); + // if no account name is given use name "default" + if (TextUtils.isEmpty(accName)) { + accName = "default"; + } + final AccountSettings accSettings = getAccSettings(accName); + if (accSettings == null || (accSettings.getKeyId() == Constants.key.none)) { + return getCreateAccountIntent(data, accName); + } + pseInput.setAdditionalEncryptId(accSettings.getKeyId()); + } + CryptoInputParcel inputParcel = CryptoInputParcelCacheService.getCryptoInputParcel(this, data); if (inputParcel == null) { inputParcel = new CryptoInputParcel(); -- cgit v1.2.3