Closed Garonenur closed 2 years ago
Not off hand, but some debug info may help.
vim --cmd 'let g:GPGDebugLevel=3' --cmd 'let g:GPGDebugLog="debug.txt"'
I opened a text-file, tried to safe it with
:w test.txt.asc
got asked to enter an ID, I did (the one of my new main key) I got the message No such ID. I don't see anything in the debug output to indicate why this happened.
GnuPG: >>>>>>>> Entering s:GPGBufWritePre()
GnuPG: called autocommand for test.txt
GnuPG: <<<<<<<< Leaving s:GPGBufWritePre()
GnuPG: >>>>>>>> Entering s:GPGInit(0)
GnuPG: gnupg.vim 2.5
GnuPG: shellredirsave: >%s 2>&1
GnuPG: shellsave: /usr/bin/zsh
GnuPG: shelltempsave: 1
GnuPG: shell: /bin/sh
GnuPG: shellcmdflag: -c
GnuPG: shellxquote:
GnuPG: shellredir: >%s 2>&1
GnuPG: stderrredirnull: 2>/dev/null
GnuPG: shell implementation: /bin/dash
GnuPG: command: LANG=C LC_ALL=C gpg --trust-model always --use-agent --version 2>/dev/null
GnuPG: output: gpg (GnuPG) 1.4.20^@Copyright (C) 2015 Free Software Foundation, Inc.^@License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>^@This is free software: you are free to change and redistribute it.^@There is NO WARRANTY, to the extent permitted by law.^@^@Home: ~/.gnupg^@Supported algorithms:^@Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA^@Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,^@ CAMELLIA128, CAMELLIA192, CAMELLIA256^@Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224^@Compression: Uncompressed, ZIP, ZLIB, BZIP2^@
GnuPG: public key algorithms: RSA, RSA-E, RSA-S, ELG-E, DSA
GnuPG: cipher algorithms: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
GnuPG: hashing algorithms: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
GnuPG: compression algorithms: Uncompressed, ZIP, ZLIB, BZIP2
GnuPG: <<<<<<<< Leaving s:GPGInit()
GnuPG: >>>>>>>> Entering s:GPGEncrypt()
GnuPG: encoding and fileencoding are the same ("utf-8"), not switching
GnuPG: no options set, so using default options: ['encrypt', 'armor']
GnuPG: >>>>>>>> Entering s:GPGCheckRecipients()
GnuPG: recipients are: []
GnuPG: unknown recipients are: []
GnuPG: <<<<<<<< Leaving s:GPGCheckRecipients()
GnuPG: command: '[,']w !LANG=C LC_ALL=C gpg --trust-model always --use-agent --quiet --no-encrypt-to --encrypt --armor >'/tmp/vEWXTMY/1' 2>/dev/null
GnuPG: <<<<<<<< Leaving s:GPGEncrypt()
If I try to use GPGEditRecipients if I open an .asc-File I get the same problem, I change the ID and get unknown ID (see second output). I get an error containing this: The recipient "3EEF6EB3" is not in your public keyring!
which is funny, because I used gpg -k to list the keys and copy pasted that ID there.
GnuPG: >>>>>>>> Entering s:GPGBufWritePre()
GnuPG: called autocommand for test.txt
GnuPG: <<<<<<<< Leaving s:GPGBufWritePre()
GnuPG: >>>>>>>> Entering s:GPGInit(0)
GnuPG: gnupg.vim 2.5
GnuPG: shellredirsave: >%s 2>&1
GnuPG: shellsave: /usr/bin/zsh
GnuPG: shelltempsave: 1
GnuPG: shell: /bin/sh
GnuPG: shellcmdflag: -c
GnuPG: shellxquote:
GnuPG: shellredir: >%s 2>&1
GnuPG: stderrredirnull: 2>/dev/null
GnuPG: shell implementation: /bin/dash
GnuPG: command: LANG=C LC_ALL=C gpg --trust-model always --use-agent --version 2>/dev/null
GnuPG: output: gpg (GnuPG) 1.4.20^@Copyright (C) 2015 Free Software Foundation, Inc.^@License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>^@This is free software: you are free to change and redistribute it.^@There is NO WARRANTY, to the extent permitted by law.^@^@Home: ~/.gnupg^@Supported algorithms:^@Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA^@Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,^@ CAMELLIA128, CAMELLIA192, CAMELLIA256^@Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224^@Compression: Uncompressed, ZIP, ZLIB, BZIP2^@
GnuPG: public key algorithms: RSA, RSA-E, RSA-S, ELG-E, DSA
GnuPG: cipher algorithms: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
GnuPG: hashing algorithms: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
GnuPG: compression algorithms: Uncompressed, ZIP, ZLIB, BZIP2
GnuPG: <<<<<<<< Leaving s:GPGInit()
GnuPG: >>>>>>>> Entering s:GPGEncrypt()
GnuPG: encoding and fileencoding are the same ("utf-8"), not switching
GnuPG: no options set, so using default options: ['encrypt', 'armor']
GnuPG: >>>>>>>> Entering s:GPGCheckRecipients()
GnuPG: recipients are: []
GnuPG: unknown recipients are: []
GnuPG: <<<<<<<< Leaving s:GPGCheckRecipients()
GnuPG: command: '[,']w !LANG=C LC_ALL=C gpg --trust-model always --use-agent --quiet --no-encrypt-to --encrypt --armor >'/tmp/vEWXTMY/1' 2>/dev/null
GnuPG: <<<<<<<< Leaving s:GPGEncrypt()
GnuPG: >>>>>>>> Entering s:GPGInit(1)
GnuPG: gnupg.vim 2.5
GnuPG: shellredirsave: >%s 2>&1
GnuPG: shellsave: /usr/bin/zsh
GnuPG: shelltempsave: 1
GnuPG: shell: /bin/sh
GnuPG: shellcmdflag: -c
GnuPG: shellxquote:
GnuPG: shellredir: >%s 2>&1
GnuPG: stderrredirnull: 2>/dev/null
GnuPG: shell implementation: /bin/dash
GnuPG: command: LANG=C LC_ALL=C gpg --trust-model always --use-agent --version 2>/dev/null
GnuPG: output: gpg (GnuPG) 1.4.20^@Copyright (C) 2015 Free Software Foundation, Inc.^@License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>^@This is free software: you are free to change and redistribute it.^@There is NO WARRANTY, to the extent permitted by law.^@^@Home: ~/.gnupg^@Supported algorithms:^@Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA^@Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,^@ CAMELLIA128, CAMELLIA192, CAMELLIA256^@Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224^@Compression: Uncompressed, ZIP, ZLIB, BZIP2^@
GnuPG: public key algorithms: RSA, RSA-E, RSA-S, ELG-E, DSA
GnuPG: cipher algorithms: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
GnuPG: hashing algorithms: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
GnuPG: compression algorithms: Uncompressed, ZIP, ZLIB, BZIP2
GnuPG: <<<<<<<< Leaving s:GPGInit()
GnuPG: >>>>>>>> Entering s:GPGDecrypt(1)
GnuPG: >>>>>>>> Entering s:GPGBufReadPost()
GnuPG: called autocommand for test
GnuPG: <<<<<<<< Leaving s:GPGBufReadPost()
GnuPG: >>>>>>>> Entering s:GPGBufWritePre()
GnuPG: called autocommand for test
GnuPG: <<<<<<<< Leaving s:GPGBufWritePre()
GnuPG: >>>>>>>> Entering s:GPGInit(0)
GnuPG: >>>>>>>> Entering s:GPGEncrypt()
GnuPG: encoding was "utf-8", switched to "utf-8"
GnuPG: no options set, so using default options: ['encrypt', 'armor']
GnuPG: >>>>>>>> Entering s:GPGCheckRecipients()
GnuPG: recipients are: []
GnuPG: unknown recipients are: []
GnuPG: <<<<<<<< Leaving s:GPGCheckRecipients()
GnuPG: command: '[,']w !LANG=C LC_ALL=C gpg --trust-model always --use-agent --quiet --no-encrypt-to --encrypt --armor >'/tmp/vugJczh/1' 2>/dev/null
GnuPG: restored encoding "utf-8"
GnuPG: <<<<<<<< Leaving s:GPGEncrypt()
GnuPG: >>>>>>>> Entering s:GPGEditRecipients()
GnuPG: >>>>>>>> Entering s:GPGInit(1)
GnuPG: >>>>>>>> Entering s:GPGDecrypt(1)
GnuPG: >>>>>>>> Entering s:GPGBufReadPost()
GnuPG: called autocommand for GPGRecipients_test
GnuPG: <<<<<<<< Leaving s:GPGBufReadPost()
GnuPG: >>>>>>>> Entering s:GPGCheckRecipients()
GnuPG: recipients are: []
GnuPG: unknown recipients are: []
GnuPG: <<<<<<<< Leaving s:GPGCheckRecipients()
GnuPG: >>>>>>>> Entering s:GPGCheckRecipients()
GnuPG: recipients are: []
GnuPG: unknown recipients are: []
GnuPG: <<<<<<<< Leaving s:GPGCheckRecipients()
GnuPG: <<<<<<<< Leaving s:GPGEditRecipients()
GnuPG: >>>>>>>> Entering s:GPGBufWritePre()
GnuPG: called autocommand for GPGRecipients_test
GnuPG: <<<<<<<< Leaving s:GPGBufWritePre()
GnuPG: >>>>>>>> Entering s:GPGInit(0)
GnuPG: >>>>>>>> Entering s:GPGEncrypt()
GnuPG: encoding was "utf-8", switched to "utf-8"
GnuPG: no options set, so using default options: ['encrypt', 'armor']
GnuPG: >>>>>>>> Entering s:GPGCheckRecipients()
GnuPG: recipients are: []
GnuPG: unknown recipients are: []
GnuPG: <<<<<<<< Leaving s:GPGCheckRecipients()
GnuPG: command: '[,']w !LANG=C LC_ALL=C gpg --trust-model always --use-agent --quiet --no-encrypt-to --encrypt --armor >'/tmp/vugJczh/3' 2>/dev/null
GnuPG: restored encoding "utf-8"
GnuPG: <<<<<<<< Leaving s:GPGEncrypt()
GnuPG: >>>>>>>> Entering s:GPGFinishRecipientsBuffer()
GnuPG: >>>>>>>> Entering s:GPGNameToID()
GnuPG: command: LANG=C LC_ALL=C gpg --trust-model always --use-agent --quiet --with-colons --fixed-list-mode --list-keys '3EEF6EB3' 2>/dev/null
GnuPG: output: tru:t:1:1476882324:1539605373:3:1:5^@
GnuPG: <<<<<<<< Leaving s:GPGNameToID()
GnuPG: <<<<<<<< Leaving s:GPGFinishRecipientsBuffer()
GnuPG: >>>>>>>> Entering s:GPGBufWritePre()
GnuPG: called autocommand for test
GnuPG: <<<<<<<< Leaving s:GPGBufWritePre()
GnuPG: >>>>>>>> Entering s:GPGInit(0)
GnuPG: >>>>>>>> Entering s:GPGEncrypt()
GnuPG: encoding was "utf-8", switched to "utf-8"
GnuPG: >>>>>>>> Entering s:GPGCheckRecipients()
GnuPG: >>>>>>>> Entering s:GPGNameToID()
GnuPG: command: LANG=C LC_ALL=C gpg --trust-model always --use-agent --quiet --with-colons --fixed-list-mode --list-keys '3EEF6EB3' 2>/dev/null
GnuPG: output: tru:t:1:1476882324:1539605373:3:1:5^@
GnuPG: <<<<<<<< Leaving s:GPGNameToID()
GnuPG: recipients are: []
GnuPG: unknown recipients are: ['3EEF6EB3']
GnuPG: <<<<<<<< Leaving s:GPGCheckRecipients()
GnuPG: command: '[,']w !LANG=C LC_ALL=C gpg --trust-model always --use-agent --quiet --no-encrypt-to --encrypt --armor >'/tmp/vugJczh/7' 2>/dev/null
GnuPG: restored encoding "utf-8"
GnuPG: <<<<<<<< Leaving s:GPGEncrypt()
GnuPG: >>>>>>>> Entering s:GPGCleanup()
GnuPG: <<<<<<<< Leaving s:GPGCleanup()
This is the interesting part:
GnuPG: command: LANG=C LC_ALL=C gpg --trust-model always --use-agent --quiet --with-colons --fixed-list-mode --list-keys '3EEF6EB3' 2>/dev/null
GnuPG: output: tru:t:1:1476882324:1539605373:3:1:5^@
Typically, we see more than a single line here. There should be uids and subkeys listed, which is what is used to find the user(s) you're trying to encrypt to. What happens when you run
LANG=C LC_ALL=C gpg --trust-model always --use-agent --quiet --with-colons --fixed-list-mode --list-keys '3EEF6EB3'
from your shell?
this is what happens:
$ LANG=C LC_ALL=C gpg --trust-model always --use-agent --quiet --with-colons --fixed-list-mode --list-keys '3EEF6EB3'
tru:t:1:1476882324:1539605373:3:1:5
pub:-:4096:1:5BD2E5B23EEF6EB3:1476533373:1539605373::u:::scaESCA:::::::
uid:-::::1476534369::2792EB23E321DEBA79C18AE98C34EE3561ED690F::Dirk Willrodt <willrodt@zbh.uni-hamburg.de>:::::::::
uid:-::::1476534350::1D0CFE38BE1590A1E37D9E7CE3F06AE07F207157::Dirk Willrodt <dirk@willrodt.name>:::::::::
uid:-::::1476534337::754D89DCD778DC5F6F9484E2F664CEC7BA3EA16C::Dirk Willrodt <dwillrodt@web.de>:::::::::
uid:-::::1476533373::F3E45603BB1D4193E1B22D90D5CC3E3A9ECBCF8F::Dirk Willrodt <garonenur@googlemail.com>:::::::::
sub:-:4096:1:05EBF1501D7137DB:1476533373:1539605373:::::e::::::
so, I get the machine readable output.
could there be a problem with multiple uids per key? the last one I used with vim-gnupg had only one uid.
could there be a problem with multiple uids per key? the last one I used with vim-gnupg had only one uid.
No, that's handled fine. I have multiple uids on my key.
Is there any difference if you run the command with 2>/dev/null
on the end? Everything should be written to stdout, but maybe part of it is being written to stderr for you.
output is the same. nothing gets printed to stderr
Hmm, this is strange. Vim should be getting the same information, then.
I updated gnupg, and I'm getting the same message. My public key lists like this: pub dsa1024 2009-09-08 [SC] B3B54A9FADA5DE58DBBF9EE044EB9A2F5B660046 uid [ultimate] Clifford Heath clifford.heath@gmail.com sub elg2048 2009-09-08 [E]
and instead of the primary key it's using the sub-key ID (not shown above) of the el-gamal. The command being run (from debug.txt as noted) is
gpg --trust-model always --verbose --decrypt --list-only --dry-run --batch --logger-fd 1 file.gpg
and that says:
gpg: public key is A0A5F0F8886FEA91
gpg: using subkey A0A5F0F8886FEA91 instead of primary key 44EB9A2F5B660046
gpg: encrypted with 2048-bit ELG key, ID A0A5F0F8886FEA91, created 2009-09-08
When saving, it complains that A0A5F0F8886FEA91 doesn't exist and requires that I enter a recipient ID. I would very much appreciate a fix for this.
Also, I deleted the --no-use-agent options, as they're deprecated and non-functional now.
Forget all I said. I wasn't using the most recent release, which works ok. Thing to find out after I fixed the old one :)
@Garonenur Is it fixed for you too, if you update vim-gnupg?
hi, sorry - I'm not using gnupg anymore and have no time to test this right now.
I ran into this as well and ended up confirming that the issue for me was vim-gnupg stripping public keys down to 8 characters. I went to make the change and send a PR and noticed the code was different on github than on vim.org. I started installing vim-gnupg from github instead and the issue had already been fixed. Just updated my vimrc to
" Deleted Plugin 'gnupg'
Plugin 'jamessan/vim-gnupg'
Is the vim.org one supposed to be used at all? I assumed it was the master source because it has the more complete README.
I went to make the change and send a PR and noticed the code was different on github than on vim.org.
There are two version of gnupg.vim on vim.org -- the original and mine. I took over maintenance when Markus stopped having time to look after it.
My version is in sync with vim.org. When I tag a new release, I upload it to vim.org.
This is still a problem on the latest master version.
Debug clearly shows a valid key being outputted by GPG but the GPGNameToID function is ignoring it.
UPDATE: This SO answer fixed the problem. This appears to be a GnuPG issue and not a vim-gnupg issue.
Debug clearly shows a valid key being outputted by GPG but the GPGNameToID function is ignoring it.
Can you show this debug output? I'd like to see if there's a way I can provide better feedback in this situation.
Shoot I can't get the output now that I fixed the expired sub-key.
It is a situation where the public key is not expired but a sub-key (ssb) is. I can't recall if the debug output showed that scenario or not.
after creating a new key, I get "no such user ID" for all keys in my keyring, I tried using the email addresses and the short fingerprints as ID - no luck. Any Idea what causes this?