diff options
Diffstat (limited to '')
-rw-r--r-- | g10/getkey.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/g10/getkey.c b/g10/getkey.c index dd72f6df0..b528ed782 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -323,6 +323,8 @@ get_pubkey_byname( PKT_public_cert *pkc, const char *name ) int i; char buf[9]; + if( *s == '0' && s[1] == 'x' && isxdigit(s[2]) ) + s += 2; /*kludge to allow 0x034343434 */ for(i=0; isxdigit(s[i]); i++ ) ; if( s[i] && !isspace(s[i]) ) /* not terminated by EOS or blank*/ @@ -419,6 +421,33 @@ get_seckey( PKT_secret_cert *skc, u32 *keyid ) } /**************** + * Check wether the secret key is available + * Returns: 0 := key is available + * G10ERR_NO_SECKEY := not availabe + */ +int +seckey_available( u32 *keyid ) +{ + PKT_secret_cert *skc; + STRLIST sl; + int rc=0; + + skc = m_alloc_clear( sizeof *skc ); + for(sl = secret_keyrings; sl; sl = sl->next ) + if( !(rc=scan_secret_keyring( skc, keyid, NULL, sl->d )) ) + goto found; + /* fixme: look at other places */ + goto leave; + + found: + leave: + free_secret_cert( skc ); + return rc; +} + + + +/**************** * Get a secret key by name and store it into skc * If NAME is NULL use the default certificate */ |