signed text and plain text.
gpgme_op_verify_start CHANGED: See gpgme_op_verify.
gpgme_check_engine REMOVED: Deprecated since 0.3.0.
+gpgme_op_genkey CHANGED: New parameter FPR.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Noteworthy changes in version 0.3.11 (2002-09-20)
+2002-11-19 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpgme.texi (Generating Keys): Document new argument to
+ gpgme_op_genkey.
+
2002-11-05 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Verify): Fix prototype of gpgme_get_sig_key.
@cindex key, creation
@cindex key ring, add
-@deftypefun GpgmeError gpgme_op_genkey (@w{GpgmeCtx @var{ctx}}, @w{const char *@var{parms}}, @w{GpgmeData @var{pubkey}}, @w{GpgmeData @var{seckey}})
+@deftypefun GpgmeError gpgme_op_genkey (@w{GpgmeCtx @var{ctx}}, @w{const char *@var{parms}}, @w{GpgmeData @var{pubkey}}, @w{GpgmeData @var{seckey}}, @w{char **@var{fpr}})
The function @code{gpgme_op_genkey} generates a new key pair in the
context @var{ctx} and puts it into the standard key ring if both
@var{pubkey} and @var{seckey} are @code{NULL}. In this case the
container is passed verbatim to GnuPG. Control statements are not
allowed.
+If @var{fpr} is not a null pointer, the function succeeds, and the
+crypto engine supports it, *@var{fpr} will contain a string with the
+fingerprint of the key, allocated with @code{malloc}. If both a
+primary and a sub key was generated, the fingerprint of the primary
+key will be returned. If the crypto engine does not provide the
+fingerprint, *@var{fpr} will be a null pointer.
+
The function returns @code{GPGME_No_Error} if the operation could be
started successfully, @code{GPGME_Invalid_Value} if @var{parms} is not
a valid XML string, @code{GPGME_Not_Supported} if @var{pubkey} or
+2002-11-19 Marcus Brinkmann <marcus@g10code.de>
+
+ * genkey.c: Only include <config.h> if [HAVE_CONFIG_H].
+ (struct genkey_result_s): Add new member FPR.
+ (_gpgme_release_genkey_result): Free RESULT->fpr if set.
+ (genkey_status_handler): Extract the fingerprint from the status
+ line.
+ (gpgme_op_genkey): Add new argument FPR and return the fingerprint
+ in it.
+ * gpgme.h: Adjust prototype of gpgme_op_genkey.
+
2002-11-19 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (gpg_keylist): Add --with-fingerprint to gpg invocation
-/* genkey.c - key generation
- * Copyright (C) 2000 Werner Koch (dd9jn)
- * Copyright (C) 2001, 2002 g10 Code GmbH
- *
- * This file is part of GPGME.
- *
- * GPGME is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GPGME is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
+/* genkey.c - Key generation.
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002 g10 Code GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GPGME is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#if HAVE_CONFIG_H
#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
{
int created_primary : 1;
int created_sub : 1;
+ char *fpr;
};
{
if (!result)
return;
+ if (result->fpr)
+ free (result->fpr);
free (result);
}
+
static void
genkey_status_handler (GpgmeCtx ctx, GpgmeStatusCode code, char *args)
{
ctx->result.genkey->created_primary = 1;
if (*args == 'B' || *args == 'S')
ctx->result.genkey->created_sub = 1;
+ if (args[1] == ' ')
+ {
+ if (ctx->result.genkey->fpr)
+ free (ctx->result.genkey->fpr);
+ ctx->result.genkey->fpr = strdup (&args[2]);
+ if (!ctx->result.genkey->fpr)
+ ctx->error = mk_error (Out_Of_Core);
+ }
}
break;
}
}
+
static GpgmeError
_gpgme_op_genkey_start (GpgmeCtx ctx, int synchronous, const char *parms,
GpgmeData pubkey, GpgmeData seckey)
* @parms: XML string with the key parameters
* @pubkey: Returns the public key
* @seckey: Returns the secret key
- *
+ * @fpr: Returns the fingerprint of the key.
+ *
* Generate a new key and store the key in the default keyrings if both
* @pubkey and @seckey are NULL. If @pubkey and @seckey are given, the newly
* created key will be returned in these data objects.
**/
GpgmeError
gpgme_op_genkey (GpgmeCtx ctx, const char *parms,
- GpgmeData pubkey, GpgmeData seckey)
+ GpgmeData pubkey, GpgmeData seckey,
+ char **fpr)
{
GpgmeError err = _gpgme_op_genkey_start (ctx, 1, parms, pubkey, seckey);
if (!err)
err = _gpgme_wait_one (ctx);
+ if (!err && fpr)
+ {
+ if (ctx->result.genkey->fpr)
+ {
+ *fpr = strdup (ctx->result.genkey->fpr);
+ if (!*fpr)
+ return mk_error (Out_Of_Core);
+ }
+ else
+ *fpr = NULL;
+ }
return err;
}
-/* gpgme.h - GnuPG Made Easy
- * Copyright (C) 2000 Werner Koch (dd9jn)
- * Copyright (C) 2001, 2002 g10 Code GmbH
- *
- * This file is part of GPGME.
- *
- * GPGME is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GPGME is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+/* gpgme.h - Public interface to GnuPG Made Easy.
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002 g10 Code GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GPGME is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef GPGME_H
#define GPGME_H
/* The possible encoding mode of GpgmeData objects. */
typedef enum
{
- GPGME_DATA_ENCODING_NONE = 0, /* i.e. not specified */
+ GPGME_DATA_ENCODING_NONE = 0, /* I.e. not specified. */
GPGME_DATA_ENCODING_BINARY = 1,
- GPGME_DATA_ENCODING_BASE64 = 2,
- GPGME_DATA_ENCODING_ARMOR = 3 /* Either PEM or OpenPGP Armor */
+ GPGME_DATA_ENCODING_BASE64 = 2,
+ GPGME_DATA_ENCODING_ARMOR = 3 /* Either PEM or OpenPGP Armor. */
}
GpgmeDataEncoding;
}
GpgmeSigStat;
-/* Flags used with the GPGME_ATTR_SIG_SUMMARY. */
+/* Flags used with the GPGME_ATTR_SIG_SUMMARY. */
enum
{
- GPGME_SIGSUM_VALID = 0x0001, /* The signature is fully valid */
- GPGME_SIGSUM_GREEN = 0x0002, /* The signature is good. */
- GPGME_SIGSUM_RED = 0x0004, /* The signature is bad. */
- GPGME_SIGSUM_KEY_REVOKED = 0x0010, /* One key has been revoked. */
- GPGME_SIGSUM_KEY_EXPIRED = 0x0020, /* One key has expired. */
- GPGME_SIGSUM_SIG_EXPIRED = 0x0040, /* The signature has expired. */
- GPGME_SIGSUM_KEY_MISSING = 0x0080, /* Can't verify: key missing. */
- GPGME_SIGSUM_CRL_MISSING = 0x0100, /* CRL not available. */
- GPGME_SIGSUM_CRL_TOO_OLD = 0x0200, /* Available CRL is too old. */
- GPGME_SIGSUM_BAD_POLICY = 0x0400, /* A policy was not met. */
- GPGME_SIGSUM_SYS_ERROR = 0x0800 /* A system error occured. */
+ GPGME_SIGSUM_VALID = 0x0001, /* The signature is fully valid. */
+ GPGME_SIGSUM_GREEN = 0x0002, /* The signature is good. */
+ GPGME_SIGSUM_RED = 0x0004, /* The signature is bad. */
+ GPGME_SIGSUM_KEY_REVOKED = 0x0010, /* One key has been revoked. */
+ GPGME_SIGSUM_KEY_EXPIRED = 0x0020, /* One key has expired. */
+ GPGME_SIGSUM_SIG_EXPIRED = 0x0040, /* The signature has expired. */
+ GPGME_SIGSUM_KEY_MISSING = 0x0080, /* Can't verify: key missing. */
+ GPGME_SIGSUM_CRL_MISSING = 0x0100, /* CRL not available. */
+ GPGME_SIGSUM_CRL_TOO_OLD = 0x0200, /* Available CRL is too old. */
+ GPGME_SIGSUM_BAD_POLICY = 0x0400, /* A policy was not met. */
+ GPGME_SIGSUM_SYS_ERROR = 0x0800 /* A system error occured. */
};
/* Generate a new keypair and add it to the keyring. PUBKEY and
SECKEY should be null for now. PARMS specifies what keys should be
- generated. */
+ generated. On success, if *FPR is non-null, it contains a
+ malloc()'ed string with the fingerprint of the generated key on
+ success. */
GpgmeError gpgme_op_genkey_start (GpgmeCtx ctx, const char *parms,
GpgmeData pubkey, GpgmeData seckey);
GpgmeError gpgme_op_genkey (GpgmeCtx ctx, const char *parms,
- GpgmeData pubkey, GpgmeData seckey);
+ GpgmeData pubkey, GpgmeData seckey,
+ char **fpr);
/* Delete KEY from the keyring. If ALLOW_SECRET is non-zero, secret
keys are also deleted. */
+2002-11-19 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpgmeplug.c (requestDecentralCertificate): Add new argument to
+ gpgme_op_genkey invocation.
+
2002-10-12 Marcus Brinkmann <marcus@g10code.de>
* gpgmeplug.c (checkMessageSignature): Update call to
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
/* Don't ASCII-armor, the MUA will use base64 encoding */
/* gpgme_set_armor (ctx, 1); */
- err = gpgme_op_genkey (ctx, certparms, pub, NULL );
+ err = gpgme_op_genkey (ctx, certparms, pub, NULL, NULL);
fprintf( stderr, "3: gpgme returned %d\n", err );
if( err != GPGME_No_Error ) {
gpgme_data_release( pub );
+2002-11-19 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpg/t-genkey.c (main): Add missing argument to gpgme_op_genkey
+ invocation.
+
2002-10-09 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-decrypt.c (print_data): Update to new gpgme_data_read
if (!parms)
exit (8);
sprintf (parms, format, ++count );
- err = gpgme_op_genkey (ctx, parms, NULL, NULL );
+ err = gpgme_op_genkey (ctx, parms, NULL, NULL, NULL);
fail_if_err (err);
free (parms);