unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12923: 24.2; epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit
@ 2012-11-18 13:42 Oleksandr Gavenko
  2012-11-20  7:32 ` Daiki Ueno
  0 siblings, 1 reply; 7+ messages in thread
From: Oleksandr Gavenko @ 2012-11-18 13:42 UTC (permalink / raw)
  To: 12923

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!





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#12923: 24.2; epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit
  2012-11-18 13:42 bug#12923: 24.2; epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit Oleksandr Gavenko
@ 2012-11-20  7:32 ` Daiki Ueno
  2012-11-20 18:11   ` Oleksandr Gavenko
  0 siblings, 1 reply; 7+ messages in thread
From: Daiki Ueno @ 2012-11-20  7:32 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 12923

Oleksandr Gavenko <gavenkoa@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#12923: 24.2; epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit
  2012-11-20  7:32 ` Daiki Ueno
@ 2012-11-20 18:11   ` Oleksandr Gavenko
  2012-11-20 21:49     ` Daiki Ueno
  0 siblings, 1 reply; 7+ messages in thread
From: Oleksandr Gavenko @ 2012-11-20 18:11 UTC (permalink / raw)
  To: Daiki Ueno; +Cc: 12923

On 2012-11-20, Daiki Ueno wrote:

> Oleksandr Gavenko <gavenkoa@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!





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#12923: 24.2; epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit
  2012-11-20 18:11   ` Oleksandr Gavenko
@ 2012-11-20 21:49     ` Daiki Ueno
  2012-11-21  1:12       ` Daiki Ueno
  2012-11-21 14:00       ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: Daiki Ueno @ 2012-11-20 21:49 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 12923

Oleksandr Gavenko <gavenkoa@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#12923: 24.2; epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit
  2012-11-20 21:49     ` Daiki Ueno
@ 2012-11-21  1:12       ` Daiki Ueno
  2012-11-21 14:00       ` Stefan Monnier
  1 sibling, 0 replies; 7+ messages in thread
From: Daiki Ueno @ 2012-11-21  1:12 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: 12923

Daiki Ueno <ueno@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@unixuser.org --encrypt < /dev/null
$ file pub.gpg
pub.gpg: data

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#12923: 24.2; epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit
  2012-11-20 21:49     ` Daiki Ueno
  2012-11-21  1:12       ` Daiki Ueno
@ 2012-11-21 14:00       ` Stefan Monnier
  2021-12-04  4:39         ` Lars Ingebrigtsen
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2012-11-21 14:00 UTC (permalink / raw)
  To: Daiki Ueno; +Cc: 12923, Oleksandr Gavenko

> 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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#12923: 24.2; epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit
  2012-11-21 14:00       ` Stefan Monnier
@ 2021-12-04  4:39         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-04  4:39 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12923, Daiki Ueno, Oleksandr Gavenko

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-04  4:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-18 13:42 bug#12923: 24.2; epa-file--find-file-not-found-function: Opening input file: Can't decrypt, Exit Oleksandr Gavenko
2012-11-20  7:32 ` Daiki Ueno
2012-11-20 18:11   ` Oleksandr Gavenko
2012-11-20 21:49     ` Daiki Ueno
2012-11-21  1:12       ` Daiki Ueno
2012-11-21 14:00       ` Stefan Monnier
2021-12-04  4:39         ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).