Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"complete": true,
"content": "-----BEGIN PGP MESSAGE-----\r\n\r\nhQIMA3LvK1JdDBkzAQ//RjLOB+l/hvljxS+WamHcsx6JH4YVWcrElifdlmmFTB0z\r\nR+F3mlJXLLAbpwAs0hLpfpsI+cpf3Ori67FfGyQPxCY3O0ilamPIvaJm7CqBJ08Y\r\nc0zwVXpmOfAj0cv3NtPKERx88LgukolLk72m5UV2jVKv5fwH685B202rO08GcCt6\r\nGO8CfvyzMv42ys8KgiPkZd8snY9NBT5918nHqHywBFmU9N3suiLM2nKvvFsg+bAg\r\n+0yGkhrFxyWuoL+OYiytR1rutDQjiqwBM7rWvwNFqN3hcBtY46qqQNq0PMe2n1Xm\r\n1fcYI2ESganoO6Ovt2m5LbEyRAJYbVpeTAe/zS1EcmF7Abcn4Zy6mrWi+7eaVfju\r\n8zhE4rxCxkQCFLb+bNc5hBl7ZTT7u7PcoRVGG8KSJc401ztef14RpzzpyP/RIhpq\r\nV4m88VZ9yimr7eIvGPG2WHW445JCq47iu61j8FyVnscgFCMNTyn3t2k/IS/dyVEA\r\nPeN36NUBhd8rM5i6WopO9szqFtwNI0Y9+xvjy07OBueU0enmxA3dcdq21Zc80F/3\r\nkkyD7W5dh4p4uBFzyL/o187hSlqGFk2+d9d6qDKVm7Ff3cY2ivF8SHXjtYk9kau2\r\nZhFyoT8D1Jf3sYxCOdj72FyByPv/ugrxce/wu9bVBZbw7WDxcxmgvEsXv+UxTTrJ\r\nwKHaEMxIbu1scpeSVUEaaAKeiviCkkC5m8jHTpjCmcVt8Sl8ucw/m5AwWIJosR20\r\n0NmxsgsEhT10fyuynWi3JhDpi+Z+TPTAxNgTqHR5pCBga/gyAQUbpNcWASylp6qa\r\nAmqrP2IFEhED6MUmxcNLomIscRVUSS29+JHJZ7RLKORKymJq2stMnpuntwV+Hq7P\r\nZqSyI7YtiUvgFsINTdpydAWmIEkSOfIDNoDFDEcxFa7AYz72YEVUHVuuS5pmJ/A+\r\nfmkvS74gJMTqf7NYRE40uUUF9gPCS86qOeyzlYqxYdCZ0ipDrUQEMFNSgwLVuDBH\r\nEM23JNOSs13nABklfWYkS9AAV1WYn/UxOHgBPspS1I+izTt2DQmjCd7RChk6a12K\r\nR8C2GYrhhlsqMNZhwaI6gGKEg5yD2Ru3oVZPGrdifMaAu1mbOVzUHfJTFzzH/2xe\r\nAD30MkqtGBtQ0rBnaMC4E8+JIA\u003d\u003d\r\n\u003d5QII\r\n-----END PGP MESSAGE-----",
"content": "As stated in subject\n\nShall not decrypt automatically\n\nHas to show a warning\n",
"decryptErr": {
"error": {
"message": "Message is encrypted using a \u0027Symmetrically Encrypted Data\u0027 (SED) packet, which enables certain types of attacks. A \u0027Symmetrically Encrypted Integrity Protected\u0027 (SEIP) packet should be used instead.",
Expand All @@ -32,27 +32,27 @@
],
"fromAddress": "denbond7@flowcrypt.test",
"hasAttachments": false,
"id": 90,
"id": 66,
"isSeen": true,
"isEncrypted": true,
"msgState": "NONE",
"receivedDate": 1632554486000,
"receivedDate": 1633423230000,
"replyTo": "denbond7@flowcrypt.test",
"replyToAddress": [
{
"address": "denbond7@flowcrypt.test"
}
],
"sentDate": 1632554484000,
"sentDate": 1633423226000,
"subject": "Decryption error. NO_MDC",
"to": [
{
"address": "default@flowcrypt.test"
}
],
"toAddress": "default@flowcrypt.test",
"uid": 20,
"uidAsHEX": "14"
"uid": 24,
"uidAsHEX": "18"
},
"text": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,34 @@ Return-Path: <denbond7@flowcrypt.test>
Delivered-To: default@flowcrypt.test
Received: from mail.flowcrypt.test
by mail.flowcrypt.test with LMTP
id zEBDJfbNTmEHBgAAc/RpdQ
id OiFBGH4PXGEbCAAAc/RpdQ
(envelope-from <denbond7@flowcrypt.test>)
for <default@flowcrypt.test>; Sat, 25 Sep 2021 07:21:26 +0000
for <default@flowcrypt.test>; Tue, 05 Oct 2021 08:40:30 +0000
Received: from localhost (localhost [127.0.0.1])
by mail.flowcrypt.test (Postfix) with ESMTP id 9445F1C2020
for <default@flowcrypt.test>; Sat, 25 Sep 2021 07:21:26 +0000 (UTC)
Date: Sat, 25 Sep 2021 10:21:24 +0300 (GMT+03:00)
by mail.flowcrypt.test (Postfix) with ESMTP id 5D31522A08
for <default@flowcrypt.test>; Tue, 5 Oct 2021 08:40:30 +0000 (UTC)
Date: Tue, 5 Oct 2021 11:40:26 +0300 (GMT+03:00)
From: denbond7@flowcrypt.test
To: default@flowcrypt.test
Message-ID: <132485680.1.1632554484802@flowcrypt.test>
Message-ID: <229386180.1.1633423226719@flowcrypt.test>
Subject: Decryption error. NO_MDC
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_0_200041331.1632554484783"
boundary="----=_Part_0_243811031.1633423226707"

