aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1997-12-12 12:03:58 +0000
committerWerner Koch <[email protected]>1997-12-12 12:03:58 +0000
commit68ea0f43533096d5c46bad4aee6e5d5864307f4a (patch)
treef5d3601897a3bdfbce113d5e1ed8b4336c83744a /g10/getkey.c
parentfingerprints and self signatures added (diff)
downloadgnupg-68ea0f43533096d5c46bad4aee6e5d5864307f4a.tar.gz
gnupg-68ea0f43533096d5c46bad4aee6e5d5864307f4a.zip
added option file handling
Diffstat (limited to 'g10/getkey.c')
-rw-r--r--g10/getkey.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index c7ea1686a..b079cca19 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -52,6 +52,7 @@ typedef struct pkc_cache_entry {
} *pkc_cache_entry_t;
static STRLIST keyrings;
+static STRLIST secret_keyrings;
static keyid_list_t unknown_keyids;
static user_id_db_t user_id_db;
@@ -69,6 +70,7 @@ void
add_keyring( const char *name )
{
STRLIST sl;
+ int rc;
/* FIXME: check wether this one is available etc */
/* my be we should do this later */
@@ -76,6 +78,28 @@ add_keyring( const char *name )
strcpy(sl->d, name );
sl->next = keyrings;
keyrings = sl;
+
+ /* FIXME: We should remove much out of this mpdule and
+ * combine it with the keyblock stuff from ringedit.c
+ * For now we will simple add the filename as keyblock resource
+ */
+ rc = add_keyblock_resource( name );
+ if( rc )
+ log_error("keyblock resource '%s': %s\n", name, rc );
+}
+
+void
+add_secret_keyring( const char *name )
+{
+ STRLIST sl;
+ int rc;
+
+ /* FIXME: check wether this one is available etc */
+ /* my be we should do this later */
+ sl = m_alloc( sizeof *sl + strlen(name) );
+ strcpy(sl->d, name );
+ sl->next = secret_keyrings;
+ secret_keyrings = sl;
}
@@ -255,10 +279,12 @@ get_pubkey_by_name( PKT_public_cert *pkc, const char *name )
int
get_seckey( PKT_secret_cert *skc, u32 *keyid )
{
+ STRLIST sl;
int rc=0;
- if( !(rc=scan_secret_keyring( skc, keyid, NULL, "../keys/secring.g10" ) ) )
- goto found;
+ 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;
@@ -280,10 +306,12 @@ get_seckey( PKT_secret_cert *skc, u32 *keyid )
int
get_seckey_by_name( PKT_secret_cert *skc, const char *name )
{
+ STRLIST sl;
int rc=0;
- if( !(rc=scan_secret_keyring( skc, NULL, name, "../keys/secring.g10" ) ) )
- goto found;
+ for(sl = secret_keyrings; sl; sl = sl->next )
+ if( !(rc=scan_secret_keyring( skc, NULL, name, sl->d ) ) )
+ goto found;
/* fixme: look at other places */
goto leave;