aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2002-11-06 16:58:28 +0000
committerDavid Shaw <[email protected]>2002-11-06 16:58:28 +0000
commit3cb4118b6c9c55d874d7dd463600d792f1fdd266 (patch)
treee5ce983b4d2a340792aab3f87433f237f950310e /g10/getkey.c
parent* gpgkeys_ldap.c (key_in_keylist, add_key_to_keylist, free_keylist, (diff)
downloadgnupg-3cb4118b6c9c55d874d7dd463600d792f1fdd266.tar.gz
gnupg-3cb4118b6c9c55d874d7dd463600d792f1fdd266.zip
* 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.
Diffstat (limited to '')
-rw-r--r--g10/getkey.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 991b98d2f..6214d8b54 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -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 */