mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-17 14:07:03 +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 \
|
certdump.c \
|
||||||
certcheck.c \
|
certcheck.c \
|
||||||
certpath.c \
|
certpath.c \
|
||||||
|
keylist.c \
|
||||||
verify.c \
|
verify.c \
|
||||||
import.c
|
import.c
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "gpgsm.h"
|
#include "gpgsm.h"
|
||||||
|
|
||||||
/* Return the fingerprint of the certificate (we can't put this into
|
/* 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
|
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
|
allocates the array. If r_len is not NULL, the length of the
|
||||||
digest is return, well, this can also be done by using
|
digest is return, well, this can also be done by using
|
||||||
|
@ -730,7 +730,7 @@ main ( int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case oWithKeyData: opt.with_key_data=1; /* fall thru */
|
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;
|
case oSkipVerify: opt.skip_verify=1; break;
|
||||||
|
|
||||||
@ -969,10 +969,9 @@ main ( int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case aListKeys:
|
case aListKeys:
|
||||||
sl = NULL;
|
for (sl=NULL; argc; argc--, argv++)
|
||||||
for ( ; argc; argc--, argv++ )
|
|
||||||
add_to_strlist (&sl, *argv);
|
add_to_strlist (&sl, *argv);
|
||||||
/* public_key_list( sl ); */
|
gpgsm_list_keys (&ctrl, sl, stdout);
|
||||||
free_strlist(sl);
|
free_strlist(sl);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -130,7 +130,6 @@ struct {
|
|||||||
const char *homedir; /* configuration directory name */
|
const char *homedir; /* configuration directory name */
|
||||||
char *outfile; /* name of output file */
|
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 with_key_data;/* include raw key in the column delimted output */
|
||||||
|
|
||||||
int fingerprint; /* list fingerprints in all key listings */
|
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 no_server; /* we are not running under server control */
|
||||||
int status_fd; /* only for non-server mode */
|
int status_fd; /* only for non-server mode */
|
||||||
struct server_local_s *server_local;
|
struct server_local_s *server_local;
|
||||||
|
int with_colons; /* use column delimited output format */
|
||||||
};
|
};
|
||||||
typedef struct server_control_s *CTRL;
|
typedef struct server_control_s *CTRL;
|
||||||
|
|
||||||
@ -204,7 +204,8 @@ int gpgsm_check_cms_signature (KsbaCert cert, const char *sigval,
|
|||||||
/*-- certpath.c --*/
|
/*-- certpath.c --*/
|
||||||
int gpgsm_validate_path (KsbaCert cert);
|
int gpgsm_validate_path (KsbaCert cert);
|
||||||
|
|
||||||
|
/*-- keylist.c --*/
|
||||||
|
void gpgsm_list_keys (CTRL ctrl, STRLIST names, FILE *fp);
|
||||||
|
|
||||||
|
|
||||||
/*-- import.c --*/
|
/*-- import.c --*/
|
||||||
|
14
sm/server.c
14
sm/server.c
@ -185,6 +185,19 @@ cmd_message (ASSUAN_CONTEXT ctx, char *line)
|
|||||||
return 0;
|
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_INPUT, NULL },
|
||||||
{ "", ASSUAN_CMD_OUTPUT, NULL },
|
{ "", ASSUAN_CMD_OUTPUT, NULL },
|
||||||
{ "MESSAGE", 0, cmd_message },
|
{ "MESSAGE", 0, cmd_message },
|
||||||
|
{ "LISTKEYS", 0, cmd_listkeys },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
int i, j, rc;
|
int i, j, rc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user