------=_Part_0_200041331.1632554484783
------=_Part_0_243811031.1633423226707
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

-----BEGIN PGP MESSAGE-----
Version: PGPainless

hQIMA3LvK1JdDBkzAQ//RjLOB+l/hvljxS+WamHcsx6JH4YVWcrElifdlmmFTB0z
R+F3mlJXLLAbpwAs0hLpfpsI+cpf3Ori67FfGyQPxCY3O0ilamPIvaJm7CqBJ08Y
c0zwVXpmOfAj0cv3NtPKERx88LgukolLk72m5UV2jVKv5fwH685B202rO08GcCt6
GO8CfvyzMv42ys8KgiPkZd8snY9NBT5918nHqHywBFmU9N3suiLM2nKvvFsg+bAg
+0yGkhrFxyWuoL+OYiytR1rutDQjiqwBM7rWvwNFqN3hcBtY46qqQNq0PMe2n1Xm
1fcYI2ESganoO6Ovt2m5LbEyRAJYbVpeTAe/zS1EcmF7Abcn4Zy6mrWi+7eaVfju
8zhE4rxCxkQCFLb+bNc5hBl7ZTT7u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200041331.1632554484783--

------=_Part_0_243811031.1633423226707--

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ class MessageDetailsActivityTest : BaseMessageDetailsActivityTest() {
)
onView(withId(R.id.textViewErrorMessage))
.check(matches(withText(errorMsg)))
testSwitch(block.content ?: "")
matchReplyButtons(details)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ object PgpDecrypt {
fun decryptWithResult(
srcInputStream: InputStream,
pgpSecretKeyRingCollection: PGPSecretKeyRingCollection,
protector: SecretKeyRingProtector
protector: SecretKeyRingProtector,
ignoreMdcErrors: Boolean = false
): DecryptionResult {
srcInputStream.use { srcStream ->
val destOutputStream = ByteArrayOutputStream()
Expand All @@ -79,6 +80,7 @@ object PgpDecrypt {
.withOptions(
ConsumerOptions()
.addDecryptionKeys(pgpSecretKeyRingCollection, protector)
.setIgnoreMDCErrors(ignoreMdcErrors)
)

decryptionStream.use { it.copyTo(outStream) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import com.flowcrypt.email.extensions.kotlin.unescapeHtml
import com.flowcrypt.email.extensions.org.bouncycastle.openpgp.armor
import com.flowcrypt.email.extensions.org.owasp.html.allowAttributesOnElementsExt
import com.flowcrypt.email.security.KeysStorageImpl
import com.flowcrypt.email.util.exception.DecryptionException
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection
import org.json.JSONObject
import org.jsoup.Jsoup
Expand Down Expand Up @@ -942,13 +941,37 @@ object PgpMsg {
)
}
} else {
results.add(
DecryptErrorMsgBlock(
content = msgBlock.content,
complete = true,
decryptErr = (decryptionResult.exception as? DecryptionException)?.to()
if (PgpDecrypt.DecryptionErrorType.NO_MDC == decryptionResult.exception.decryptionErrorType) {
val resultWithIgnoredMDCErrors = PgpDecrypt.decryptWithResult(
msgBlock.content?.toInputStream()!!,
ringCollection,
protector,
true
)
)
val decryptErrorMsgBlock = if (resultWithIgnoredMDCErrors.exception == null) {
DecryptErrorMsgBlock(
content = resultWithIgnoredMDCErrors.content.toString(),
complete = true,
decryptErr = decryptionResult.exception.toDecryptError()
)
} else {
DecryptErrorMsgBlock(
content = msgBlock.content,
complete = true,
decryptErr = decryptionResult.exception.toDecryptError()
)
}

results.add(decryptErrorMsgBlock)
} else {
results.add(
DecryptErrorMsgBlock(
content = msgBlock.content,
complete = true,
decryptErr = decryptionResult.exception.toDecryptError()
)
)
}
}

return results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DecryptionException(
return super.toString() + ", DecryptionErrorType = " + decryptionErrorType
}

fun to(): DecryptError {
fun toDecryptError(): DecryptError {
return DecryptError(DecryptErrorDetails(decryptionErrorType, e.message), fingerprints, true)
}
}
Binary file not shown.