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

Previous Next

Package: emacs;

Reported by: Oleksandr Gavenko <gavenkoa <at> gmail.com>

Date: Sun, 18 Nov 2012 13:44:02 UTC

Severity: normal

Found in version 24.2

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12923 in the body.
You can then email your comments to 12923 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12923; Package emacs. (Sun, 18 Nov 2012 13:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleksandr Gavenko <gavenkoa <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 18 Nov 2012 13:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Oleksandr Gavenko <gavenkoa <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2;
	epa-file--find-file-not-found-function: Opening input file: Can't
	decrypt, Exit
Date: Sun, 18 Nov 2012 15:42:11 +0200
When I try open any .gpg files I get error:

  epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit

Root of issue come from Emacs call:

  $ gpg "--no-tty" "--status-fd" "1" "--yes" "--enable-progress-filter" \
  "--command-fd" "0" "--output" "/tmp/epg-output3999nru" \
  "--decrypt" "--" "/home/user/.gnupg/pubring.gpg"

  gpg: WARNING: unsafe enclosing directory permissions on configuration file `/home/user/.gnupg/gpg.conf'
  [GNUPG:] PROGRESS /home/user/.gnupg/pu ? 0 22238
  [GNUPG:] UNEXPECTED 0
  gpg: decrypt_message failed: unexpected data

from call stack:

  epa-file-insert-file-contents --> epg-decrypt-file
    --> epg-start-decrypt --> epg--start
	--> (setq process
          (apply #'start-process "epg" buffer
		       (if (eq (epg-context-protocol context) 'CMS)
			   epg-gpgsm-program
			 epg-gpg-program)
		       args))

So this error occur on opening files with '.gpg' extension.

See also:

  http://unix.stackexchange.com/questions/28330/emacs-auto-encryption-and-gpg

  http://comments.gmane.org/gmane.emacs.bugs/38903
                gnupg support is no longer able to create .gpg files from
                scratch

================================================================

In GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-09-09 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.2/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  desktop-save-mode: t
  which-function-mode: t
  auto-image-file-mode: t
  icomplete-mode: t
  iswitchb-mode: t
  show-paren-mode: t
  global-hl-line-mode: t
  delete-selection-mode: t
  global-hi-lock-mode: t
  display-time-mode: t
  recentf-mode: t
  yas/global-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Decrypting /home/user/.gnupg/pubring.gpg...0%
epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Unexpected; Exit

Load-path shadows:
/usr/share/emacs/24.2/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs/24.2/site-lisp/cscope/xcscope hides /usr/share/emacs/site-lisp/xcscope
/usr/share/emacs24/site-lisp/quilt-el/quilt hides /usr/share/emacs/site-lisp/quilt
/usr/share/emacs24/site-lisp/flim/md4 hides /usr/share/emacs/24.2/lisp/md4
/usr/share/emacs24/site-lisp/flim/hex-util hides /usr/share/emacs/24.2/lisp/hex-util
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.2/lisp/textmodes/ispell
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.2/lisp/textmodes/flyspell
/usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.2/lisp/textmodes/rst
/usr/share/emacs24/site-lisp/flim/ntlm hides /usr/share/emacs/24.2/lisp/net/ntlm
/usr/share/emacs24/site-lisp/flim/hmac-def hides /usr/share/emacs/24.2/lisp/net/hmac-def
/usr/share/emacs24/site-lisp/flim/sasl hides /usr/share/emacs/24.2/lisp/net/sasl
/usr/share/emacs24/site-lisp/flim/sasl-digest hides /usr/share/emacs/24.2/lisp/net/sasl-digest
/usr/share/emacs24/site-lisp/flim/hmac-md5 hides /usr/share/emacs/24.2/lisp/net/hmac-md5
/usr/share/emacs24/site-lisp/flim/sasl-cram hides /usr/share/emacs/24.2/lisp/net/sasl-cram
/usr/share/emacs24/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/24.2/lisp/net/sasl-ntlm
/usr/share/emacs24/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/24.2/lisp/language/thai-word
/usr/share/emacs24/site-lisp/emms/tq hides /usr/share/emacs/24.2/lisp/emacs-lisp/tq
/usr/share/emacs/site-lisp/emacs-jabber/srv hides /home/user/usr/share/emacs/site-lisp/srv
/usr/share/emacs/24.2/lisp/emacs-lisp/ert hides /home/user/usr/share/emacs/site-lisp/nxhtml/tests/ert
/home/user/usr/share/emacs/site-lisp/rnc-mode hides /home/user/usr/share/emacs/site-lisp/nxhtml/util/rnc-mode
/usr/share/emacs/24.2/lisp/emacs-lisp/chart hides /home/user/usr/share/emacs/site-lisp/nxhtml/util/chart
/usr/share/emacs/24.2/lisp/htmlfontify hides /home/user/usr/share/emacs/site-lisp/nxhtml/util/htmlfontify

Features:
(shadow emacsbug log-view find-dired grep cl-specs edebug debug diff-mode
vc-git vc-bzr vc-sccs vc-cvs vc-rcs vc-dir ewoc dired-aux debian-copyright
readme-debian debian-changelog-mode tar-mode deb-view shell dabbrev term ehelp
electric tabify man generic apt-utils log-edit pcvs-util add-log vc ediff-merg
ediff-diff ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff
epa-file epa epg reporter debian-bug canlock quail help-mode view newcomment
browse-url url-util url-handlers url-parse url-vars qp misearch multi-isearch
pp time-stamp nnfolder mailalias smtpmail sendmail sort smiley gnus-cite
mail-extr gnus-async gnus-bcklg gnus-ml gnus-topic utf-7 nndraft nnmh gnutls
network-stream auth-source eieio starttls nnimap parse-time tls utf7 netrc
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu
mml2015 epg-config mm-view mml-smime smime password-cache dig mailcap
gnus-cache gnus-sum doc-view image-mode rnc-mode make-mode nxml-uchnm rng-xsd
xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse
rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap
nxml-util nxml-glyph nxml-enc xmltok rst flyspell ispell sh-script executable
vc-dispatcher vc-svn eldoc python-21 python sgml-mode vc-hg org-wl org-w3m
org-vm org-rmail org-mhe org-mew org-irc org-jsinfo org-infojs org-html
org-exp ob-exp org-exp-blocks find-func org-agenda org-info org-gnus
org-docview org-bibtex bibtex org-bbdb wesnoth-mode wesnoth-wml-data
wesnoth-update dictem fvwm-mode desktop ropemacs pymacs cwarn cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
which-func imenu gnus-demon nntp gnus-group gnus-undo nnmail mail-source
gnus-start gnus-spec gnus-win nnoo gnus-int gnus-range message rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader gnus gnus-ems nnheader gnus-util
mail-utils mm-util mail-prsvr ecomplete org-remember org-datetree org byte-opt
warnings bytecomp byte-compile cconv macroexp ob-emacs-lisp ob-tangle ob-ref
ob-lob ob-table org-footnote org-src ob-comint ob-keys ob ob-eval
org-pcomplete pcomplete org-list org-faces org-compat org-entities org-macs
noutline outline format-spec cal-menu calendar cal-loaddefs remember jdone
image-file jka-compr ls-lisp ffap dired saveplace icomplete uniquify iswitchb
paren hl-line delsel hi-lock generic-x disp-table server time avoid recentf
tree-widget wid-edit autoload-my etags-select etags-table etags debian-el
debian-el-loaddefs advice advice-preload yasnippet help-fns derived edmacro
kmacro easymenu assoc w3m-load slime-autoloads compile comint regexp-opt
ansi-color ring mmm-auto mmm-vars mmm-compat cl emms-auto jabber-autoloads
emacs-goodies-el emacs-goodies-custom emacs-goodies-loaddefs easy-mmode
dpkg-dev-el dpkg-dev-el-loaddefs time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)

-- 
Best regards!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12923; Package emacs. (Tue, 20 Nov 2012 07:34:01 GMT) Full text and rfc822 format available.

Message #8 received at 12923 <at> debbugs.gnu.org (full text, mbox):

From: Daiki Ueno <ueno <at> unixuser.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 12923 <at> debbugs.gnu.org
Subject: Re: bug#12923: 24.2;
	epa-file--find-file-not-found-function: Opening input file: Can't
	decrypt, Exit
Date: Tue, 20 Nov 2012 16:32:35 +0900
Oleksandr Gavenko <gavenkoa <at> gmail.com> writes:

> When I try open any .gpg files I get error:

Correction: "open existing, not encrypted .gpg files"

> Root of issue come from Emacs call:
>
>   $ gpg "--no-tty" "--status-fd" "1" "--yes" "--enable-progress-filter" \
>   "--command-fd" "0" "--output" "/tmp/epg-output3999nru" \
>   "--decrypt" "--" "/home/user/.gnupg/pubring.gpg"

> So this error occur on opening files with '.gpg' extension.

So what do you want instead?  I think you get a similar error when
opening a .tar.gz file which is not a gzip compressed tar archive.

If you want to edit the binary contents, you can use M-x
find-file-literally.  If you want to browse your keyring, you can use
M-x epa-list-keys.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12923; Package emacs. (Tue, 20 Nov 2012 18:13:02 GMT) Full text and rfc822 format available.

Message #11 received at 12923 <at> debbugs.gnu.org (full text, mbox):

From: Oleksandr Gavenko <gavenkoa <at> gmail.com>
To: Daiki Ueno <ueno <at> unixuser.org>
Cc: 12923 <at> debbugs.gnu.org
Subject: Re: bug#12923: 24.2;
	epa-file--find-file-not-found-function: Opening input file: Can't
	decrypt, Exit
Date: Tue, 20 Nov 2012 20:11:26 +0200
On 2012-11-20, Daiki Ueno wrote:

> Oleksandr Gavenko <gavenkoa <at> gmail.com> writes:
>
>> When I try open any .gpg files I get error:
>
> Correction: "open existing, not encrypted .gpg files"
>
Yes!

>> Root of issue come from Emacs call:
>>
>>   $ gpg "--no-tty" "--status-fd" "1" "--yes" "--enable-progress-filter" \
>>   "--command-fd" "0" "--output" "/tmp/epg-output3999nru" \
>>   "--decrypt" "--" "/home/user/.gnupg/pubring.gpg"
>
>> So this error occur on opening files with '.gpg' extension.
>
> So what do you want instead?  I think you get a similar error when
> opening a .tar.gz file which is not a gzip compressed tar archive.
>
> If you want to edit the binary contents, you can use M-x
> find-file-literally.  If you want to browse your keyring, you can use
> M-x epa-list-keys.

My point that this file created by:

  $ gpg --version
  gpg (GnuPG) 1.4.12

from Debian distribution and I don't take .gpg extension to them personally
(this do gpg privately without my knowledge):

  $ ls ~/.gnupg/*.gpg
  /home/user/.gnupg/pubring.gpg
  /home/user/.gnupg/secring.gpg
  /home/user/.gnupg/trustdb.gpg

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

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!).

-- 
Best regards!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12923; Package emacs. (Tue, 20 Nov 2012 21:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 12923 <at> debbugs.gnu.org (full text, mbox):

From: Daiki Ueno <ueno <at> unixuser.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 12923 <at> debbugs.gnu.org
Subject: Re: bug#12923: 24.2;
	epa-file--find-file-not-found-function: Opening input file: Can't
	decrypt, Exit
Date: Wed, 21 Nov 2012 06:49:46 +0900
Oleksandr Gavenko <gavenkoa <at> gmail.com> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12923; Package emacs. (Wed, 21 Nov 2012 01:14:01 GMT) Full text and rfc822 format available.

Message #17 received at 12923 <at> debbugs.gnu.org (full text, mbox):

From: Daiki Ueno <ueno <at> unixuser.org>
To: Oleksandr Gavenko <gavenkoa <at> gmail.com>
Cc: 12923 <at> debbugs.gnu.org
Subject: Re: bug#12923: 24.2;
	epa-file--find-file-not-found-function: Opening input file: Can't
	decrypt, Exit
Date: Wed, 21 Nov 2012 10:12:16 +0900
Daiki Ueno <ueno <at> unixuser.org> writes:

> If the above magic works well for typical use-cases,

Unfortunately it seems not:

$ gpg --output sym.gpg --symmetric < /dev/null
$ file sym.gpg
sym.gpg: DOS executable (COM)

$ gpg --output pub.gpg -r ueno <at> unixuser.org --encrypt < /dev/null
$ file pub.gpg
pub.gpg: data

$ file ~/.gnupg/pubring.gpg
/home/ueno/.gnupg/pubring.gpg: GPG key public ring




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12923; Package emacs. (Wed, 21 Nov 2012 14:03:01 GMT) Full text and rfc822 format available.

Message #20 received at 12923 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Daiki Ueno <ueno <at> unixuser.org>
Cc: 12923 <at> debbugs.gnu.org, Oleksandr Gavenko <gavenkoa <at> gmail.com>
Subject: Re: bug#12923: 24.2;
	epa-file--find-file-not-found-function: Opening input file: Can't
	decrypt, Exit
Date: Wed, 21 Nov 2012 09:00:58 -0500
> If the above magic works well for typical use-cases, it might be worth
> adding them to Emacs too.

I took this bug-report to say "make sure that we handle .gpg files in
a file-safe way, showing the raw-bytes if we can't show the decrypted
content".  So rather than try to detect that we have a keyring, we
should just try to decrypt and look at the resulting error
(which should hopefully be different for "bad decryption key" than it
is for "trying to decrypt something else (e.g. a keyring file)").


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12923; Package emacs. (Sat, 04 Dec 2021 04:40:02 GMT) Full text and rfc822 format available.

Message #23 received at 12923 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12923 <at> debbugs.gnu.org, Daiki Ueno <ueno <at> unixuser.org>,
 Oleksandr Gavenko <gavenkoa <at> gmail.com>
Subject: Re: bug#12923: 24.2; epa-file--find-file-not-found-function:
 Opening input file: Can't decrypt, Exit
Date: Sat, 04 Dec 2021 05:39:35 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> I took this bug-report to say "make sure that we handle .gpg files in
> a file-safe way, showing the raw-bytes if we can't show the decrypted
> content".  So rather than try to detect that we have a keyring, we
> should just try to decrypt and look at the resulting error
> (which should hopefully be different for "bad decryption key" than it
> is for "trying to decrypt something else (e.g. a keyring file)").

I've now done this in Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 12923 <at> debbugs.gnu.org and Oleksandr Gavenko <gavenkoa <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 04 Dec 2021 04:40:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 01 Jan 2022 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 170 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.