1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* pubkey-enc.c (get_session_key): With hidden recipients or try a given

passphrase against all secret keys rather than trying all secret keys in
turn.  Don't if --try-all-secrets or --status-fd is enabled.

* passphrase.c (passphrase_to_dek): Mode 1 means do a regular passphrase
query, but don't prompt with the key info.

* seckey-cert.c (do_check, check_secret_key): A negative ask count means
to enable passphrase mode 1.

* keydb.h, getkey.c (enum_secret_keys): Add flag to include
secret-parts-missing keys (or not) in the list.
This commit is contained in:
David Shaw 2002-11-06 16:58:28 +00:00
parent ec0d9a416e
commit 3cb4118b6c
6 changed files with 57 additions and 13 deletions

View file

@ -2286,6 +2286,9 @@ lookup( GETKEY_CTX ctx, KBNODE *ret_keyblock, int secmode )
* b) to get the ultimately trusted keys.
* The a) usage might have some problems.
*
* set with_subkeys true to include subkeys
* set with_spm true to include secret-parts-missing keys
*
* Enumerate all primary secret keys. Caller must use these procedure:
* 1) create a void pointer and initialize it to NULL
* 2) pass this void pointer by reference to this function
@ -2296,7 +2299,8 @@ lookup( GETKEY_CTX ctx, KBNODE *ret_keyblock, int secmode )
* so that can free it's context.
*/
int
enum_secret_keys( void **context, PKT_secret_key *sk, int with_subkeys )
enum_secret_keys( void **context, PKT_secret_key *sk,
int with_subkeys, int with_spm )
{
int rc=0;
struct {
@ -2331,9 +2335,11 @@ enum_secret_keys( void **context, PKT_secret_key *sk, int with_subkeys )
do {
/* get the next secret key from the current keyblock */
for (; c->node; c->node = c->node->next) {
if (c->node->pkt->pkttype == PKT_SECRET_KEY
if ((c->node->pkt->pkttype == PKT_SECRET_KEY
|| (with_subkeys
&& c->node->pkt->pkttype == PKT_SECRET_SUBKEY) ) {
&& c->node->pkt->pkttype == PKT_SECRET_SUBKEY) )
&& !(c->node->pkt->pkt.secret_key->protect.s2k.mode==1001
&& !with_spm)) {
copy_secret_key (sk, c->node->pkt->pkt.secret_key );
c->node = c->node->next;
return 0; /* found */