[Gpg4win-devel] Mime Type in Kleopatra

Andre Heinecke aheinecke at gnupg.org
Mon Jun 8 15:22:49 CEST 2020


 Hello,

On Monday 8 June 2020 01:33:31 CEST Dave Scotese wrote:
> I encrypt a text file of sensitive information.  In the past, Kleopatra
> asked if I wanted to encrypt it to ASCII ("ASCII-Armor" I think it was
> called).  Now it has no such option, and the resulting encrypted file is
> not ASCII.  When I use other software to decrypt it, the decryption works
> but the mimetype of the result is "application/octet-stream" 

That is the problem of the other software. The mimetype information is not 
part of the encrypted package. We keep the file type hint through the 
extension. So that foo.txt becomes foo.txt.gpg after encryption. It sounds 
like you use it for mail though. For Mail MIME type stuff only properly works 
using PGP/MIME and S/MIME.

> even though
> the original file was a (Windows) text file.

We found that users were confused by having the option directly in the dialog 
but as we recognize the use case we have "Create signed or encrypted files as 
text files." under configure Kleopatra. Tab Crypto Operations.

This will change the behavior.

> I now know that I can create the ASCII-armor'ed file by copying the text in
> the file to my clipboard and using Kleopatra's "Clipboard|Encrypt" feature,
> but GPG4Win shouldn't be setting an incorrect mimetype when it encrypts a
> text file.  it would be handy to use something like
> OpenKeychain's CharsetVerifier
> <https://github.com/open-keychain/open-keychain/blob/master/OpenKeychain/
src/main/java/org/sufficientlysecure/keychain/util/CharsetVerifier.java#L32>
> to guess a better mimetype than "application/octet-stream" which is
> apparently what Kleopatra is using, and that prevents OpenKeychain from
> providing the decrypted text from the file to the user, as text, upon
> decryption.  I've already suggested to OpenKeychain that decryption results
> with the  "application/octet-stream" mimetype could be tested (see previous
> link) to see if "text/plain" would work, but that's a kludge rather than a
> fix.

It's the Mail agent of the sender that sends application/octet-stream as that 
looks at the encrypted data. Sees: Oh just random bytes. So application/octet-
stream is the correct MIME type.

When you ASCII Armor it will look like text so it sets that.
> which I interpret to mean that gpg4win is responsible for (incorrectly)
> indicating the mimetype.

No it's the sending Mail agent. 

> If this is not the appropriate place for this inquiry, please advise.

I hope this answers your questions. Changing the config option should work for 
you, but I'd still advise that you use a PGP/MIME aware mail client to send 
encrypted mails for the best user experience.

Best Regards,
Andre

-- 
GnuPG.com - a brand of g10 Code, the GnuPG experts.

g10 Code GmbH, Erkrath/Germany, AG Wuppertal HRB14459
GF Werner Koch, USt-Id DE215605608, www.g10code.com.

GnuPG e.V., Rochusstr. 44, D-40479 Düsseldorf.  VR 11482 Düsseldorf
Vorstand: W.Koch, B.Reiter, A.Heinecke        Mail: board at gnupg.org
Finanzamt D-Altstadt, St-Nr: 103/5923/1779.   Tel: +49-211-28010702
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.wald.intevation.org/pipermail/gpg4win-devel/attachments/20200608/02876d4b/attachment.sig>


More information about the Gpg4win-devel mailing list