Add self-encrypt for old API

This commit is contained in:
Dominik Schürmann 2015-05-10 03:00:42 +02:00
parent b1ccfc6276
commit 6e326fb000

View File

@ -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();