don't encrypt twice to the same key if additional encryption id is in recipient list
This commit is contained in:
parent
ef59affd74
commit
b7968d6279
|
@ -330,15 +330,18 @@ public class PgpSignEncryptOperation extends BaseOperation<PgpSignEncryptInputPa
|
||||||
} else {
|
} else {
|
||||||
log.add(LogType.MSG_PSE_ASYMMETRIC, indent);
|
log.add(LogType.MSG_PSE_ASYMMETRIC, indent);
|
||||||
|
|
||||||
// Asymmetric encryption
|
long additionalEncryptId = data.getAdditionalEncryptId();
|
||||||
for (long encryptMasterKeyId : data.getEncryptionMasterKeyIds()) {
|
for (long encryptMasterKeyId : data.getEncryptionMasterKeyIds()) {
|
||||||
|
if (encryptMasterKeyId == additionalEncryptId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
boolean success = processEncryptionMasterKeyId(indent, log, data, cPk, encryptMasterKeyId);
|
boolean success = processEncryptionMasterKeyId(indent, log, data, cPk, encryptMasterKeyId);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return new PgpSignEncryptResult(PgpSignEncryptResult.RESULT_ERROR, log);
|
return new PgpSignEncryptResult(PgpSignEncryptResult.RESULT_ERROR, log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long additionalEncryptId = data.getAdditionalEncryptId();
|
|
||||||
if (additionalEncryptId != Constants.key.none) {
|
if (additionalEncryptId != Constants.key.none) {
|
||||||
boolean success = processEncryptionMasterKeyId(indent, log, data, cPk, additionalEncryptId);
|
boolean success = processEncryptionMasterKeyId(indent, log, data, cPk, additionalEncryptId);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|
Loading…
Reference in a new issue