exaexa / codecrypt

Post-quantum cryptography tool (THIS REPOSITORY IS ONLY A MIRROR OF THE MAIN ONE, PLEASE DO NOT FILE BUGS HERE)
https://gitea.blesmrt.net/exa/codecrypt
GNU Lesser General Public License v3.0
307 stars 41 forks source link

error: ambiguous local user specified #20

Closed StrangeTcy closed 7 years ago

StrangeTcy commented 7 years ago

On Ubuntu 16.04 x64, whenever I try to both sign and encrypt a file for myself, this error occurs. Meanwhile, just encrypting works perfectly.

exaexa commented 7 years ago

Please specify a minimal way to reproduce the problem, starting with empty CCR_DIR (or show previous content of your keyring using ccr -k).

StrangeTcy commented 7 years ago
ccr -k
pubkey  MCEQCMDPC128FO-CUBE256-CHACHA20 @45b49c4998464601ddcae2...  Enoch Root
pubkey  MCEQCMDPC128FO-CUBE256-CHACHA20 @4aa4b7135acea7a9ca8c55...  Enoch Root
pubkey  FMTSEQ256C-CUBE512-CUBE256  @4d388e9ef771f652ae6cb3...  Enoch Root
pubkey  FMTSEQ128C-CUBE256-CUBE128  @749d25259e5cda42dda3be...  Enoch Root
pubkey  FMTSEQ256C-CUBE512-CUBE256  @d1038d900bc4a3ffd7271c...  Enoch_Root_strong
pubkey  MCEQCMDPC256FO-CUBE512-CHACHA20 @d86d1b0198fd0f0a92e187...  Enoch_Root_strong
pubkey  MCEQCMDPC256FO-CUBE512-CHACHA20 @fc07388afaf5e58ca628cb...  Enoch Root
pubkey  MCEQCMDPC256FO-CUBE512-CHACHA20 @48e8ce82311a69cefcdc45...  Naum
pubkey  FMTSEQ256C-CUBE512-CUBE256  @6d6f76e20d41d5bd19cf14...  Naum
pubkey  FMTSEQ256C-CUBE512-CUBE256  @b9fa1b220a5ce80ed2fe98...  Chiffa
pubkey  MCEQCMDPC256FO-CUBE512-CHACHA20 @d411abcef86c29e80bbb4f...  Chiffa

ccr --armor --sign --encrypt --recipient @d86d1b0198fd0f0a92e187 --in hpmor.pdf --out hpmor.pdf.pqcrypt
error: ambiguous local user specified
exaexa commented 7 years ago

and ccr -K ?

It seems you have one of your public keys imported both in keypairs and in public keys storage. (note CCR doesn't store private keys alone without public counterparts, because pubkey derivation is sometimes costly).

I guess you also have a full keypair of key @d86d1b019 (you can see it in ccr --list-secret or -K), if so, you can delete the unnecessary copy of the publickey by ccr -x @d86d1b019 and -se/-dv should work just right after that.

If that's the case, I will add some warning for users trying to import pubkeys from keypairs they already have.

If not, it's probably a bug (and I'll probably require some debug information for fixing that).

StrangeTcy commented 7 years ago
ccr -K
keypair MCEQCMDPC128FO-CUBE256-CHACHA20 @45b49c4998464601ddcae2...  Enoch Root
keypair MCEQCMDPC128FO-CUBE256-CHACHA20 @4aa4b7135acea7a9ca8c55...  Enoch Root
keypair FMTSEQ256C-CUBE512-CUBE256  @4d388e9ef771f652ae6cb3...  Enoch Root
keypair FMTSEQ128C-CUBE256-CUBE128  @749d25259e5cda42dda3be...  Enoch Root
keypair FMTSEQ256C-CUBE512-CUBE256  @d1038d900bc4a3ffd7271c...  Enoch_Root_strong
keypair MCEQCMDPC256FO-CUBE512-CHACHA20 @d86d1b0198fd0f0a92e187...  Enoch_Root_strong
keypair MCEQCMDPC256FO-CUBE512-CHACHA20 @fc07388afaf5e58ca628cb...  Enoch Root

ccr -x @d86d1b019
no such key

ccr -x @d86d1b0198fd0f0a92e187
no such key

Now I'm confused.

exaexa commented 7 years ago

Oh sorry, forget about my previous comment, my bad --- it's probably a whole lot simpler. :grin:

It seems you have multiple local signature keys available. Codecrypt can't therefore decide which one it will use for the actual signature, and you need to specify a single one using e.g. -u @d1038d900bc4.

I should make the error message a bit more explanative, or enable some "default choice" logic.

StrangeTcy commented 7 years ago

Yep, that worked. Thanks!

exaexa commented 7 years ago

I guess you can also rename your keys a bit so that the specifications can get a bit less cumbersome than -u @1234123432141234. Btw if you can think of some good method to specify or automatically select the default key for signatures, let me know.

StrangeTcy commented 7 years ago

My immediate idea: prompt the user upon creation of the encryption keypair. Something like "would you like to create a signing pair with the same user name?". And then, when the user wants to both encrypt and sign, use the signing key with the same user name. But I'm no expert.

exaexa commented 7 years ago

some defaulting seems handy. Putting that to TODO.