information about the result of a key listing operation in
a GpgmeKeyListResult object.
+ * Now that each function comes with its own result retrieval
+ interface, the generic gpgme_get_op_info interface is not useful
+ anymore and dropped.
+
* Interface changes relative to the 0.4.0 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GpgmeIOCb CHANGED: Return type from void to GpgmeError.
gpgme_key_get_as_xml REMOVED
GpgmeKeyListResult NEW
gpgme_op_keylist_result NEW
+gpgme_get_op_info REMOVED
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Noteworthy changes in version 0.4.0 (2002-12-23)
2003-04-30 Marcus Brinkmann <marcus@g10code.de>
+ * gpgme.texi (Encrypting a Plaintext): Remove reference to
+ gpgme_get_op_info.
+ (Detailed Results): Subsection removed.
+
* gpgme.texi (Key Listing Mode): Add GPGME_KEYLIST_MODE_SIGS.
(Manipulating Keys): Add obsoleteness note.
(Key Signatures): Likewise.
* Decrypt and Verify:: Decrypting a signed ciphertext.
* Sign:: Creating a signature.
* Encrypt:: Encrypting a plaintext.
-* Detailed Results:: How to obtain more info about the operation.
Sign
* Decrypt and Verify:: Decrypting a signed ciphertext.
* Sign:: Creating a signature.
* Encrypt:: Encrypting a plaintext.
-* Detailed Results:: How to obtain more info about the operation.
@end menu
@var{rset} are invalid, but not all. In this case the plaintext is
encrypted for all valid recipients and returned in @var{cipher}. More
information about the invalid recipients is available with
-@code{gpgme_get_op_info}. @xref{Detailed Results}.
+@code{gpgme_op_encrypt_result}.
If @var{recp} is @code{NULL}, symmetric rather than public key
encryption is performed. Symmetrically encrypted cipher text can be
@end deftypefun
-@node Detailed Results
-@subsection Detailed Results
-@cindex cryptographic operation, detailed results
-
-@deftypefun {char *} gpgme_get_op_info (@w{GpgmeCtx @var{ctx}}, @w{int @var{reserved}})
-The function @code{gpgme_get_op_info} retrieves more information about
-the last crypto operation.
-
-The function returns a string in the XML format. The user has to
-release the string with @code{free}.
-
-Here is a sample of the information that might be returned:
-@example
-<GnupgOperationInfo>
- <signature>
- <detached/> <!-- or cleartext or standard -->
- <algo>17</algo>
- <hashalgo>2</hashalgo>
- <micalg>pgp-sha1</micalg>
- <sigclass>01</sigclass>
- <created>9222222</created>
- <fpr>121212121212121212</fpr>
- </signature>
-</GnupgOperationInfo>
-@end example
-
-Currently, the only operations that return additional information are
-encrypt, sign. @xref{Encrypt}, @xref{Sign}.
-
-The function returns a string or @code{NULL} if no such data is
-available.
-@end deftypefun
-
-
@node Run Control
@section Run Control
@cindex run control
2003-04-30 Marcus Brinkmann <marcus@g10code.de>
+ * gpgme.h (gpgme_get_op_info): Remove prototype.
+ * ops.h (_gpgme_set_op_info,
+ _gpgme_data_release_and_return_string, _gpgme_data_get_as_string,
+ _gpgme_data_append, _gpgme_data_append_string,
+ _gpgme_data_append_string_for_xml, _gpgme_data_append_for_xml,
+ _gpgme_data_append_percentstring_for_xml): Likewise.
+ (_gpgme_progress_status_handler): Change first arg to void *.
+ * progress.c (_gpgme_progress_status_handler): Likewise.
+ * conversion.c: Do not include <string.h>, <errno.h>, <ctype.h>,
+ and <sys/types.h>, but <string.h>.
+ (_gpgme_data_append): Remove function.
+ (_gpgme_data_append_string): Likewise.
+ (_gpgme_data_append_for_xml): Likewise.
+ (_gpgme_data_append_string_for_xml): Likewise.
+ (_gpgme_data_append_percentstring_for_xml): Likewise.
+ * data-mem.c (_gpgme_data_get_as_string): Likewise.
+ (_gpgme_data_release_and_return_string): Likewise.
+ * gpgme.c (gpgme_get_op_info): Likewise.
+ (_gpgme_set_op_info): Likewise.
+
* gpgme.h (struct _gpgme_key): New structure.
(GpgmeKey): Define using _gpgme_key.
(struct _gpgme_subkey): New structure.
#include <config.h>
#endif
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <sys/types.h>
#include <stdlib.h>
+#include <string.h>
#include "gpgme.h"
#include "util.h"
return GPGME_General_Error;
}
-
-\f
-GpgmeError
-_gpgme_data_append (GpgmeData dh, const char *buffer, size_t length)
-{
- if (!dh || !buffer)
- return GPGME_Invalid_Value;
-
- do
- {
- ssize_t amt = gpgme_data_write (dh, buffer, length);
- if (amt == 0 || (amt < 0 && errno != EINTR))
- return GPGME_File_Error;
- buffer += amt;
- length -= amt;
- }
- while (length > 0);
-
- return 0;
-}
-
-
-GpgmeError
-_gpgme_data_append_string (GpgmeData dh, const char *str)
-{
- if (!str)
- return 0;
-
- return _gpgme_data_append (dh, str, strlen (str));
-}
-
-
-GpgmeError
-_gpgme_data_append_for_xml (GpgmeData dh, const char *buffer, size_t len)
-{
- const char *text, *str;
- size_t count;
- int err = 0;
-
- if (!dh || !buffer)
- return GPGME_Invalid_Value;
-
- do
- {
- text = NULL;
- str = buffer;
- for (count = len; count && !text; str++, count--)
- {
- if (*str == '<')
- text = "<";
- else if (*str == '>')
- text = ">"; /* Not sure whether this is really needed. */
- else if (*str == '&')
- text = "&";
- else if (!*str)
- text = "�";
- }
- if (text)
- {
- str--;
- count++;
- }
- if (str != buffer)
- err = _gpgme_data_append (dh, buffer, str - buffer);
- if (!err && text)
- {
- err = _gpgme_data_append_string (dh, text);
- str++;
- count--;
- }
- buffer = str;
- len = count;
- }
- while (!err && len);
- return err;
-}
-
-
-/* Append a string to DATA and convert it so that the result will be
- valid XML. */
-GpgmeError
-_gpgme_data_append_string_for_xml (GpgmeData dh, const char *str)
-{
- return _gpgme_data_append_for_xml (dh, str, strlen (str));
-}
-
-
-/* Append a string with percent style (%XX) escape characters as
- XML. */
-GpgmeError
-_gpgme_data_append_percentstring_for_xml (GpgmeData dh, const char *str)
-{
- const unsigned char *src;
- unsigned char *buf, *dst;
- int val;
- GpgmeError err;
-
- buf = malloc (strlen (str));
- dst = buf;
- for (src = str; *src; src++)
- {
- if (*src == '%' && (val = _gpgme_hextobyte (src + 1)) != -1)
- {
- *dst++ = val;
- src += 2;
- }
- else
- *dst++ = *src;
- }
-
- err = _gpgme_data_append_for_xml (dh, buf, dst - buf);
- free (buf);
- return err;
-}
}
-/* This function does make sense when we know that it contains no nil
- chars and if the underlying data object is memory based. */
-char *
-_gpgme_data_get_as_string (GpgmeData dh)
-{
- char *dst = NULL;
- const char *src = NULL;
-
- assert (dh->cbs == &mem_cbs);
-
- src = dh->data.mem.buffer;
- if (!src)
- src = dh->data.mem.orig_buffer;
- dst = malloc (dh->data.mem.length + 1);
- if (dst)
- {
- if (src)
- memcpy (dst, src, dh->data.mem.length);
- dst[dh->data.mem.length] = '\0';
- }
- return dst;
-}
-
-
char *
gpgme_data_release_and_get_mem (GpgmeData dh, size_t *r_len)
{
return str;
}
-
-
-/* This function does make sense when we know that it contains no nil
- chars and if the underlying data object is memory based. */
-char *
-_gpgme_data_release_and_return_string (GpgmeData dh)
-{
- char *str = NULL;
-
- if (!dh)
- return NULL;
-
- assert (dh->cbs == &mem_cbs);
- if (gpgme_data_write (dh, "", 1) == 1)
- str = gpgme_data_release_and_get_mem (dh, NULL);
- else
- gpgme_data_release (dh);
-
- return str;
-}
data = next_data;
}
ctx->op_data = NULL;
- _gpgme_set_op_info (ctx, NULL);
-}
-
-
-/**
- * gpgme_get_op_info:
- * @c: the context
- * @reserved:
- *
- * Return information about the last operation. The caller has to
- * free the string. NULL is returned if there is not previous
- * operation available or the operation has not yet finished.
- *
- * Here is a sample information we return:
- * <literal>
- * <![CDATA[
- * <GnupgOperationInfo>
- * <signature>
- * <detached/> <!-- or cleartext or standard -->
- * <algo>17</algo>
- * <hashalgo>2</hashalgo>
- * <micalg>pgp-sha1</micalg>
- * <sigclass>01</sigclass>
- * <created>9222222</created>
- * <fpr>121212121212121212</fpr>
- * </signature>
- * </GnupgOperationInfo>
- * ]]>
- * </literal>
- * Return value: NULL for no info available or an XML string
- **/
-char *
-gpgme_get_op_info (GpgmeCtx ctx, int reserved)
-{
- if (!ctx || reserved || !ctx->op_info)
- return NULL; /* Invalid value. */
-
- return _gpgme_data_get_as_string (ctx->op_info);
-}
-
-
-/* Store the data object INFO with the operation info in the context
- CTX. INFO is consumed. Subsequent calls append the data. */
-void
-_gpgme_set_op_info (GpgmeCtx ctx, GpgmeData info)
-{
- assert (ctx);
-
- if (!ctx->op_info)
- ctx->op_info = info;
- else
- {
- char *info_mem = 0;
- size_t info_len;
-
- info_mem = gpgme_data_release_and_get_mem (info, &info_len);
- _gpgme_data_append (ctx->op_info, info_mem, info_len);
- }
}
R_KEY. */
GpgmeError gpgme_get_sig_key (GpgmeCtx ctx, int idx, GpgmeKey *r_key);
-/* Return a string with more info about the last crypto operating in CTX.
- RESERVED should be zero. The user has to free the string. */
-char *gpgme_get_op_info (GpgmeCtx ctx, int reserved);
-
-
+\f
/* Run control. */
/* The type of an I/O callback function. */
#include "gpgme.h"
#include "context.h"
-/*-- gpgme.c --*/
+\f
+/* From gpgme.c. */
void _gpgme_release_result (GpgmeCtx ctx);
-void _gpgme_set_op_info (GpgmeCtx c, GpgmeData info);
-/*-- wait.c --*/
+\f
+/* From wait.c. */
GpgmeError _gpgme_wait_one (GpgmeCtx ctx);
GpgmeError _gpgme_wait_on_condition (GpgmeCtx ctx, volatile int *cond);
-/*-- recipient.c --*/
+/* From recipient.c. */
int _gpgme_recipients_all_valid ( const GpgmeRecipients rset );
-
-/*-- data.c and conversion.c --*/
-char * _gpgme_data_release_and_return_string ( GpgmeData dh );
-char * _gpgme_data_get_as_string ( GpgmeData dh );
-GpgmeError _gpgme_data_append ( GpgmeData dh,
- const char *buffer, size_t length );
-GpgmeError _gpgme_data_append_string ( GpgmeData dh, const char *s );
-GpgmeError _gpgme_data_append_string_for_xml ( GpgmeData dh,
- const char *s);
-GpgmeError _gpgme_data_append_for_xml ( GpgmeData dh,
- const char *buffer,
- size_t len );
-GpgmeError _gpgme_data_append_percentstring_for_xml ( GpgmeData dh,
- const char *string );
-
+\f
+/* From data.c. */
GpgmeError _gpgme_data_inbound_handler (void *opaque, int fd);
GpgmeError _gpgme_data_outbound_handler (void *opaque, int fd);
char *args);
\f
-/*-- passphrase.c --*/
+/* From passphrase.c. */
GpgmeError _gpgme_passphrase_status_handler (void *priv, GpgmeStatusCode code,
char *args);
GpgmeError _gpgme_passphrase_command_handler (void *opaque,
GpgmeStatusCode code,
const char *key, const char **result);
-/*-- progress.c --*/
-GpgmeError _gpgme_progress_status_handler (GpgmeCtx ctx, GpgmeStatusCode code,
+\f
+/* From progress.c. */
+GpgmeError _gpgme_progress_status_handler (void *priv, GpgmeStatusCode code,
char *args);
\f
GpgmeError
-_gpgme_progress_status_handler (GpgmeCtx ctx, GpgmeStatusCode code, char *args)
+_gpgme_progress_status_handler (void *priv, GpgmeStatusCode code, char *args)
{
+ GpgmeCtx ctx = (GpgmeCtx) priv;
char *p;
char *args_cpy;
int type = 0;
2003-04-30 Marcus Brinkmann <marcus@g10code.de>
+ * gpg/t-eventloop.c (main): Do not call print_op_info.
+ (print_op_info): Function removed.
+
* gpg/t-keylist.c: Rewritten.
* gpgsm/t-keylist.c (main): Rewritten.
* gpg/t-edit.c (main): Do not use gpgme_key_get_as_xml. Use
exit (1); } \
} while(0)
-static void
-print_op_info (GpgmeCtx ctx)
-{
- char *str = gpgme_get_op_info (ctx, 0);
-
- if (!str)
- puts ("<!-- no operation info available -->");
- else
- {
- puts (str);
- free (str);
- }
-}
-
-
static void
print_data (GpgmeData dh)
{
my_wait ();
fail_if_err (op_result.err);
- print_op_info (ctx);
fail_if_err (err);
fflush (NULL);