2002-02-08 Marcus Brinkmann <marcus@g10code.de>
* genkey.c (gpgme_op_genkey_start): Allow PUBKEY and SECKEY to be set, and pass them down to the crypto engine. * engine-gpgsm.h (_gpgme_gpgsm_start): New arguments PUBKEY and SECKEY. * engine.h: Likewise. * rungpg.h (_gpgme_gpg_spawn): Likewise. * engine.c (_gpgme_engine_op_genkey): Likewise. Use those arguments. * rungpg.c (_gpgme_gpg_op_genkey): Likewise. Complain if those arguments are set. * engine-gpgsm.c (_gpgme_gpgsm_op_genkey): Likewise. Implement function. * engine-gpgsm.c (_gpgme_gpgsm_op_keylist): Beautify comment.
This commit is contained in:
parent
6f2245b35d
commit
f0a45d0c20
@ -1,3 +1,19 @@
|
|||||||
|
2002-02-08 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* genkey.c (gpgme_op_genkey_start): Allow PUBKEY and SECKEY to be
|
||||||
|
set, and pass them down to the crypto engine.
|
||||||
|
* engine-gpgsm.h (_gpgme_gpgsm_start): New arguments PUBKEY and SECKEY.
|
||||||
|
* engine.h: Likewise.
|
||||||
|
* rungpg.h (_gpgme_gpg_spawn): Likewise.
|
||||||
|
* engine.c (_gpgme_engine_op_genkey): Likewise. Use those
|
||||||
|
arguments.
|
||||||
|
* rungpg.c (_gpgme_gpg_op_genkey): Likewise. Complain if those
|
||||||
|
arguments are set.
|
||||||
|
* engine-gpgsm.c (_gpgme_gpgsm_op_genkey): Likewise. Implement
|
||||||
|
function.
|
||||||
|
|
||||||
|
* engine-gpgsm.c (_gpgme_gpgsm_op_keylist): Beautify comment.
|
||||||
|
|
||||||
2002-02-06 Marcus Brinkmann <marcus@g10code.de>
|
2002-02-06 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* rungpg.c (_gpgme_gpg_op_keylist): Remove handling of keylist
|
* rungpg.c (_gpgme_gpg_op_keylist): Remove handling of keylist
|
||||||
|
@ -504,10 +504,30 @@ _gpgme_gpgsm_op_export (GpgsmObject gpgsm, GpgmeRecipients recp,
|
|||||||
|
|
||||||
|
|
||||||
GpgmeError
|
GpgmeError
|
||||||
_gpgme_gpgsm_op_genkey (GpgsmObject gpgsm, GpgmeData help_data, int use_armor)
|
_gpgme_gpgsm_op_genkey (GpgsmObject gpgsm, GpgmeData help_data, int use_armor,
|
||||||
|
GpgmeData pubkey, GpgmeData seckey)
|
||||||
{
|
{
|
||||||
/* FIXME */
|
GpgmeError err;
|
||||||
return mk_error (Not_Implemented);
|
|
||||||
|
if (!gpgsm || !pubkey || seckey)
|
||||||
|
return mk_error (Invalid_Value);
|
||||||
|
|
||||||
|
gpgsm->command = xtrystrdup ("GENKEY");
|
||||||
|
if (!gpgsm->command)
|
||||||
|
return mk_error (Out_Of_Core);
|
||||||
|
|
||||||
|
gpgsm->input_data = help_data;
|
||||||
|
err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, 0);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
gpgsm->output_data = pubkey;
|
||||||
|
err = gpgsm_set_fd (gpgsm->assuan_ctx, "OUTPUT", gpgsm->output_fd_server,
|
||||||
|
use_armor ? "--armor" : 0);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
_gpgme_io_close (gpgsm->message_fd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -543,7 +563,8 @@ _gpgme_gpgsm_op_keylist (GpgsmObject gpgsm, const char *pattern,
|
|||||||
if (!pattern)
|
if (!pattern)
|
||||||
pattern = "";
|
pattern = "";
|
||||||
|
|
||||||
line = xtrymalloc (15 + strlen (pattern) + 1); /* "LISTSECRETKEYS "+p+'\0'.*/
|
/* Length is "LISTSECRETKEYS " + p + '\0'. */
|
||||||
|
line = xtrymalloc (15 + strlen (pattern) + 1);
|
||||||
if (!line)
|
if (!line)
|
||||||
return mk_error (Out_Of_Core);
|
return mk_error (Out_Of_Core);
|
||||||
if (secret_only)
|
if (secret_only)
|
||||||
@ -932,7 +953,8 @@ _gpgme_gpgsm_op_export (GpgsmObject gpgsm, GpgmeRecipients recp,
|
|||||||
|
|
||||||
|
|
||||||
GpgmeError
|
GpgmeError
|
||||||
_gpgme_gpgsm_op_genkey (GpgsmObject gpgsm, GpgmeData help_data, int use_armor)
|
_gpgme_gpgsm_op_genkey (GpgsmObject gpgsm, GpgmeData help_data, int use_armor,
|
||||||
|
GpgmeData pubkey, GpgmeData seckey)
|
||||||
{
|
{
|
||||||
return mk_error (Invalid_Engine);
|
return mk_error (Invalid_Engine);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* engine-gpgsm.h - GPGME GpgSM engine calling functions
|
/* engine-gpgsm.h - GPGME GpgSM engine calling functions
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -45,7 +45,8 @@ GpgmeError _gpgme_gpgsm_op_encrypt (GpgsmObject gpgsm, GpgmeRecipients recp,
|
|||||||
GpgmeError _gpgme_gpgsm_op_export (GpgsmObject gpgsm, GpgmeRecipients recp,
|
GpgmeError _gpgme_gpgsm_op_export (GpgsmObject gpgsm, GpgmeRecipients recp,
|
||||||
GpgmeData keydata, int use_armor);
|
GpgmeData keydata, int use_armor);
|
||||||
GpgmeError _gpgme_gpgsm_op_genkey (GpgsmObject gpgsm, GpgmeData help_data,
|
GpgmeError _gpgme_gpgsm_op_genkey (GpgsmObject gpgsm, GpgmeData help_data,
|
||||||
int use_armor);
|
int use_armor, GpgmeData pubkey,
|
||||||
|
GpgmeData seckey);
|
||||||
GpgmeError _gpgme_gpgsm_op_import (GpgsmObject gpgsm, GpgmeData keydata);
|
GpgmeError _gpgme_gpgsm_op_import (GpgsmObject gpgsm, GpgmeData keydata);
|
||||||
GpgmeError _gpgme_gpgsm_op_keylist (GpgsmObject gpgsm, const char *pattern,
|
GpgmeError _gpgme_gpgsm_op_keylist (GpgsmObject gpgsm, const char *pattern,
|
||||||
int secret_only, int keylist_mode);
|
int secret_only, int keylist_mode);
|
||||||
|
@ -376,7 +376,8 @@ _gpgme_engine_op_export (EngineObject engine, GpgmeRecipients recp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GpgmeError
|
GpgmeError
|
||||||
_gpgme_engine_op_genkey (EngineObject engine, GpgmeData help_data, int use_armor)
|
_gpgme_engine_op_genkey (EngineObject engine, GpgmeData help_data,
|
||||||
|
int use_armor, GpgmeData pubkey, GpgmeData seckey)
|
||||||
{
|
{
|
||||||
if (!engine)
|
if (!engine)
|
||||||
return mk_error (Invalid_Value);
|
return mk_error (Invalid_Value);
|
||||||
@ -384,9 +385,11 @@ _gpgme_engine_op_genkey (EngineObject engine, GpgmeData help_data, int use_armor
|
|||||||
switch (engine->protocol)
|
switch (engine->protocol)
|
||||||
{
|
{
|
||||||
case GPGME_PROTOCOL_OpenPGP:
|
case GPGME_PROTOCOL_OpenPGP:
|
||||||
return _gpgme_gpg_op_genkey (engine->engine.gpg, help_data, use_armor);
|
return _gpgme_gpg_op_genkey (engine->engine.gpg, help_data, use_armor,
|
||||||
|
pubkey, seckey);
|
||||||
case GPGME_PROTOCOL_CMS:
|
case GPGME_PROTOCOL_CMS:
|
||||||
return _gpgme_gpgsm_op_genkey (engine->engine.gpgsm, help_data, use_armor);
|
return _gpgme_gpgsm_op_genkey (engine->engine.gpgsm, help_data, use_armor,
|
||||||
|
pubkey, seckey);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* engine.h - GPGME engine calling functions
|
/* engine.h - GPGME engine calling functions
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -49,7 +49,8 @@ GpgmeError _gpgme_engine_op_encrypt (EngineObject engine, GpgmeRecipients recp,
|
|||||||
GpgmeError _gpgme_engine_op_export (EngineObject engine, GpgmeRecipients recp,
|
GpgmeError _gpgme_engine_op_export (EngineObject engine, GpgmeRecipients recp,
|
||||||
GpgmeData keydata, int use_armor);
|
GpgmeData keydata, int use_armor);
|
||||||
GpgmeError _gpgme_engine_op_genkey (EngineObject engine, GpgmeData help_data,
|
GpgmeError _gpgme_engine_op_genkey (EngineObject engine, GpgmeData help_data,
|
||||||
int use_armor);
|
int use_armor, GpgmeData pubkey,
|
||||||
|
GpgmeData seckey);
|
||||||
GpgmeError _gpgme_engine_op_import (EngineObject engine, GpgmeData keydata);
|
GpgmeError _gpgme_engine_op_import (EngineObject engine, GpgmeData keydata);
|
||||||
GpgmeError _gpgme_engine_op_keylist (EngineObject engine, const char *pattern,
|
GpgmeError _gpgme_engine_op_keylist (EngineObject engine, const char *pattern,
|
||||||
int secret_only,
|
int secret_only,
|
||||||
|
@ -138,16 +138,6 @@ gpgme_op_genkey_start (GpgmeCtx ctx, const char *parms,
|
|||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
/* We need a special mechanism to get the fd of a pipe here, so
|
|
||||||
* that we can use this for the %pubring and %secring parameters.
|
|
||||||
* We don't have this yet, so we implement only the adding to the
|
|
||||||
* standard keyrings */
|
|
||||||
if (pubkey || seckey)
|
|
||||||
{
|
|
||||||
err = mk_error (Not_Implemented);
|
|
||||||
goto leave;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pubkey && !seckey)
|
if (!pubkey && !seckey)
|
||||||
; /* okay: Add key to the keyrings */
|
; /* okay: Add key to the keyrings */
|
||||||
else if (!pubkey || gpgme_data_get_type (pubkey) != GPGME_DATA_TYPE_NONE)
|
else if (!pubkey || gpgme_data_get_type (pubkey) != GPGME_DATA_TYPE_NONE)
|
||||||
@ -162,11 +152,12 @@ gpgme_op_genkey_start (GpgmeCtx ctx, const char *parms,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pubkey)
|
if (pubkey)
|
||||||
{
|
/* FIXME: Need some more things here. */
|
||||||
_gpgme_data_set_mode (pubkey, GPGME_DATA_MODE_IN);
|
_gpgme_data_set_mode (pubkey, GPGME_DATA_MODE_IN);
|
||||||
_gpgme_data_set_mode (seckey, GPGME_DATA_MODE_IN);
|
|
||||||
/* FIXME: Need some more things here. */
|
if (seckey)
|
||||||
}
|
/* FIXME: Need some more things here. */
|
||||||
|
_gpgme_data_set_mode (seckey, GPGME_DATA_MODE_IN);
|
||||||
|
|
||||||
if ((parms = strstr (parms, "<GnupgKeyParms "))
|
if ((parms = strstr (parms, "<GnupgKeyParms "))
|
||||||
&& (s = strchr (parms, '>'))
|
&& (s = strchr (parms, '>'))
|
||||||
@ -188,7 +179,8 @@ gpgme_op_genkey_start (GpgmeCtx ctx, const char *parms,
|
|||||||
_gpgme_engine_set_status_handler (ctx->engine, genkey_status_handler, ctx);
|
_gpgme_engine_set_status_handler (ctx->engine, genkey_status_handler, ctx);
|
||||||
_gpgme_engine_set_verbosity (ctx->engine, ctx->verbosity);
|
_gpgme_engine_set_verbosity (ctx->engine, ctx->verbosity);
|
||||||
|
|
||||||
err = _gpgme_engine_op_genkey (ctx->engine, ctx->help_data_1, ctx->use_armor);
|
err = _gpgme_engine_op_genkey (ctx->engine, ctx->help_data_1, ctx->use_armor,
|
||||||
|
pubkey, seckey);
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
err = _gpgme_engine_start (ctx->engine, ctx);
|
err = _gpgme_engine_start (ctx->engine, ctx);
|
||||||
|
@ -1338,10 +1338,21 @@ _gpgme_gpg_op_export (GpgObject gpg, GpgmeRecipients recp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GpgmeError
|
GpgmeError
|
||||||
_gpgme_gpg_op_genkey (GpgObject gpg, GpgmeData help_data, int use_armor)
|
_gpgme_gpg_op_genkey (GpgObject gpg, GpgmeData help_data, int use_armor,
|
||||||
|
GpgmeData pubkey, GpgmeData seckey)
|
||||||
{
|
{
|
||||||
GpgmeError err;
|
GpgmeError err;
|
||||||
|
|
||||||
|
if (!gpg)
|
||||||
|
return mk_error (Invalid_Value);
|
||||||
|
|
||||||
|
/* We need a special mechanism to get the fd of a pipe here, so
|
||||||
|
* that we can use this for the %pubring and %secring parameters.
|
||||||
|
* We don't have this yet, so we implement only the adding to the
|
||||||
|
* standard keyrings */
|
||||||
|
if (pubkey || seckey)
|
||||||
|
return err = mk_error (Not_Implemented);
|
||||||
|
|
||||||
err = _gpgme_gpg_add_arg (gpg, "--gen-key");
|
err = _gpgme_gpg_add_arg (gpg, "--gen-key");
|
||||||
if (!err && use_armor)
|
if (!err && use_armor)
|
||||||
err = _gpgme_gpg_add_arg (gpg, "--armor");
|
err = _gpgme_gpg_add_arg (gpg, "--armor");
|
||||||
|
@ -129,7 +129,8 @@ GpgmeError _gpgme_gpg_op_encrypt (GpgObject gpg, GpgmeRecipients recp,
|
|||||||
GpgmeError _gpgme_gpg_op_export (GpgObject gpg, GpgmeRecipients recp,
|
GpgmeError _gpgme_gpg_op_export (GpgObject gpg, GpgmeRecipients recp,
|
||||||
GpgmeData keydata, int use_armor);
|
GpgmeData keydata, int use_armor);
|
||||||
GpgmeError _gpgme_gpg_op_genkey (GpgObject gpg, GpgmeData help_data,
|
GpgmeError _gpgme_gpg_op_genkey (GpgObject gpg, GpgmeData help_data,
|
||||||
int use_armor);
|
int use_armor, GpgmeData pubkey,
|
||||||
|
GpgmeData seckey);
|
||||||
GpgmeError _gpgme_gpg_op_import (GpgObject gpg, GpgmeData keydata);
|
GpgmeError _gpgme_gpg_op_import (GpgObject gpg, GpgmeData keydata);
|
||||||
GpgmeError _gpgme_gpg_op_keylist (GpgObject gpg, const char *pattern,
|
GpgmeError _gpgme_gpg_op_keylist (GpgObject gpg, const char *pattern,
|
||||||
int secret_only, int keylist_mode);
|
int secret_only, int keylist_mode);
|
||||||
|
Loading…
Reference in New Issue
Block a user