[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [EasyPG (epa)] Emacs can't save modified encrypted file
From: |
Christopher M. Miles |
Subject: |
Re: [EasyPG (epa)] Emacs can't save modified encrypted file |
Date: |
Wed, 03 May 2023 18:40:15 +0800 |
User-agent: |
mu4e 1.10.3; emacs 30.0.50 |
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
signature.asc
Description: PGP signature
- Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption, (continued)
- Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption, Christopher M. Miles, 2023/05/01
- Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption, Ihor Radchenko, 2023/05/01
- Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption, Christopher M. Miles, 2023/05/01
- Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption, Ihor Radchenko, 2023/05/01
- Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption, Christopher M. Miles, 2023/05/01
- Re: [SUGGESTION] Re: [PATCH] org-crypt-decrypt-entry: Apply initial visibility upon decryption, Ihor Radchenko, 2023/05/01
- Message not available
- [EasyPG (epa)] Emacs can't save modified encrypted file, Christopher M. Miles, 2023/05/02
- Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Ihor Radchenko, 2023/05/02
- Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Christopher M. Miles, 2023/05/02
- Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Ihor Radchenko, 2023/05/02
- Re: [EasyPG (epa)] Emacs can't save modified encrypted file,
Christopher M. Miles <=
- Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Ihor Radchenko, 2023/05/03
- Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Christopher M. Miles, 2023/05/03
- Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Ihor Radchenko, 2023/05/03
- [Uploaded Edebug video] Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Christopher M. Miles, 2023/05/03
- Re: [Uploaded Edebug video] Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Ihor Radchenko, 2023/05/03
- Re: [Uploaded Edebug video] Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Christopher M. Miles, 2023/05/03
- Re: [Uploaded Edebug video] Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Ihor Radchenko, 2023/05/04
- Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Christopher M. Miles, 2023/05/05
- Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Ihor Radchenko, 2023/05/05
- Re: [EasyPG (epa)] Emacs can't save modified encrypted file, Christopher M. Miles, 2023/05/05