Subject: Re: bug#12923: 24.2; epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit

From: Daiki Ueno <[email-masked]>
Date: Wed, 21 Nov 2012 06:49:46 +0900

Oleksandr Gavenko <[email-masked]> writes:

> So Emacs break some usual convention used by gpg about .gpg extension...
>
>   $ file /home/user/.gnupg/pubring.gpg
>   /home/user/.gnupg/pubring.gpg: GPG key public ring

Oh, I didn't know that the file command defines such a magic:

# GnuPG
# The format is very similar to pgp
0       string          \001gpg                 GPG key trust database
>4      byte            x                       version %d
# Note: magic.mime had 0x8501 for the next line instead of 0x8502
0       beshort         0x8502                  GPG encrypted data
!:mime  text/PGP # encoding: data

# This magic is not particularly good, as the keyrings don't have true
# magic. Nevertheless, it covers many keyrings.
0       beshort         0x9901                  GPG key public ring
!:mime  application/x-gnupg-keyring

> I expect that Emacs open this file in any case (ever if it doesn't support
> some "standard" .gpg format - open it literary as fall back!).

The rationale of the current behavior (try decryption only) was that a
.gpg file may contain GPG packets which can have any type of GPG data
(encrypted, signed, public keys, ...) in theory.

If the above magic works well for typical use-cases, it might be worth
adding them to Emacs too.

Regards,
-- 
Daiki Ueno