Commit e7820eed authored by Sandro Knauß's avatar Sandro Knauß
Browse files

Add test for another way who a mail can be signed.

parent 526f6167
......@@ -33,6 +33,7 @@ private Q_SLOTS:
void testMailWithoutEncryption();
void testSMIMESignedEncrypted();
void testOpenPGPSignedEncrypted();
void testOpenPGPEncryptedAndSigned();
void testForwardedOpenPGPSignedEncrypted();
void testSignedForwardedOpenPGPSignedEncrypted();
void testOpenPGPEncrypted();
......@@ -167,6 +168,31 @@ void UnencryptedMessageTest::testOpenPGPSignedEncrypted()
// TODO: Check that the signature is valid
void UnencryptedMessageTest::testOpenPGPEncryptedAndSigned()
KMime::Message::Ptr originalMessage = readAndParseMail(QStringLiteral("openpgp-encrypted+signed.mbox"));
NodeHelper nodeHelper;
Test::TestObjectTreeSource emptySource(Q_NULLPTR, Q_NULLPTR);
ObjectTreeParser otp(&emptySource, &nodeHelper);
QCOMPARE(otp.plainTextContent().toLatin1().data(), "encrypted message text");
QCOMPARE(nodeHelper.overallEncryptionState(, KMMsgFullyEncrypted);
QCOMPARE(nodeHelper.overallSignatureState(, KMMsgFullySigned);
// Now, test that the unencrypted message is generated correctly
KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage(originalMessage);
QCOMPARE(unencryptedMessage->contentType()->mimeType().data(), "text/plain");
QCOMPARE(unencryptedMessage->contents().size(), 0);
QCOMPARE(unencryptedMessage->decodedContent().data(), "encrypted message text");
// TODO: Check that the signature is valid
void UnencryptedMessageTest::testOpenPGPEncrypted()
KMime::Message::Ptr originalMessage = readAndParseMail(QStringLiteral("openpgp-encrypted.mbox"));
......@@ -109,15 +109,7 @@ Interface::MessagePart::Ptr MultiPartEncryptedBodyPartFormatter::process(Interfa
// without encapsulating a nicely formatted
// ~~~~~~~ Multipart/Signed part.
// (see RFC 3156 --> 6.2)
// In part.objectTreeParser() case we paint a _2nd_ frame inside the
// encryption frame, but we do _not_ show a respective
// encapsulated MIME part in the Mime Tree Viewer
// since we do want to show the _true_ structure of the
// message there - not the structure that the sender's
// MUA 'should' have sent. :-D (khz, 12.09.2002)
part.nodeHelper()->setSignatureState(node, KMMsgFullySigned);
qCDebug(MIMETREEPARSER_LOG) << "setting FULLY SIGNED to:" << node;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment