KMail/Protected Headers: Difference between revisions

From KDE Wiki Sandbox
(Add Protected header page for KMail)
 
m (Fix minor typos)
 
Line 1: Line 1:
Kmail support [https://datatracker.ietf.org/doc/draft-autocrypt-lamps-protected-headers/ Protected Headers for Cryptographic E-Mails]. This means that we also send a signed/encrypted copy of headers and display the signed/encrypted headers if available and ignores the unsecure headers. Currently KMail don’t obfuscate the subject to not break current workflows. Those things will be improved later on.
'''KMail''' support [https://datatracker.ietf.org/doc/draft-autocrypt-lamps-protected-headers/ Protected Headers for Cryptographic E-Mails]. This means that we also send a signed/encrypted copy of headers and display the signed/encrypted headers if available and ignores the insecure headers. Currently, '''KMail''' doesn’t obfuscate the subject to not break current workflows. Those things will be improved later on.


It is transparent for users and no difference is shown for an user, but this feature is only enabled for Grantlee based header themes.
It is transparent for users and no difference is shown for a user, but this feature is only enabled for Grantlee based header themes.


== Developers information ==
== Developers information ==
Line 10: Line 10:
usage:  
usage:  
* <code>KMime::Content *content</code>  - mime part that will be encrypted/signed  
* <code>KMime::Content *content</code>  - mime part that will be encrypted/signed  
* <code>KMime::Message *skeletonMessage</code> - message the has all the headers, that will ent unencrypted over the wire. The headers from this will be copied to `content`
* <code>KMime::Message *skeletonMessage</code> - message the has all the headers, that will be unencrypted over the wire. The headers from this will be copied to `content`
* <code>bool protectedHeadersObvoscate</code> - obfuscated the subject or not
* <code>bool protectedHeadersObvoscate</code> - obfuscated the subject or not


Line 22: Line 22:
</syntaxhighlight>
</syntaxhighlight>


For displaying the protected headers, first the mail needs to get parsed within the MimeTreeParser. If the correct structure is used than the encrypted MimePart is added [https://invent.kde.org/pim/messagelib/-/blob/master/mimetreeparser/src/bodyformatter/multipartencrypted.cpp#L89 registered to override and unencrypted header]. After that you can use [https://invent.kde.org/pim/messagelib/-/blob/master/mimetreeparser/src/nodehelper.h#L87 <code>MimeTreeParser::NodeHelper::hasMailHeader</code>] and other methods to ask the system to give you the correct header for and mail. [https://invent.kde.org/pim/messagelib/-/blob/master/messageviewer/src/header/grantleeheaderformatter.cpp#L378 This is done for Grantlee based header themes].
For displaying the protected headers, first, the mail needs to get parsed within the MimeTreeParser. If the correct structure is used than the encrypted MimePart is added [https://invent.kde.org/pim/messagelib/-/blob/master/mimetreeparser/src/bodyformatter/multipartencrypted.cpp#L89 registered to override and unencrypted header]. After that you can use [https://invent.kde.org/pim/messagelib/-/blob/master/mimetreeparser/src/nodehelper.h#L87 <code>MimeTreeParser::NodeHelper::hasMailHeader</code>] and other methods to ask the system to give you the correct header for and mail. [https://invent.kde.org/pim/messagelib/-/blob/master/messageviewer/src/header/grantleeheaderformatter.cpp#L378 This is done for Grantlee based header themes].

Latest revision as of 17:32, 12 June 2020

KMail support Protected Headers for Cryptographic E-Mails. This means that we also send a signed/encrypted copy of headers and display the signed/encrypted headers if available and ignores the insecure headers. Currently, KMail doesn’t obfuscate the subject to not break current workflows. Those things will be improved later on.

It is transparent for users and no difference is shown for a user, but this feature is only enabled for Grantlee based header themes.

Developers information

If developers want to dig into encrypted headers, there are two places to look for the code. For sending it is the class MessageComposer::ProtectedHeadersJob: messagecomposer/src/job/protectedheaders.h

usage:

  • KMime::Content *content - mime part that will be encrypted/signed
  • KMime::Message *skeletonMessage - message the has all the headers, that will be unencrypted over the wire. The headers from this will be copied to `content`
  • bool protectedHeadersObvoscate - obfuscated the subject or not


ProtectedHeadersJob *pJob = new ProtectedHeadersJob;
pJob->setContent(content);
pJob->setSkeletonMessage(skeletonMessage);
pJob->setObvoscate(protectedHeadersObvoscate);
QObject::connect(pJob, &ProtectedHeadersJob::finished, this, [d, pJob](KJob *job) {...});

For displaying the protected headers, first, the mail needs to get parsed within the MimeTreeParser. If the correct structure is used than the encrypted MimePart is added registered to override and unencrypted header. After that you can use MimeTreeParser::NodeHelper::hasMailHeader and other methods to ask the system to give you the correct header for and mail. This is done for Grantlee based header themes.