doc/
2002-01-31 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Generating Keys): Document error at creation failure. gpgme/ 2002-01-31 Marcus Brinkmann <marcus@g10code.de> * rungpg.h: Add STATUS_KEY_CREATED. * progress.c: New file. * Makefile.am (libgpgme_la_SOURCES): Add progress.c. * genkey.c (genkey_status_handler): Use _gpgme_progress_status_handler. Add check for status. (struct genkey_result_s): New structure. (_gpgme_release_genkey_result): New function. (gpgme_op_genkey): Check for error. * gpgme.c (_gpgme_release_result): Call _gpgme_release_genkey_result. * ops.h (_gpgme_release_genkey_result): Add prototype. * types.h (GenKeyResult): New type. * context.h (gpgme_context_s): Add GenKeyResult to member result.
This commit is contained in:
parent
ca5e3a09e3
commit
129da707d1
4
TODO
4
TODO
@ -35,7 +35,9 @@
|
|||||||
(it's an internal error, as select_protocol checks already).
|
(it's an internal error, as select_protocol checks already).
|
||||||
|
|
||||||
* Operations
|
* Operations
|
||||||
** Import, export, genkey, delete status handler need much more work.
|
** Export status handler need much more work.
|
||||||
|
** Import should return a useful error when one happened.
|
||||||
|
** Genkey should return something more useful than General_Error.
|
||||||
|
|
||||||
* Error Values
|
* Error Values
|
||||||
** Map ASSUAN error values.
|
** Map ASSUAN error values.
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2002-01-31 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* gpgme.texi (Generating Keys): Document error at creation
|
||||||
|
failure.
|
||||||
|
|
||||||
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* gpgme.texi (Deleting Keys): Document new error values.
|
* gpgme.texi (Deleting Keys): Document new error values.
|
||||||
|
@ -1472,8 +1472,9 @@ allowed.
|
|||||||
|
|
||||||
The function returns @code{GPGME_No_Error} if the operation could be
|
The function returns @code{GPGME_No_Error} if the operation could be
|
||||||
started successfully, @code{GPGME_Invalid_Value} if @var{parms} is not
|
started successfully, @code{GPGME_Invalid_Value} if @var{parms} is not
|
||||||
a valid XML string, and @code{GPGME_Not_Supported} if @var{pubkey} or
|
a valid XML string, @code{GPGME_Not_Supported} if @var{pubkey} or
|
||||||
@var{seckey} is not @code{NULL}.
|
@var{seckey} is not @code{NULL}, and @code{GPGME_General_Error} if no
|
||||||
|
key was created by the backend.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@deftypefun GpgmeError gpgme_op_genkey_start (@w{GpgmeCtx @var{ctx}}, @w{const char *@var{parms}}, @w{GpgmeData @var{pubkey}}, @w{GpgmeData @var{seckey}})
|
@deftypefun GpgmeError gpgme_op_genkey_start (@w{GpgmeCtx @var{ctx}}, @w{const char *@var{parms}}, @w{GpgmeData @var{pubkey}}, @w{GpgmeData @var{seckey}})
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
2002-01-31 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* rungpg.h: Add STATUS_KEY_CREATED.
|
||||||
|
|
||||||
|
* progress.c: New file.
|
||||||
|
* Makefile.am (libgpgme_la_SOURCES): Add progress.c.
|
||||||
|
|
||||||
|
* genkey.c (genkey_status_handler): Use
|
||||||
|
_gpgme_progress_status_handler. Add check for status.
|
||||||
|
(struct genkey_result_s): New structure.
|
||||||
|
(_gpgme_release_genkey_result): New function.
|
||||||
|
(gpgme_op_genkey): Check for error.
|
||||||
|
* gpgme.c (_gpgme_release_result): Call
|
||||||
|
_gpgme_release_genkey_result.
|
||||||
|
* ops.h (_gpgme_release_genkey_result): Add prototype.
|
||||||
|
* types.h (GenKeyResult): New type.
|
||||||
|
* context.h (gpgme_context_s): Add GenKeyResult to member result.
|
||||||
|
|
||||||
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* gpgme.c (_gpgme_release_result): Call
|
* gpgme.c (_gpgme_release_result): Call
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Copyright (C) 2000 Werner Koch (dd9jn)
|
# Copyright (C) 2000 Werner Koch (dd9jn)
|
||||||
# Copyright (C) 2001 g10 Code GmbH
|
# Copyright (C) 2001, 2002 g10 Code GmbH
|
||||||
#
|
#
|
||||||
# This file is part of GPGME.
|
# This file is part of GPGME.
|
||||||
#
|
#
|
||||||
@ -46,6 +46,7 @@ libgpgme_la_SOURCES = \
|
|||||||
verify.c \
|
verify.c \
|
||||||
sign.c \
|
sign.c \
|
||||||
passphrase.c \
|
passphrase.c \
|
||||||
|
progress.c \
|
||||||
key.c key.h \
|
key.c key.h \
|
||||||
keylist.c \
|
keylist.c \
|
||||||
trustlist.c \
|
trustlist.c \
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* context.h
|
/* context.h
|
||||||
* Copyright (C) 2000 Werner Koch (dd9jn)
|
* Copyright (C) 2000 Werner Koch (dd9jn)
|
||||||
* Copyright (C) 2001 g10 Code GmbH
|
* Copyright (C) 2001, 2002 g10 Code GmbH
|
||||||
*
|
*
|
||||||
* This file is part of GPGME.
|
* This file is part of GPGME.
|
||||||
*
|
*
|
||||||
@ -70,6 +70,7 @@ struct gpgme_context_s {
|
|||||||
PassphraseResult passphrase;
|
PassphraseResult passphrase;
|
||||||
ImportResult import;
|
ImportResult import;
|
||||||
DeleteResult delete;
|
DeleteResult delete;
|
||||||
|
GenKeyResult genkey;
|
||||||
} result;
|
} result;
|
||||||
|
|
||||||
GpgmeData notation; /* last signature notation */
|
GpgmeData notation; /* last signature notation */
|
||||||
@ -136,9 +137,4 @@ struct gpgme_recipients_s {
|
|||||||
gpgme_wait ((c), 1); \
|
gpgme_wait ((c), 1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONTEXT_H */
|
#endif /* CONTEXT_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* delete.c - delete a key
|
/* delete.c - delete a key
|
||||||
* Copyright (C) 2001 g10 Code GmbH
|
* Copyright (C) 2001, 2002 g10 Code GmbH
|
||||||
*
|
*
|
||||||
* This file is part of GPGME.
|
* This file is part of GPGME.
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* genkey.c - key generation
|
/* genkey.c - key generation
|
||||||
* Copyright (C) 2000 Werner Koch (dd9jn)
|
* Copyright (C) 2000 Werner Koch (dd9jn)
|
||||||
* Copyright (C) 2001 g10 Code GmbH
|
* Copyright (C) 2001, 2002 g10 Code GmbH
|
||||||
*
|
*
|
||||||
* This file is part of GPGME.
|
* This file is part of GPGME.
|
||||||
*
|
*
|
||||||
@ -29,39 +29,55 @@
|
|||||||
#include "context.h"
|
#include "context.h"
|
||||||
#include "ops.h"
|
#include "ops.h"
|
||||||
|
|
||||||
static void
|
|
||||||
genkey_status_handler ( GpgmeCtx ctx, GpgStatusCode code, char *args )
|
struct genkey_result_s
|
||||||
{
|
{
|
||||||
if ( code == STATUS_PROGRESS && *args ) {
|
int created_primary : 1;
|
||||||
if (ctx->progress_cb) {
|
int created_sub : 1;
|
||||||
char *p;
|
};
|
||||||
int type=0, current=0, total=0;
|
|
||||||
|
|
||||||
if ( (p = strchr (args, ' ')) ) {
|
void
|
||||||
*p++ = 0;
|
_gpgme_release_genkey_result (GenKeyResult result)
|
||||||
if (*p) {
|
{
|
||||||
type = *(byte*)p;
|
if (!result)
|
||||||
if ( (p = strchr (p+1, ' ')) ) {
|
return;
|
||||||
*p++ = 0;
|
xfree (result);
|
||||||
if (*p) {
|
}
|
||||||
current = atoi (p);
|
|
||||||
if ( (p = strchr (p+1, ' ')) ) {
|
static void
|
||||||
*p++ = 0;
|
genkey_status_handler (GpgmeCtx ctx, GpgStatusCode code, char *args)
|
||||||
total = atoi (p);
|
{
|
||||||
}
|
_gpgme_progress_status_handler (ctx, code, args);
|
||||||
}
|
|
||||||
}
|
if (ctx->out_of_core)
|
||||||
}
|
return;
|
||||||
}
|
|
||||||
if ( type != 'X' )
|
if (!ctx->result.genkey)
|
||||||
ctx->progress_cb ( ctx->progress_cb_value, args, type,
|
{
|
||||||
current, total );
|
ctx->result.genkey = xtrycalloc (1, sizeof *ctx->result.genkey);
|
||||||
|
if (!ctx->result.genkey)
|
||||||
|
{
|
||||||
|
ctx->out_of_core = 1;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG2 ("genkey_status: code=%d args=`%s'\n", code, args );
|
switch (code)
|
||||||
/* FIXME: Need to do more */
|
{
|
||||||
|
case STATUS_KEY_CREATED:
|
||||||
|
if (args && *args)
|
||||||
|
{
|
||||||
|
if (*args == 'B' || *args == 'P')
|
||||||
|
ctx->result.genkey->created_primary = 1;
|
||||||
|
if (*args == 'B' || *args == 'S')
|
||||||
|
ctx->result.genkey->created_sub = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -189,6 +205,7 @@ gpgme_op_genkey_start (GpgmeCtx ctx, const char *parms,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gpgme_op_genkey:
|
* gpgme_op_genkey:
|
||||||
* @c: the context
|
* @c: the context
|
||||||
@ -209,11 +226,15 @@ gpgme_op_genkey (GpgmeCtx ctx, const char *parms,
|
|||||||
{
|
{
|
||||||
GpgmeError err = gpgme_op_genkey_start (ctx, parms, pubkey, seckey);
|
GpgmeError err = gpgme_op_genkey_start (ctx, parms, pubkey, seckey);
|
||||||
if (!err)
|
if (!err)
|
||||||
gpgme_wait (ctx, 1);
|
{
|
||||||
|
gpgme_wait (ctx, 1);
|
||||||
|
|
||||||
|
/* FIXME: Should return some more useful error value. */
|
||||||
|
if (!ctx->result.genkey)
|
||||||
|
err = mk_error (General_Error);
|
||||||
|
else if (!ctx->result.genkey->created_primary
|
||||||
|
&& !ctx->result.genkey->created_sub)
|
||||||
|
err = mk_error (General_Error);
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
* @r_ctx: Returns the new context
|
* @r_ctx: Returns the new context
|
||||||
*
|
*
|
||||||
* Create a new context to be used with most of the other GPGME
|
* Create a new context to be used with most of the other GPGME
|
||||||
* functions. Use gpgme_release_contect() to release all resources
|
* functions. Use gpgme_release_context() to release all resources
|
||||||
*
|
*
|
||||||
* Return value: An error code
|
* Return value: An error code
|
||||||
**/
|
**/
|
||||||
@ -88,6 +88,7 @@ _gpgme_release_result (GpgmeCtx ctx)
|
|||||||
_gpgme_release_passphrase_result (ctx->result.passphrase);
|
_gpgme_release_passphrase_result (ctx->result.passphrase);
|
||||||
_gpgme_release_import_result (ctx->result.import);
|
_gpgme_release_import_result (ctx->result.import);
|
||||||
_gpgme_release_delete_result (ctx->result.delete);
|
_gpgme_release_delete_result (ctx->result.delete);
|
||||||
|
_gpgme_release_genkey_result (ctx->result.genkey);
|
||||||
memset (&ctx->result, 0, sizeof (ctx->result));
|
memset (&ctx->result, 0, sizeof (ctx->result));
|
||||||
_gpgme_set_op_info (ctx, NULL);
|
_gpgme_set_op_info (ctx, NULL);
|
||||||
}
|
}
|
||||||
|
10
gpgme/ops.h
10
gpgme/ops.h
@ -1,6 +1,6 @@
|
|||||||
/* ops.h - internal operations stuff
|
/* ops.h - internal operations stuff
|
||||||
* Copyright (C) 2000 Werner Koch (dd9jn)
|
* Copyright (C) 2000 Werner Koch (dd9jn)
|
||||||
* Copyright (C) 2001 g10 Code GmbH
|
* Copyright (C) 2001, 2002 g10 Code GmbH
|
||||||
*
|
*
|
||||||
* This file is part of GPGME.
|
* This file is part of GPGME.
|
||||||
*
|
*
|
||||||
@ -95,15 +95,23 @@ void _gpgme_passphrase_status_handler (GpgmeCtx ctx, GpgStatusCode code,
|
|||||||
GpgmeError _gpgme_passphrase_start (GpgmeCtx ctx);
|
GpgmeError _gpgme_passphrase_start (GpgmeCtx ctx);
|
||||||
GpgmeError _gpgme_passphrase_result (GpgmeCtx ctx);
|
GpgmeError _gpgme_passphrase_result (GpgmeCtx ctx);
|
||||||
|
|
||||||
|
/*-- progress.c --*/
|
||||||
|
void _gpgme_progress_status_handler (GpgmeCtx ctx, GpgStatusCode code,
|
||||||
|
char *args);
|
||||||
|
|
||||||
/*-- import.c --*/
|
/*-- import.c --*/
|
||||||
void _gpgme_release_import_result (ImportResult res);
|
void _gpgme_release_import_result (ImportResult res);
|
||||||
|
|
||||||
/*-- delete.c --*/
|
/*-- delete.c --*/
|
||||||
void _gpgme_release_delete_result (DeleteResult res);
|
void _gpgme_release_delete_result (DeleteResult res);
|
||||||
|
|
||||||
|
/*-- genkey.c --*/
|
||||||
|
void _gpgme_release_genkey_result (GenKeyResult res);
|
||||||
|
|
||||||
/*-- version.c --*/
|
/*-- version.c --*/
|
||||||
const char *_gpgme_compare_versions (const char *my_version,
|
const char *_gpgme_compare_versions (const char *my_version,
|
||||||
const char *req_version);
|
const char *req_version);
|
||||||
char *_gpgme_get_program_version (const char *const path);
|
char *_gpgme_get_program_version (const char *const path);
|
||||||
|
|
||||||
|
|
||||||
#endif /* OPS_H */
|
#endif /* OPS_H */
|
||||||
|
@ -48,7 +48,6 @@ typedef enum {
|
|||||||
STATUS_SHM_GET_BOOL ,
|
STATUS_SHM_GET_BOOL ,
|
||||||
STATUS_SHM_GET_HIDDEN ,
|
STATUS_SHM_GET_HIDDEN ,
|
||||||
STATUS_NEED_PASSPHRASE ,
|
STATUS_NEED_PASSPHRASE ,
|
||||||
STATUS_USERID_HINT ,
|
|
||||||
STATUS_UNEXPECTED ,
|
STATUS_UNEXPECTED ,
|
||||||
STATUS_VALIDSIG ,
|
STATUS_VALIDSIG ,
|
||||||
STATUS_SIG_ID ,
|
STATUS_SIG_ID ,
|
||||||
@ -81,9 +80,11 @@ typedef enum {
|
|||||||
STATUS_GOT_IT ,
|
STATUS_GOT_IT ,
|
||||||
STATUS_PROGRESS ,
|
STATUS_PROGRESS ,
|
||||||
STATUS_SIG_CREATED ,
|
STATUS_SIG_CREATED ,
|
||||||
|
STATUS_KEY_CREATED ,
|
||||||
STATUS_SESSION_KEY ,
|
STATUS_SESSION_KEY ,
|
||||||
STATUS_NOTATION_NAME ,
|
STATUS_NOTATION_NAME ,
|
||||||
STATUS_NOTATION_DATA ,
|
STATUS_NOTATION_DATA ,
|
||||||
|
STATUS_USERID_HINT ,
|
||||||
STATUS_POLICY_URL ,
|
STATUS_POLICY_URL ,
|
||||||
STATUS_BEGIN_STREAM ,
|
STATUS_BEGIN_STREAM ,
|
||||||
STATUS_END_STREAM ,
|
STATUS_END_STREAM ,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* types.h - Some type definitions
|
/* types.h - Some type definitions
|
||||||
* Copyright (C) 2000 Werner Koch (dd9jn)
|
* Copyright (C) 2000 Werner Koch (dd9jn)
|
||||||
* Copyright (C) 2001 g10 Code GmbH
|
* Copyright (C) 2001, 2002 g10 Code GmbH
|
||||||
*
|
*
|
||||||
* This file is part of GPGME.
|
* This file is part of GPGME.
|
||||||
*
|
*
|
||||||
@ -84,5 +84,9 @@ typedef struct import_result_s *ImportResult;
|
|||||||
struct delete_result_s;
|
struct delete_result_s;
|
||||||
typedef struct delete_result_s *DeleteResult;
|
typedef struct delete_result_s *DeleteResult;
|
||||||
|
|
||||||
|
/*-- genkey.c --*/
|
||||||
|
struct genkey_result_s;
|
||||||
|
typedef struct genkey_result_s *GenKeyResult;
|
||||||
|
|
||||||
|
|
||||||
#endif /* TYPES_H */
|
#endif /* TYPES_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user