Handle missing MDC as failed only if no valid signature is present

This commit is contained in:
Dominik Schürmann 2014-08-10 21:50:46 +02:00
parent 33a4d68520
commit 13f86890d6
2 changed files with 9 additions and 1 deletions

View File

@ -65,6 +65,10 @@ public class OpenPgpSignatureResultBuilder {
this.mSignatureAvailable = signatureAvailable; this.mSignatureAvailable = signatureAvailable;
} }
public boolean isValidSignature() {
return mValidSignature;
}
public OpenPgpSignatureResult build() { public OpenPgpSignatureResult build() {
if (mSignatureAvailable) { if (mSignatureAvailable) {
OpenPgpSignatureResult result = new OpenPgpSignatureResult(); OpenPgpSignatureResult result = new OpenPgpSignatureResult();

View File

@ -535,10 +535,14 @@ public class PgpDecryptVerify {
} else { } else {
// no integrity check // no integrity check
Log.d(Constants.TAG, "Encrypted data was not integrity protected! MDC packet is missing!"); Log.d(Constants.TAG, "Encrypted data was not integrity protected! MDC packet is missing!");
// If no valid signature is present:
// Handle missing integrity protection like failed integrity protection! // Handle missing integrity protection like failed integrity protection!
// The MDC packet can be stripped by an attacker! // The MDC packet can be stripped by an attacker!
if (!signatureResultBuilder.isValidSignature()) {
throw new IntegrityCheckFailedException(); throw new IntegrityCheckFailedException();
} }
}
updateProgress(R.string.progress_done, 100, 100); updateProgress(R.string.progress_done, 100, 100);