mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
Added basic code for keylisting.
New Assuan command LISTKEYS.
This commit is contained in:
parent
ff1ba2fdc7
commit
a413066de1
@ -34,6 +34,7 @@ gpgsm_SOURCES = \
|
||||
certdump.c \
|
||||
certcheck.c \
|
||||
certpath.c \
|
||||
keylist.c \
|
||||
verify.c \
|
||||
import.c
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "gpgsm.h"
|
||||
|
||||
/* Return the fingerprint of the certificate (we can't put this into
|
||||
libksba becuase we need libgcrypt support). The caller must
|
||||
libksba because we need libgcrypt support). The caller must
|
||||
provide an array of sufficient length or NULL so that the function
|
||||
allocates the array. If r_len is not NULL, the length of the
|
||||
digest is return, well, this can also be done by using
|
||||
|
@ -730,7 +730,7 @@ main ( int argc, char **argv)
|
||||
break;
|
||||
|
||||
case oWithKeyData: opt.with_key_data=1; /* fall thru */
|
||||
case oWithColons: opt.with_colons=':'; break;
|
||||
case oWithColons: ctrl.with_colons = 1; break;
|
||||
|
||||
case oSkipVerify: opt.skip_verify=1; break;
|
||||
|
||||
@ -969,10 +969,9 @@ main ( int argc, char **argv)
|
||||
break;
|
||||
|
||||
case aListKeys:
|
||||
sl = NULL;
|
||||
for ( ; argc; argc--, argv++ )
|
||||
for (sl=NULL; argc; argc--, argv++)
|
||||
add_to_strlist (&sl, *argv);
|
||||
/* public_key_list( sl ); */
|
||||
gpgsm_list_keys (&ctrl, sl, stdout);
|
||||
free_strlist(sl);
|
||||
break;
|
||||
|
||||
|
@ -130,7 +130,6 @@ struct {
|
||||
const char *homedir; /* configuration directory name */
|
||||
char *outfile; /* name of output file */
|
||||
|
||||
int with_colons; /* use column delimited output format */
|
||||
int with_key_data;/* include raw key in the column delimted output */
|
||||
|
||||
int fingerprint; /* list fingerprints in all key listings */
|
||||
@ -176,6 +175,7 @@ struct server_control_s {
|
||||
int no_server; /* we are not running under server control */
|
||||
int status_fd; /* only for non-server mode */
|
||||
struct server_local_s *server_local;
|
||||
int with_colons; /* use column delimited output format */
|
||||
};
|
||||
typedef struct server_control_s *CTRL;
|
||||
|
||||
@ -204,7 +204,8 @@ int gpgsm_check_cms_signature (KsbaCert cert, const char *sigval,
|
||||
/*-- certpath.c --*/
|
||||
int gpgsm_validate_path (KsbaCert cert);
|
||||
|
||||
|
||||
/*-- keylist.c --*/
|
||||
void gpgsm_list_keys (CTRL ctrl, STRLIST names, FILE *fp);
|
||||
|
||||
|
||||
/*-- import.c --*/
|
||||
|
14
sm/server.c
14
sm/server.c
@ -185,6 +185,19 @@ cmd_message (ASSUAN_CONTEXT ctx, char *line)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
cmd_listkeys (ASSUAN_CONTEXT ctx, char *line)
|
||||
{
|
||||
CTRL ctrl = assuan_get_pointer (ctx);
|
||||
|
||||
ctrl->with_colons = 1;
|
||||
/* fixme: check that the returned data_fp is not NULL */
|
||||
gpgsm_list_keys (assuan_get_pointer (ctx), NULL, assuan_get_data_fp (ctx));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -206,6 +219,7 @@ register_commands (ASSUAN_CONTEXT ctx)
|
||||
{ "", ASSUAN_CMD_INPUT, NULL },
|
||||
{ "", ASSUAN_CMD_OUTPUT, NULL },
|
||||
{ "MESSAGE", 0, cmd_message },
|
||||
{ "LISTKEYS", 0, cmd_listkeys },
|
||||
{ NULL }
|
||||
};
|
||||
int i, j, rc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user