From: "Christopher M. Miles" <numbchild@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: "Christopher M. Miles" <numbchild@gmail.com>,
emacs-orgmode@gnu.org, Karl Voit <devnull@Karl-Voit.at>
Subject: Re: [EasyPG (epa)] Emacs can't save modified encrypted file
Date: Wed, 03 May 2023 18:40:15 +0800 [thread overview]
Message-ID: <m2a5ylr8f8.fsf@numbchild@gmail.com> (raw)
In-Reply-To: <87354esdhk.fsf@localhost>
[-- Attachment #1: Type: text/plain, Size: 6163 bytes --]
Ihor Radchenko <yantar92@posteo.net> writes:
> "Christopher M. Miles" <numbchild@gmail.com> writes:
>
>>> Do you have any issues decrypting and encrypting files from command
>>> line? If no, what about from M-x shell? If yet no, what if you call gpg
>>> via `start-process'?
>>>
>>
>> - [X] test decrypt & encrypt in terminal with gpg command. -> works fine.
>>
>> - [X] test decrypt & encrypt in Emacs =[M-x shell]= with gpg command. -> works fine.
>> ...
>> - [X] test decrypt & encrypt in Emacs with ~start-process~ -> works fine
>
> Ok. The further step we can try is following what epg does.
> I am now looking into `epg--start' source code and I note
> `epg-debug' variable, which might provide some more info to think about.
> Also, note the `make-process' call in `epg--start' - you may try to run
> it manually, similar to `start-process' and check if it fails. (For me,
> :connection-type 'pipe part is a bit fishy - I recall there were some
> quirks related to it;
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44824 ... but it was the
> opposite to having 'pipe AFAIR).
Ok, I followed your suggestions, did following steps.
- [X] toggle option ~epg-debug~
#+begin_src emacs-lisp
(setq epg-debug t)
#+end_src
#+begin_example :file "*epg-debug*"
GPG_AGENT_INFO is not set
/opt/homebrew/bin/gpg --no-tty --status-fd 1 --yes --enable-progress-filter --command-fd 0 --output /var/folders/ym/f3v5_yk1279g5ls70x3hzblh0000gn/T/epg-outputMMP3Zp --pinentry-mode loopback --decrypt -- /Users/stardiviner/.config/emacs/secrets/authinfo.gpg
[GNUPG:] PROGRESS /Users/stardiviner/. ? 0 1204 B
[GNUPG:] ENC_TO AEDA8A17BB08B786 1 0
[GNUPG:] ENC_TO 0251FA6886EB6B77 1 0
[GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
[GNUPG:] KEY_CONSIDERED 9BAA92BCCDDDB9EF3B36CB99B8C4B8E547C32433 0
[GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
[GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
[GNUPG:] DECRYPTION_KEY 32A8581A6E137ABD26DA2F570251FA6886EB6B77 F09F650D7D674819892591401B5DF1C95AE89AC3 u
[GNUPG:] NO_SECKEY AEDA8A17BB08B786
[GNUPG:] BEGIN_DECRYPTION
[GNUPG:] DECRYPTION_INFO 2 7 0
[GNUPG:] PROGRESS /Users/stardiviner/. ? 1204 1204 B
[GNUPG:] PLAINTEXT 62 1682998161
[GNUPG:] DECRYPTION_OKAY
[GNUPG:] GOODMDC
[GNUPG:] END_DECRYPTION
GPG_AGENT_INFO is not set
/opt/homebrew/bin/gpg --no-tty --status-fd 1 --yes --enable-progress-filter --command-fd 0 --output /var/folders/ym/f3v5_yk1279g5ls70x3hzblh0000gn/T/epg-outputE3zoeh --pinentry-mode loopback --encrypt -r 1B5DF1C95AE89AC3 -r B8C4B8E547C32433
[GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
[GNUPG:] KEY_CONSIDERED 9BAA92BCCDDDB9EF3B36CB99B8C4B8E547C32433 0
[GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
GPG_AGENT_INFO is not set
/opt/homebrew/bin/gpg --no-tty --status-fd 1 --yes --enable-progress-filter --command-fd 0 --output /var/folders/ym/f3v5_yk1279g5ls70x3hzblh0000gn/T/epg-outputxPZRrb --pinentry-mode loopback --encrypt -r 1B5DF1C95AE89AC3 -r B8C4B8E547C32433
[GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
[GNUPG:] KEY_CONSIDERED 9BAA92BCCDDDB9EF3B36CB99B8C4B8E547C32433 0
[GNUPG:] KEY_CONSIDERED F09F650D7D674819892591401B5DF1C95AE89AC3 0
#+end_example
- [X] test the debug output buffer printed full command in terminal. (remove =--output= option to see the output)
#+begin_src sh :eval no
gpg --no-tty --status-fd 1 --yes --enable-progress-filter --command-fd 0 --pinentry-mode loopback --decrypt -- /Users/stardiviner/.config/emacs/secrets/authinfo.gpg
# after input password, it decrypted success
#+end_src
The encrypt command seems missing input file.
#+begin_src sh :eval no
gpg --no-tty --status-fd 1 --yes --enable-progress-filter --command-fd 0 --pinentry-mode loopback --encrypt -r 1B5DF1C95AE89AC3 -r B8C4B8E547C32433
#+end_src
- [X] I look into ~epg--start~ source code. note the ~make-process~ call in ~epg--start~ - you may try to
run it manually, similar to ~start-process~ and check if it fails. (For me, ~:connection-type 'pipe~
part is a bit fishy.)
#+begin_src emacs-lisp :eval no
;;; `epg-start-encrypt' -> `epg--start'
(let ((context
#s(epg-context :protocol OpenPGP :program "/opt/homebrew/bin/gpg" :home-directory nil :armor nil :textmode nil :include-certs nil :cipher-algorithm nil :digest-algorithm nil :compress-algorithm nil :passphrase-callback (epa-file-passphrase-callback-function . "/Users/stardiviner/.config/emacs/secrets/authinfo.gpg") :progress-callback (epa-progress-callback-function . "Encrypting /Users/stardiviner/.config/emacs/secrets/authinfo.gpg") :edit-callback nil :signers nil :sender nil :sig-notations nil :process nil :output-file "/var/folders/ym/f3v5_yk1279g5ls70x3hzblh0000gn/T/epg-outputsyLCLb" :result nil :operation encrypt :pinentry-mode loopback :error-output "" :error-buffer nil))
(args '("--encrypt" #1="-r" "1B5DF1C95AE89AC3" #1# "B8C4B8E547C32433"))
(error-process (make-pipe-process :name "epg-error"
:buffer (generate-new-buffer " *epg-error*")
;; Suppress "XXX finished" line.
:sentinel #'ignore
:noquery t)))
(make-process
:name "epg"
:buffer (generate-new-buffer " *epg*")
:command (cons (epg-context-program context) args)
:connection-type 'pipe
:coding 'raw-text
:filter #'epg--process-filter
:stderr error-process
:noquery t))
#+end_src
- [X] record screen record for edebug process (430M), then compress big recorded video (~170M).
I uploaded to here: https://file.io/5fvOAbW5DPi6
--
[ stardiviner ]
I try to make every word tell the meaning that I want to express without misunderstanding.
Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
next prev parent reply other threads:[~2023-05-03 10:56 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-30 20:21 [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption Ihor Radchenko
2023-05-01 3:41 ` [SUGGESTION] " Christopher M. Miles
2023-05-01 7:50 ` Ihor Radchenko
2023-05-01 11:32 ` Christopher M. Miles
2023-05-01 11:46 ` Ihor Radchenko
2023-05-01 12:26 ` Christopher M. Miles
2023-05-01 12:38 ` Ihor Radchenko
2023-05-01 13:12 ` Christopher M. Miles
2023-05-01 13:38 ` Ihor Radchenko
2023-05-01 19:10 ` Christopher M. Miles
2023-05-01 19:18 ` Ihor Radchenko
[not found] ` <m2sfcgmbpo.fsf@numbchild>
2023-05-02 4:00 ` [EasyPG (epa)] Emacs can't save modified encrypted file Christopher M. Miles
2023-05-02 11:57 ` Ihor Radchenko
2023-05-02 17:38 ` Christopher M. Miles
2023-05-02 20:08 ` Ihor Radchenko
2023-05-03 10:40 ` Christopher M. Miles [this message]
2023-05-03 12:08 ` Ihor Radchenko
2023-05-03 16:51 ` Christopher M. Miles
2023-05-03 17:02 ` Ihor Radchenko
2023-05-03 17:29 ` [Uploaded Edebug video] " Christopher M. Miles
2023-05-03 19:08 ` Ihor Radchenko
2023-05-04 2:28 ` Christopher M. Miles
2023-05-04 17:28 ` Ihor Radchenko
2023-05-05 6:30 ` Christopher M. Miles
2023-05-05 8:36 ` Ihor Radchenko
2023-05-05 13:20 ` Christopher M. Miles
2023-05-05 15:29 ` Christopher M. Miles
2023-05-15 13:38 ` [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption Ihor Radchenko
2023-05-15 15:56 ` Christopher M. Miles
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2a5ylr8f8.fsf@numbchild@gmail.com \
--to=numbchild@gmail.com \
--cc=devnull@Karl-Voit.at \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.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).