kbpgp icon indicating copy to clipboard operation
kbpgp copied to clipboard

figuring out which keymanager was used from the keyring when unboxing/decrypting

Open sverkoye opened this issue 9 years ago • 3 comments

I'm working with your example at: https://keybase.io/kbpgp/docs/decrypting

There you show how to figure out who signed the message. Could you also indicate how we can see which keymanager in the keyring was actually used to perform successful decryption? I'm in the scenario where I have multiple priv/pub key pairs in my keyring that might "receive" encrypted messages.

Thanks

sverkoye avatar Mar 02 '15 12:03 sverkoye

By my read of the code, unbox should callback with 4 arguments:

cb err, literals, warnings, esk

The fourth parameter is the "encryption subkey" used for decryption. Give that a shot and let me know if it's useful. If so, we'll update the docs.

Thanks.

maxtaco avatar Mar 02 '15 13:03 maxtaco

Thanks, I did not see that one. esk will certainly help there.

It was not immediately clear for me how to go from the subkey to the parent keymanager. But after fiddling around I did something like this:

  1. when constructing the key ring add a parent_key property to the subkeys to hold the parent keymanager
  2. then use esk.parent_key

If you now of a better or cleaner way, please let me know.

Thanks

sverkoye avatar Mar 02 '15 14:03 sverkoye

I think this is currently the best way, but I'll make a note to come up with something better.

maxtaco avatar Mar 03 '15 15:03 maxtaco