rnpgp / rnp

RNP: high performance C++ OpenPGP library used by Mozilla Thunderbird
https://www.rnpgp.org
Other
194 stars 55 forks source link

kr-def-key parameter ignored #1075

Closed rrrooommmaaa closed 4 years ago

rrrooommmaaa commented 4 years ago

Description

I would expect to sign (or do some other operation) with default key if the key is not specified for the operation. However, kr-def-key configuration value never gets to cli_rnp_t.defkey field.

Steps to Reproduce

???

Expected Behavior

Value from CFG_KR_DEF_KEY should go to cli_rnp_t.defkey

Actual Behavior

Value from CFG_KR_DEF_KEY is never used. Always trying to use the first key in the keystore.

ni4 commented 4 years ago

@rrrooommmaaa actually kr-def-key is not a command line parameter, but some internal variable which is set based on keyring configuration. In most cases it would pick up the first key in the keyring, however may also parse GnuPG config via conffile() function.

rrrooommmaaa commented 4 years ago

@ni4 Anyway, it is set in rnp_cfg_set_defkey and never read afterwards. Where is it supposed to be read?

ni4 commented 4 years ago

@rrrooommmaaa Okay, now it's an issue :) Probably it was lost somewhere during the CLI->FFI transition.

rrrooommmaaa commented 4 years ago

@ni4 I have re-worded the issue.

ni4 commented 4 years ago

@rrrooommmaaa Did you start working on this issue? I plan to introduce some changes which may have impact on it (make rnp_cfg_t field of rnp_cli_t structure, so we'll not pass two structures as parameters). Then it would be logical to replace rnp->defkey with rnp_cfg_getstr(rnp_cli_get_cfg(rnp), CFG_KR_DEF_KEY)).

rrrooommmaaa commented 4 years ago

I haven't yet. Feel free to re-assign. @ni4

ni4 commented 4 years ago

Ok, thanks!