2014-01-06 16:16:52 +00:00
|
|
|
|
\input texinfo @c -*- mode: texinfo; coding: utf-8; -*-
|
|
|
|
|
@documentencoding UTF-8
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@setfilename gpgme.info
|
2016-08-10 14:33:20 +00:00
|
|
|
|
@include defs.inc
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@settitle The `GnuPG Made Easy' Reference Manual
|
|
|
|
|
|
|
|
|
|
@dircategory GNU Libraries
|
|
|
|
|
@direntry
|
2002-04-16 12:24:02 +00:00
|
|
|
|
* @acronym{GPGME}: (gpgme). Adding support for cryptography to your program.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end direntry
|
|
|
|
|
|
|
|
|
|
@c Unify some of the indices.
|
|
|
|
|
@syncodeindex tp fn
|
|
|
|
|
@syncodeindex pg fn
|
|
|
|
|
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@copying
|
2016-09-16 10:20:33 +00:00
|
|
|
|
Copyright @copyright{} 2002--2008, 2010, 2012--2016 g10 Code GmbH.
|
2008-06-04 14:14:38 +00:00
|
|
|
|
|
|
|
|
|
@quotation
|
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
|
Free Software Foundation; either version 3 of the License, or (at your
|
|
|
|
|
option) any later version. The text of the license can be found in the
|
|
|
|
|
section entitled ``Copying''.
|
|
|
|
|
@end quotation
|
|
|
|
|
|
|
|
|
|
This document 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.
|
|
|
|
|
@end copying
|
|
|
|
|
|
|
|
|
|
@c Macros used by the description of the UI server protocol
|
2016-11-11 14:10:57 +00:00
|
|
|
|
@macro clnt{string}
|
|
|
|
|
@sc{c:} \string\
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@end macro
|
2016-11-11 14:10:57 +00:00
|
|
|
|
@macro srvr{string}
|
|
|
|
|
@sc{s:} \string\
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@end macro
|
|
|
|
|
|
|
|
|
|
|
2012-05-02 08:35:47 +00:00
|
|
|
|
@c
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@c T I T L E P A G E
|
|
|
|
|
@c
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@ifinfo
|
|
|
|
|
This file documents the @acronym{GPGME} library.
|
|
|
|
|
|
|
|
|
|
This is Edition @value{EDITION}, last updated @value{UPDATED}, of
|
|
|
|
|
@cite{The `GnuPG Made Easy' Reference Manual}, for Version
|
|
|
|
|
@value{VERSION}.
|
|
|
|
|
|
2004-09-27 15:23:26 +00:00
|
|
|
|
@c NOTE: Don't forget to update the year for the TeX version, too.
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@insertcopying
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@end ifinfo
|
|
|
|
|
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@c We do not want that bastard short titlepage.
|
|
|
|
|
@c @iftex
|
|
|
|
|
@c @shorttitlepage The `GnuPG Made Easy' Reference Manual
|
|
|
|
|
@c @end iftex
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@titlepage
|
|
|
|
|
@center @titlefont{The `GnuPG Made Easy'}
|
|
|
|
|
@sp 1
|
|
|
|
|
@center @titlefont{Reference Manual}
|
|
|
|
|
@sp 6
|
|
|
|
|
@center Edition @value{EDITION}
|
|
|
|
|
@sp 1
|
|
|
|
|
@center last updated @value{UPDATED}
|
|
|
|
|
@sp 1
|
|
|
|
|
@center for version @value{VERSION}
|
|
|
|
|
@page
|
|
|
|
|
@vskip 0pt plus 1filll
|
2016-09-16 10:20:33 +00:00
|
|
|
|
Published by The GnuPG Project@* c/o g10 Code GmbH@* Hüttenstr. 61@* 40699 Erkrath, Germany
|
2004-09-30 02:11:18 +00:00
|
|
|
|
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@insertcopying
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end titlepage
|
|
|
|
|
@page
|
|
|
|
|
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@summarycontents
|
|
|
|
|
@contents
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@ifnottex
|
|
|
|
|
@node Top
|
|
|
|
|
@top Main Menu
|
|
|
|
|
This is Edition @value{EDITION}, last updated @value{UPDATED}, of
|
|
|
|
|
@cite{The `GnuPG Made Easy' Reference Manual}, for Version
|
2002-01-16 00:52:37 +00:00
|
|
|
|
@value{VERSION} of the @acronym{GPGME} library.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end ifnottex
|
|
|
|
|
|
|
|
|
|
@menu
|
|
|
|
|
* Introduction:: How to use this manual.
|
2002-01-30 01:43:05 +00:00
|
|
|
|
* Preparation:: What you should do before using the library.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
* Protocols and Engines:: Supported crypto protocols.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
* Algorithms:: Supported algorithms.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
* Error Handling:: Error numbers and their meanings.
|
|
|
|
|
* Exchanging Data:: Passing data to and from @acronym{GPGME}.
|
|
|
|
|
* Contexts:: Handling @acronym{GPGME} contexts.
|
|
|
|
|
|
|
|
|
|
Appendices
|
|
|
|
|
|
2008-06-04 14:14:38 +00:00
|
|
|
|
* UI Server Protocol:: The GnuPG UI Server Protocol.
|
2013-04-16 16:30:20 +00:00
|
|
|
|
* Debugging:: How to solve problems.
|
2016-09-16 10:20:33 +00:00
|
|
|
|
* Deprecated Functions:: Documentation of deprecated functions.
|
2008-06-04 14:14:38 +00:00
|
|
|
|
|
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* README: Refer to COPYING.LESSER and "each file" instead of
COPYING.
* COPYING.LESSER: New file.
* gpgme.spec.in (%doc): Add COPYING.LESSER.
* acinclude.m4, configure.ac, Makefile.am: Change license to LGPL
2.1 or later.
* TODO: Add copyright notice.
* README.CVS: Likewise.
assuan/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* README.1st: Add copyright notice.
doc/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am: Change license to LGPL.
(gpgme_TEXINFOS): Replace gpl.texi with lesser.texi.
* gpgme.texi: Change license to LGPL (also for documentation of
GPGME's license).
* lesser.texi: New file.
* gpl.texi: File removed.
gpgme/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* putc_unlocked.c, funopen.c: I just claim copyright on these
files and change their license to LGPL, because they are totally
trivial wrapper functions.
* isascii.c: Change copyright notice to the one from ctype/ctype.h
in the GNU C Library (CVS Head 2004-10-10), where isascii is
defined as a macro doing exactly the same as the function in this
file.
* memrchr.c: Update from the GNU C Library (CVS Head 2001-07-06).
* stpcpy.c: Update from the GNU C Library (CVS Head 2004-10-10).
* ath.c, ath-compat.c, ath.h, ath-pth.c, ath-pth-compat.c,
ath-pthread.c, ath-pthread-compat.c, context.h, conversion.c,
data.c, data-compat.c, data-fd.c, data.h, data-mem.c,
data-stream.c, data-user.c, debug.c, debug.h, decrypt.c,
decrypt-verify.c, delete.c, edit.c, encrypt.c, encrypt-sign.c,
engine-backend.h, engine.c, engine-gpgsm.c, engine.h, error.c,
export.c, genkey.c, get-env.c, gpgme.c, gpgme.h, import.c, io.h,
key.c, keylist.c, mkstatus, Makefile.am, ops.h, op-support.c,
passphrase.c, posix-io.c, posix-sema.c, posix-util.c, progress.c,
rungpg.c, sema.h, sign.c, signers.c, trust-item.c, trustlist.c,
util.h, verify.c, version.c, w32-io.c, w32-sema.c, w32-util.c,
wait.c, wait-global.c, wait.h, wait-private.c, wait-user.c: Change
license to LGPL.
tests/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* gpg/mkdemodirs: Add copyright notice.
* gpgsm/Makefile.am, gpgsm/t-support.h, gpgsm/t-decrypt.c,
gpgsm/t-encrypt.c, gpgsm/t-export.c, gpgsm/t-genkey.c,
gpgsm/t-import.c, gpgsm/t-keylist.c, gpgsm/t-sign.c,
gpgsm/t-verify.c, gpg/Makefile.am, gpg/t-decrypt.c,
gpg/t-decrypt-verify.c, gpg/t-edit.c, gpg/t-encrypt.c,
gpg/t-encrypt-sign.c, gpg/t-encrypt-sym.c, gpg/t-eventloop.c,
gpg/t-export.c, gpg/t-genkey.c, gpg/t-import.c, gpg/t-keylist.c,
gpg/t-keylist-sig.c, gpg/t-sign.c, gpg/t-signers.c,
gpg/t-support.h, gpg/t-thread1.c, gpg/t-trustlist.c,
gpg/t-verify.c, Makefile.am, t-data.c, t-engine-info.c,
t-version.c: Change license to LGPL.
2004-12-07 21:13:39 +00:00
|
|
|
|
* Library Copying:: The GNU Lesser General Public License says
|
|
|
|
|
how you can copy and share `GnuPG Made Easy'.
|
2008-06-04 14:14:38 +00:00
|
|
|
|
* Copying:: The GNU General Public License says how you
|
|
|
|
|
can copy and share this manual.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
Indices
|
|
|
|
|
|
|
|
|
|
* Concept Index:: Index of concepts and programs.
|
|
|
|
|
* Function and Data Index:: Index of functions, variables and data types.
|
|
|
|
|
|
|
|
|
|
@detailmenu
|
|
|
|
|
--- The Detailed Node Listing ---
|
|
|
|
|
|
|
|
|
|
Introduction
|
|
|
|
|
|
|
|
|
|
* Getting Started:: Purpose of the manual, and how to use it.
|
|
|
|
|
* Features:: Reasons to install and use @acronym{GPGME}.
|
|
|
|
|
* Overview:: Basic architecture of the @acronym{GPGME} library.
|
|
|
|
|
|
2002-01-30 01:43:05 +00:00
|
|
|
|
Preparation
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
* Header:: What header file you need to include.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Building the Source:: Compiler options to be used.
|
2004-02-06 15:47:15 +00:00
|
|
|
|
* Largefile Support (LFS):: How to use @acronym{GPGME} with LFS.
|
2002-05-09 06:49:40 +00:00
|
|
|
|
* Using Automake:: Compiler options to be used the easy way.
|
2003-09-03 01:15:56 +00:00
|
|
|
|
* Using Libtool:: Avoiding compiler options entirely.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Library Version Check:: Getting and verifying the library version.
|
2003-10-06 16:17:13 +00:00
|
|
|
|
* Signal Handling:: How @acronym{GPGME} affects signal handling.
|
2016-11-10 16:28:29 +00:00
|
|
|
|
* Multi-Threading:: How @acronym{GPGME} can be used in an MT environment.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
Protocols and Engines
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Engine Version Check:: Verifying the engine version.
|
|
|
|
|
* Engine Information:: Obtaining more information about the engines.
|
2005-01-12 11:13:17 +00:00
|
|
|
|
* Engine Configuration:: Changing the engine configuration.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
* OpenPGP:: Support for the OpenPGP protocol.
|
|
|
|
|
* Cryptographic Message Syntax:: Support for the CMS.
|
|
|
|
|
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
Algorithms
|
|
|
|
|
|
|
|
|
|
* Public Key Algorithms:: A list of all public key algorithms.
|
|
|
|
|
* Hash Algorithms:: A list of all hash algorithms.
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
Error Handling
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
* Error Values:: The error value and what it means.
|
|
|
|
|
* Error Codes:: A list of important error codes.
|
|
|
|
|
* Error Sources:: A list of important error sources.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Error Strings:: How to get a descriptive string from a value.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2012-05-02 08:35:47 +00:00
|
|
|
|
Exchanging Data
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Creating Data Buffers:: Creating new data buffers.
|
|
|
|
|
* Destroying Data Buffers:: Releasing data buffers.
|
|
|
|
|
* Manipulating Data Buffers:: Operations on data buffers.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-12-06 22:06:25 +00:00
|
|
|
|
Creating Data Buffers
|
|
|
|
|
|
|
|
|
|
* Memory Based Data Buffers:: Creating memory based data buffers.
|
|
|
|
|
* File Based Data Buffers:: Creating file based data buffers.
|
|
|
|
|
* Callback Based Data Buffers:: Creating callback based data buffers.
|
|
|
|
|
|
2005-09-30 14:17:47 +00:00
|
|
|
|
Manipulating Data Buffers
|
|
|
|
|
|
|
|
|
|
* Data Buffer I/O Operations:: I/O operations on data buffers.
|
|
|
|
|
* Data Buffer Meta-Data:: Meta-data manipulation of data buffers.
|
2014-04-10 11:01:00 +00:00
|
|
|
|
* Data Buffer Convenience:: Convenience function for data buffers.
|
2005-09-30 14:17:47 +00:00
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
Contexts
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Creating Contexts:: Creating new @acronym{GPGME} contexts.
|
|
|
|
|
* Destroying Contexts:: Releasing @acronym{GPGME} contexts.
|
2009-06-16 14:43:38 +00:00
|
|
|
|
* Result Management:: Managing the result of crypto operations.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Context Attributes:: Setting properties of a context.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
* Key Management:: Managing keys with @acronym{GPGME}.
|
|
|
|
|
* Trust Item Management:: Managing trust items with @acronym{GPGME}.
|
|
|
|
|
* Crypto Operations:: Using a context for cryptography.
|
2014-04-10 11:01:00 +00:00
|
|
|
|
* Miscellaneous:: Miscellaneous operations.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Run Control:: Controlling how operations are run.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
Context Attributes
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Protocol Selection:: Selecting the protocol used by a context.
|
2005-01-12 11:13:17 +00:00
|
|
|
|
* Crypto Engine:: Configuring the crypto engine.
|
2016-10-25 15:27:49 +00:00
|
|
|
|
* Setting the Sender:: How to tell the engine the sender.
|
2003-05-27 05:45:06 +00:00
|
|
|
|
* ASCII Armor:: Requesting @acronym{ASCII} armored output.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Text Mode:: Choosing canonical text mode.
|
2015-07-02 08:19:04 +00:00
|
|
|
|
* Offline Mode:: Choosing offline mode.
|
2002-02-25 18:31:07 +00:00
|
|
|
|
* Included Certificates:: Including a number of certificates.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Key Listing Mode:: Selecting key listing mode.
|
|
|
|
|
* Passphrase Callback:: Getting the passphrase from the user.
|
|
|
|
|
* Progress Meter Callback:: Being informed about the progress.
|
2015-04-17 00:23:38 +00:00
|
|
|
|
* Status Message Callback:: Status messages received from gpg.
|
2003-09-14 00:02:41 +00:00
|
|
|
|
* Locale:: Setting the locale of a context.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
Key Management
|
|
|
|
|
|
2016-09-16 09:48:29 +00:00
|
|
|
|
* Key objects:: Description of the key structures.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Listing Keys:: Browsing the list of available keys.
|
|
|
|
|
* Information About Keys:: Requesting detailed information about keys.
|
|
|
|
|
* Manipulating Keys:: Operations on keys.
|
|
|
|
|
* Generating Keys:: Creating new key pairs.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
* Signing Keys:: Adding key signatures to public keys.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Exporting Keys:: Retrieving key data from the key ring.
|
2002-01-30 01:17:30 +00:00
|
|
|
|
* Importing Keys:: Adding keys to the key ring.
|
|
|
|
|
* Deleting Keys:: Removing keys from the key ring.
|
2014-04-10 11:01:00 +00:00
|
|
|
|
* Changing Passphrases:: Change the passphrase of a key.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
* Changing TOFU Data:: Changing data pertaining to TOFU.
|
2007-06-05 14:47:18 +00:00
|
|
|
|
* Advanced Key Editing:: Advanced key edit operation.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
Trust Item Management
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Listing Trust Items:: Browsing the list of available trust items.
|
|
|
|
|
* Manipulating Trust Items:: Operations on trust items.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
Crypto Operations
|
|
|
|
|
|
|
|
|
|
* Decrypt:: Decrypting a ciphertext.
|
|
|
|
|
* Verify:: Verifying a signature.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Decrypt and Verify:: Decrypting a signed ciphertext.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
* Sign:: Creating a signature.
|
|
|
|
|
* Encrypt:: Encrypting a plaintext.
|
|
|
|
|
|
|
|
|
|
Sign
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Selecting Signers:: How to choose the keys to sign with.
|
|
|
|
|
* Creating a Signature:: How to create a signature.
|
2005-10-01 02:33:35 +00:00
|
|
|
|
* Signature Notation Data:: How to add notation data to a signature.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-01-16 00:54:39 +00:00
|
|
|
|
Encrypt
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Encrypting a Plaintext:: How to encrypt a plaintext.
|
|
|
|
|
|
2014-04-10 11:01:00 +00:00
|
|
|
|
Miscellaneous
|
|
|
|
|
|
2016-11-03 15:29:45 +00:00
|
|
|
|
* Running other Programs:: Running other Programs.
|
|
|
|
|
* Using the Assuan protocol:: Using the Assuan protocol.
|
|
|
|
|
* Checking for updates:: How to check for software updates.
|
2014-04-10 11:01:00 +00:00
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
Run Control
|
2002-01-16 00:54:39 +00:00
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Waiting For Completion:: Waiting until an operation is completed.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
* Using External Event Loops:: Advanced control over what happens when.
|
2004-02-24 23:08:48 +00:00
|
|
|
|
* Cancellation:: How to end pending operations prematurely.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
|
|
|
|
Using External Event Loops
|
|
|
|
|
|
|
|
|
|
* I/O Callback Interface:: How I/O callbacks are registered.
|
|
|
|
|
* Registering I/O Callbacks:: How to use I/O callbacks for a context.
|
|
|
|
|
* I/O Callback Example:: An example how to use I/O callbacks.
|
|
|
|
|
* I/O Callback Example GTK+:: How to integrate @acronym{GPGME} in GTK+.
|
|
|
|
|
* I/O Callback Example GDK:: How to integrate @acronym{GPGME} in GDK.
|
2004-03-07 22:32:49 +00:00
|
|
|
|
* I/O Callback Example Qt:: How to integrate @acronym{GPGME} in Qt.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@end detailmenu
|
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
@node Introduction
|
|
|
|
|
@chapter Introduction
|
|
|
|
|
|
|
|
|
|
`GnuPG Made Easy' (@acronym{GPGME}) is a C language library that
|
|
|
|
|
allows to add support for cryptography to a program. It is designed
|
2003-06-05 23:20:29 +00:00
|
|
|
|
to make access to public key crypto engines like GnuPG or GpgSM easier
|
|
|
|
|
for applications. @acronym{GPGME} provides a high-level crypto API
|
|
|
|
|
for encryption, decryption, signing, signature verification and key
|
2002-01-16 00:41:10 +00:00
|
|
|
|
management.
|
|
|
|
|
|
|
|
|
|
@acronym{GPGME} uses GnuPG and GpgSM as its backends to support
|
2002-01-30 01:43:05 +00:00
|
|
|
|
OpenPGP and the Cryptographic Message Syntax (CMS).
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@menu
|
|
|
|
|
* Getting Started:: Purpose of the manual, and how to use it.
|
|
|
|
|
* Features:: Reasons to install and use @acronym{GPGME}.
|
|
|
|
|
* Overview:: Basic architecture of the @acronym{GPGME} library.
|
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Getting Started
|
|
|
|
|
@section Getting Started
|
|
|
|
|
|
doc/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (I/O Callback Interface): Document new even
GPGME_EVENT_START.
(Waiting For Completion): Document new possible return values.
(I/O Callback Interface): Document return type of GpgmeIOCb.
gpgme/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* context.h (gpgme_context_s): Remove member ERROR.
* types.h (GpgmeStatusHandler): Change return type to GpgmeError.
(GpgmeCommandHandler): Change return type to GpgmeError and add
new argument RESULT.
* gpgme.h (GpgmeIOCb): Change return type to GpgmeError.
(GpgmeEventIO): New event GPGME_EVENT_START.
(GpgmeIdleFunc): Remove type.
(gpgme_register_idle): Remove prototype.
* data.c: Include <assert.h>.
(_gpgme_data_inbound_handler): Change return type to GpgmeError.
Return any error instead ignoring it, don't close file descriptor
on error.
(_gpgme_data_outbound_handler): Likewise.
* decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(_gpgme_decrypt_status_handler): Change return type to GpgmeError.
Return error instead setting ctx->error. Return success at end of
function.
(gpgme_op_decrypt): Don't work around the old kludge anymore.
* decrypt-verify.c (decrypt_verify_status_handler): Change return
type to GpgmeError. Return possible errors.
* delete.c: Do not include <stdio.h>, <string.h>, <time.h> and
<assert.h>.
(delete_status_handler): Change return type to GpgmeError. Return
error instead setting ctx->error. Return success at end of
function.
* edit.c: Do not include <stdio.h> and <string.h>.
(_gpgme_edit_status_handler): Change type to GpgmeError,
make static and rename to ...
(edit_status_handler): ... this. Return error directly.
(command_handler): Change return type to GpgmeError, add result
argument. Return error directly.
* encrypt.c (status_handler_finish): Remove function.
(_gpgme_encrypt_status_handler): Change return type to GpgmeError.
Return error directly.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (close_notify_handler): Do not signal done event
anymore.
(status_handler): Change return type to GpgmeError. Diddle things
around a bit to return errors directly.
(start): Send start event.
* export.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(export_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* genkey.c: Do not include <stdio.h> and <assert.h>.
(genkey_status_handler): Change return type to GpgmeError. Don't
check ctx->error. Return errors directly.
* gpgme.c (_gpgme_release_result): Do not initialize ctx->error.
(_gpgme_op_event_cb): Function removed.
(_gpgme_op_event_cb_user): Likewise.
* import.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(import_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* keylist.c (keylist_colon_handler, keylist_status_handler, finish_key):
Change return type to GpgmeError, return error directly.
* Makefile (libgpgme_la_SOURCES): Add wait-global.c,
wait-private.c and wait-user.c
* ops.h (test_and_allocate_result): Return error instead setting
ctx->error.
(_gpgme_data_inbound_handler, _gpgme_data_outbound_handler,
_gpgme_verify_status_handler, _gpgme_decrypt_status_handler,
_gpgme_sign_status_handler, _gpgme_encrypt_staus_handler,
_gpgme_passphrase_status_handler, _gpgme_progress_status_handler):
Change return type to GpgmeError.
(_gpgme_passphease_command_handler): Change return type to
GpgmeError and add new argument RESULT.
* op-support.c: Use new callback functions, and change private
data to ctx everywhere.
* passphrase.c (_gpgme_passphrase_status_handler): Change return
type to GpgmeError, return error directly.
(_gpgme_passphrase_command_handler): Change return type to
GpgmeError, add result argument. Return results accordingly.
* progress.c (_gpgme_progress_status_handler): Change return type
to GpgmeError, return errors directly.
* rungpg.c (status_handler): Change return type to GpgmeError.
Return error directly.
(close_notify_handler): Don't send done event.
(colon_line_handler): Change return type to GpgmeError, return
errors directly.
* rungpg.c (start): Send start event.
* sign.c (_gpgme_sign_status_handler): Change return type to
GpgmeError, return errors directly.
* trustlist.c (trustlist_status_handler): Change return type to
GpgmeError. Return 0.
(trustlist_colon_handler): Change return type GpgmeError. Return
errors directly.
* verify.c (add_notation): Change return type to GpgmeError,
return errors directly.
(_gpgme_verify_status_handler): Likewise.
* wait.h (struct fd_table): Remove lock member.
(struct wait_item_s): Moved here from wait.c.
(struct tag): New structure.
(_gpgme_wait_event_cb): Remove prototype.
(_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb,
_gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb,
_gpgme_wait_user_event_io_cb): New prototypes.
* wait.c: Don't include <stdio.h>.
(ftd_global, ctx_done_list, ctx_done_list_size,
ctx_done_list_length, ctx_done_list_lock, idle_function): Remove
global variable.
(gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove
function.
(gpgme_wait): Move to file wait-global.c.
(_gpgme_add_io_cb): Take ctx as private argument, initialize ctx
member in wait item and tag.
(_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock.
(_gpgme_wait_one, _gpgme_wait_on_condition): Move to
wait-private.c.
(gpgme_fd_table_init): Don't initialize FDT->lock.
(gpgme_fd_table_deinit): Don't destroy FDT->lock.
(_gpgme_fd_table_put): Make static and rename to ...
(fd_table_put): ... this function. Don't use FDT->lock.
(struct wait_item_s): Move to wait.h.
* wait-global.c: New file.
* wait-private.c: New file.
* wait-user.c: New file.
2003-01-29 15:20:58 +00:00
|
|
|
|
This manual documents the @acronym{GPGME} library programming
|
2002-01-16 00:41:10 +00:00
|
|
|
|
interface. All functions and data types provided by the library are
|
|
|
|
|
explained.
|
|
|
|
|
|
2002-01-30 01:17:30 +00:00
|
|
|
|
The reader is assumed to possess basic knowledge about cryptography in
|
2002-01-16 00:41:10 +00:00
|
|
|
|
general, and public key cryptography in particular. The underlying
|
|
|
|
|
cryptographic engines that are used by the library are not explained,
|
|
|
|
|
but where necessary, special features or requirements by an engine are
|
|
|
|
|
mentioned as far as they are relevant to @acronym{GPGME} or its users.
|
|
|
|
|
|
|
|
|
|
This manual can be used in several ways. If read from the beginning
|
|
|
|
|
to the end, it gives a good introduction into the library and how it
|
|
|
|
|
can be used in an application. Forward references are included where
|
|
|
|
|
necessary. Later on, the manual can be used as a reference manual to
|
|
|
|
|
get just the information needed about any particular interface of the
|
|
|
|
|
library. Experienced programmers might want to start looking at the
|
|
|
|
|
examples at the end of the manual, and then only read up those parts
|
|
|
|
|
of the interface which are unclear.
|
|
|
|
|
|
2016-09-19 07:06:24 +00:00
|
|
|
|
The documentation for the language bindings is currently not included
|
|
|
|
|
in this manual. Those languages bindings follow the general
|
|
|
|
|
programming model of @acronym{GPGME} but may provide some extra high
|
|
|
|
|
level abstraction on top of the @acronym{GPGME} style API. For now
|
|
|
|
|
please see the README files in the @file{lang/} directory of the
|
|
|
|
|
source distribution.
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@node Features
|
|
|
|
|
@section Features
|
|
|
|
|
|
|
|
|
|
@acronym{GPGME} has a couple of advantages over other libraries doing
|
|
|
|
|
a similar job, and over implementing support for GnuPG or other crypto
|
|
|
|
|
engines into your application directly.
|
|
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
|
@item it's free software
|
|
|
|
|
Anybody can use, modify, and redistribute it under the terms of the GNU
|
2004-12-07 21:21:41 +00:00
|
|
|
|
Lesser General Public License (@pxref{Library Copying}).
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@item it's flexible
|
|
|
|
|
@acronym{GPGME} provides transparent support for several cryptographic
|
|
|
|
|
protocols by different engines. Currently, @acronym{GPGME} supports
|
|
|
|
|
the OpenPGP protocol using GnuPG as the backend, and the Cryptographic
|
|
|
|
|
Message Syntax using GpgSM as the backend.
|
|
|
|
|
|
|
|
|
|
@item it's easy
|
|
|
|
|
@acronym{GPGME} hides the differences between the protocols and
|
|
|
|
|
engines from the programmer behind an easy-to-use interface. This way
|
|
|
|
|
the programmer can focus on the other parts of the program, and still
|
|
|
|
|
integrate strong cryptography in his application. Once support for
|
|
|
|
|
@acronym{GPGME} has been added to a program, it is easy to add support
|
|
|
|
|
for other crypto protocols once @acronym{GPGME} backends provide them.
|
|
|
|
|
|
2016-09-19 07:06:24 +00:00
|
|
|
|
@item it's language friendly
|
|
|
|
|
@acronym{GPGME} comes with languages bindings for several common
|
|
|
|
|
programming languages: Common Lisp, C++, Python 2, and Python 3.
|
|
|
|
|
@end table
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@node Overview
|
|
|
|
|
@section Overview
|
|
|
|
|
|
|
|
|
|
@acronym{GPGME} provides a data abstraction that is used to pass data
|
|
|
|
|
to the crypto engine, and receive returned data from it. Data can be
|
|
|
|
|
read from memory or from files, but it can also be provided by a
|
|
|
|
|
callback function.
|
|
|
|
|
|
|
|
|
|
The actual cryptographic operations are always set within a context.
|
|
|
|
|
A context provides configuration parameters that define the behaviour
|
|
|
|
|
of all operations performed within it. Only one operation per context
|
|
|
|
|
is allowed at any time, but when one operation is finished, you can
|
|
|
|
|
run the next operation in the same context. There can be more than
|
|
|
|
|
one context, and all can run different operations at the same time.
|
|
|
|
|
|
|
|
|
|
Furthermore, @acronym{GPGME} has rich key management facilities
|
|
|
|
|
including listing keys, querying their attributes, generating,
|
|
|
|
|
importing, exporting and deleting keys, and acquiring information
|
|
|
|
|
about the trust path.
|
|
|
|
|
|
2002-05-09 03:38:12 +00:00
|
|
|
|
With some precautions, @acronym{GPGME} can be used in a multi-threaded
|
|
|
|
|
environment, although it is not completely thread safe and thus needs
|
|
|
|
|
the support of the application.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
|
2002-01-30 01:43:05 +00:00
|
|
|
|
@node Preparation
|
|
|
|
|
@chapter Preparation
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
To use @acronym{GPGME}, you have to perform some changes to your
|
|
|
|
|
sources and the build system. The necessary changes are small and
|
|
|
|
|
explained in the following sections. At the end of this chapter, it
|
|
|
|
|
is described how the library is initialized, and how the requirements
|
|
|
|
|
of the library are verified.
|
|
|
|
|
|
|
|
|
|
@menu
|
|
|
|
|
* Header:: What header file you need to include.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Building the Source:: Compiler options to be used.
|
2004-02-06 15:47:15 +00:00
|
|
|
|
* Largefile Support (LFS):: How to use @acronym{GPGME} with LFS.
|
2002-05-09 06:49:40 +00:00
|
|
|
|
* Using Automake:: Compiler options to be used the easy way.
|
2003-09-03 01:15:56 +00:00
|
|
|
|
* Using Libtool:: Avoiding compiler options entirely.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Library Version Check:: Getting and verifying the library version.
|
2003-10-06 16:17:13 +00:00
|
|
|
|
* Signal Handling:: How @acronym{GPGME} affects signal handling.
|
2016-11-10 16:28:29 +00:00
|
|
|
|
* Multi-Threading:: How @acronym{GPGME} can be used in an MT environment.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Header
|
|
|
|
|
@section Header
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex header file
|
|
|
|
|
@cindex include file
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
All interfaces (data types and functions) of the library are defined
|
|
|
|
|
in the header file `gpgme.h'. You must include this in all programs
|
|
|
|
|
using the library, either directly or through some other header file,
|
|
|
|
|
like this:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
#include <gpgme.h>
|
|
|
|
|
@end example
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
The name space of @acronym{GPGME} is @code{gpgme_*} for function names
|
|
|
|
|
and data types and @code{GPGME_*} for other symbols. Symbols internal
|
|
|
|
|
to @acronym{GPGME} take the form @code{_gpgme_*} and @code{_GPGME_*}.
|
2002-08-20 23:25:49 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
Because @acronym{GPGME} makes use of the GPG Error library, using
|
2003-06-22 21:09:58 +00:00
|
|
|
|
@acronym{GPGME} will also use the @code{GPG_ERR_*} name space
|
2014-10-02 13:48:53 +00:00
|
|
|
|
directly, and the @code{gpg_err*}, @code{gpg_str*}, and @code{gpgrt_*}
|
|
|
|
|
name space indirectly.
|
2003-06-05 23:20:29 +00:00
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Building the Source
|
|
|
|
|
@section Building the Source
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex compiler options
|
|
|
|
|
@cindex compiler flags
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
If you want to compile a source file including the `gpgme.h' header
|
|
|
|
|
file, you must make sure that the compiler can find it in the
|
|
|
|
|
directory hierarchy. This is accomplished by adding the path to the
|
|
|
|
|
directory in which the header file is located to the compilers include
|
|
|
|
|
file search path (via the @option{-I} option).
|
|
|
|
|
|
|
|
|
|
However, the path to the include file is determined at the time the
|
|
|
|
|
source is configured. To solve this problem, gpgme ships with a small
|
|
|
|
|
helper program @command{gpgme-config} that knows about the path to the
|
|
|
|
|
include file and other configuration options. The options that need
|
|
|
|
|
to be added to the compiler invocation at compile time are output by
|
|
|
|
|
the @option{--cflags} option to @command{gpgme-config}. The following
|
|
|
|
|
example shows how it can be used at the command line:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
gcc -c foo.c `gpgme-config --cflags`
|
|
|
|
|
@end example
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
Adding the output of @samp{gpgme-config --cflags} to the compiler
|
|
|
|
|
command line will ensure that the compiler can find the
|
|
|
|
|
@acronym{GPGME} header file.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
A similar problem occurs when linking the program with the library.
|
|
|
|
|
Again, the compiler has to find the library files. For this to work,
|
|
|
|
|
the path to the library files has to be added to the library search
|
|
|
|
|
path (via the @option{-L} option). For this, the option
|
|
|
|
|
@option{--libs} to @command{gpgme-config} can be used. For
|
|
|
|
|
convenience, this option also outputs all other options that are
|
|
|
|
|
required to link the program with @acronym{GPGME} (in particular, the
|
|
|
|
|
@samp{-lgpgme} option). The example shows how to link @file{foo.o}
|
|
|
|
|
with the @acronym{GPGME} library to a program @command{foo}.
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
gcc -o foo foo.o `gpgme-config --libs`
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
Of course you can also combine both examples to a single command by
|
|
|
|
|
specifying both options to @command{gpgme-config}:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
gcc -o foo foo.c `gpgme-config --cflags --libs`
|
|
|
|
|
@end example
|
|
|
|
|
|
2016-08-21 13:49:03 +00:00
|
|
|
|
If you need to detect the installed language bindings you can use list
|
|
|
|
|
them using:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
gpgme-config --print-lang
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
or test for the availability using
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
gpgme-config --have-lang=python && echo 'Bindings for Pythons available'
|
|
|
|
|
@end example
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2004-02-06 15:47:15 +00:00
|
|
|
|
@node Largefile Support (LFS)
|
2004-02-01 13:39:45 +00:00
|
|
|
|
@section Largefile Support (LFS)
|
2004-02-06 15:47:15 +00:00
|
|
|
|
@cindex largefile support
|
2004-02-01 13:39:45 +00:00
|
|
|
|
@cindex LFS
|
|
|
|
|
|
2004-02-06 15:47:15 +00:00
|
|
|
|
@acronym{GPGME} is compiled with largefile support by default, if it
|
|
|
|
|
is available on the system. This means that GPGME supports files
|
|
|
|
|
larger than two gigabyte in size, if the underlying operating system
|
|
|
|
|
can. On some systems, largefile support is already the default. On
|
|
|
|
|
such systems, nothing special is required. However, some systems
|
|
|
|
|
provide only support for files up to two gigabyte in size by default.
|
|
|
|
|
Support for larger file sizes has to be specifically enabled.
|
2004-02-01 13:39:45 +00:00
|
|
|
|
|
|
|
|
|
To make a difficult situation even more complex, such systems provide
|
|
|
|
|
two different types of largefile support. You can either get all
|
|
|
|
|
relevant functions replaced with alternatives that are largefile
|
|
|
|
|
capable, or you can get new functions and data types for largefile
|
|
|
|
|
support added. Those new functions have the same name as their
|
|
|
|
|
smallfile counterparts, but with a suffix of 64.
|
|
|
|
|
|
|
|
|
|
An example: The data type @code{off_t} is 32 bit wide on GNU/Linux PC
|
|
|
|
|
systems. To address offsets in large files, you can either enable
|
|
|
|
|
largefile support add-on. Then a new data type @code{off64_t} is
|
|
|
|
|
provided, which is 64 bit wide. Or you can replace the existing
|
|
|
|
|
@code{off_t} data type with its 64 bit wide counterpart. All
|
|
|
|
|
occurences of @code{off_t} are then automagically replaced.
|
|
|
|
|
|
|
|
|
|
As if matters were not complex enough, there are also two different
|
|
|
|
|
types of file descriptors in such systems. This is important because
|
|
|
|
|
if file descriptors are exchanged between programs that use a
|
|
|
|
|
different maximum file size, certain errors must be produced on some
|
|
|
|
|
file descriptors to prevent subtle overflow bugs from occuring.
|
|
|
|
|
|
|
|
|
|
As you can see, supporting two different maximum file sizes at the
|
|
|
|
|
same time is not at all an easy task. However, the maximum file size
|
|
|
|
|
does matter for @acronym{GPGME}, because some data types it uses in
|
|
|
|
|
its interfaces are affected by that. For example, the @code{off_t}
|
|
|
|
|
data type is used in the @code{gpgme_data_seek} function, to match its
|
|
|
|
|
@acronym{POSIX} counterpart. This affects the call-frame of the
|
|
|
|
|
function, and thus the ABI of the library. Furthermore, file
|
|
|
|
|
descriptors can be exchanged between GPGME and the application.
|
|
|
|
|
|
|
|
|
|
For you as the user of the library, this means that your program must
|
|
|
|
|
be compiled in the same file size mode as the library. Luckily, there
|
|
|
|
|
is absolutely no valid reason for new programs to not enable largefile
|
|
|
|
|
support by default and just use that. The compatibility modes (small
|
|
|
|
|
file sizes or dual mode) can be considered an historic artefact, only
|
|
|
|
|
useful to allow for a transitional period.
|
|
|
|
|
|
Make definition of off_t robust against misbehaving w32 toolchains.
* configure.ac (NEED__FILE_OFFSET_BITS): Change to define gpgme_off_t
and gpgme_ssize_t.
(API__OFF_T, API__SSIZE_T): New ac_subst.
* src/gpgme.h.in: Replace all ssize_t and off_t by ac_subst macros.
* src/assuan-support.c, src/ath-pthread.c, src/ath.c, src/ath.h
* src/data-compat.c, src/data-fd.c, src/data-mem.c, src/data-stream.c
* src/data-user.c, src/data.c, src/data.h, src/engine-gpgsm.c
* src/engine-uiserver.c, src/gpgme-tool.c, src/gpgme.c: Replace off_t
by gpgme_off_t and sszie_t by gpgme_ssize_t.
* src/ath-pthread.c, src/ath.h: Include gpgme.h.
--
For a detailed description, see the gpgme.texi diff.
2013-04-25 11:00:16 +00:00
|
|
|
|
On POSIX platforms @acronym{GPGME} is compiled using largefile support
|
|
|
|
|
by default. This means that your application must do the same, at
|
|
|
|
|
least as far as it is relevant for using the @file{gpgme.h} header
|
|
|
|
|
file. All types in this header files refer to their largefile
|
|
|
|
|
counterparts, if they are different from any default types on the
|
|
|
|
|
system.
|
|
|
|
|
|
|
|
|
|
On 32 and 64 bit Windows platforms @code{off_t} is declared as 32 bit
|
|
|
|
|
signed integer. There is no specific support for LFS in the C
|
|
|
|
|
library. The recommendation from Microsoft is to use the native
|
|
|
|
|
interface (@code{CreateFile} et al.) for large files. Released binary
|
|
|
|
|
versions of @acronym{GPGME} (libgpgme-11.dll) have always been build
|
|
|
|
|
with a 32 bit @code{off_t}. To avoid an ABI break we stick to this
|
|
|
|
|
convention for 32 bit Windows by using @code{long} there.
|
|
|
|
|
@acronym{GPGME} versions for 64 bit Windows have never been released
|
|
|
|
|
and thus we are able to use @code{int64_t} instead of @code{off_t}
|
|
|
|
|
there. For easier migration the typedef @code{gpgme_off_t} has been
|
|
|
|
|
defined. The reason we cannot use @code{off_t} directly is that some
|
|
|
|
|
toolchains (e.g. mingw64) introduce a POSIX compatible hack for
|
|
|
|
|
@code{off_t}. Some widely used toolkits make use of this hack and in
|
|
|
|
|
turn @acronym{GPGME} would need to use it also. However, this would
|
|
|
|
|
introduce an ABI break and existing software making use of libgpgme
|
|
|
|
|
might suffer from a severe break. Thus with version 1.4.2 we
|
|
|
|
|
redefined all functions using @code{off_t} to use @code{gpgme_off_t}
|
|
|
|
|
which is defined as explained above. This way we keep the ABI well
|
|
|
|
|
defined and independent of any toolchain hacks. The bottom line is
|
|
|
|
|
that LFS support in @acronym{GPGME} is only available on 64 bit
|
|
|
|
|
versions of Windows.
|
|
|
|
|
|
|
|
|
|
On POSIX platforms you can enable largefile support, if it is
|
|
|
|
|
different from the default on the system the application is compiled
|
|
|
|
|
on, by using the Autoconf macro @code{AC_SYS_LARGEFILE}. If you do
|
|
|
|
|
this, then you don't need to worry about anything else: It will just
|
|
|
|
|
work. In this case you might also want to use @code{AC_FUNC_FSEEKO}
|
|
|
|
|
to take advantage of some new interfaces, and @code{AC_TYPE_OFF_T}
|
|
|
|
|
(just in case).
|
2004-02-01 13:39:45 +00:00
|
|
|
|
|
|
|
|
|
If you do not use Autoconf, you can define the preprocessor symbol
|
|
|
|
|
@code{_FILE_OFFSET_BITS} to 64 @emph{before} including any header
|
|
|
|
|
files, for example by specifying the option
|
|
|
|
|
@code{-D_FILE_OFFSET_BITS=64} on the compiler command line. You will
|
|
|
|
|
also want to define the preprocessor symbol @code{LARGEFILE_SOURCE} to
|
|
|
|
|
1 in this case, to take advantage of some new interfaces.
|
|
|
|
|
|
|
|
|
|
If you do not want to do either of the above, you probably know enough
|
|
|
|
|
about the issue to invent your own solution. Just keep in mind that
|
|
|
|
|
the @acronym{GPGME} header file expects that largefile support is
|
|
|
|
|
enabled, if it is available. In particular, we do not support dual
|
|
|
|
|
mode (@code{_LARGEFILE64_SOURCE}).
|
|
|
|
|
|
|
|
|
|
|
2002-05-09 06:49:40 +00:00
|
|
|
|
@node Using Automake
|
|
|
|
|
@section Using Automake
|
|
|
|
|
@cindex automake
|
|
|
|
|
@cindex autoconf
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
It is much easier if you use GNU Automake instead of writing your own
|
|
|
|
|
Makefiles. If you do that you do not have to worry about finding and
|
2002-05-09 06:49:40 +00:00
|
|
|
|
invoking the @command{gpgme-config} script at all. @acronym{GPGME}
|
|
|
|
|
provides an extension to Automake that does all the work for you.
|
|
|
|
|
|
|
|
|
|
@c A simple macro for optional variables.
|
|
|
|
|
@macro ovar{varname}
|
|
|
|
|
@r{[}@var{\varname\}@r{]}
|
|
|
|
|
@end macro
|
|
|
|
|
@defmac AM_PATH_GPGME (@ovar{minimum-version}, @ovar{action-if-found}, @ovar{action-if-not-found})
|
2003-09-03 01:15:56 +00:00
|
|
|
|
@defmacx AM_PATH_GPGME_PTH (@ovar{minimum-version}, @ovar{action-if-found}, @ovar{action-if-not-found})
|
|
|
|
|
@defmacx AM_PATH_GPGME_PTHREAD (@ovar{minimum-version}, @ovar{action-if-found}, @ovar{action-if-not-found})
|
2002-05-09 06:49:40 +00:00
|
|
|
|
Check whether @acronym{GPGME} (at least version @var{minimum-version},
|
|
|
|
|
if given) exists on the host system. If it is found, execute
|
|
|
|
|
@var{action-if-found}, otherwise do @var{action-if-not-found}, if
|
|
|
|
|
given.
|
|
|
|
|
|
|
|
|
|
Additionally, the function defines @code{GPGME_CFLAGS} to the flags
|
|
|
|
|
needed for compilation of the program to find the @file{gpgme.h}
|
|
|
|
|
header file, and @code{GPGME_LIBS} to the linker flags needed to link
|
2014-10-02 13:48:53 +00:00
|
|
|
|
the program to the @acronym{GPGME} library. If the used helper script
|
|
|
|
|
does not match the target type you are building for a warning is
|
|
|
|
|
printed and the string @code{libgcrypt} is appended to the variable
|
|
|
|
|
@code{gpg_config_script_warn}.
|
2003-09-03 01:15:56 +00:00
|
|
|
|
|
|
|
|
|
@code{AM_PATH_GPGME_PTH} checks for the version of @acronym{GPGME}
|
|
|
|
|
that can be used with GNU Pth, and defines @code{GPGME_PTH_CFLAGS} and
|
|
|
|
|
@code{GPGME_PTH_LIBS}.
|
|
|
|
|
|
|
|
|
|
@code{AM_PATH_GPGME_PTHREAD} checks for the version of @acronym{GPGME}
|
|
|
|
|
that can be used with the native pthread implementation, and defines
|
core: Use gpgrt locking for thread safeness
* configure.ac: Require libgpg-error 1.17. No longer
check for pthread.
* doc/gpgme.texi: Document removed neccessity for thread
safe gpgme flavours.
* src/sema.h (DEFINE_GLOBAL_LOCK),
(DEFINE_STATIC_LOCK, INIT_LOCK, DECLARE_LOCK)
(DESTROY_LOCK, LOCK, UNLOCK): Change to gpgrt equivalents.
* src/posix-sema.c, src/w32-sema.c: Removed.
* src/Makefile.am: Remove libpthread and
Update accordingly.
* src/ath.c, src/ath.h (ath_mutex_init)
(ath_mutex_destroy, ath_mutex_lock, ath_mutex_unlock): Removed.
* src/ath.h (ATH_MUTEX_INITIALIZER): Removed.
* src/version.c (do_subsystem_inits): sema_subsystem_init is
no longer required.
* tests/gpg/Makefile.am: Add new threading tests.
(t_thread1_LDADD, t_cancel_LDADD):
Use just gpgme.
* tests/gpg/t-thread-keylist-verify.c,
tests/gpg/t-thread-keylist.c: New.
* src/gpgme-config.in: Use -lgpgme for thread-model pthread.
--
Using gpgrt locks instead of pthread locks removes
the neccessity to link pthread directly to gpgme and
have a different, thread safe flavor of gpgme. Now
gpgme is thread-safe if the conditions mentioned
in the doc are met.
As the cpp bindings linked against libgpgme
and not libgpgme-pthread this fixes threading problems
with them.
libgpgme-pthread is removed but gpgme-config still supports
--thread=pthread for compatibility with find scripts.
2016-11-08 14:32:14 +00:00
|
|
|
|
@code{GPGME_PTHREAD_CFLAGS} and @code{GPGME_PTHREAD_LIBS}. Since
|
|
|
|
|
version 1.8.0 this is no longer required to GPGME_PTHREAD as
|
|
|
|
|
@acronym{GPGME} itself is thread safe.
|
2014-10-02 13:48:53 +00:00
|
|
|
|
|
|
|
|
|
This macro searches for @command{gpgme-config} along the PATH. If
|
|
|
|
|
you are cross-compiling, it is useful to set the environment variable
|
|
|
|
|
@code{SYSROOT} to the top directory of your target. The macro will
|
|
|
|
|
then first look for the helper program in the @file{bin} directory
|
|
|
|
|
below that top directory. An absolute directory name must be used for
|
|
|
|
|
@code{SYSROOT}. Finally, if the configure command line option
|
|
|
|
|
@code{--with-gpgme-prefix} is used, only its value is used for the top
|
|
|
|
|
directory below which the helper script is expected.
|
|
|
|
|
|
2002-05-09 06:49:40 +00:00
|
|
|
|
@end defmac
|
|
|
|
|
|
|
|
|
|
You can use the defined Autoconf variables like this in your
|
|
|
|
|
@file{Makefile.am}:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
AM_CPPFLAGS = $(GPGME_CFLAGS)
|
|
|
|
|
LDADD = $(GPGME_LIBS)
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
|
2003-09-03 01:15:56 +00:00
|
|
|
|
@node Using Libtool
|
|
|
|
|
@section Using Libtool
|
|
|
|
|
@cindex libtool
|
|
|
|
|
|
|
|
|
|
The easiest way is to just use GNU Libtool. If you use libtool, and
|
|
|
|
|
link to @code{libgpgme.la}, @code{libgpgme-pth.la} or
|
|
|
|
|
@code{libgpgme-pthread.la} respectively, everything will be done
|
|
|
|
|
automatically by Libtool.
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Library Version Check
|
|
|
|
|
@section Library Version Check
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex version check, of the library
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@deftypefun {const char *} gpgme_check_version (@w{const char *@var{required_version}})
|
2009-05-28 15:16:01 +00:00
|
|
|
|
The function @code{gpgme_check_version} has four purposes. It can be
|
2002-01-16 00:41:10 +00:00
|
|
|
|
used to retrieve the version number of the library. In addition it
|
|
|
|
|
can verify that the version number is higher than a certain required
|
|
|
|
|
version number. In either case, the function initializes some
|
|
|
|
|
sub-systems, and for this reason alone it must be invoked early in
|
|
|
|
|
your program, before you make use of the other functions in
|
2009-05-28 15:16:01 +00:00
|
|
|
|
@acronym{GPGME}. The last purpose is to run selftests.
|
2007-07-12 15:25:20 +00:00
|
|
|
|
|
|
|
|
|
As a side effect for W32 based systems, the socket layer will get
|
|
|
|
|
initialized.
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
If @var{required_version} is @code{NULL}, the function returns a
|
|
|
|
|
pointer to a statically allocated string containing the version number
|
|
|
|
|
of the library.
|
|
|
|
|
|
|
|
|
|
If @var{required_version} is not @code{NULL}, it should point to a
|
|
|
|
|
string containing a version number, and the function checks that the
|
|
|
|
|
version of the library is at least as high as the version number
|
|
|
|
|
provided. In this case, the function returns a pointer to a
|
|
|
|
|
statically allocated string containing the version number of the
|
|
|
|
|
library. If @var{REQUIRED_VERSION} is not a valid version number, or
|
|
|
|
|
if the version requirement is not met, the function returns
|
|
|
|
|
@code{NULL}.
|
|
|
|
|
|
|
|
|
|
If you use a version of a library that is backwards compatible with
|
|
|
|
|
older releases, but contains additional interfaces which your program
|
|
|
|
|
uses, this function provides a run-time check if the necessary
|
|
|
|
|
features are provided by the installed version of the library.
|
2009-05-28 15:16:01 +00:00
|
|
|
|
|
|
|
|
|
If a selftest fails, the function may still succeed. Selftest errors
|
|
|
|
|
are returned later when invoking @code{gpgme_new}, so that a detailed
|
|
|
|
|
error code can be returned (historically, @code{gpgme_check_version}
|
|
|
|
|
does not return a detailed error code).
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2012-09-25 13:38:26 +00:00
|
|
|
|
@deftypefun {int} gpgme_set_global_flag @
|
|
|
|
|
(@w{const char *@var{name}}, @
|
|
|
|
|
@w{const char *@var{value}})
|
|
|
|
|
|
|
|
|
|
On some systems it is not easy to set environment variables and thus
|
|
|
|
|
hard to use @acronym{GPGME}'s internal trace facility for debugging.
|
|
|
|
|
This function has been introduced as an alternative way to enable
|
2014-01-06 16:16:52 +00:00
|
|
|
|
debugging and for a couple of other rarely used tweaks. It is
|
|
|
|
|
important to assure that only one thread accesses @acronym{GPGME}
|
|
|
|
|
functions between a call to this function and after the return from
|
|
|
|
|
the call to @code{gpgme_check_version}.
|
|
|
|
|
|
|
|
|
|
All currently supported features require that this function is called
|
|
|
|
|
as early as possible --- even before @code{gpgme_check_version}. The
|
|
|
|
|
features are identified by the following values for @var{name}:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2016-08-16 16:53:42 +00:00
|
|
|
|
@item debug
|
2014-01-06 16:16:52 +00:00
|
|
|
|
To enable debugging use the string ``debug'' for @var{name} and
|
|
|
|
|
@var{value} identical to the value used with the environment variable
|
|
|
|
|
@code{GPGME_DEBUG}.
|
|
|
|
|
|
2016-08-16 16:53:42 +00:00
|
|
|
|
@item disable-gpgconf
|
2014-01-06 16:16:52 +00:00
|
|
|
|
Using this feature with any @var{value} disables the detection of the
|
|
|
|
|
gpgconf program and thus forces GPGME to fallback into the simple
|
|
|
|
|
OpenPGP only mode. It may be used to force the use of GnuPG-1 on
|
|
|
|
|
systems which have both GPG versions installed. Note that in general
|
|
|
|
|
the use of @code{gpgme_set_engine_info} is a better way to select a
|
|
|
|
|
specific engine version.
|
|
|
|
|
|
2016-08-16 16:53:42 +00:00
|
|
|
|
@item gpgconf-name
|
|
|
|
|
@itemx gpg-name
|
2014-01-06 16:16:52 +00:00
|
|
|
|
Set the name of the gpgconf respective gpg binary. The defaults are
|
|
|
|
|
@code{GNU/GnuPG/gpgconf} and @code{GNU/GnuPG/gpg}. Under Unix the
|
|
|
|
|
leading directory part is ignored. Under Windows the leading
|
|
|
|
|
directory part is used as the default installation directory; the
|
|
|
|
|
@code{.exe} suffix is added by GPGME. Use forward slashed even under
|
|
|
|
|
Windows.
|
|
|
|
|
|
2016-08-16 16:53:42 +00:00
|
|
|
|
@item require-gnupg
|
|
|
|
|
Set the mimimum version of the required GnuPG engine. If that version
|
|
|
|
|
is not met, GPGME fails early instead of trying to use the existant
|
|
|
|
|
version. The given version must be a string with major, minor, and
|
|
|
|
|
micro number. Example: "2.1.0".
|
|
|
|
|
|
|
|
|
|
@item w32-inst-dir
|
2015-10-28 15:24:30 +00:00
|
|
|
|
On Windows GPGME needs to know its installation directory to find its
|
|
|
|
|
spawn helper. This is in general no problem because a DLL has this
|
|
|
|
|
information. Some applications however link statically to GPGME and
|
|
|
|
|
thus GPGME can only figure out the installation directory of this
|
|
|
|
|
application which may be wrong in certain cases. By supplying an
|
|
|
|
|
installation directory as value to this flag, GPGME will assume that
|
|
|
|
|
that directory is the installation directory. This flag has no effect
|
|
|
|
|
on non-Windows platforms.
|
|
|
|
|
|
2014-01-06 16:16:52 +00:00
|
|
|
|
@end table
|
2012-09-25 13:38:26 +00:00
|
|
|
|
|
|
|
|
|
This function returns @code{0} on success. In contrast to other
|
|
|
|
|
functions the non-zero return value on failure does not convey any
|
|
|
|
|
error code. For setting ``debug'' the only possible error cause is an
|
|
|
|
|
out of memory condition; which would exhibit itself later anyway.
|
|
|
|
|
Thus the return value may be ignored.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2003-09-14 00:02:41 +00:00
|
|
|
|
After initializing @acronym{GPGME}, you should set the locale
|
2004-03-23 13:43:37 +00:00
|
|
|
|
information to the locale required for your output terminal. This
|
|
|
|
|
locale information is needed for example for the curses and Gtk
|
|
|
|
|
pinentry. Here is an example of a complete initialization:
|
2003-09-14 00:02:41 +00:00
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
#include <locale.h>
|
|
|
|
|
#include <gpgme.h>
|
|
|
|
|
|
|
|
|
|
void
|
2008-03-05 12:00:57 +00:00
|
|
|
|
init_gpgme (void)
|
2003-09-14 00:02:41 +00:00
|
|
|
|
@{
|
|
|
|
|
/* Initialize the locale environment. */
|
|
|
|
|
setlocale (LC_ALL, "");
|
|
|
|
|
gpgme_check_version (NULL);
|
|
|
|
|
gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
|
2006-07-16 13:36:04 +00:00
|
|
|
|
#ifdef LC_MESSAGES
|
2003-09-14 00:02:41 +00:00
|
|
|
|
gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
|
2006-07-16 13:36:04 +00:00
|
|
|
|
#endif
|
2003-09-14 00:02:41 +00:00
|
|
|
|
@}
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
Note that you are highly recommended to initialize the locale settings
|
|
|
|
|
like this. @acronym{GPGME} can not do this for you because it would
|
2006-07-16 13:36:04 +00:00
|
|
|
|
not be thread safe. The conditional on LC_MESSAGES is only necessary
|
|
|
|
|
for portability to W32 systems.
|
2003-09-14 00:02:41 +00:00
|
|
|
|
|
|
|
|
|
|
2003-10-06 16:17:13 +00:00
|
|
|
|
@node Signal Handling
|
|
|
|
|
@section Signal Handling
|
|
|
|
|
@cindex signals
|
|
|
|
|
@cindex signal handling
|
|
|
|
|
|
|
|
|
|
The @acronym{GPGME} library communicates with child processes (the
|
|
|
|
|
crypto engines). If a child process dies unexpectedly, for example
|
|
|
|
|
due to a bug, or system problem, a @code{SIGPIPE} signal will be
|
|
|
|
|
delivered to the application. The default action is to abort the
|
|
|
|
|
program. To protect against this, @code{gpgme_check_version} sets the
|
|
|
|
|
@code{SIGPIPE} signal action to @code{SIG_IGN}, which means that the
|
|
|
|
|
signal will be ignored.
|
|
|
|
|
|
|
|
|
|
@acronym{GPGME} will only do that if the signal action for
|
|
|
|
|
@code{SIGPIPE} is @code{SIG_DEF} at the time
|
|
|
|
|
@code{gpgme_check_version} is called. If it is something different,
|
|
|
|
|
@code{GPGME} will take no action.
|
|
|
|
|
|
|
|
|
|
This means that if your application does not install any signal
|
|
|
|
|
handler for @code{SIGPIPE}, you don't need to take any precautions.
|
|
|
|
|
If you do install a signal handler for @code{SIGPIPE}, you must be
|
|
|
|
|
prepared to handle any @code{SIGPIPE} events that occur due to
|
|
|
|
|
@acronym{GPGME} writing to a defunct pipe. Furthermore, if your
|
|
|
|
|
application is multi-threaded, and you install a signal action for
|
|
|
|
|
@code{SIGPIPE}, you must make sure you do this either before
|
|
|
|
|
@code{gpgme_check_version} is called or afterwards.
|
|
|
|
|
|
|
|
|
|
|
2016-11-10 16:28:29 +00:00
|
|
|
|
@node Multi-Threading
|
|
|
|
|
@section Multi-Threading
|
2002-05-09 03:38:12 +00:00
|
|
|
|
@cindex thread-safeness
|
|
|
|
|
@cindex multi-threading
|
|
|
|
|
|
2016-11-10 16:28:29 +00:00
|
|
|
|
The @acronym{GPGME} library is mostly thread-safe, and can be used
|
|
|
|
|
in a multi-threaded environment but there are some requirements
|
|
|
|
|
for multi-threaded use:
|
2002-05-09 03:38:12 +00:00
|
|
|
|
|
|
|
|
|
@itemize @bullet
|
|
|
|
|
@item
|
|
|
|
|
The function @code{gpgme_check_version} must be called before any
|
2002-06-04 12:12:08 +00:00
|
|
|
|
other function in the library, because it initializes the thread
|
2003-09-14 14:48:48 +00:00
|
|
|
|
support subsystem in @acronym{GPGME}. To achieve this in
|
|
|
|
|
multi-threaded programs, you must synchronize the memory with respect
|
|
|
|
|
to other threads that also want to use @acronym{GPGME}. For this, it
|
|
|
|
|
is sufficient to call @code{gpgme_check_version} before creating the
|
|
|
|
|
other threads using @acronym{GPGME}@footnote{At least this is true for
|
|
|
|
|
POSIX threads, as @code{pthread_create} is a function that
|
|
|
|
|
synchronizes memory with respects to other threads. There are many
|
|
|
|
|
functions which have this property, a complete list can be found in
|
|
|
|
|
POSIX, IEEE Std 1003.1-2003, Base Definitions, Issue 6, in the
|
|
|
|
|
definition of the term ``Memory Synchronization''. For other thread
|
|
|
|
|
packages other, more relaxed or more strict rules may apply.}.
|
2002-05-09 03:38:12 +00:00
|
|
|
|
|
|
|
|
|
@item
|
2003-06-22 12:26:11 +00:00
|
|
|
|
Any @code{gpgme_data_t} and @code{gpgme_ctx_t} object must only be
|
|
|
|
|
accessed by one thread at a time. If multiple threads want to deal
|
|
|
|
|
with the same object, the caller has to make sure that operations on
|
|
|
|
|
that object are fully synchronized.
|
2002-05-09 03:38:12 +00:00
|
|
|
|
|
|
|
|
|
@item
|
2002-06-28 01:14:41 +00:00
|
|
|
|
Only one thread at any time is allowed to call @code{gpgme_wait}. If
|
2002-05-09 03:38:12 +00:00
|
|
|
|
multiple threads call this function, the caller must make sure that
|
doc/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (I/O Callback Interface): Document new even
GPGME_EVENT_START.
(Waiting For Completion): Document new possible return values.
(I/O Callback Interface): Document return type of GpgmeIOCb.
gpgme/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* context.h (gpgme_context_s): Remove member ERROR.
* types.h (GpgmeStatusHandler): Change return type to GpgmeError.
(GpgmeCommandHandler): Change return type to GpgmeError and add
new argument RESULT.
* gpgme.h (GpgmeIOCb): Change return type to GpgmeError.
(GpgmeEventIO): New event GPGME_EVENT_START.
(GpgmeIdleFunc): Remove type.
(gpgme_register_idle): Remove prototype.
* data.c: Include <assert.h>.
(_gpgme_data_inbound_handler): Change return type to GpgmeError.
Return any error instead ignoring it, don't close file descriptor
on error.
(_gpgme_data_outbound_handler): Likewise.
* decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(_gpgme_decrypt_status_handler): Change return type to GpgmeError.
Return error instead setting ctx->error. Return success at end of
function.
(gpgme_op_decrypt): Don't work around the old kludge anymore.
* decrypt-verify.c (decrypt_verify_status_handler): Change return
type to GpgmeError. Return possible errors.
* delete.c: Do not include <stdio.h>, <string.h>, <time.h> and
<assert.h>.
(delete_status_handler): Change return type to GpgmeError. Return
error instead setting ctx->error. Return success at end of
function.
* edit.c: Do not include <stdio.h> and <string.h>.
(_gpgme_edit_status_handler): Change type to GpgmeError,
make static and rename to ...
(edit_status_handler): ... this. Return error directly.
(command_handler): Change return type to GpgmeError, add result
argument. Return error directly.
* encrypt.c (status_handler_finish): Remove function.
(_gpgme_encrypt_status_handler): Change return type to GpgmeError.
Return error directly.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (close_notify_handler): Do not signal done event
anymore.
(status_handler): Change return type to GpgmeError. Diddle things
around a bit to return errors directly.
(start): Send start event.
* export.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(export_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* genkey.c: Do not include <stdio.h> and <assert.h>.
(genkey_status_handler): Change return type to GpgmeError. Don't
check ctx->error. Return errors directly.
* gpgme.c (_gpgme_release_result): Do not initialize ctx->error.
(_gpgme_op_event_cb): Function removed.
(_gpgme_op_event_cb_user): Likewise.
* import.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(import_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* keylist.c (keylist_colon_handler, keylist_status_handler, finish_key):
Change return type to GpgmeError, return error directly.
* Makefile (libgpgme_la_SOURCES): Add wait-global.c,
wait-private.c and wait-user.c
* ops.h (test_and_allocate_result): Return error instead setting
ctx->error.
(_gpgme_data_inbound_handler, _gpgme_data_outbound_handler,
_gpgme_verify_status_handler, _gpgme_decrypt_status_handler,
_gpgme_sign_status_handler, _gpgme_encrypt_staus_handler,
_gpgme_passphrase_status_handler, _gpgme_progress_status_handler):
Change return type to GpgmeError.
(_gpgme_passphease_command_handler): Change return type to
GpgmeError and add new argument RESULT.
* op-support.c: Use new callback functions, and change private
data to ctx everywhere.
* passphrase.c (_gpgme_passphrase_status_handler): Change return
type to GpgmeError, return error directly.
(_gpgme_passphrase_command_handler): Change return type to
GpgmeError, add result argument. Return results accordingly.
* progress.c (_gpgme_progress_status_handler): Change return type
to GpgmeError, return errors directly.
* rungpg.c (status_handler): Change return type to GpgmeError.
Return error directly.
(close_notify_handler): Don't send done event.
(colon_line_handler): Change return type to GpgmeError, return
errors directly.
* rungpg.c (start): Send start event.
* sign.c (_gpgme_sign_status_handler): Change return type to
GpgmeError, return errors directly.
* trustlist.c (trustlist_status_handler): Change return type to
GpgmeError. Return 0.
(trustlist_colon_handler): Change return type GpgmeError. Return
errors directly.
* verify.c (add_notation): Change return type to GpgmeError,
return errors directly.
(_gpgme_verify_status_handler): Likewise.
* wait.h (struct fd_table): Remove lock member.
(struct wait_item_s): Moved here from wait.c.
(struct tag): New structure.
(_gpgme_wait_event_cb): Remove prototype.
(_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb,
_gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb,
_gpgme_wait_user_event_io_cb): New prototypes.
* wait.c: Don't include <stdio.h>.
(ftd_global, ctx_done_list, ctx_done_list_size,
ctx_done_list_length, ctx_done_list_lock, idle_function): Remove
global variable.
(gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove
function.
(gpgme_wait): Move to file wait-global.c.
(_gpgme_add_io_cb): Take ctx as private argument, initialize ctx
member in wait item and tag.
(_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock.
(_gpgme_wait_one, _gpgme_wait_on_condition): Move to
wait-private.c.
(gpgme_fd_table_init): Don't initialize FDT->lock.
(gpgme_fd_table_deinit): Don't destroy FDT->lock.
(_gpgme_fd_table_put): Make static and rename to ...
(fd_table_put): ... this function. Don't use FDT->lock.
(struct wait_item_s): Move to wait.h.
* wait-global.c: New file.
* wait-private.c: New file.
* wait-user.c: New file.
2003-01-29 15:20:58 +00:00
|
|
|
|
all invocations are fully synchronized. It is safe to start
|
|
|
|
|
asynchronous operations while a thread is running in gpgme_wait.
|
2003-09-13 18:04:16 +00:00
|
|
|
|
|
|
|
|
|
@item
|
|
|
|
|
The function @code{gpgme_strerror} is not thread safe. You have to
|
|
|
|
|
use @code{gpgme_strerror_r} instead.
|
2002-05-09 03:38:12 +00:00
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@node Protocols and Engines
|
|
|
|
|
@chapter Protocols and Engines
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex protocol
|
|
|
|
|
@cindex engine
|
|
|
|
|
@cindex crypto engine
|
|
|
|
|
@cindex backend
|
|
|
|
|
@cindex crypto backend
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@acronym{GPGME} supports several cryptographic protocols, however, it
|
|
|
|
|
does not implement them. Rather it uses backends (also called
|
|
|
|
|
engines) which implement the protocol. @acronym{GPGME} uses
|
|
|
|
|
inter-process communication to pass data back and forth between the
|
|
|
|
|
application and the backend, but the details of the communication
|
2003-06-05 23:20:29 +00:00
|
|
|
|
protocol and invocation of the backend is completely hidden by the
|
2002-01-16 00:41:10 +00:00
|
|
|
|
interface. All complexity is handled by @acronym{GPGME}. Where an
|
|
|
|
|
exchange of information between the application and the backend is
|
|
|
|
|
necessary, @acronym{GPGME} provides the necessary callback function
|
|
|
|
|
hooks and further interfaces.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {enum gpgme_protocol_t}
|
|
|
|
|
@tindex gpgme_protocol_t
|
|
|
|
|
The @code{gpgme_protocol_t} type specifies the set of possible protocol
|
2002-01-16 00:41:10 +00:00
|
|
|
|
values that are supported by @acronym{GPGME}. The following protocols
|
|
|
|
|
are supported:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_PROTOCOL_OpenPGP
|
|
|
|
|
This specifies the OpenPGP protocol.
|
2003-06-05 23:20:29 +00:00
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@item GPGME_PROTOCOL_CMS
|
|
|
|
|
This specifies the Cryptographic Message Syntax.
|
2007-09-27 12:17:24 +00:00
|
|
|
|
|
2016-08-02 14:51:08 +00:00
|
|
|
|
@item GPGME_PROTOCOL_GPGCONF
|
2009-11-03 20:27:35 +00:00
|
|
|
|
Under development. Please ask on @email{gnupg-devel@@gnupg.org} for help.
|
|
|
|
|
|
2016-08-02 14:51:08 +00:00
|
|
|
|
@item GPGME_PROTOCOL_ASSUAN
|
|
|
|
|
This specifies the raw Assuan protocol.
|
|
|
|
|
|
2009-11-03 20:27:35 +00:00
|
|
|
|
@item GPGME_PROTOCOL_G13
|
|
|
|
|
Under development. Please ask on @email{gnupg-devel@@gnupg.org} for help.
|
|
|
|
|
|
|
|
|
|
@item GPGME_PROTOCOL_UISERVER
|
|
|
|
|
Under development. Please ask on @email{gnupg-devel@@gnupg.org} for help.
|
|
|
|
|
|
2014-04-10 11:01:00 +00:00
|
|
|
|
@item GPGME_PROTOCOL_SPAWN
|
|
|
|
|
Special protocol for use with @code{gpgme_op_spawn}.
|
|
|
|
|
|
2007-09-27 12:17:24 +00:00
|
|
|
|
@item GPGME_PROTOCOL_UNKNOWN
|
|
|
|
|
Reserved for future extension. You may use this to indicate that the
|
|
|
|
|
used protocol is not known to the application. Currently,
|
|
|
|
|
@acronym{GPGME} does not accept this value in any operation, though,
|
|
|
|
|
except for @code{gpgme_get_protocol_name}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-01-30 12:01:21 +00:00
|
|
|
|
|
2005-10-01 22:14:40 +00:00
|
|
|
|
@deftypefun {const char *} gpgme_get_protocol_name (@w{gpgme_protocol_t @var{protocol}})
|
2003-01-30 12:01:21 +00:00
|
|
|
|
The function @code{gpgme_get_protocol_name} returns a statically
|
|
|
|
|
allocated string describing the protocol @var{protocol}, or
|
|
|
|
|
@code{NULL} if the protocol number is not valid.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@menu
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Engine Version Check:: Verifying the engine version.
|
|
|
|
|
* Engine Information:: Obtaining more information about the engines.
|
2005-01-12 11:13:17 +00:00
|
|
|
|
* Engine Configuration:: Changing the engine configuration.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
* OpenPGP:: Support for the OpenPGP protocol.
|
|
|
|
|
* Cryptographic Message Syntax:: Support for the CMS.
|
2016-08-02 14:51:08 +00:00
|
|
|
|
* Assuan:: Support for the raw Assuan protocol.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Engine Version Check
|
|
|
|
|
@section Engine Version Check
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex version check, of the engines
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2014-04-10 09:47:19 +00:00
|
|
|
|
@deftypefun @w{const char *} gpgme_get_dirinfo (@w{cons char *@var{what}})
|
|
|
|
|
The function @code{gpgme_get_dirinfo} returns a statically allocated
|
|
|
|
|
string with the value associated to @var{what}. The returned values
|
|
|
|
|
are the defaults and won't change even after
|
|
|
|
|
@code{gpgme_set_engine_info} has been used to configure a different
|
|
|
|
|
engine. @code{NULL} is returned if no value is available. Commonly
|
|
|
|
|
supported values for @var{what} are:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item homedir
|
|
|
|
|
Return the default home directory.
|
|
|
|
|
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
@item sysconfdir
|
|
|
|
|
Return the name of the system configuration directory
|
|
|
|
|
|
|
|
|
|
@item bindir
|
|
|
|
|
Return the name of the directory with GnuPG program files.
|
|
|
|
|
|
|
|
|
|
@item libdir
|
|
|
|
|
Return the name of the directory with GnuPG related library files.
|
|
|
|
|
|
|
|
|
|
@item libexecdir
|
|
|
|
|
Return the name of the directory with GnuPG helper program files.
|
|
|
|
|
|
|
|
|
|
@item datadir
|
|
|
|
|
Return the name of the directory with GnuPG shared data.
|
|
|
|
|
|
|
|
|
|
@item localedir
|
|
|
|
|
Return the name of the directory with GnuPG locale data.
|
|
|
|
|
|
2014-04-10 09:47:19 +00:00
|
|
|
|
@item agent-socket
|
|
|
|
|
Return the name of the socket to connect to the gpg-agent.
|
|
|
|
|
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
@item agent-ssh-socket
|
|
|
|
|
Return the name of the socket to connect to the ssh-agent component of
|
|
|
|
|
gpg-agent.
|
|
|
|
|
|
|
|
|
|
@item dirmngr-socket
|
|
|
|
|
Return the name of the socket to connect to the dirmngr.
|
|
|
|
|
|
2014-04-10 09:47:19 +00:00
|
|
|
|
@item uiserver-socket
|
|
|
|
|
Return the name of the socket to connect to the user interface server.
|
|
|
|
|
|
|
|
|
|
@item gpgconf-name
|
|
|
|
|
Return the file name of the engine configuration tool.
|
|
|
|
|
|
|
|
|
|
@item gpg-name
|
|
|
|
|
Return the file name of the OpenPGP engine.
|
|
|
|
|
|
|
|
|
|
@item gpgsm-name
|
|
|
|
|
Return the file name of the CMS engine.
|
|
|
|
|
|
|
|
|
|
@item g13-name
|
|
|
|
|
Return the name of the file container encryption engine.
|
|
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_engine_check_version (@w{gpgme_protocol_t @var{protocol}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_engine_check_version} verifies that the
|
|
|
|
|
engine implementing the protocol @var{PROTOCOL} is installed in the
|
|
|
|
|
expected path and meets the version requirement of @acronym{GPGME}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
This function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
engine is available and @code{GPG_ERR_INV_ENGINE} if it is not.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Engine Information
|
|
|
|
|
@section Engine Information
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex engine, information about
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_engine_info_t}
|
|
|
|
|
@tindex gpgme_protocol_t
|
|
|
|
|
The @code{gpgme_engine_info_t} type specifies a pointer to a structure
|
2003-06-05 23:20:29 +00:00
|
|
|
|
describing a crypto engine. The structure contains the following
|
|
|
|
|
elements:
|
2003-01-30 11:54:23 +00:00
|
|
|
|
|
|
|
|
|
@table @code
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_engine_info_t next
|
2003-01-30 11:54:23 +00:00
|
|
|
|
This is a pointer to the next engine info structure in the linked
|
|
|
|
|
list, or @code{NULL} if this is the last element.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_protocol_t protocol
|
2003-06-05 23:20:29 +00:00
|
|
|
|
This is the protocol for which the crypto engine is used. You can
|
2003-01-30 11:54:23 +00:00
|
|
|
|
convert this to a string with @code{gpgme_get_protocol_name} for
|
|
|
|
|
printing.
|
|
|
|
|
|
2003-01-30 13:11:25 +00:00
|
|
|
|
@item const char *file_name
|
|
|
|
|
This is a string holding the file name of the executable of the crypto
|
2003-01-30 11:54:23 +00:00
|
|
|
|
engine. Currently, it is never @code{NULL}, but using @code{NULL} is
|
|
|
|
|
reserved for future use, so always check before you use it.
|
|
|
|
|
|
2005-01-12 11:13:17 +00:00
|
|
|
|
@item const char *home_dir
|
|
|
|
|
This is a string holding the directory name of the crypto engine's
|
|
|
|
|
configuration directory. If it is @code{NULL}, then the default
|
2014-04-10 09:47:19 +00:00
|
|
|
|
directory is used. See @code{gpgme_get_dirinfo} on how to get the
|
|
|
|
|
default directory.
|
2005-01-12 11:13:17 +00:00
|
|
|
|
|
2003-01-30 11:54:23 +00:00
|
|
|
|
@item const char *version
|
|
|
|
|
This is a string containing the version number of the crypto engine.
|
|
|
|
|
It might be @code{NULL} if the version number can not be determined,
|
|
|
|
|
for example because the executable doesn't exist or is invalid.
|
|
|
|
|
|
|
|
|
|
@item const char *req_version
|
|
|
|
|
This is a string containing the minimum required version number of the
|
|
|
|
|
crypto engine for @acronym{GPGME} to work correctly. This is the
|
|
|
|
|
version number that @code{gpgme_engine_check_version} verifies
|
|
|
|
|
against. Currently, it is never @code{NULL}, but using @code{NULL} is
|
|
|
|
|
reserved for future use, so always check before you use it.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end table
|
2003-01-30 11:54:23 +00:00
|
|
|
|
@end deftp
|
|
|
|
|
|
2005-01-12 11:13:17 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_get_engine_info (@w{gpgme_engine_info_t *@var{info}})
|
2003-01-30 11:54:23 +00:00
|
|
|
|
The function @code{gpgme_get_engine_info} returns a linked list of
|
|
|
|
|
engine info structures in @var{info}. Each info structure describes
|
2005-01-12 11:13:17 +00:00
|
|
|
|
the defaults of one configured backend.
|
2003-01-30 11:54:23 +00:00
|
|
|
|
|
|
|
|
|
The memory for the info structures is allocated the first time this
|
|
|
|
|
function is invoked, and must not be freed by the caller.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
This function returns the error code @code{GPG_ERR_NO_ERROR} if
|
|
|
|
|
successful, and a system error if the memory could not be allocated.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
Here is an example how you can provide more diagnostics if you receive
|
|
|
|
|
an error message which indicates that the crypto engine is invalid.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@example
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_ctx_t ctx;
|
|
|
|
|
gpgme_error_t err;
|
2003-01-30 11:54:23 +00:00
|
|
|
|
|
|
|
|
|
[...]
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
if (gpgme_err_code (err) == GPG_ERR_INV_ENGINE)
|
2003-01-30 11:54:23 +00:00
|
|
|
|
@{
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_engine_info_t info;
|
2003-01-30 11:54:23 +00:00
|
|
|
|
err = gpgme_get_engine_info (&info);
|
|
|
|
|
if (!err)
|
|
|
|
|
@{
|
|
|
|
|
while (info && info->protocol != gpgme_get_protocol (ctx))
|
|
|
|
|
info = info->next;
|
|
|
|
|
if (!info)
|
|
|
|
|
fprintf (stderr, "GPGME compiled without support for protocol %s",
|
|
|
|
|
gpgme_get_protocol_name (info->protocol));
|
2009-05-05 17:19:17 +00:00
|
|
|
|
else if (info->file_name && !info->version)
|
2003-01-30 11:54:23 +00:00
|
|
|
|
fprintf (stderr, "Engine %s not installed properly",
|
2009-05-05 17:19:17 +00:00
|
|
|
|
info->file_name);
|
|
|
|
|
else if (info->file_name && info->version && info->req_version)
|
2003-01-30 11:54:23 +00:00
|
|
|
|
fprintf (stderr, "Engine %s version %s installed, "
|
2009-05-05 17:19:17 +00:00
|
|
|
|
"but at least version %s required", info->file_name,
|
2003-01-30 11:54:23 +00:00
|
|
|
|
info->version, info->req_version);
|
|
|
|
|
else
|
|
|
|
|
fprintf (stderr, "Unknown problem with engine for protocol %s",
|
|
|
|
|
gpgme_get_protocol_name (info->protocol));
|
|
|
|
|
@}
|
|
|
|
|
@}
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
|
2005-01-12 11:13:17 +00:00
|
|
|
|
@node Engine Configuration
|
|
|
|
|
@section Engine Configuration
|
|
|
|
|
@cindex engine, configuration of
|
|
|
|
|
@cindex configuration of crypto backend
|
|
|
|
|
|
|
|
|
|
You can change the configuration of a backend engine, and thus change
|
|
|
|
|
the executable program and configuration directory to be used. You
|
|
|
|
|
can make these changes the default or set them for some contexts
|
|
|
|
|
individually.
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_set_engine_info (@w{gpgme_protocol_t @var{proto}}, @w{const char *@var{file_name}}, @w{const char *@var{home_dir}})
|
|
|
|
|
The function @code{gpgme_set_engine_info} changes the default
|
|
|
|
|
configuration of the crypto engine implementing the protocol
|
|
|
|
|
@var{proto}.
|
|
|
|
|
|
|
|
|
|
@var{file_name} is the file name of the executable program
|
|
|
|
|
implementing this protocol, and @var{home_dir} is the directory name
|
|
|
|
|
of the configuration directory for this crypto engine. If
|
|
|
|
|
@var{home_dir} is @code{NULL}, the engine's default will be used.
|
|
|
|
|
|
|
|
|
|
The new defaults are not applied to already created GPGME contexts.
|
|
|
|
|
|
|
|
|
|
This function returns the error code @code{GPG_ERR_NO_ERROR} if
|
|
|
|
|
successful, or an eror code on failure.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
The functions @code{gpgme_ctx_get_engine_info} and
|
|
|
|
|
@code{gpgme_ctx_set_engine_info} can be used to change the engine
|
|
|
|
|
configuration per context. @xref{Crypto Engine}.
|
|
|
|
|
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@node OpenPGP
|
|
|
|
|
@section OpenPGP
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex OpenPGP
|
|
|
|
|
@cindex GnuPG
|
|
|
|
|
@cindex protocol, GnuPG
|
|
|
|
|
@cindex engine, GnuPG
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
OpenPGP is implemented by GnuPG, the @acronym{GNU} Privacy Guard.
|
|
|
|
|
This is the first protocol that was supported by @acronym{GPGME}.
|
|
|
|
|
|
|
|
|
|
The OpenPGP protocol is specified by @code{GPGME_PROTOCOL_OpenPGP}.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Cryptographic Message Syntax
|
|
|
|
|
@section Cryptographic Message Syntax
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex CMS
|
|
|
|
|
@cindex cryptographic message syntax
|
|
|
|
|
@cindex GpgSM
|
|
|
|
|
@cindex protocol, CMS
|
|
|
|
|
@cindex engine, GpgSM
|
|
|
|
|
@cindex S/MIME
|
|
|
|
|
@cindex protocol, S/MIME
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@acronym{CMS} is implemented by GpgSM, the S/MIME implementation for
|
|
|
|
|
GnuPG.
|
|
|
|
|
|
|
|
|
|
The @acronym{CMS} protocol is specified by @code{GPGME_PROTOCOL_CMS}.
|
|
|
|
|
|
|
|
|
|
|
2016-08-02 14:51:08 +00:00
|
|
|
|
@node Assuan
|
|
|
|
|
@section Assuan
|
|
|
|
|
@cindex ASSUAN
|
|
|
|
|
@cindex protocol, ASSUAN
|
|
|
|
|
@cindex engine, ASSUAN
|
|
|
|
|
|
|
|
|
|
Assuan is the RPC library used by the various @acronym{GnuPG}
|
|
|
|
|
components. The Assuan protocol allows one to talk to arbitrary
|
|
|
|
|
Assuan servers using @acronym{GPGME}. @xref{Using the Assuan
|
|
|
|
|
protocol}.
|
|
|
|
|
|
|
|
|
|
The ASSUAN protocol is specified by @code{GPGME_PROTOCOL_ASSUAN}.
|
|
|
|
|
|
|
|
|
|
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
@node Algorithms
|
|
|
|
|
@chapter Algorithms
|
|
|
|
|
@cindex algorithms
|
|
|
|
|
|
|
|
|
|
The crypto backends support a variety of algorithms used in public key
|
2008-07-04 15:46:01 +00:00
|
|
|
|
cryptography.@footnote{Some engines also provide symmetric only
|
|
|
|
|
encryption; see the description of the encryption function on how to use
|
|
|
|
|
this.} The following sections list the identifiers used to denote such
|
|
|
|
|
an algorithm.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
|
|
|
|
|
@menu
|
|
|
|
|
* Public Key Algorithms:: A list of all public key algorithms.
|
|
|
|
|
* Hash Algorithms:: A list of all hash algorithms.
|
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Public Key Algorithms
|
|
|
|
|
@section Public Key Algorithms
|
|
|
|
|
@cindex algorithms, public key
|
|
|
|
|
@cindex public key algorithms
|
|
|
|
|
|
|
|
|
|
Public key algorithms are used for encryption, decryption, signing and
|
|
|
|
|
verification of signatures.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {enum gpgme_pubkey_algo_t}
|
|
|
|
|
@tindex gpgme_pubkey_algo_t
|
|
|
|
|
The @code{gpgme_pubkey_algo_t} type specifies the set of all public key
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
algorithms that are supported by @acronym{GPGME}. Possible values
|
|
|
|
|
are:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_PK_RSA
|
|
|
|
|
This value indicates the RSA (Rivest, Shamir, Adleman) algorithm.
|
|
|
|
|
|
|
|
|
|
@item GPGME_PK_RSA_E
|
|
|
|
|
Deprecated. This value indicates the RSA (Rivest, Shamir, Adleman)
|
|
|
|
|
algorithm for encryption and decryption only.
|
|
|
|
|
|
|
|
|
|
@item GPGME_PK_RSA_S
|
|
|
|
|
Deprecated. This value indicates the RSA (Rivest, Shamir, Adleman)
|
|
|
|
|
algorithm for signing and verification only.
|
|
|
|
|
|
|
|
|
|
@item GPGME_PK_DSA
|
|
|
|
|
This value indicates DSA, the Digital Signature Algorithm.
|
|
|
|
|
|
|
|
|
|
@item GPGME_PK_ELG
|
|
|
|
|
This value indicates ElGamal.
|
|
|
|
|
|
|
|
|
|
@item GPGME_PK_ELG_E
|
|
|
|
|
This value also indicates ElGamal and is used specifically in GnuPG.
|
2010-01-05 17:36:53 +00:00
|
|
|
|
|
2014-05-08 12:03:14 +00:00
|
|
|
|
@item GPGME_PK_ECC
|
|
|
|
|
This value is a generic indicator for ellipic curve algorithms.
|
2010-01-05 17:36:53 +00:00
|
|
|
|
|
|
|
|
|
@item GPGME_PK_ECDSA
|
|
|
|
|
This value indicates ECDSA, the Elliptic Curve Digital Signature
|
2014-05-08 12:03:14 +00:00
|
|
|
|
Algorithm as defined by FIPS 186-2 and RFC-6637.
|
2010-01-05 17:36:53 +00:00
|
|
|
|
|
|
|
|
|
@item GPGME_PK_ECDH
|
2014-05-08 12:03:14 +00:00
|
|
|
|
This value indicates ECDH, the Eliptic Curve Diffie-Hellmann
|
|
|
|
|
encryption algorithm as defined by RFC-6637.
|
2010-01-05 17:36:53 +00:00
|
|
|
|
|
2015-08-30 17:04:44 +00:00
|
|
|
|
@item GPGME_PK_EDDSA
|
|
|
|
|
This value indicates the EdDSA algorithm.
|
|
|
|
|
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun {const char *} gpgme_pubkey_algo_name (@w{gpgme_pubkey_algo_t @var{algo}})
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
The function @code{gpgme_pubkey_algo_name} returns a pointer to a
|
|
|
|
|
statically allocated string containing a description of the public key
|
|
|
|
|
algorithm @var{algo}. This string can be used to output the name of
|
|
|
|
|
the public key algorithm to the user.
|
|
|
|
|
|
|
|
|
|
If @var{algo} is not a valid public key algorithm, @code{NULL} is
|
|
|
|
|
returned.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2015-08-30 17:04:44 +00:00
|
|
|
|
@deftypefun {char *} gpgme_pubkey_algo_string (@w{gpgme_subkey_t @var{key}})
|
|
|
|
|
The function @code{gpgme_pubkey_algo_string} is a convenience function
|
|
|
|
|
to build and return an algorithm string in the same way GnuPG does
|
|
|
|
|
(e.g. ``rsa2048'' or ``ed25519''). The caller must free the result
|
|
|
|
|
using @code{gpgme_free}. On error (e.g. invalid argument or memory
|
|
|
|
|
exhausted), the function returns NULL and sets @code{ERRNO}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
|
|
|
|
|
@node Hash Algorithms
|
|
|
|
|
@section Hash Algorithms
|
|
|
|
|
@cindex algorithms, hash
|
|
|
|
|
@cindex algorithms, message digest
|
|
|
|
|
@cindex hash algorithms
|
|
|
|
|
@cindex message digest algorithms
|
|
|
|
|
|
|
|
|
|
Hash (message digest) algorithms are used to compress a long message
|
|
|
|
|
to make it suitable for public key cryptography.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {enum gpgme_hash_algo_t}
|
|
|
|
|
@tindex gpgme_hash_algo_t
|
|
|
|
|
The @code{gpgme_hash_algo_t} type specifies the set of all hash algorithms
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
that are supported by @acronym{GPGME}. Possible values are:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_MD_MD5
|
|
|
|
|
@item GPGME_MD_SHA1
|
|
|
|
|
@item GPGME_MD_RMD160
|
|
|
|
|
@item GPGME_MD_MD2
|
|
|
|
|
@item GPGME_MD_TIGER
|
|
|
|
|
@item GPGME_MD_HAVAL
|
|
|
|
|
@item GPGME_MD_SHA256
|
|
|
|
|
@item GPGME_MD_SHA384
|
|
|
|
|
@item GPGME_MD_SHA512
|
2014-05-08 12:03:14 +00:00
|
|
|
|
@item GPGME_MD_SHA224
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
@item GPGME_MD_MD4
|
|
|
|
|
@item GPGME_MD_CRC32
|
|
|
|
|
@item GPGME_MD_CRC32_RFC1510
|
|
|
|
|
@item GPGME_MD_CRC24_RFC2440
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun {const char *} gpgme_hash_algo_name (@w{gpgme_hash_algo_t @var{algo}})
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
The function @code{gpgme_hash_algo_name} returns a pointer to a
|
|
|
|
|
statically allocated string containing a description of the hash
|
|
|
|
|
algorithm @var{algo}. This string can be used to output the name of
|
|
|
|
|
the hash algorithm to the user.
|
|
|
|
|
|
|
|
|
|
If @var{algo} is not a valid hash algorithm, @code{NULL} is returned.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@node Error Handling
|
|
|
|
|
@chapter Error Handling
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex error handling
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
Many functions in @acronym{GPGME} can return an error if they fail.
|
|
|
|
|
For this reason, the application should always catch the error
|
|
|
|
|
condition and take appropriate measures, for example by releasing the
|
|
|
|
|
resources and passing the error up to the caller, or by displaying a
|
|
|
|
|
descriptive message to the user and cancelling the operation.
|
|
|
|
|
|
|
|
|
|
Some error values do not indicate a system error or an error in the
|
|
|
|
|
operation, but the result of an operation that failed properly. For
|
|
|
|
|
example, if you try to decrypt a tempered message, the decryption will
|
|
|
|
|
fail. Another error value actually means that the end of a data
|
|
|
|
|
buffer or list has been reached. The following descriptions explain
|
2003-06-05 23:20:29 +00:00
|
|
|
|
for many error codes what they mean usually. Some error values have
|
|
|
|
|
specific meanings if returned by a certain functions. Such cases are
|
2002-01-16 00:41:10 +00:00
|
|
|
|
described in the documentation of those functions.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@acronym{GPGME} uses the @code{libgpg-error} library. This allows to
|
|
|
|
|
share the error codes with other components of the GnuPG system, and
|
|
|
|
|
thus pass error values transparently from the crypto engine, or some
|
|
|
|
|
helper application of the crypto engine, to the user. This way no
|
|
|
|
|
information is lost. As a consequence, @acronym{GPGME} does not use
|
|
|
|
|
its own identifiers for error codes, but uses those provided by
|
|
|
|
|
@code{libgpg-error}. They usually start with @code{GPG_ERR_}.
|
|
|
|
|
|
|
|
|
|
However, @acronym{GPGME} does provide aliases for the functions
|
|
|
|
|
defined in libgpg-error, which might be preferred for name space
|
|
|
|
|
consistency.
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@menu
|
2003-06-05 23:20:29 +00:00
|
|
|
|
* Error Values:: The error value and what it means.
|
|
|
|
|
* Error Sources:: A list of important error sources.
|
|
|
|
|
* Error Codes:: A list of important error codes.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Error Strings:: How to get a descriptive string from a value.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Error Values
|
|
|
|
|
@section Error Values
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@cindex error values
|
|
|
|
|
@cindex error codes
|
|
|
|
|
@cindex error sources
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {gpgme_err_code_t}
|
|
|
|
|
The @code{gpgme_err_code_t} type is an alias for the @code{libgpg-error}
|
|
|
|
|
type @code{gpg_err_code_t}. The error code indicates the type of an
|
|
|
|
|
error, or the reason why an operation failed.
|
|
|
|
|
|
|
|
|
|
A list of important error codes can be found in the next section.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {gpgme_err_source_t}
|
|
|
|
|
The @code{gpgme_err_source_t} type is an alias for the
|
|
|
|
|
@code{libgpg-error} type @code{gpg_err_source_t}. The error source
|
|
|
|
|
has not a precisely defined meaning. Sometimes it is the place where
|
|
|
|
|
the error happened, sometimes it is the place where an error was
|
|
|
|
|
encoded into an error value. Usually the error source will give an
|
|
|
|
|
indication to where to look for the problem. This is not always true,
|
|
|
|
|
but it is attempted to achieve this goal.
|
|
|
|
|
|
|
|
|
|
A list of important error sources can be found in the next section.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {gpgme_error_t}
|
|
|
|
|
The @code{gpgme_error_t} type is an alias for the @code{libgpg-error}
|
|
|
|
|
type @code{gpg_error_t}. An error value like this has always two
|
|
|
|
|
components, an error code and an error source. Both together form the
|
|
|
|
|
error value.
|
|
|
|
|
|
|
|
|
|
Thus, the error value can not be directly compared against an error
|
|
|
|
|
code, but the accessor functions described below must be used.
|
|
|
|
|
However, it is guaranteed that only 0 is used to indicate success
|
|
|
|
|
(@code{GPG_ERR_NO_ERROR}), and that in this case all other parts of
|
|
|
|
|
the error value are set to 0, too.
|
|
|
|
|
|
|
|
|
|
Note that in @acronym{GPGME}, the error source is used purely for
|
|
|
|
|
diagnostical purposes. Only the error code should be checked to test
|
|
|
|
|
for a certain outcome of a function. The manual only documents the
|
|
|
|
|
error code part of an error value. The error source is left
|
|
|
|
|
unspecified and might be anything.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-09-14 00:02:41 +00:00
|
|
|
|
@deftypefun {static inline gpgme_err_code_t} gpgme_err_code (@w{gpgme_error_t @var{err}})
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The static inline function @code{gpgme_err_code} returns the
|
|
|
|
|
@code{gpgme_err_code_t} component of the error value @var{err}. This
|
|
|
|
|
function must be used to extract the error code from an error value in
|
|
|
|
|
order to compare it with the @code{GPG_ERR_*} error code macros.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-09-14 00:02:41 +00:00
|
|
|
|
@deftypefun {static inline gpgme_err_source_t} gpgme_err_source (@w{gpgme_error_t @var{err}})
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The static inline function @code{gpgme_err_source} returns the
|
|
|
|
|
@code{gpgme_err_source_t} component of the error value @var{err}. This
|
|
|
|
|
function must be used to extract the error source from an error value in
|
|
|
|
|
order to compare it with the @code{GPG_ERR_SOURCE_*} error source macros.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-09-14 00:02:41 +00:00
|
|
|
|
@deftypefun {static inline gpgme_error_t} gpgme_err_make (@w{gpgme_err_source_t @var{source}}, @w{gpgme_err_code_t @var{code}})
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The static inline function @code{gpgme_err_make} returns the error
|
|
|
|
|
value consisting of the error source @var{source} and the error code
|
|
|
|
|
@var{code}.
|
|
|
|
|
|
|
|
|
|
This function can be used in callback functions to construct an error
|
|
|
|
|
value to return it to the library.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-09-14 00:02:41 +00:00
|
|
|
|
@deftypefun {static inline gpgme_error_t} gpgme_error (@w{gpgme_err_code_t @var{code}})
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The static inline function @code{gpgme_error} returns the error value
|
|
|
|
|
consisting of the default error source and the error code @var{code}.
|
|
|
|
|
|
|
|
|
|
For @acronym{GPGME} applications, the default error source is
|
|
|
|
|
@code{GPG_ERR_SOURCE_USER_1}. You can define
|
|
|
|
|
@code{GPGME_ERR_SOURCE_DEFAULT} before including @file{gpgme.h} to
|
|
|
|
|
change this default.
|
|
|
|
|
|
|
|
|
|
This function can be used in callback functions to construct an error
|
|
|
|
|
value to return it to the library.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
The @code{libgpg-error} library provides error codes for all system
|
|
|
|
|
error numbers it knows about. If @var{err} is an unknown error
|
|
|
|
|
number, the error code @code{GPG_ERR_UNKNOWN_ERRNO} is used. The
|
|
|
|
|
following functions can be used to construct error values from system
|
|
|
|
|
errnor numbers.
|
|
|
|
|
|
|
|
|
|
@deftypefun {gpgme_error_t} gpgme_err_make_from_errno (@w{gpgme_err_source_t @var{source}}, @w{int @var{err}})
|
|
|
|
|
The function @code{gpgme_err_make_from_errno} is like
|
|
|
|
|
@code{gpgme_err_make}, but it takes a system error like @code{errno}
|
|
|
|
|
instead of a @code{gpgme_err_code_t} error code.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun {gpgme_error_t} gpgme_error_from_errno (@w{int @var{err}})
|
|
|
|
|
The function @code{gpgme_error_from_errno} is like @code{gpgme_error},
|
|
|
|
|
but it takes a system error like @code{errno} instead of a
|
|
|
|
|
@code{gpgme_err_code_t} error code.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
Sometimes you might want to map system error numbers to error codes
|
|
|
|
|
directly, or map an error code representing a system error back to the
|
|
|
|
|
system error number. The following functions can be used to do that.
|
|
|
|
|
|
|
|
|
|
@deftypefun {gpgme_err_code_t} gpgme_err_code_from_errno (@w{int @var{err}})
|
|
|
|
|
The function @code{gpgme_err_code_from_errno} returns the error code
|
|
|
|
|
for the system error @var{err}. If @var{err} is not a known system
|
|
|
|
|
error, the function returns @code{GPG_ERR_UNKNOWN_ERRNO}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun {int} gpgme_err_code_to_errno (@w{gpgme_err_code_t @var{err}})
|
|
|
|
|
The function @code{gpgme_err_code_to_errno} returns the system error
|
|
|
|
|
for the error code @var{err}. If @var{err} is not an error code
|
|
|
|
|
representing a system error, or if this system error is not defined on
|
|
|
|
|
this system, the function returns @code{0}.
|
|
|
|
|
@end deftypefun
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
|
|
|
|
|
@node Error Sources
|
|
|
|
|
@section Error Sources
|
|
|
|
|
@cindex error codes, list of
|
|
|
|
|
|
|
|
|
|
The library @code{libgpg-error} defines an error source for every
|
|
|
|
|
component of the GnuPG system. The error source part of an error
|
|
|
|
|
value is not well defined. As such it is mainly useful to improve the
|
|
|
|
|
diagnostic error message for the user.
|
|
|
|
|
|
|
|
|
|
If the error code part of an error value is @code{0}, the whole error
|
|
|
|
|
value will be @code{0}. In this case the error source part is of
|
|
|
|
|
course @code{GPG_ERR_SOURCE_UNKNOWN}.
|
|
|
|
|
|
|
|
|
|
The list of error sources that might occur in applications using
|
|
|
|
|
@acronym{GPGME} is:
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@table @code
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_SOURCE_UNKNOWN
|
|
|
|
|
The error source is not known. The value of this error source is
|
|
|
|
|
@code{0}.
|
|
|
|
|
|
|
|
|
|
@item GPG_ERR_SOURCE_GPGME
|
|
|
|
|
The error source is @acronym{GPGME} itself. This is the default for
|
|
|
|
|
errors that occur in the @acronym{GPGME} library.
|
|
|
|
|
|
|
|
|
|
@item GPG_ERR_SOURCE_GPG
|
|
|
|
|
The error source is GnuPG, which is the crypto engine used for the
|
|
|
|
|
OpenPGP protocol.
|
|
|
|
|
|
|
|
|
|
@item GPG_ERR_SOURCE_GPGSM
|
|
|
|
|
The error source is GPGSM, which is the crypto engine used for the
|
2003-07-22 12:19:32 +00:00
|
|
|
|
CMS protocol.
|
2003-06-05 23:20:29 +00:00
|
|
|
|
|
|
|
|
|
@item GPG_ERR_SOURCE_GCRYPT
|
|
|
|
|
The error source is @code{libgcrypt}, which is used by crypto engines
|
|
|
|
|
to perform cryptographic operations.
|
|
|
|
|
|
|
|
|
|
@item GPG_ERR_SOURCE_GPGAGENT
|
|
|
|
|
The error source is @command{gpg-agent}, which is used by crypto
|
|
|
|
|
engines to perform operations with the secret key.
|
|
|
|
|
|
|
|
|
|
@item GPG_ERR_SOURCE_PINENTRY
|
|
|
|
|
The error source is @command{pinentry}, which is used by
|
|
|
|
|
@command{gpg-agent} to query the passphrase to unlock a secret key.
|
|
|
|
|
|
|
|
|
|
@item GPG_ERR_SOURCE_SCD
|
|
|
|
|
The error source is the SmartCard Daemon, which is used by
|
|
|
|
|
@command{gpg-agent} to delegate operations with the secret key to a
|
|
|
|
|
SmartCard.
|
|
|
|
|
|
|
|
|
|
@item GPG_ERR_SOURCE_KEYBOX
|
|
|
|
|
The error source is @code{libkbx}, a library used by the crypto
|
|
|
|
|
engines to manage local keyrings.
|
|
|
|
|
|
|
|
|
|
@item GPG_ERR_SOURCE_USER_1
|
|
|
|
|
@item GPG_ERR_SOURCE_USER_2
|
|
|
|
|
@item GPG_ERR_SOURCE_USER_3
|
|
|
|
|
@item GPG_ERR_SOURCE_USER_4
|
|
|
|
|
These error sources are not used by any GnuPG component and can be
|
|
|
|
|
used by other software. For example, applications using
|
|
|
|
|
@acronym{GPGME} can use them to mark error values coming from callback
|
|
|
|
|
handlers. Thus @code{GPG_ERR_SOURCE_USER_1} is the default for errors
|
|
|
|
|
created with @code{gpgme_error} and @code{gpgme_error_from_errno},
|
|
|
|
|
unless you define @code{GPGME_ERR_SOURCE_DEFAULT} before including
|
|
|
|
|
@file{gpgme.h}.
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Error Codes
|
|
|
|
|
@section Error Codes
|
|
|
|
|
@cindex error codes, list of
|
|
|
|
|
|
|
|
|
|
The library @code{libgpg-error} defines many error values. Most of
|
|
|
|
|
them are not used by @code{GPGME} directly, but might be returned by
|
|
|
|
|
@acronym{GPGME} because it received them from the crypto engine. The
|
|
|
|
|
below list only includes such error codes that have a specific meaning
|
|
|
|
|
in @code{GPGME}, or which are so common that you should know about
|
|
|
|
|
them.
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPG_ERR_EOF
|
2002-01-16 00:41:10 +00:00
|
|
|
|
This value indicates the end of a list, buffer or file.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_NO_ERROR
|
|
|
|
|
This value indicates success. The value of this error code is
|
|
|
|
|
@code{0}. Also, it is guaranteed that an error value made from the
|
|
|
|
|
error code @code{0} will be @code{0} itself (as a whole). This means
|
|
|
|
|
that the error source information is lost for this error code,
|
|
|
|
|
however, as this error code indicates that no error occured, this is
|
|
|
|
|
generally not a problem.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_GENERAL
|
2002-01-16 00:41:10 +00:00
|
|
|
|
This value means that something went wrong, but either there is not
|
|
|
|
|
enough information about the problem to return a more useful error
|
2002-01-30 01:43:05 +00:00
|
|
|
|
value, or there is no separate error value for this type of problem.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_ENOMEM
|
2002-01-30 01:43:05 +00:00
|
|
|
|
This value means that an out-of-memory condition occurred.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_E...
|
|
|
|
|
System errors are mapped to GPG_ERR_FOO where FOO is the symbol for
|
|
|
|
|
the system error.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_INV_VALUE
|
|
|
|
|
This value means that some user provided data was out of range. This
|
|
|
|
|
can also refer to objects. For example, if an empty
|
|
|
|
|
@code{gpgme_data_t} object was expected, but one containing data was
|
|
|
|
|
provided, this error value is returned.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_UNUSABLE_PUBKEY
|
|
|
|
|
This value means that some recipients for a message were invalid.
|
2002-02-26 23:39:58 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_UNUSABLE_SECKEY
|
|
|
|
|
This value means that some signers were invalid.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_NO_DATA
|
|
|
|
|
This value means that a @code{gpgme_data_t} object which was expected
|
|
|
|
|
to have content was found empty.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_CONFLICT
|
2002-01-30 01:43:05 +00:00
|
|
|
|
This value means that a conflict of some sort occurred.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_NOT_IMPLEMENTED
|
2002-01-16 00:41:10 +00:00
|
|
|
|
This value indicates that the specific function (or operation) is not
|
|
|
|
|
implemented. This error should never happen. It can only occur if
|
|
|
|
|
you use certain values or configuration options which do not work,
|
|
|
|
|
but for which we think that they should work at some later time.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_DECRYPT_FAILED
|
2002-01-16 00:41:10 +00:00
|
|
|
|
This value indicates that a decryption operation was unsuccessful.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_BAD_PASSPHRASE
|
2003-04-24 14:33:13 +00:00
|
|
|
|
This value means that the user did not provide a correct passphrase
|
|
|
|
|
when requested.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_CANCELED
|
2002-01-16 00:41:10 +00:00
|
|
|
|
This value means that the operation was canceled.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_INV_ENGINE
|
2002-01-16 00:41:10 +00:00
|
|
|
|
This value means that the engine that implements the desired protocol
|
|
|
|
|
is currently not available. This can either be because the sources
|
|
|
|
|
were configured to exclude support for this engine, or because the
|
|
|
|
|
engine is not installed properly.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_AMBIGUOUS_NAME
|
2003-07-31 16:01:13 +00:00
|
|
|
|
This value indicates that a user ID or other specifier did not specify
|
|
|
|
|
a unique key.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_WRONG_KEY_USAGE
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
This value indicates that a key is not used appropriately.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_CERT_REVOKED
|
|
|
|
|
This value indicates that a key signature was revoced.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_CERT_EXPIRED
|
|
|
|
|
This value indicates that a key signature expired.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_NO_CRL_KNOWN
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
This value indicates that no certificate revocation list is known for
|
|
|
|
|
the certificate.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_NO_POLICY_MATCH
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
This value indicates that a policy issue occured.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_NO_SECKEY
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
This value indicates that no secret key for the user ID is available.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_MISSING_CERT
|
|
|
|
|
This value indicates that a key could not be imported because the
|
|
|
|
|
issuer certificate is missing.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_BAD_CERT_CHAIN
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
This value indicates that a key could not be imported because its
|
2003-06-05 23:20:29 +00:00
|
|
|
|
certificate chain is not good, for example it could be too long.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_UNSUPPORTED_ALGORITHM
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
This value means a verification failed because the cryptographic
|
|
|
|
|
algorithm is not supported by the crypto backend.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_BAD_SIGNATURE
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
This value means a verification failed because the signature is bad.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_NO_PUBKEY
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Deleting Keys): Document
GPGME_Ambiguous_Specification.
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
Add GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* delete.c: Include <errno.h> and "gpgme.h", but not "util.h" or
"key.h".
(enum delete_problem): Move into function delete_status_handler.
(delete_status_handler): Change first argument to void *. Parse
delete problem with strtol instead atoi. Return better error
values.
(_gpgme_op_delete_start): Rename to ...
(delete_start): ... this. Rework error handling.
(gpgme_op_delete_start): Use delete_start instead
_gpgme_op_delete_start.
(gpgme_op_delete): Likewise.
* gpgme.h (GpgmeDataType): Removed.
2003-04-27 17:35:42 +00:00
|
|
|
|
This value means a verification failed because the public key is not
|
|
|
|
|
available.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_USER_1
|
|
|
|
|
@item GPG_ERR_USER_2
|
|
|
|
|
@item ...
|
|
|
|
|
@item GPG_ERR_USER_16
|
|
|
|
|
These error codes are not used by any GnuPG component and can be
|
|
|
|
|
freely used by other software. Applications using @acronym{GPGME}
|
|
|
|
|
might use them to mark specific errors returned by callback handlers
|
|
|
|
|
if no suitable error codes (including the system errors) for
|
|
|
|
|
these errors exist already.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Error Strings
|
|
|
|
|
@section Error Strings
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex error values, printing of
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@cindex error codes, printing of
|
|
|
|
|
@cindex error sources, printing of
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex error strings
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun {const char *} gpgme_strerror (@w{gpgme_error_t @var{err}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_strerror} returns a pointer to a statically
|
2003-06-05 23:20:29 +00:00
|
|
|
|
allocated string containing a description of the error code contained
|
|
|
|
|
in the error value @var{err}. This string can be used to output a
|
|
|
|
|
diagnostic message to the user.
|
2003-09-13 21:45:13 +00:00
|
|
|
|
|
|
|
|
|
This function is not thread safe. Use @code{gpgme_strerror_r} in
|
|
|
|
|
multi-threaded programs.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2007-05-18 22:30:42 +00:00
|
|
|
|
@deftypefun {int} gpgme_strerror_r (@w{gpgme_error_t @var{err}}, @w{char *@var{buf}}, @w{size_t @var{buflen}})
|
|
|
|
|
The function @code{gpgme_strerror_r} returns the error string for
|
|
|
|
|
@var{err} in the user-supplied buffer @var{buf} of size @var{buflen}.
|
|
|
|
|
This function is, in contrast to @code{gpgme_strerror}, thread-safe if
|
|
|
|
|
a thread-safe @code{strerror_r} function is provided by the system.
|
|
|
|
|
If the function succeeds, 0 is returned and @var{buf} contains the
|
|
|
|
|
string describing the error. If the buffer was not large enough,
|
|
|
|
|
ERANGE is returned and @var{buf} contains as much of the beginning of
|
|
|
|
|
the error string as fits into the buffer.
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftypefun {const char *} gpgme_strsource (@w{gpgme_error_t @var{err}})
|
|
|
|
|
The function @code{gpgme_strerror} returns a pointer to a statically
|
|
|
|
|
allocated string containing a description of the error source
|
|
|
|
|
contained in the error value @var{err}. This string can be used to
|
|
|
|
|
output a diagnostic message to the user.
|
|
|
|
|
@end deftypefun
|
2002-03-06 00:33:50 +00:00
|
|
|
|
|
|
|
|
|
The following example illustrates the use of @code{gpgme_strerror}:
|
|
|
|
|
|
|
|
|
|
@example
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_ctx_t ctx;
|
|
|
|
|
gpgme_error_t err = gpgme_new (&ctx);
|
2002-03-06 00:33:50 +00:00
|
|
|
|
if (err)
|
|
|
|
|
@{
|
2003-06-05 23:20:29 +00:00
|
|
|
|
fprintf (stderr, "%s: creating GpgME context failed: %s: %s\n",
|
|
|
|
|
argv[0], gpgme_strsource (err), gpgme_strerror (err));
|
2002-03-06 00:33:50 +00:00
|
|
|
|
exit (1);
|
|
|
|
|
@}
|
|
|
|
|
@end example
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Exchanging Data
|
|
|
|
|
@chapter Exchanging Data
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex data, exchanging
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
A lot of data has to be exchanged between the user and the crypto
|
|
|
|
|
engine, like plaintext messages, ciphertext, signatures and
|
|
|
|
|
information about the keys. The technical details about exchanging
|
|
|
|
|
the data information are completely abstracted by @acronym{GPGME}.
|
2003-05-18 20:45:24 +00:00
|
|
|
|
The user provides and receives the data via @code{gpgme_data_t} objects,
|
2002-01-16 00:41:10 +00:00
|
|
|
|
regardless of the communication protocol between @acronym{GPGME} and
|
|
|
|
|
the crypto engine in use.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_data_t}
|
|
|
|
|
The @code{gpgme_data_t} type is a handle for a container for generic
|
2002-01-16 00:41:10 +00:00
|
|
|
|
data, which is used by @acronym{GPGME} to exchange data with the user.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2008-03-11 16:05:40 +00:00
|
|
|
|
@code{gpgme_data_t} objects do not provide notifications on events.
|
|
|
|
|
It is assumed that read and write operations are blocking until data
|
|
|
|
|
is available. If this is undesirable, the application must ensure
|
|
|
|
|
that all GPGME data operations always have data available, for example
|
|
|
|
|
by using memory buffers or files rather than pipes or sockets. This
|
|
|
|
|
might be relevant, for example, if the external event loop mechanism
|
|
|
|
|
is used.
|
|
|
|
|
|
Make definition of off_t robust against misbehaving w32 toolchains.
* configure.ac (NEED__FILE_OFFSET_BITS): Change to define gpgme_off_t
and gpgme_ssize_t.
(API__OFF_T, API__SSIZE_T): New ac_subst.
* src/gpgme.h.in: Replace all ssize_t and off_t by ac_subst macros.
* src/assuan-support.c, src/ath-pthread.c, src/ath.c, src/ath.h
* src/data-compat.c, src/data-fd.c, src/data-mem.c, src/data-stream.c
* src/data-user.c, src/data.c, src/data.h, src/engine-gpgsm.c
* src/engine-uiserver.c, src/gpgme-tool.c, src/gpgme.c: Replace off_t
by gpgme_off_t and sszie_t by gpgme_ssize_t.
* src/ath-pthread.c, src/ath.h: Include gpgme.h.
--
For a detailed description, see the gpgme.texi diff.
2013-04-25 11:00:16 +00:00
|
|
|
|
@deftp {Data type} {gpgme_off_t}
|
|
|
|
|
On POSIX platforms the @code{gpgme_off_t} type is an alias for
|
|
|
|
|
@code{off_t}; it may be used interchangeable. On Windows platforms
|
|
|
|
|
@code{gpgme_off_t} is defined as a long (i.e. 32 bit) for 32 bit
|
|
|
|
|
Windows and as a 64 bit signed integer for 64 bit Windows.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {gpgme_ssize_t}
|
|
|
|
|
The @code{gpgme_ssize_t} type is an alias for @code{ssize_t}. It has
|
|
|
|
|
only been introduced to overcome portability problems pertaining to
|
|
|
|
|
the declaration of @code{ssize_t} by different toolchains.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@menu
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Creating Data Buffers:: Creating new data buffers.
|
|
|
|
|
* Destroying Data Buffers:: Releasing data buffers.
|
|
|
|
|
* Manipulating Data Buffers:: Operations on data buffers.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Creating Data Buffers
|
|
|
|
|
@section Creating Data Buffers
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex data buffer, creation
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-12-06 22:06:25 +00:00
|
|
|
|
Data objects can be based on memory, files, or callback functions
|
|
|
|
|
provided by the user. Not all operations are supported by all
|
|
|
|
|
objects.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@menu
|
|
|
|
|
* Memory Based Data Buffers:: Creating memory based data buffers.
|
|
|
|
|
* File Based Data Buffers:: Creating file based data buffers.
|
|
|
|
|
* Callback Based Data Buffers:: Creating callback based data buffers.
|
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Memory Based Data Buffers
|
|
|
|
|
@subsection Memory Based Data Buffers
|
|
|
|
|
|
|
|
|
|
Memory based data objects store all data in allocated memory. This is
|
|
|
|
|
convenient, but only practical for an amount of data that is a
|
|
|
|
|
fraction of the available physical memory. The data has to be copied
|
|
|
|
|
from its source and to its destination, which can often be avoided by
|
2012-05-02 08:35:47 +00:00
|
|
|
|
using one of the other data object
|
2002-12-06 22:06:25 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_new (@w{gpgme_data_t *@var{dh}})
|
|
|
|
|
The function @code{gpgme_data_new} creates a new @code{gpgme_data_t}
|
2002-01-16 00:41:10 +00:00
|
|
|
|
object and returns a handle for it in @var{dh}. The data object is
|
2002-12-06 22:06:25 +00:00
|
|
|
|
memory based and initially empty.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
data object was successfully created, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{dh} is not a valid pointer, and @code{GPG_ERR_ENOMEM} if not
|
|
|
|
|
enough memory is available.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_new_from_mem (@w{gpgme_data_t *@var{dh}}, @w{const char *@var{buffer}}, @w{size_t @var{size}}, @w{int @var{copy}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_data_new_from_mem} creates a new
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_data_t} object and fills it with @var{size} bytes starting
|
2002-01-16 00:41:10 +00:00
|
|
|
|
from @var{buffer}.
|
|
|
|
|
|
|
|
|
|
If @var{copy} is not zero, a private copy of the data is made. If
|
|
|
|
|
@var{copy} is zero, the data is taken from the specified buffer as
|
|
|
|
|
needed, and the user has to ensure that the buffer remains valid for
|
|
|
|
|
the whole life span of the data object.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
data object was successfully created, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{dh} or @var{buffer} is not a valid pointer, and
|
|
|
|
|
@code{GPG_ERR_ENOMEM} if not enough memory is available.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_new_from_file (@w{gpgme_data_t *@var{dh}}, @w{const char *@var{filename}}, @w{int @var{copy}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_data_new_from_file} creates a new
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_data_t} object and fills it with the content of the file
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@var{filename}.
|
|
|
|
|
|
|
|
|
|
If @var{copy} is not zero, the whole file is read in at initialization
|
|
|
|
|
time and the file is not used anymore after that. This is the only
|
|
|
|
|
mode supported currently. Later, a value of zero for @var{copy} might
|
|
|
|
|
cause all reads to be delayed until the data is needed, but this is
|
|
|
|
|
not yet implemented.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
data object was successfully created, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{dh} or @var{filename} is not a valid pointer,
|
|
|
|
|
@code{GPG_ERR_NOT_IMPLEMENTED} if @var{code} is zero, and
|
|
|
|
|
@code{GPG_ERR_ENOMEM} if not enough memory is available.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_new_from_filepart (@w{gpgme_data_t *@var{dh}}, @w{const char *@var{filename}}, @w{FILE *@var{fp}}, @w{off_t @var{offset}}, @w{size_t @var{length}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_data_new_from_filepart} creates a new
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_data_t} object and fills it with a part of the file specified
|
2002-01-16 00:41:10 +00:00
|
|
|
|
by @var{filename} or @var{fp}.
|
|
|
|
|
|
|
|
|
|
Exactly one of @var{filename} and @var{fp} must be non-zero, the other
|
|
|
|
|
must be zero. The argument that is not zero specifies the file from
|
|
|
|
|
which @var{length} bytes are read into the data object, starting from
|
|
|
|
|
@var{offset}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
data object was successfully created, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{dh} and exactly one of @var{filename} and @var{fp} is not a valid
|
|
|
|
|
pointer, and @code{GPG_ERR_ENOMEM} if not enough memory is available.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-12-06 22:06:25 +00:00
|
|
|
|
|
|
|
|
|
@node File Based Data Buffers
|
|
|
|
|
@subsection File Based Data Buffers
|
|
|
|
|
|
|
|
|
|
File based data objects operate directly on file descriptors or
|
|
|
|
|
streams. Only a small amount of data is stored in core at any time,
|
|
|
|
|
so the size of the data objects is not limited by @acronym{GPGME}.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_new_from_fd (@w{gpgme_data_t *@var{dh}}, @w{int @var{fd}})
|
2002-12-06 22:06:25 +00:00
|
|
|
|
The function @code{gpgme_data_new_from_fd} creates a new
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_data_t} object and uses the file descriptor @var{fd} to read
|
2002-12-06 22:06:25 +00:00
|
|
|
|
from (if used as an input data object) and write to (if used as an
|
|
|
|
|
output data object).
|
|
|
|
|
|
|
|
|
|
When using the data object as an input buffer, the function might read
|
|
|
|
|
a bit more from the file descriptor than is actually needed by the
|
|
|
|
|
crypto engine in the desired operation because of internal buffering.
|
|
|
|
|
|
2008-03-11 16:05:40 +00:00
|
|
|
|
Note that GPGME assumes that the file descriptor is set to blocking
|
|
|
|
|
mode. Errors during I/O operations, except for EINTR, are usually
|
|
|
|
|
fatal for crypto operations.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
data object was successfully created, and @code{GPG_ERR_ENOMEM} if not
|
|
|
|
|
enough memory is available.
|
2002-12-06 22:06:25 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_new_from_stream (@w{gpgme_data_t *@var{dh}}, @w{FILE *@var{stream}})
|
2002-12-06 22:06:25 +00:00
|
|
|
|
The function @code{gpgme_data_new_from_stream} creates a new
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_data_t} object and uses the I/O stream @var{stream} to read
|
2002-12-06 22:06:25 +00:00
|
|
|
|
from (if used as an input data object) and write to (if used as an
|
|
|
|
|
output data object).
|
|
|
|
|
|
|
|
|
|
When using the data object as an input buffer, the function might read
|
|
|
|
|
a bit more from the stream than is actually needed by the crypto
|
|
|
|
|
engine in the desired operation because of internal buffering.
|
|
|
|
|
|
2008-03-11 16:05:40 +00:00
|
|
|
|
Note that GPGME assumes that the stream is in blocking mode. Errors
|
|
|
|
|
during I/O operations, except for EINTR, are usually fatal for crypto
|
|
|
|
|
operations.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
data object was successfully created, and @code{GPG_ERR_ENOMEM} if not
|
|
|
|
|
enough memory is available.
|
2002-12-06 22:06:25 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Callback Based Data Buffers
|
|
|
|
|
@subsection Callback Based Data Buffers
|
|
|
|
|
|
|
|
|
|
If neither memory nor file based data objects are a good fit for your
|
|
|
|
|
application, you can implement the functions a data object provides
|
|
|
|
|
yourself and create a data object from these callback functions.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {ssize_t (*gpgme_data_read_cb_t) (@w{void *@var{handle}}, @w{void @var{*buffer}}, @w{size_t @var{size}})}
|
|
|
|
|
@tindex gpgme_data_read_cb_t
|
|
|
|
|
The @code{gpgme_data_read_cb_t} type is the type of functions which
|
2002-12-06 22:06:25 +00:00
|
|
|
|
@acronym{GPGME} calls if it wants to read data from a user-implemented
|
|
|
|
|
data object. The function should read up to @var{size} bytes from the
|
|
|
|
|
current read position into the space starting at @var{buffer}. The
|
|
|
|
|
@var{handle} is provided by the user at data object creation time.
|
|
|
|
|
|
2008-03-11 16:05:40 +00:00
|
|
|
|
Note that GPGME assumes that the read blocks until data is available.
|
|
|
|
|
Errors during I/O operations, except for EINTR, are usually fatal for
|
|
|
|
|
crypto operations.
|
|
|
|
|
|
2002-12-06 22:06:25 +00:00
|
|
|
|
The function should return the number of bytes read, 0 on EOF, and -1
|
|
|
|
|
on error. If an error occurs, @var{errno} should be set to describe
|
|
|
|
|
the type of the error.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {ssize_t (*gpgme_data_write_cb_t) (@w{void *@var{handle}}, @w{const void @var{*buffer}}, @w{size_t @var{size}})}
|
|
|
|
|
@tindex gpgme_data_write_cb_t
|
|
|
|
|
The @code{gpgme_data_write_cb_t} type is the type of functions which
|
2002-12-06 22:06:25 +00:00
|
|
|
|
@acronym{GPGME} calls if it wants to write data to a user-implemented
|
|
|
|
|
data object. The function should write up to @var{size} bytes to the
|
|
|
|
|
current write position from the space starting at @var{buffer}. The
|
|
|
|
|
@var{handle} is provided by the user at data object creation time.
|
|
|
|
|
|
2008-03-11 16:05:40 +00:00
|
|
|
|
Note that GPGME assumes that the write blocks until data is available.
|
|
|
|
|
Errors during I/O operations, except for EINTR, are usually fatal for
|
|
|
|
|
crypto operations.
|
|
|
|
|
|
2002-12-06 22:06:25 +00:00
|
|
|
|
The function should return the number of bytes written, and -1 on
|
|
|
|
|
error. If an error occurs, @var{errno} should be set to describe the
|
|
|
|
|
type of the error.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {off_t (*gpgme_data_seek_cb_t) (@w{void *@var{handle}}, @w{off_t @var{offset}}, @w{int @var{whence}})}
|
|
|
|
|
@tindex gpgme_data_seek_cb_t
|
|
|
|
|
The @code{gpgme_data_seek_cb_t} type is the type of functions which
|
2002-12-06 22:06:25 +00:00
|
|
|
|
@acronym{GPGME} calls if it wants to change the current read/write
|
|
|
|
|
position in a user-implemented data object, just like the @code{lseek}
|
|
|
|
|
function.
|
|
|
|
|
|
|
|
|
|
The function should return the new read/write position, and -1 on
|
|
|
|
|
error. If an error occurs, @var{errno} should be set to describe the
|
|
|
|
|
type of the error.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {void (*gpgme_data_release_cb_t) (@w{void *@var{handle}})}
|
|
|
|
|
@tindex gpgme_data_release_cb_t
|
|
|
|
|
The @code{gpgme_data_release_cb_t} type is the type of functions which
|
2002-12-06 22:06:25 +00:00
|
|
|
|
@acronym{GPGME} calls if it wants to destroy a user-implemented data
|
|
|
|
|
object. The @var{handle} is provided by the user at data object
|
|
|
|
|
creation time.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {struct gpgme_data_cbs}
|
2002-12-06 22:06:25 +00:00
|
|
|
|
This structure is used to store the data callback interface functions
|
|
|
|
|
described above. It has the following members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_data_read_cb_t read
|
2002-12-06 22:06:25 +00:00
|
|
|
|
This is the function called by @acronym{GPGME} to read data from the
|
|
|
|
|
data object. It is only required for input data object.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_data_write_cb_t write
|
2002-12-06 22:06:25 +00:00
|
|
|
|
This is the function called by @acronym{GPGME} to write data to the
|
|
|
|
|
data object. It is only required for output data object.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_data_seek_cb_t seek
|
2002-12-06 22:06:25 +00:00
|
|
|
|
This is the function called by @acronym{GPGME} to change the current
|
|
|
|
|
read/write pointer in the data object (if available). It is optional.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_data_release_cb_t release
|
2002-12-06 22:06:25 +00:00
|
|
|
|
This is the function called by @acronym{GPGME} to release a data
|
|
|
|
|
object. It is optional.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_new_from_cbs (@w{gpgme_data_t *@var{dh}}, @w{gpgme_data_cbs_t @var{cbs}}, @w{void *@var{handle}})
|
2002-12-06 22:06:25 +00:00
|
|
|
|
The function @code{gpgme_data_new_from_cbs} creates a new
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_data_t} object and uses the user-provided callback functions
|
2002-12-06 22:06:25 +00:00
|
|
|
|
to operate on the data object.
|
|
|
|
|
|
|
|
|
|
The handle @var{handle} is passed as first argument to the callback
|
|
|
|
|
functions. This can be used to identify this data object.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
data object was successfully created, and @code{GPG_ERR_ENOMEM} if not
|
|
|
|
|
enough memory is available.
|
2002-12-06 22:06:25 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Destroying Data Buffers
|
|
|
|
|
@section Destroying Data Buffers
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex data buffer, destruction
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_data_release (@w{gpgme_data_t @var{dh}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_data_release} destroys the data object with
|
|
|
|
|
the handle @var{dh}. It releases all associated resources that were
|
|
|
|
|
not provided by the user in the first place.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun {char *} gpgme_data_release_and_get_mem (@w{gpgme_data_t @var{dh}}, @w{size_t *@var{length}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_data_release_and_get_mem} is like
|
|
|
|
|
@code{gpgme_data_release}, except that it returns the data buffer and
|
|
|
|
|
its length that was provided by the object.
|
|
|
|
|
|
2005-10-06 10:44:26 +00:00
|
|
|
|
The user has to release the buffer with @code{gpgme_free}. In case
|
|
|
|
|
the user provided the data buffer in non-copy mode, a copy will be
|
|
|
|
|
made for this purpose.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
In case an error returns, or there is no suitable data buffer that can
|
2006-09-25 14:57:00 +00:00
|
|
|
|
be returned to the user, the function will return @code{NULL}. In any
|
|
|
|
|
case, the data object @var{dh} is destroyed.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2005-10-06 10:44:26 +00:00
|
|
|
|
@deftypefun void gpgme_free (@w{void *@var{buffer}})
|
|
|
|
|
The function @code{gpgme_free} releases the memory returned by
|
2015-08-30 17:04:44 +00:00
|
|
|
|
@code{gpgme_data_release_and_get_mem} and
|
|
|
|
|
@code{gpgme_pubkey_algo_string}. It should be used instead of the
|
|
|
|
|
system libraries @code{free} function in case different allocators are
|
|
|
|
|
used by a program. This is often the case if gpgme is used under
|
|
|
|
|
Windows as a DLL.
|
2005-10-06 10:44:26 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Manipulating Data Buffers
|
|
|
|
|
@section Manipulating Data Buffers
|
2005-09-30 14:17:47 +00:00
|
|
|
|
@cindex data buffer, manipulation
|
|
|
|
|
|
|
|
|
|
Data buffers contain data and meta-data. The following operations can
|
|
|
|
|
be used to manipulate both.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@menu
|
|
|
|
|
* Data Buffer I/O Operations:: I/O operations on data buffers.
|
|
|
|
|
* Data Buffer Meta-Data:: Meta-data manipulation of data buffers.
|
2014-04-10 11:01:00 +00:00
|
|
|
|
* Data Buffer Convenience:: Convenience function for data buffers.
|
2005-09-30 14:17:47 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Data Buffer I/O Operations
|
|
|
|
|
@subsection Data Buffer I/O Operations
|
|
|
|
|
@cindex data buffer, I/O operations
|
|
|
|
|
@cindex data buffer, read
|
|
|
|
|
@cindex data buffer, write
|
|
|
|
|
@cindex data buffer, seek
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun ssize_t gpgme_data_read (@w{gpgme_data_t @var{dh}}, @w{void *@var{buffer}}, @w{size_t @var{length}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_data_read} reads up to @var{length} bytes
|
|
|
|
|
from the data object with the handle @var{dh} into the space starting
|
2002-12-06 22:06:25 +00:00
|
|
|
|
at @var{buffer}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-12-06 22:06:25 +00:00
|
|
|
|
If no error occurs, the actual amount read is returned. If the end of
|
2003-07-28 12:09:42 +00:00
|
|
|
|
the data object is reached, the function returns 0.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-12-06 22:06:25 +00:00
|
|
|
|
In all other cases, the function returns -1 and sets @var{errno}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun ssize_t gpgme_data_write (@w{gpgme_data_t @var{dh}}, @w{const void *@var{buffer}}, @w{size_t @var{size}})
|
2002-12-06 22:06:25 +00:00
|
|
|
|
The function @code{gpgme_data_write} writes up to @var{size} bytes
|
2002-01-16 00:41:10 +00:00
|
|
|
|
starting from @var{buffer} into the data object with the handle
|
|
|
|
|
@var{dh} at the current write position.
|
|
|
|
|
|
2002-12-06 22:06:25 +00:00
|
|
|
|
The function returns the number of bytes actually written, or -1 if an
|
|
|
|
|
error occurs. If an error occurs, @var{errno} is set.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2006-11-01 10:02:12 +00:00
|
|
|
|
@deftypefun off_t gpgme_data_seek (@w{gpgme_data_t @var{dh}}, @w{off_t @var{offset}}, @w{int @var{whence}})
|
2002-12-06 22:06:25 +00:00
|
|
|
|
The function @code{gpgme_data_seek} changes the current read/write
|
|
|
|
|
position.
|
|
|
|
|
|
|
|
|
|
The @var{whence} argument specifies how the @var{offset} should be
|
|
|
|
|
interpreted. It must be one of the following symbolic constants:
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@table @code
|
2002-12-06 22:06:25 +00:00
|
|
|
|
@item SEEK_SET
|
2006-11-01 10:02:12 +00:00
|
|
|
|
Specifies that @var{offset} is a count of characters from the
|
2002-12-06 22:06:25 +00:00
|
|
|
|
beginning of the data object.
|
|
|
|
|
|
|
|
|
|
@item SEEK_CUR
|
2006-11-01 10:02:12 +00:00
|
|
|
|
Specifies that @var{offset} is a count of characters from the current
|
2002-12-06 22:06:25 +00:00
|
|
|
|
file position. This count may be positive or negative.
|
|
|
|
|
|
|
|
|
|
@item SEEK_END
|
2006-11-01 10:02:12 +00:00
|
|
|
|
Specifies that @var{offset} is a count of characters from the end of
|
2002-12-06 22:06:25 +00:00
|
|
|
|
the data object. A negative count specifies a position within the
|
|
|
|
|
current extent of the data object; a positive count specifies a
|
|
|
|
|
position past the current end. If you set the position past the
|
|
|
|
|
current end, and actually write data, you will extend the data object
|
|
|
|
|
with zeros up to that position.
|
|
|
|
|
@end table
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-12-06 22:06:25 +00:00
|
|
|
|
If successful, the function returns the resulting file position,
|
|
|
|
|
measured in bytes from the beginning of the data object. You can use
|
|
|
|
|
this feature together with @code{SEEK_CUR} to read the current
|
|
|
|
|
read/write position.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-12-06 22:06:25 +00:00
|
|
|
|
If the function fails, -1 is returned and @var{errno} is set.
|
|
|
|
|
@end deftypefun
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2005-09-30 14:17:47 +00:00
|
|
|
|
|
|
|
|
|
@node Data Buffer Meta-Data
|
|
|
|
|
@subsection Data Buffer Meta-Data
|
|
|
|
|
@cindex data buffer, meta-data
|
|
|
|
|
@cindex data buffer, file name
|
|
|
|
|
@cindex data buffer, encoding
|
|
|
|
|
|
2005-10-01 22:14:40 +00:00
|
|
|
|
@deftypefun {char *} gpgme_data_get_file_name (@w{gpgme_data_t @var{dh}})
|
2005-09-30 14:17:47 +00:00
|
|
|
|
The function @code{gpgme_data_get_file_name} returns a pointer to a
|
|
|
|
|
string containing the file name associated with the data object. The
|
|
|
|
|
file name will be stored in the output when encrypting or signing the
|
|
|
|
|
data and will be returned to the user when decrypting or verifying the
|
|
|
|
|
output data.
|
|
|
|
|
|
|
|
|
|
If no error occurs, the string containing the file name is returned.
|
|
|
|
|
Otherwise, @code{NULL} will be returned.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_set_file_name (@w{gpgme_data_t @var{dh}}, @w{const char *@var{file_name}})
|
|
|
|
|
The function @code{gpgme_data_set_file_name} sets the file name
|
|
|
|
|
associated with the data object. The file name will be stored in the
|
|
|
|
|
output when encrypting or signing the data and will be returned to the
|
|
|
|
|
user when decrypting or verifying the output data.
|
|
|
|
|
|
|
|
|
|
The function returns the error code @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{dh} is not a valid pointer and @code{GPG_ERR_ENOMEM} if not
|
|
|
|
|
enough memory is available.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {enum gpgme_data_encoding_t}
|
|
|
|
|
@tindex gpgme_data_encoding_t
|
|
|
|
|
The @code{gpgme_data_encoding_t} type specifies the encoding of a
|
2008-01-28 19:41:26 +00:00
|
|
|
|
@code{gpgme_data_t} object. For input data objects, the encoding is
|
|
|
|
|
useful to give the backend a hint on the type of data. For output
|
|
|
|
|
data objects, the encoding can specify the output data format on
|
|
|
|
|
certain operations. Please note that not all backends support all
|
|
|
|
|
encodings on all operations. The following data types are available:
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-04-27 12:17:56 +00:00
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_DATA_ENCODING_NONE
|
2002-05-26 20:12:51 +00:00
|
|
|
|
This specifies that the encoding is not known. This is the default
|
2002-07-25 15:52:23 +00:00
|
|
|
|
for a new data object. The backend will try its best to detect the
|
|
|
|
|
encoding automatically.
|
2002-04-27 12:17:56 +00:00
|
|
|
|
|
|
|
|
|
@item GPGME_DATA_ENCODING_BINARY
|
|
|
|
|
This specifies that the data is encoding in binary form; i.e. there is
|
|
|
|
|
no special encoding.
|
|
|
|
|
|
|
|
|
|
@item GPGME_DATA_ENCODING_BASE64
|
|
|
|
|
This specifies that the data is encoded using the Base-64 encoding
|
|
|
|
|
scheme as used by @acronym{MIME} and other protocols.
|
|
|
|
|
|
|
|
|
|
@item GPGME_DATA_ENCODING_ARMOR
|
|
|
|
|
This specifies that the data is encoded in an armored form as used by
|
|
|
|
|
OpenPGP and PEM.
|
2009-06-16 15:42:37 +00:00
|
|
|
|
|
2016-07-13 12:45:02 +00:00
|
|
|
|
@item GPGME_DATA_ENCODING_MIME
|
|
|
|
|
This specifies that the data is encoded as a MIME part.
|
|
|
|
|
|
2009-06-16 15:42:37 +00:00
|
|
|
|
@item GPGME_DATA_ENCODING_URL
|
|
|
|
|
The data is a list of linefeed delimited URLs. This is only useful with
|
|
|
|
|
@code{gpgme_op_import}.
|
|
|
|
|
|
|
|
|
|
@item GPGME_DATA_ENCODING_URL0
|
|
|
|
|
The data is a list of binary zero delimited URLs. This is only useful
|
|
|
|
|
with @code{gpgme_op_import}.
|
|
|
|
|
|
|
|
|
|
@item GPGME_DATA_ENCODING_URLESC
|
|
|
|
|
The data is a list of linefeed delimited URLs with all control and space
|
|
|
|
|
characters percent escaped. This mode is is not yet implemented.
|
|
|
|
|
|
2002-04-27 12:17:56 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_data_encoding_t gpgme_data_get_encoding (@w{gpgme_data_t @var{dh}})
|
2002-05-26 20:12:51 +00:00
|
|
|
|
The function @code{gpgme_data_get_encoding} returns the encoding of
|
|
|
|
|
the data object with the handle @var{dh}. If @var{dh} is not a valid
|
|
|
|
|
pointer (e.g. @code{NULL}) @code{GPGME_DATA_ENCODING_NONE} is
|
|
|
|
|
returned.
|
2002-04-27 12:17:56 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_set_encoding (@w{gpgme_data_t @var{dh}, gpgme_data_encoding_t @var{enc}})
|
2002-05-26 20:12:51 +00:00
|
|
|
|
The function @code{gpgme_data_set_encoding} changes the encoding of
|
|
|
|
|
the data object with the handle @var{dh} to @var{enc}.
|
2002-04-27 12:17:56 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2016-08-12 13:24:46 +00:00
|
|
|
|
@deftypefun {gpgme_error_t} gpgme_data_set_flag @
|
|
|
|
|
(@w{gpgme_data_t @var{dh}}, @
|
|
|
|
|
@w{const char *@var{name}}, @
|
|
|
|
|
@w{const char *@var{value}})
|
|
|
|
|
|
|
|
|
|
Some minor properties of the data object can be controlled with flags
|
|
|
|
|
set by this function. The properties are identified by the following
|
|
|
|
|
values for @var{name}:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item size-hint
|
|
|
|
|
The value is a decimal number with the length gpgme shall assume for
|
|
|
|
|
this data object. This is useful if the data is provided by callbacks
|
|
|
|
|
or via file descriptors but the applications knows the total size of
|
|
|
|
|
the data. If this is set the OpenPGP engine may use this to decide on
|
|
|
|
|
buffer allocation strategies and to provide a total value for its
|
|
|
|
|
progress information.
|
|
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
This function returns @code{0} on success.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2013-08-09 17:19:26 +00:00
|
|
|
|
@node Data Buffer Convenience
|
|
|
|
|
@subsection Data Buffer Convenience Functions
|
|
|
|
|
@cindex data buffer, convenience
|
|
|
|
|
@cindex type of data
|
|
|
|
|
@cindex identify
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {enum gpgme_data_type_t}
|
|
|
|
|
@tindex gpgme_data_type_t
|
|
|
|
|
The @code{gpgme_data_type_t} type is used to return the detected type
|
|
|
|
|
of the content of a data buffer.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_DATA_TYPE_INVALID
|
|
|
|
|
This is returned by @code{gpgme_data_identify} if it was not possible
|
|
|
|
|
to identify the data. Reasons for this might be a non-seekable stream
|
|
|
|
|
or a memory problem. The value is 0.
|
|
|
|
|
@item GPGME_DATA_TYPE_UNKNOWN
|
|
|
|
|
The type of the data is not known.
|
|
|
|
|
@item GPGME_DATA_TYPE_PGP_SIGNED
|
|
|
|
|
The data is an OpenPGP signed message. This may be a binary
|
|
|
|
|
signature, a detached one or a cleartext signature.
|
|
|
|
|
@item GPGME_DATA_TYPE_PGP_OTHER
|
|
|
|
|
This is a generic OpenPGP message. In most cases this will be
|
|
|
|
|
encrypted data.
|
|
|
|
|
@item GPGME_DATA_TYPE_PGP_KEY
|
|
|
|
|
This is an OpenPGP key (private or public).
|
|
|
|
|
@item GPGME_DATA_TYPE_CMS_SIGNED
|
|
|
|
|
This is a CMS signed message.
|
|
|
|
|
@item GPGME_DATA_TYPE_CMS_ENCRYPTED
|
|
|
|
|
This is a CMS encrypted (enveloped data) message.
|
|
|
|
|
@item GPGME_DATA_TYPE_CMS_OTHER
|
|
|
|
|
This is used for other CMS message types.
|
|
|
|
|
@item GPGME_DATA_TYPE_X509_CERT
|
|
|
|
|
The data is a X.509 certificate
|
|
|
|
|
@item GPGME_DATA_TYPE_PKCS12
|
|
|
|
|
The data is a PKCS#12 message. This is commonly used to exchange
|
|
|
|
|
private keys for X.509.
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_data_type_t gpgme_data_identify (@w{gpgme_data_t @var{dh}})
|
|
|
|
|
The function @code{gpgme_data_identify} returns the type of the data
|
|
|
|
|
with the handle @var{dh}. If it is not possible to perform the
|
|
|
|
|
identification, the function returns zero
|
|
|
|
|
(@code{GPGME_DATA_TYPE_INVALID}). Note that depending on how the data
|
|
|
|
|
object has been created the identification may not be possible or the
|
|
|
|
|
data object may change its internal state (file pointer moved). For
|
|
|
|
|
file or memory based data object, the state should not change.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-04-27 12:17:56 +00:00
|
|
|
|
|
|
|
|
|
@c
|
|
|
|
|
@c Chapter Contexts
|
2012-05-02 08:35:47 +00:00
|
|
|
|
@c
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@node Contexts
|
|
|
|
|
@chapter Contexts
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex context
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-01-30 01:43:05 +00:00
|
|
|
|
All cryptographic operations in @acronym{GPGME} are performed within a
|
2002-01-16 00:41:10 +00:00
|
|
|
|
context, which contains the internal state of the operation as well as
|
|
|
|
|
configuration parameters. By using several contexts you can run
|
|
|
|
|
several cryptographic operations in parallel, with different
|
|
|
|
|
configuration.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_ctx_t}
|
|
|
|
|
The @code{gpgme_ctx_t} type is a handle for a @acronym{GPGME} context,
|
2002-01-16 00:41:10 +00:00
|
|
|
|
which is used to hold the configuration, status and result of
|
|
|
|
|
cryptographic operations.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@menu
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Creating Contexts:: Creating new @acronym{GPGME} contexts.
|
|
|
|
|
* Destroying Contexts:: Releasing @acronym{GPGME} contexts.
|
2009-06-16 14:43:38 +00:00
|
|
|
|
* Result Management:: Managing the result of crypto operations.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Context Attributes:: Setting properties of a context.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
* Key Management:: Managing keys with @acronym{GPGME}.
|
|
|
|
|
* Trust Item Management:: Managing trust items with @acronym{GPGME}.
|
|
|
|
|
* Crypto Operations:: Using a context for cryptography.
|
2014-04-10 11:01:00 +00:00
|
|
|
|
* Miscellaneous:: Miscellaneous operations
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Run Control:: Controlling how operations are run.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Creating Contexts
|
|
|
|
|
@section Creating Contexts
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex context, creation
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_new (@w{gpgme_ctx_t *@var{ctx}})
|
2004-12-07 19:05:18 +00:00
|
|
|
|
The function @code{gpgme_new} creates a new @code{gpgme_ctx_t} object
|
|
|
|
|
and returns a handle for it in @var{ctx}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
context was successfully created, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} is not a valid pointer, and @code{GPG_ERR_ENOMEM} if not
|
2009-05-28 15:16:01 +00:00
|
|
|
|
enough memory is available. Also, it returns
|
|
|
|
|
@code{GPG_ERR_NOT_OPERATIONAL} if @code{gpgme_check_version} was not
|
|
|
|
|
called to initialize GPGME, and @code{GPG_ERR_SELFTEST_FAILED} if a
|
|
|
|
|
selftest failed. Currently, the only selftest is for Windows MingW32
|
|
|
|
|
targets to see if @code{-mms-bitfields} was used (as required).
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Destroying Contexts
|
|
|
|
|
@section Destroying Contexts
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex context, destruction
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_release (@w{gpgme_ctx_t @var{ctx}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_release} destroys the context with the handle
|
|
|
|
|
@var{ctx} and releases all associated resources.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2009-06-16 14:43:38 +00:00
|
|
|
|
@node Result Management
|
|
|
|
|
@section Result Management
|
|
|
|
|
@cindex context, result of operation
|
|
|
|
|
|
|
|
|
|
The detailed result of an operation is returned in operation-specific
|
|
|
|
|
structures such as @code{gpgme_decrypt_result_t}. The corresponding
|
|
|
|
|
retrieval functions such as @code{gpgme_op_decrypt_result} provide
|
2016-11-15 09:29:48 +00:00
|
|
|
|
static access to the results after an operation completes. Those
|
|
|
|
|
structures shall be considered read-only and an application must not
|
2016-11-15 10:53:35 +00:00
|
|
|
|
allocate such a structure on its own. The following interfaces make
|
2016-11-15 09:29:48 +00:00
|
|
|
|
it possible to detach a result structure from its associated context
|
|
|
|
|
and give it a lifetime beyond that of the current operation or
|
|
|
|
|
context.
|
2009-06-16 14:43:38 +00:00
|
|
|
|
|
|
|
|
|
@deftypefun void gpgme_result_ref (@w{void *@var{result}})
|
|
|
|
|
The function @code{gpgme_result_ref} acquires an additional reference
|
|
|
|
|
for the result @var{result}, which may be of any type
|
|
|
|
|
@code{gpgme_*_result_t}. As long as the user holds a reference, the
|
|
|
|
|
result structure is guaranteed to be valid and unmodified.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun void gpgme_result_unref (@w{void *@var{result}})
|
|
|
|
|
The function @code{gpgme_result_unref} releases a reference for the
|
|
|
|
|
result @var{result}. If this was the last reference, the result
|
|
|
|
|
structure will be destroyed and all resources associated to it will be
|
|
|
|
|
released.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
Note that a context may hold its own references to result structures,
|
|
|
|
|
typically until the context is destroyed or the next operation is
|
|
|
|
|
started. In fact, these references are accessed through the
|
|
|
|
|
@code{gpgme_op_*_result} functions.
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Context Attributes
|
|
|
|
|
@section Context Attributes
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex context, attributes
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@menu
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Protocol Selection:: Selecting the protocol used by a context.
|
2005-01-12 11:13:17 +00:00
|
|
|
|
* Crypto Engine:: Configuring the crypto engine.
|
2016-10-25 15:27:49 +00:00
|
|
|
|
* Setting the Sender:: How to tell the engine the sender.
|
2003-05-27 05:45:06 +00:00
|
|
|
|
* ASCII Armor:: Requesting @acronym{ASCII} armored output.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Text Mode:: Choosing canonical text mode.
|
2015-07-02 08:19:04 +00:00
|
|
|
|
* Offline Mode:: Choosing offline mode.
|
2016-07-04 09:23:12 +00:00
|
|
|
|
* Pinentry Mode:: Choosing the pinentry mode.
|
2014-04-10 11:01:00 +00:00
|
|
|
|
* Included Certificates:: Including a number of certificates.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Key Listing Mode:: Selecting key listing mode.
|
|
|
|
|
* Passphrase Callback:: Getting the passphrase from the user.
|
|
|
|
|
* Progress Meter Callback:: Being informed about the progress.
|
2015-04-17 00:23:38 +00:00
|
|
|
|
* Status Message Callback:: Status messages received from gpg.
|
2003-09-14 00:02:41 +00:00
|
|
|
|
* Locale:: Setting the locale of a context.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Protocol Selection
|
|
|
|
|
@subsection Protocol Selection
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex context, selecting protocol
|
|
|
|
|
@cindex protocol, selecting
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_set_protocol (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_protocol_t @var{proto}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_set_protocol} sets the protocol used within
|
|
|
|
|
the context @var{ctx} to @var{proto}. All crypto operations will be
|
|
|
|
|
performed by the crypto engine configured for that protocol.
|
|
|
|
|
@xref{Protocols and Engines}.
|
|
|
|
|
|
|
|
|
|
Setting the protocol with @code{gpgme_set_protocol} does not check if
|
|
|
|
|
the crypto engine for that protocol is available and installed
|
2002-01-29 22:58:25 +00:00
|
|
|
|
correctly. @xref{Engine Version Check}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
protocol could be set successfully, and @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{protocol} is not a valid protocol.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_protocol_t gpgme_get_protocol (@w{gpgme_ctx_t @var{ctx}})
|
2002-05-03 18:20:24 +00:00
|
|
|
|
The function @code{gpgme_get_protocol} retrieves the protocol currently
|
|
|
|
|
use with the context @var{ctx}.
|
|
|
|
|
@end deftypefun
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2005-01-12 11:13:17 +00:00
|
|
|
|
|
|
|
|
|
@node Crypto Engine
|
|
|
|
|
@subsection Crypto Engine
|
|
|
|
|
@cindex context, configuring engine
|
|
|
|
|
@cindex engine, configuration per context
|
|
|
|
|
|
|
|
|
|
The following functions can be used to set and retrieve the
|
|
|
|
|
configuration of the crypto engines of a specific context. The
|
|
|
|
|
default can also be retrieved without any particular context.
|
|
|
|
|
@xref{Engine Information}. The default can also be changed globally.
|
|
|
|
|
@xref{Engine Configuration}.
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_engine_info_t gpgme_ctx_get_engine_info (@w{gpgme_ctx_t @var{ctx}})
|
|
|
|
|
The function @code{gpgme_ctx_get_engine_info} returns a linked list of
|
|
|
|
|
engine info structures. Each info structure describes the
|
|
|
|
|
configuration of one configured backend, as used by the context
|
|
|
|
|
@var{ctx}.
|
|
|
|
|
|
|
|
|
|
The result is valid until the next invocation of
|
|
|
|
|
@code{gpgme_ctx_set_engine_info} for this particular context.
|
|
|
|
|
|
|
|
|
|
This function can not fail.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_ctx_set_engine_info (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_protocol_t @var{proto}}, @w{const char *@var{file_name}}, @w{const char *@var{home_dir}})
|
|
|
|
|
The function @code{gpgme_ctx_set_engine_info} changes the
|
|
|
|
|
configuration of the crypto engine implementing the protocol
|
|
|
|
|
@var{proto} for the context @var{ctx}.
|
|
|
|
|
|
|
|
|
|
@var{file_name} is the file name of the executable program
|
|
|
|
|
implementing this protocol, and @var{home_dir} is the directory name
|
|
|
|
|
of the configuration directory for this crypto engine. If
|
|
|
|
|
@var{home_dir} is @code{NULL}, the engine's default will be used.
|
|
|
|
|
|
|
|
|
|
Currently this function must be used before starting the first crypto
|
|
|
|
|
operation. It is unspecified if and when the changes will take effect
|
|
|
|
|
if the function is called after starting the first operation on the
|
|
|
|
|
context @var{ctx}.
|
|
|
|
|
|
|
|
|
|
This function returns the error code @code{GPG_ERR_NO_ERROR} if
|
|
|
|
|
successful, or an eror code on failure.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2016-10-25 15:27:49 +00:00
|
|
|
|
@node Setting the Sender
|
|
|
|
|
@subsection How to tell the engine the sender.
|
|
|
|
|
@cindex context, sender
|
|
|
|
|
@cindex sender
|
|
|
|
|
@cindex From:
|
|
|
|
|
|
|
|
|
|
Some engines can make use of the sender’s address, for example to
|
|
|
|
|
figure out the best user id in certain trust models. For verification
|
|
|
|
|
and signing of mails, it is thus suggested to let the engine know the
|
|
|
|
|
sender ("From:") address. @acronym{GPGME} provides two functions to
|
|
|
|
|
accomplish that. Note that the esoteric use of multiple "From:"
|
|
|
|
|
addresses is not supported.
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_set_sender @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{int @var{address}})
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_set_sender} specifies the sender address for
|
|
|
|
|
use in sign and verify operations. @var{address} is expected to be
|
|
|
|
|
the ``addr-spec'' part of an address but my also be a complete mailbox
|
|
|
|
|
address, in which case this function extracts the ``addr-spec'' from
|
|
|
|
|
it. Using @code{NULL} for @var{address} clears the sender address.
|
|
|
|
|
|
|
|
|
|
The function returns 0 on success or an error code on failure. The
|
|
|
|
|
most likely failure is that no valid ``addr-spec'' was found in
|
|
|
|
|
@var{address}.
|
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun @w{const char *} gpgme_get_sender @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}})
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_get_sender} returns the current sender
|
|
|
|
|
address from the context, or NULL if none was set. The returned
|
|
|
|
|
value is valid as long as the @var{ctx} is valid and
|
|
|
|
|
@code{gpgme_set_sender} has not been called again.
|
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-05-27 05:41:43 +00:00
|
|
|
|
@c FIXME: Unfortunately, using @acronym here breaks texi2dvi.
|
|
|
|
|
@node ASCII Armor
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@subsection @acronym{ASCII} Armor
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex context, armor mode
|
|
|
|
|
@cindex @acronym{ASCII} armor
|
|
|
|
|
@cindex armor mode
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_set_armor (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{yes}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_set_armor} specifies if the output should be
|
2002-01-22 14:23:56 +00:00
|
|
|
|
@acronym{ASCII} armored. By default, output is not @acronym{ASCII}
|
|
|
|
|
armored.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-01-22 14:23:56 +00:00
|
|
|
|
@acronym{ASCII} armored output is disabled if @var{yes} is zero, and
|
2002-01-16 00:41:10 +00:00
|
|
|
|
enabled otherwise.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun int gpgme_get_armor (@w{gpgme_ctx_t @var{ctx}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_get_armor} returns 1 if the output is
|
|
|
|
|
@acronym{ASCII} armored, and @code{0} if it is not, or if @var{ctx} is
|
|
|
|
|
not a valid pointer.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Text Mode
|
|
|
|
|
@subsection Text Mode
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex context, text mode
|
|
|
|
|
@cindex text mode
|
|
|
|
|
@cindex canonical text mode
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_set_textmode (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{yes}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_set_textmode} specifies if canonical text mode
|
|
|
|
|
should be used. By default, text mode is not used.
|
|
|
|
|
|
|
|
|
|
Text mode is for example used for the RFC2015 signatures; note that
|
|
|
|
|
the updated RFC 3156 mandates that the mail user agent does some
|
|
|
|
|
preparations so that text mode is not needed anymore.
|
|
|
|
|
|
2002-02-25 18:31:07 +00:00
|
|
|
|
This option is only relevant to the OpenPGP crypto engine, and ignored
|
|
|
|
|
by all other engines.
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
Canonical text mode is disabled if @var{yes} is zero, and enabled
|
|
|
|
|
otherwise.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun int gpgme_get_textmode (@w{gpgme_ctx_t @var{ctx}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_get_textmode} returns 1 if canonical text
|
|
|
|
|
mode is enabled, and @code{0} if it is not, or if @var{ctx} is not a
|
|
|
|
|
valid pointer.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2015-07-02 08:19:04 +00:00
|
|
|
|
@node Offline Mode
|
|
|
|
|
@subsection Offline Mode
|
|
|
|
|
@cindex context, offline mode
|
|
|
|
|
@cindex offline mode
|
|
|
|
|
|
|
|
|
|
@deftypefun void gpgme_set_offline (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{yes}})
|
|
|
|
|
The function @code{gpgme_set_offline} specifies if offline mode
|
|
|
|
|
should be used. By default, offline mode is not used.
|
|
|
|
|
|
|
|
|
|
The offline mode specifies if dirmngr should be used to do additional
|
|
|
|
|
validation that might require connections to external services.
|
|
|
|
|
(e.g. CRL / OCSP checks).
|
|
|
|
|
|
|
|
|
|
Offline mode only affects the keylist mode @code{GPGME_KEYLIST_MODE_VALIDATE}
|
|
|
|
|
and is only relevant to the CMS crypto engine. Offline mode
|
|
|
|
|
is ignored otherwise.
|
|
|
|
|
|
|
|
|
|
This option may be extended in the future to completely disable
|
|
|
|
|
the use of dirmngr for any engine.
|
|
|
|
|
|
|
|
|
|
Offline mode is disabled if @var{yes} is zero, and enabled
|
|
|
|
|
otherwise.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun int gpgme_get_offline (@w{gpgme_ctx_t @var{ctx}})
|
|
|
|
|
The function @code{gpgme_get_offline} returns 1 if offline
|
|
|
|
|
mode is enabled, and @code{0} if it is not, or if @var{ctx} is not a
|
|
|
|
|
valid pointer.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2016-07-04 09:23:12 +00:00
|
|
|
|
@node Pinentry Mode
|
|
|
|
|
@subsection Pinentry Mode
|
|
|
|
|
@cindex context, pinentry mode
|
|
|
|
|
@cindex pinentry mode
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_set_pinentry_mode (@w{gpgme_ctx_t @var{ctx}},
|
|
|
|
|
@w{gpgme_pinentry_mode_t @var{mode}})
|
|
|
|
|
The function @code{gpgme_set_pinentry_mode} specifies the pinentry mode
|
|
|
|
|
to be used.
|
|
|
|
|
|
|
|
|
|
For GnuPG >= 2.1 this option is required to be set to
|
|
|
|
|
@code{GPGME_PINENTRY_MODE_LOOPBACK} to enable the passphrase callback
|
|
|
|
|
mechanism in GPGME through @code{gpgme_set_passphrase_cb}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_pinentry_mode_t gpgme_get_pinentry_mode (@w{gpgme_ctx_t @var{ctx}})
|
|
|
|
|
The function @code{gpgme_get_pinenty_mode} returns the
|
|
|
|
|
mode set for the context.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {enum gpgme_pinentry_mode_t}
|
|
|
|
|
@tindex gpgme_pinentry_mode_t
|
|
|
|
|
The @code{gpgme_minentry_mode_t} type specifies the set of possible pinentry
|
|
|
|
|
modes that are supported by @acronym{GPGME} if GnuPG >= 2.1 is used.
|
|
|
|
|
The following modes are supported:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_PINENTRY_MODE_DEFAULT
|
|
|
|
|
Use the default of the agent, which is ask.
|
|
|
|
|
|
|
|
|
|
@item GPGME_PINENTRY_MODE_ASK
|
|
|
|
|
Force the use of the Pinentry.
|
|
|
|
|
|
|
|
|
|
@item GPGME_PINENTRY_MODE_CANCEL
|
|
|
|
|
Emulate use of Pinentry's cancel button.
|
|
|
|
|
|
|
|
|
|
@item GPGME_PINENTRY_MODE_ERROR
|
|
|
|
|
Return a Pinentry error @code{No Pinentry}.
|
|
|
|
|
|
|
|
|
|
@item GPGME_PINENTRY_MODE_LOOPBACK
|
|
|
|
|
Redirect Pinentry queries to the caller.
|
|
|
|
|
This enables the use of @code{gpgme_set_passphrase_cb} whis pinentry
|
|
|
|
|
queries redirected to gpgme.
|
|
|
|
|
|
|
|
|
|
Note: This mode requires @code{allow-loopback-pinentry} to be enabled
|
|
|
|
|
in the @file{gpg-agent.conf} or an agent started with that option.
|
|
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
|
2002-02-25 18:31:07 +00:00
|
|
|
|
@node Included Certificates
|
|
|
|
|
@subsection Included Certificates
|
|
|
|
|
@cindex certificates, included
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_set_include_certs (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{nr_of_certs}})
|
2002-02-25 18:31:07 +00:00
|
|
|
|
The function @code{gpgme_set_include_certs} specifies how many
|
|
|
|
|
certificates should be included in an S/MIME signed message. By
|
|
|
|
|
default, only the sender's certificate is included. The possible
|
|
|
|
|
values of @var{nr_of_certs} are:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2005-04-28 16:11:34 +00:00
|
|
|
|
@item GPGME_INCLUDE_CERTS_DEFAULT
|
|
|
|
|
Fall back to the default of the crypto backend. This is the default
|
|
|
|
|
for GPGME.
|
2002-02-25 18:31:07 +00:00
|
|
|
|
@item -2
|
|
|
|
|
Include all certificates except the root certificate.
|
|
|
|
|
@item -1
|
|
|
|
|
Include all certificates.
|
|
|
|
|
@item 0
|
|
|
|
|
Include no certificates.
|
|
|
|
|
@item 1
|
|
|
|
|
Include the sender's certificate only.
|
|
|
|
|
@item n
|
|
|
|
|
Include the first n certificates of the certificates path, starting
|
|
|
|
|
from the sender's certificate. The number @code{n} must be positive.
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
Values of @var{nr_of_certs} smaller than -2 are undefined.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
This option is only relevant to the CMS crypto engine, and ignored by
|
|
|
|
|
all other engines.
|
2002-02-25 18:31:07 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun int gpgme_get_include_certs (@w{gpgme_ctx_t @var{ctx}})
|
2002-02-25 18:31:07 +00:00
|
|
|
|
The function @code{gpgme_get_include_certs} returns the number of
|
|
|
|
|
certificates to include into an S/MIME signed message.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Key Listing Mode
|
|
|
|
|
@subsection Key Listing Mode
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex key listing mode
|
|
|
|
|
@cindex key listing, mode of
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2005-05-28 20:09:20 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_set_keylist_mode (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_keylist_mode_t @var{mode}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_set_keylist_mode} changes the default
|
2002-02-06 00:08:47 +00:00
|
|
|
|
behaviour of the key listing functions. The value in @var{mode} is a
|
|
|
|
|
bitwise-or combination of one or multiple of the following bit values:
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@table @code
|
2002-02-06 00:08:47 +00:00
|
|
|
|
@item GPGME_KEYLIST_MODE_LOCAL
|
|
|
|
|
The @code{GPGME_KEYLIST_MODE_LOCAL} symbol specifies that the local
|
|
|
|
|
keyring should be searched for keys in the keylisting operation. This
|
|
|
|
|
is the default.
|
|
|
|
|
|
|
|
|
|
@item GPGME_KEYLIST_MODE_EXTERN
|
|
|
|
|
The @code{GPGME_KEYLIST_MODE_EXTERN} symbol specifies that an external
|
2008-05-07 15:41:14 +00:00
|
|
|
|
source should be searched for keys in the keylisting operation. The
|
|
|
|
|
type of external source is dependant on the crypto engine used and
|
|
|
|
|
whether it is combined with @code{GPGME_KEYLIST_MODE_LOCAL}. For
|
|
|
|
|
example, it can be a remote keyserver or LDAP certificate server.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
|
|
|
|
@item GPGME_KEYLIST_MODE_SIGS
|
|
|
|
|
The @code{GPGME_KEYLIST_MODE_SIGS} symbol specifies that the key
|
|
|
|
|
signatures should be included in the listed keys.
|
2004-02-17 15:27:42 +00:00
|
|
|
|
|
2005-10-02 14:39:31 +00:00
|
|
|
|
@item GPGME_KEYLIST_MODE_SIG_NOTATIONS
|
|
|
|
|
The @code{GPGME_KEYLIST_MODE_SIG_NOTATIONS} symbol specifies that the
|
|
|
|
|
signature notations on key signatures should be included in the listed
|
|
|
|
|
keys. This only works if @code{GPGME_KEYLIST_MODE_SIGS} is also
|
|
|
|
|
enabled.
|
|
|
|
|
|
2016-08-25 09:38:03 +00:00
|
|
|
|
@item GPGME_KEYLIST_MODE_WITH_TOFU
|
|
|
|
|
The @code{GPGME_KEYLIST_MODE_WITH_TOFU} symbol specifies that
|
|
|
|
|
information pertaining to the TOFU trust model should be included in
|
|
|
|
|
the listed keys.
|
|
|
|
|
|
2014-06-04 07:57:54 +00:00
|
|
|
|
@item GPGME_KEYLIST_MODE_WITH_SECRET
|
|
|
|
|
The @code{GPGME_KEYLIST_MODE_WITH_SECRET} returns information about
|
|
|
|
|
the presence of a corresponding secret key in a public key listing. A
|
|
|
|
|
public key listing with this mode is slower than a standard listing
|
|
|
|
|
but can be used instead of a second run to list the secret keys. This
|
|
|
|
|
is only supported for GnuPG versions >= 2.1.
|
|
|
|
|
|
2009-03-18 11:19:29 +00:00
|
|
|
|
@item GPGME_KEYLIST_MODE_EPHEMERAL
|
|
|
|
|
The @code{GPGME_KEYLIST_MODE_EPHEMERAL} symbol specifies that keys
|
|
|
|
|
flagged as ephemeral are included in the listing.
|
|
|
|
|
|
2004-02-17 15:27:42 +00:00
|
|
|
|
@item GPGME_KEYLIST_MODE_VALIDATE
|
|
|
|
|
The @code{GPGME_KEYLIST_MODE_VALIDATE} symbol specifies that the
|
|
|
|
|
backend should do key or certificate validation and not just get the
|
2004-03-29 18:42:41 +00:00
|
|
|
|
validity information from an internal cache. This might be an
|
2005-11-15 16:04:28 +00:00
|
|
|
|
expensive operation and is in general not useful. Currently only
|
2004-02-17 15:27:42 +00:00
|
|
|
|
implemented for the S/MIME backend and ignored for other backends.
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end table
|
2002-02-06 00:08:47 +00:00
|
|
|
|
|
|
|
|
|
At least one of @code{GPGME_KEYLIST_MODE_LOCAL} and
|
|
|
|
|
@code{GPGME_KEYLIST_MODE_EXTERN} must be specified. For future binary
|
|
|
|
|
compatibility, you should get the current mode with
|
|
|
|
|
@code{gpgme_get_keylist_mode} and modify it by setting or clearing the
|
2008-05-07 15:41:14 +00:00
|
|
|
|
appropriate bits, and then using that calculated value in the
|
2002-02-06 00:08:47 +00:00
|
|
|
|
@code{gpgme_set_keylisting_mode} operation. This will leave all other
|
|
|
|
|
bits in the mode value intact (in particular those that are not used
|
|
|
|
|
in the current version of the library).
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
mode could be set correctly, and @code{GPG_ERR_INV_VALUE} if @var{ctx}
|
|
|
|
|
is not a valid pointer or @var{mode} is not a valid mode.
|
2002-02-06 00:08:47 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2003-05-29 03:21:02 +00:00
|
|
|
|
@deftypefun gpgme_keylist_mode_t gpgme_get_keylist_mode (@w{gpgme_ctx_t @var{ctx}})
|
2002-02-06 00:08:47 +00:00
|
|
|
|
The function @code{gpgme_get_keylist_mode} returns the current key
|
|
|
|
|
listing mode of the context @var{ctx}. This value can then be
|
|
|
|
|
modified and used in a subsequent @code{gpgme_set_keylist_mode}
|
|
|
|
|
operation to only affect the desired bits (and leave all others
|
|
|
|
|
intact).
|
|
|
|
|
|
|
|
|
|
The function returns 0 if @var{ctx} is not a valid pointer, and the
|
|
|
|
|
current mode otherwise. Note that 0 is not a valid mode value.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Passphrase Callback
|
|
|
|
|
@subsection Passphrase Callback
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex callback, passphrase
|
|
|
|
|
@cindex passphrase callback
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-27 01:31:06 +00:00
|
|
|
|
@deftp {Data type} {gpgme_error_t (*gpgme_passphrase_cb_t)(void *@var{hook}, const char *@var{uid_hint}, const char *@var{passphrase_info}, @w{int @var{prev_was_bad}}, @w{int @var{fd}})}
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@tindex gpgme_passphrase_cb_t
|
|
|
|
|
The @code{gpgme_passphrase_cb_t} type is the type of functions usable as
|
2002-01-16 00:41:10 +00:00
|
|
|
|
passphrase callback function.
|
|
|
|
|
|
2003-05-27 01:31:06 +00:00
|
|
|
|
The argument @var{uid_hint} might contain a string that gives an
|
|
|
|
|
indication for which user ID the passphrase is required. If this is
|
|
|
|
|
not available, or not applicable (in the case of symmetric encryption,
|
|
|
|
|
for example), @var{uid_hint} will be @code{NULL}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-27 01:31:06 +00:00
|
|
|
|
The argument @var{passphrase_info}, if not @code{NULL}, will give
|
|
|
|
|
further information about the context in which the passphrase is
|
|
|
|
|
required. This information is engine and operation specific.
|
|
|
|
|
|
|
|
|
|
If this is the repeated attempt to get the passphrase, because
|
|
|
|
|
previous attempts failed, then @var{prev_was_bad} is 1, otherwise it
|
|
|
|
|
will be 0.
|
|
|
|
|
|
|
|
|
|
The user must write the passphrase, followed by a newline character,
|
2013-02-07 19:51:29 +00:00
|
|
|
|
to the file descriptor @var{fd}. The function @code{gpgme_io_writen}
|
|
|
|
|
should be used for the write operation. Note that if the user returns
|
|
|
|
|
0 to indicate success, the user must at least write a newline
|
|
|
|
|
character before returning from the callback.
|
2003-02-06 20:09:24 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
If an error occurs, return the corresponding @code{gpgme_error_t}
|
|
|
|
|
value. You can use the error code @code{GPG_ERR_CANCELED} to abort
|
|
|
|
|
the operation. Otherwise, return @code{0}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_set_passphrase_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_passphrase_cb_t @var{passfunc}}, @w{void *@var{hook_value}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_set_passphrase_cb} sets the function that is
|
|
|
|
|
used when a passphrase needs to be provided by the user to
|
|
|
|
|
@var{passfunc}. The function @var{passfunc} needs to implemented by
|
|
|
|
|
the user, and whenever it is called, it is called with its first
|
|
|
|
|
argument being @var{hook_value}. By default, no passphrase callback
|
|
|
|
|
function is set.
|
|
|
|
|
|
|
|
|
|
Not all crypto engines require this callback to retrieve the
|
|
|
|
|
passphrase. It is better if the engine retrieves the passphrase from
|
|
|
|
|
a trusted agent (a daemon process), rather than having each user to
|
2004-09-27 20:24:48 +00:00
|
|
|
|
implement their own passphrase query. Some engines do not even
|
|
|
|
|
support an external passphrase callback at all, in this case the error
|
2004-09-28 11:42:06 +00:00
|
|
|
|
code @code{GPG_ERR_NOT_SUPPORTED} is returned.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-07-04 09:23:12 +00:00
|
|
|
|
For GnuPG >= 2.1 the pinentry mode has to be set to
|
|
|
|
|
@code{GPGME_PINENTRY_MODE_LOOPBACK} to enable the passphrase callback.
|
|
|
|
|
See @code{gpgme_set_pinentry_mode}.
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The user can disable the use of a passphrase callback function by
|
|
|
|
|
calling @code{gpgme_set_passphrase_cb} with @var{passfunc} being
|
|
|
|
|
@code{NULL}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_get_passphrase_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_passphrase_cb_t *@var{passfunc}}, @w{void **@var{hook_value}})
|
2002-04-22 21:58:26 +00:00
|
|
|
|
The function @code{gpgme_get_passphrase_cb} returns the function that
|
|
|
|
|
is used when a passphrase needs to be provided by the user in
|
|
|
|
|
@var{*passfunc}, and the first argument for this function in
|
|
|
|
|
@var{*hook_value}. If no passphrase callback is set, or @var{ctx} is
|
|
|
|
|
not a valid pointer, @code{NULL} is returned in both variables.
|
2002-04-22 22:06:09 +00:00
|
|
|
|
|
|
|
|
|
@var{passfunc} or @var{hook_value} can be @code{NULL}. In this case,
|
|
|
|
|
the corresponding value will not be returned.
|
2002-04-22 21:58:26 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Progress Meter Callback
|
|
|
|
|
@subsection Progress Meter Callback
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex callback, progress meter
|
|
|
|
|
@cindex progress meter callback
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-07-08 17:22:44 +00:00
|
|
|
|
@deftp {Data type} {void (*gpgme_progress_cb_t)(void *@var{hook}, const char *@var{what}, int @var{type}, int @var{current}, int @var{total})}
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@tindex gpgme_progress_cb_t
|
|
|
|
|
The @code{gpgme_progress_cb_t} type is the type of functions usable as
|
2002-01-16 00:41:10 +00:00
|
|
|
|
progress callback function.
|
|
|
|
|
|
|
|
|
|
The arguments are specific to the crypto engine. More information
|
|
|
|
|
about the progress information returned from the GnuPG engine can be
|
|
|
|
|
found in the GnuPG source code in the file @file{doc/DETAILS} in the
|
|
|
|
|
section PROGRESS.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_set_progress_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_progress_cb_t @var{progfunc}}, @w{void *@var{hook_value}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_set_progress_cb} sets the function that is
|
|
|
|
|
used when progress information about a cryptographic operation is
|
|
|
|
|
available. The function @var{progfunc} needs to implemented by the
|
|
|
|
|
user, and whenever it is called, it is called with its first argument
|
|
|
|
|
being @var{hook_value}. By default, no progress callback function
|
|
|
|
|
is set.
|
|
|
|
|
|
|
|
|
|
Setting a callback function allows an interactive program to display
|
|
|
|
|
progress information about a long operation to the user.
|
|
|
|
|
|
|
|
|
|
The user can disable the use of a progress callback function by
|
|
|
|
|
calling @code{gpgme_set_progress_cb} with @var{progfunc} being
|
|
|
|
|
@code{NULL}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_get_progress_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_progress_cb_t *@var{progfunc}}, @w{void **@var{hook_value}})
|
2002-04-22 21:58:26 +00:00
|
|
|
|
The function @code{gpgme_get_progress_cb} returns the function that is
|
|
|
|
|
used to inform the user about the progress made in @var{*progfunc},
|
|
|
|
|
and the first argument for this function in @var{*hook_value}. If no
|
|
|
|
|
progress callback is set, or @var{ctx} is not a valid pointer,
|
|
|
|
|
@code{NULL} is returned in both variables.
|
2002-04-22 22:06:09 +00:00
|
|
|
|
|
|
|
|
|
@var{progfunc} or @var{hook_value} can be @code{NULL}. In this case,
|
|
|
|
|
the corresponding value will not be returned.
|
2002-04-22 21:58:26 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2015-04-17 00:23:38 +00:00
|
|
|
|
@node Status Message Callback
|
|
|
|
|
@subsection Status Message Callback
|
|
|
|
|
@cindex callback, status message
|
|
|
|
|
@cindex status message callback
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {gpgme_error_t (*gpgme_status_cb_t)(void *@var{hook}, const char *@var{keyword}, const char *@var{args})}
|
|
|
|
|
@tindex gpgme_status_cb_t
|
|
|
|
|
The @code{gpgme_status_cb_t} type is the type of function usable as
|
|
|
|
|
a status message callback function.
|
|
|
|
|
|
|
|
|
|
The argument @var{keyword} is the name of the status message while the
|
|
|
|
|
@var{args} argument contains any arguments for the status message.
|
|
|
|
|
|
|
|
|
|
If an error occurs, return the corresponding @code{gpgme_error_t}
|
|
|
|
|
value. Otherwise, return @code{0}.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftypefun void gpgme_set_status_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_status_cb_t @var{statusfunc}}, @w{void *@var{hook_value}})
|
|
|
|
|
The function @code{gpgme_set_status_cb} sets the function that is used when a
|
|
|
|
|
status message is received from gpg to @var{statusfunc}. The function
|
2015-08-15 20:58:04 +00:00
|
|
|
|
@var{statusfunc} needs to be implemented by the user, and whenever it is
|
|
|
|
|
called, it is called with its first argument being @var{hook_value}. By
|
|
|
|
|
default, no status message callback function is set.
|
2015-04-17 00:23:38 +00:00
|
|
|
|
|
|
|
|
|
The user can disable the use of a status message callback function by calling
|
|
|
|
|
@code{gpgme_set_status_cb} with @var{statusfunc} being @code{NULL}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun void gpgme_get_status_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_status_cb_t *@var{statusfunc}}, @w{void **@var{hook_value}})
|
|
|
|
|
The function @code{gpgme_get_status_cb} returns the function that is used to
|
|
|
|
|
process status messages from gpg in @var{*statusfunc}, and the first argument
|
|
|
|
|
for this function in @var{*hook_value}. If no status message callback is set,
|
|
|
|
|
or @var{ctx} is not a valid pointer, @code{NULL} is returned in both
|
|
|
|
|
variables.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2016-05-19 15:01:07 +00:00
|
|
|
|
@deftypefun {gpgme_error_t} gpgme_set_ctx_flag @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{const char *@var{name}}, @
|
|
|
|
|
@w{const char *@var{value}})
|
|
|
|
|
|
|
|
|
|
Some minor properties of the context can be controlled with flags set
|
|
|
|
|
by this function. The properties are identified by the following
|
|
|
|
|
values for @var{name}:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2017-01-31 08:44:29 +00:00
|
|
|
|
@item "redraw"
|
|
|
|
|
This flag is normally not changed by the caller because GPGME sets and
|
|
|
|
|
clears it automatically: The flag is cleared before an operation and
|
|
|
|
|
set if an operation noticed that the engine has launched a Pinentry.
|
|
|
|
|
A Curses based application may use this information to redraw the
|
|
|
|
|
screen; for example:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
err = gpgme_op_keylist_start (ctx, "foo@@example.org", 0);
|
|
|
|
|
while (!err)
|
|
|
|
|
@{
|
|
|
|
|
err = gpgme_op_keylist_next (ctx, &key);
|
|
|
|
|
if (err)
|
|
|
|
|
break;
|
|
|
|
|
show_key (key);
|
|
|
|
|
gpgme_key_release (key);
|
|
|
|
|
@}
|
|
|
|
|
if ((s = gpgme_get_ctx_flag (ctx, "redraw")) && *s)
|
|
|
|
|
redraw_screen ();
|
|
|
|
|
gpgme_release (ctx);
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
|
2016-05-19 15:01:07 +00:00
|
|
|
|
@item "full-status"
|
|
|
|
|
Using a @var{value} of "1" the status callback set by
|
|
|
|
|
gpgme_set_status_cb returns all status lines with the exception of
|
|
|
|
|
PROGRESS lines. With the default of "0" the status callback is only
|
|
|
|
|
called in certain situations.
|
|
|
|
|
|
2016-05-21 08:22:57 +00:00
|
|
|
|
@item "raw-description"
|
|
|
|
|
Setting the @var{value} to "1" returns human readable strings in a raw
|
|
|
|
|
format. For example the non breaking space characters ("~") will not
|
|
|
|
|
be removed from the @code{description} field of the
|
|
|
|
|
@code{gpgme_tofu_info_t} object.
|
|
|
|
|
|
2016-11-15 09:29:48 +00:00
|
|
|
|
@item "export-session-key"
|
|
|
|
|
Using a @var{value} of "1" specifies that the context should try to
|
|
|
|
|
export the symmetric session key when decrypting data. By default, or
|
|
|
|
|
when using an empty string or "0" for @var{value}, session keys are
|
|
|
|
|
not exported.
|
|
|
|
|
|
|
|
|
|
@item "override-session-key"
|
|
|
|
|
The string given in @var{value} is passed to the GnuPG engine to override
|
|
|
|
|
the session key for decryption. The format of that session key is
|
|
|
|
|
specific to GnuPG and can be retrieved during a decrypt operation when
|
2016-11-16 09:12:19 +00:00
|
|
|
|
the context flag "export-session-key" is enabled. Please be aware that
|
|
|
|
|
using this feature with GnuPG < 2.1.16 will leak the session key on
|
|
|
|
|
many platforms via ps(1).
|
2016-11-15 09:29:48 +00:00
|
|
|
|
|
2016-05-19 15:01:07 +00:00
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
This function returns @code{0} on success.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2015-04-17 00:23:38 +00:00
|
|
|
|
|
2016-11-15 08:24:17 +00:00
|
|
|
|
@deftypefun {const char *} gpgme_get_ctx_flag @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{const char *@var{name}})
|
|
|
|
|
|
|
|
|
|
The value of flags settable by @code{gpgme_set_ctx_flag} can be
|
|
|
|
|
retrieved by this function. If @var{name} is unknown the function
|
|
|
|
|
returns @code{NULL}. For boolean flags an empty string is returned
|
|
|
|
|
for False and the string "1" is returned for True; either atoi(3) or a
|
|
|
|
|
test for an empty string can be used to get the boolean value.
|
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2003-09-14 00:02:41 +00:00
|
|
|
|
@node Locale
|
|
|
|
|
@subsection Locale
|
|
|
|
|
@cindex locale, default
|
|
|
|
|
@cindex locale, of a context
|
|
|
|
|
|
|
|
|
|
A locale setting can be associated with a context. This locale is
|
|
|
|
|
passed to the crypto engine, and used for applications like the PIN
|
|
|
|
|
entry, which is displayed to the user when entering a passphrase is
|
|
|
|
|
required.
|
|
|
|
|
|
|
|
|
|
The default locale is used to initialize the locale setting of all
|
|
|
|
|
contexts created afterwards.
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_set_locale (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{category}}, @w{const char *@var{value}})
|
|
|
|
|
The function @code{gpgme_set_locale} sets the locale of the context
|
|
|
|
|
@var{ctx}, or the default locale if @var{ctx} is a null pointer.
|
|
|
|
|
|
|
|
|
|
The locale settings that should be changed are specified by
|
|
|
|
|
@var{category}. Supported categories are @code{LC_CTYPE},
|
|
|
|
|
@code{LC_MESSAGES}, and @code{LC_ALL}, which is a wildcard you can use
|
|
|
|
|
if you want to change all the categories at once.
|
|
|
|
|
|
|
|
|
|
The value to be used for the locale setting is @var{value}, which will
|
|
|
|
|
be copied to @acronym{GPGME}'s internal data structures. @var{value}
|
|
|
|
|
can be a null pointer, which disables setting the locale, and will
|
|
|
|
|
make PIN entry and other applications use their default setting, which
|
|
|
|
|
is usually not what you want.
|
|
|
|
|
|
|
|
|
|
Note that the settings are only used if the application runs on a text
|
|
|
|
|
terminal, and that the settings should fit the configuration of the
|
|
|
|
|
output terminal. Normally, it is sufficient to initialize the default
|
|
|
|
|
value at startup.
|
|
|
|
|
|
|
|
|
|
The function returns an error if not enough memory is available.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@node Key Management
|
|
|
|
|
@section Key Management
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex key management
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
Some of the cryptographic operations require that recipients or
|
|
|
|
|
signers are specified. This is always done by specifying the
|
|
|
|
|
respective keys that should be used for the operation. The following
|
|
|
|
|
section describes how such keys can be selected and manipulated.
|
|
|
|
|
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
|
|
|
|
@menu
|
|
|
|
|
* Key objects:: Description of the key structures.
|
|
|
|
|
* Listing Keys:: Browsing the list of available keys.
|
|
|
|
|
* Information About Keys:: Requesting detailed information about keys.
|
|
|
|
|
* Manipulating Keys:: Operations on keys.
|
|
|
|
|
* Generating Keys:: Creating new key pairs.
|
|
|
|
|
* Signing Keys:: Adding key signatures to public keys.
|
|
|
|
|
* Exporting Keys:: Retrieving key data from the key ring.
|
|
|
|
|
* Importing Keys:: Adding keys to the key ring.
|
|
|
|
|
* Deleting Keys:: Removing keys from the key ring.
|
|
|
|
|
* Changing Passphrases:: Change the passphrase of a key.
|
|
|
|
|
* Changing TOFU Data:: Changing data pertaining to TOFU.
|
|
|
|
|
* Advanced Key Editing:: Advanced key edit operation.
|
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
@node Key objects
|
|
|
|
|
@subsection Key objects
|
|
|
|
|
|
|
|
|
|
The keys are represented in GPGME by structures which may only be read
|
|
|
|
|
by the application but never be allocated or changed. They are valid
|
|
|
|
|
as long as the key object itself is valid.
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} gpgme_key_t
|
|
|
|
|
|
|
|
|
|
The @code{gpgme_key_t} type is a pointer to a key object. It has the
|
|
|
|
|
following members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item gpgme_keylist_mode_t keylist_mode
|
|
|
|
|
The keylist mode that was active when the key was retrieved.
|
|
|
|
|
|
|
|
|
|
@item unsigned int revoked : 1
|
|
|
|
|
This is true if the key is revoked.
|
|
|
|
|
|
|
|
|
|
@item unsigned int expired : 1
|
|
|
|
|
This is true if the key is expired.
|
|
|
|
|
|
|
|
|
|
@item unsigned int disabled : 1
|
|
|
|
|
This is true if the key is disabled.
|
|
|
|
|
|
|
|
|
|
@item unsigned int invalid : 1
|
|
|
|
|
This is true if the key is invalid. This might have several reasons,
|
|
|
|
|
for a example for the S/MIME backend, it will be set during key
|
|
|
|
|
listings if the key could not be validated due to missing
|
|
|
|
|
certificates or unmatched policies.
|
|
|
|
|
|
|
|
|
|
@item unsigned int can_encrypt : 1
|
|
|
|
|
This is true if the key (ie one of its subkeys) can be used for
|
|
|
|
|
encryption.
|
|
|
|
|
|
|
|
|
|
@item unsigned int can_sign : 1
|
|
|
|
|
This is true if the key (ie one of its subkeys) can be used to create
|
|
|
|
|
data signatures.
|
|
|
|
|
|
|
|
|
|
@item unsigned int can_certify : 1
|
|
|
|
|
This is true if the key (ie one of its subkeys) can be used to create
|
|
|
|
|
key certificates.
|
|
|
|
|
|
|
|
|
|
@item unsigned int can_authenticate : 1
|
|
|
|
|
This is true if the key (ie one of its subkeys) can be used for
|
|
|
|
|
authentication.
|
|
|
|
|
|
|
|
|
|
@item unsigned int is_qualified : 1
|
|
|
|
|
This is true if the key can be used for qualified signatures according
|
|
|
|
|
to local government regulations.
|
|
|
|
|
|
|
|
|
|
@item unsigned int secret : 1
|
|
|
|
|
This is true if the key is a secret key. Note, that this will always
|
|
|
|
|
be true even if the corresponding subkey flag may be false
|
|
|
|
|
(offline/stub keys). This is only set if a listing of secret keys has
|
|
|
|
|
been requested or if @code{GPGME_KEYLIST_MODE_WITH_SECRET} is active.
|
|
|
|
|
|
|
|
|
|
@item gpgme_protocol_t protocol
|
|
|
|
|
This is the protocol supported by this key.
|
|
|
|
|
|
|
|
|
|
@item char *issuer_serial
|
|
|
|
|
If @code{protocol} is @code{GPGME_PROTOCOL_CMS}, then this is the
|
|
|
|
|
issuer serial.
|
|
|
|
|
|
|
|
|
|
@item char *issuer_name
|
|
|
|
|
If @code{protocol} is @code{GPGME_PROTOCOL_CMS}, then this is the
|
|
|
|
|
issuer name.
|
|
|
|
|
|
|
|
|
|
@item char *chain_id
|
|
|
|
|
If @code{protocol} is @code{GPGME_PROTOCOL_CMS}, then this is the
|
|
|
|
|
chain ID, which can be used to built the certificate chain.
|
|
|
|
|
|
|
|
|
|
@item gpgme_validity_t owner_trust
|
|
|
|
|
If @code{protocol} is @code{GPGME_PROTOCOL_OpenPGP}, then this is the
|
|
|
|
|
owner trust.
|
|
|
|
|
|
|
|
|
|
@item gpgme_subkey_t subkeys
|
|
|
|
|
This is a linked list with the subkeys of the key. The first subkey
|
|
|
|
|
in the list is the primary key and usually available.
|
|
|
|
|
|
|
|
|
|
@item gpgme_user_id_t uids
|
|
|
|
|
This is a linked list with the user IDs of the key. The first user ID
|
|
|
|
|
in the list is the main (or primary) user ID.
|
|
|
|
|
|
|
|
|
|
@item char *fpr
|
|
|
|
|
This field gives the fingerprint of the primary key. Note that
|
|
|
|
|
this is a copy of the fingerprint of the first subkey. For an
|
|
|
|
|
incomplete key (for example from a verification result) a subkey may
|
|
|
|
|
be missing but this field may be set nevertheless.
|
|
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
|
2013-05-24 15:51:16 +00:00
|
|
|
|
@deftp {Data type} gpgme_subkey_t
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2013-05-24 15:51:16 +00:00
|
|
|
|
The @code{gpgme_subkey_t} type is a pointer to a subkey structure.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
Subkeys are one component of a @code{gpgme_key_t} object. In fact,
|
2003-06-05 23:20:29 +00:00
|
|
|
|
subkeys are those parts that contains the real information about the
|
2003-04-30 03:02:50 +00:00
|
|
|
|
individual cryptographic keys that belong to the same key object. One
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@code{gpgme_key_t} can contain several subkeys. The first subkey in
|
|
|
|
|
the linked list is also called the primary key.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
|
|
|
|
The subkey structure has the following members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2013-05-24 15:51:16 +00:00
|
|
|
|
@item gpgme_subkey_t next
|
2003-04-30 03:02:50 +00:00
|
|
|
|
This is a pointer to the next subkey structure in the linked list, or
|
|
|
|
|
@code{NULL} if this is the last element.
|
|
|
|
|
|
|
|
|
|
@item unsigned int revoked : 1
|
|
|
|
|
This is true if the subkey is revoked.
|
|
|
|
|
|
|
|
|
|
@item unsigned int expired : 1
|
|
|
|
|
This is true if the subkey is expired.
|
|
|
|
|
|
|
|
|
|
@item unsigned int disabled : 1
|
|
|
|
|
This is true if the subkey is disabled.
|
|
|
|
|
|
|
|
|
|
@item unsigned int invalid : 1
|
|
|
|
|
This is true if the subkey is invalid.
|
|
|
|
|
|
|
|
|
|
@item unsigned int can_encrypt : 1
|
|
|
|
|
This is true if the subkey can be used for encryption.
|
|
|
|
|
|
|
|
|
|
@item unsigned int can_sign : 1
|
2003-07-09 00:49:58 +00:00
|
|
|
|
This is true if the subkey can be used to create data signatures.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
|
|
|
|
@item unsigned int can_certify : 1
|
2003-07-09 00:49:58 +00:00
|
|
|
|
This is true if the subkey can be used to create key certificates.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
2003-07-31 16:59:36 +00:00
|
|
|
|
@item unsigned int can_authenticate : 1
|
|
|
|
|
This is true if the subkey can be used for authentication.
|
|
|
|
|
|
2005-09-30 11:01:37 +00:00
|
|
|
|
@item unsigned int is_qualified : 1
|
|
|
|
|
This is true if the subkey can be used for qualified signatures
|
|
|
|
|
according to local government regulations.
|
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
@item unsigned int secret : 1
|
2014-06-04 07:57:54 +00:00
|
|
|
|
This is true if the subkey is a secret key. Note that it will be
|
|
|
|
|
false if the key is actually a stub key; i.e. a secret key operation
|
|
|
|
|
is currently not possible (offline-key). This is only set if a
|
|
|
|
|
listing of secret keys has been requested or if
|
|
|
|
|
@code{GPGME_KEYLIST_MODE_WITH_SECRET} is active.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_pubkey_algo_t pubkey_algo
|
2003-04-30 03:02:50 +00:00
|
|
|
|
This is the public key algorithm supported by this subkey.
|
|
|
|
|
|
|
|
|
|
@item unsigned int length
|
|
|
|
|
This is the length of the subkey (in bits).
|
|
|
|
|
|
|
|
|
|
@item char *keyid
|
|
|
|
|
This is the key ID of the subkey in hexadecimal digits.
|
|
|
|
|
|
|
|
|
|
@item char *fpr
|
|
|
|
|
This is the fingerprint of the subkey in hexadecimal digits, if
|
2005-12-06 16:30:21 +00:00
|
|
|
|
available.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
2016-08-23 13:22:28 +00:00
|
|
|
|
@item char *keygrip
|
|
|
|
|
The keygrip of the subkey in hex digit form or @code{NULL} if not
|
|
|
|
|
availabale.
|
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
@item long int timestamp
|
|
|
|
|
This is the creation timestamp of the subkey. This is -1 if the
|
|
|
|
|
timestamp is invalid, and 0 if it is not available.
|
|
|
|
|
|
|
|
|
|
@item long int expires
|
|
|
|
|
This is the expiration timestamp of the subkey, or 0 if the subkey
|
|
|
|
|
does not expire.
|
2014-03-05 05:52:49 +00:00
|
|
|
|
|
|
|
|
|
@item unsigned int is_cardkey : 1
|
|
|
|
|
True if the secret key is stored on a smart card.
|
|
|
|
|
|
|
|
|
|
@item char *card_number
|
|
|
|
|
The serial number of a smart card holding this key or @code{NULL}.
|
2014-05-08 18:39:15 +00:00
|
|
|
|
|
|
|
|
|
@item char *curve
|
2015-08-30 17:04:44 +00:00
|
|
|
|
For ECC algorithms the name of the curve.
|
2014-05-08 18:39:15 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@deftp {Data type} gpgme_user_id_t
|
|
|
|
|
|
|
|
|
|
A user ID is a component of a @code{gpgme_key_t} object. One key can
|
|
|
|
|
have many user IDs. The first one in the list is the main (or
|
|
|
|
|
primary) user ID.
|
|
|
|
|
|
|
|
|
|
The user ID structure has the following members.
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item gpgme_user_id_t next
|
|
|
|
|
This is a pointer to the next user ID structure in the linked list, or
|
|
|
|
|
@code{NULL} if this is the last element.
|
|
|
|
|
|
|
|
|
|
@item unsigned int revoked : 1
|
|
|
|
|
This is true if the user ID is revoked.
|
|
|
|
|
|
|
|
|
|
@item unsigned int invalid : 1
|
|
|
|
|
This is true if the user ID is invalid.
|
|
|
|
|
|
|
|
|
|
@item gpgme_validity_t validity
|
|
|
|
|
This specifies the validity of the user ID.
|
|
|
|
|
|
|
|
|
|
@item char *uid
|
|
|
|
|
This is the user ID string.
|
|
|
|
|
|
|
|
|
|
@item char *name
|
|
|
|
|
This is the name component of @code{uid}, if available.
|
|
|
|
|
|
|
|
|
|
@item char *comment
|
|
|
|
|
This is the comment component of @code{uid}, if available.
|
|
|
|
|
|
|
|
|
|
@item char *email
|
|
|
|
|
This is the email component of @code{uid}, if available.
|
|
|
|
|
|
|
|
|
|
@item char *address;
|
|
|
|
|
The mail address (addr-spec from RFC-5322) of the user ID string.
|
|
|
|
|
This is general the same as the @code{email} part of this structure
|
|
|
|
|
but might be slightly different. If no mail address is available
|
|
|
|
|
@code{NULL} is stored.
|
|
|
|
|
|
|
|
|
|
@item gpgme_tofu_info_t tofu
|
|
|
|
|
If not @code{NULL} information from the TOFU database pertaining to
|
|
|
|
|
this user id.
|
|
|
|
|
|
|
|
|
|
@item gpgme_key_sig_t signatures
|
|
|
|
|
This is a linked list with the signatures on this user ID.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} gpgme_key_sig_t
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
The @code{gpgme_key_sig_t} type is a pointer to a key signature structure.
|
|
|
|
|
Key signatures are one component of a @code{gpgme_key_t} object, and
|
2016-09-16 09:48:29 +00:00
|
|
|
|
validate user IDs on the key in the OpenPGP protocol.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
|
|
|
|
The signatures on a key are only available if the key was retrieved
|
|
|
|
|
via a listing operation with the @code{GPGME_KEYLIST_MODE_SIGS} mode
|
2005-10-02 14:39:31 +00:00
|
|
|
|
enabled, because it can be expensive to retrieve all signatures of a
|
|
|
|
|
key.
|
|
|
|
|
|
|
|
|
|
The signature notations on a key signature are only available if the
|
|
|
|
|
key was retrieved via a listing operation with the
|
|
|
|
|
@code{GPGME_KEYLIST_MODE_SIG_NOTATIONS} mode enabled, because it can
|
|
|
|
|
be expensive to retrieve all signature notations.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
|
|
|
|
The key signature structure has the following members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_key_sig_t next
|
2003-04-30 03:02:50 +00:00
|
|
|
|
This is a pointer to the next key signature structure in the linked
|
|
|
|
|
list, or @code{NULL} if this is the last element.
|
|
|
|
|
|
|
|
|
|
@item unsigned int revoked : 1
|
|
|
|
|
This is true if the key signature is a revocation signature.
|
|
|
|
|
|
|
|
|
|
@item unsigned int expired : 1
|
|
|
|
|
This is true if the key signature is expired.
|
|
|
|
|
|
|
|
|
|
@item unsigned int invalid : 1
|
|
|
|
|
This is true if the key signature is invalid.
|
|
|
|
|
|
2004-01-13 21:43:25 +00:00
|
|
|
|
@item unsigned int exportable : 1
|
2003-04-30 03:02:50 +00:00
|
|
|
|
This is true if the key signature is exportable.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_pubkey_algo_t pubkey_algo
|
2003-04-30 03:02:50 +00:00
|
|
|
|
This is the public key algorithm used to create the signature.
|
|
|
|
|
|
|
|
|
|
@item char *keyid
|
|
|
|
|
This is the key ID of the key (in hexadecimal digits) used to create
|
|
|
|
|
the signature.
|
|
|
|
|
|
|
|
|
|
@item long int timestamp
|
|
|
|
|
This is the creation timestamp of the key signature. This is -1 if
|
|
|
|
|
the timestamp is invalid, and 0 if it is not available.
|
|
|
|
|
|
|
|
|
|
@item long int expires
|
|
|
|
|
This is the expiration timestamp of the key signature, or 0 if the key
|
|
|
|
|
signature does not expire.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_error_t status
|
2003-04-30 03:02:50 +00:00
|
|
|
|
This is the status of the signature and has the same meaning as the
|
2003-05-18 20:45:24 +00:00
|
|
|
|
member of the same name in a @code{gpgme_signature_t} object.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
2003-12-25 14:38:40 +00:00
|
|
|
|
@item unsigned int sig_class
|
2003-04-30 03:02:50 +00:00
|
|
|
|
This specifies the signature class of the key signature. The meaning
|
|
|
|
|
is specific to the crypto engine.
|
|
|
|
|
|
|
|
|
|
@item char *uid
|
|
|
|
|
This is the main user ID of the key used to create the signature.
|
|
|
|
|
|
|
|
|
|
@item char *name
|
|
|
|
|
This is the name component of @code{uid}, if available.
|
|
|
|
|
|
|
|
|
|
@item char *comment
|
|
|
|
|
This is the comment component of @code{uid}, if available.
|
|
|
|
|
|
|
|
|
|
@item char *email
|
|
|
|
|
This is the email component of @code{uid}, if available.
|
2005-10-02 14:39:31 +00:00
|
|
|
|
|
|
|
|
|
@item gpgme_sig_notation_t notations
|
|
|
|
|
This is a linked list with the notation data and policy URLs.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Listing Keys
|
|
|
|
|
@subsection Listing Keys
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex listing keys
|
|
|
|
|
@cindex key listing
|
|
|
|
|
@cindex key listing, start
|
|
|
|
|
@cindex key ring, list
|
|
|
|
|
@cindex key ring, search
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_keylist_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}}, @w{int @var{secret_only}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_op_keylist_start} initiates a key listing
|
|
|
|
|
operation inside the context @var{ctx}. It sets everything up so that
|
|
|
|
|
subsequent invocations of @code{gpgme_op_keylist_next} return the keys
|
|
|
|
|
in the list.
|
|
|
|
|
|
|
|
|
|
If @var{pattern} is @code{NULL}, all available keys are returned.
|
|
|
|
|
Otherwise, @var{pattern} contains an engine specific expression that
|
2004-06-08 17:39:40 +00:00
|
|
|
|
is used to limit the list to all keys matching the pattern. Note that
|
|
|
|
|
the total length of the pattern is restricted to an engine-specific
|
|
|
|
|
maximum (a couple of hundred characters are usually accepted). The
|
|
|
|
|
pattern should be used to restrict the search to a certain common name
|
|
|
|
|
or user, not to list many specific keys at once by listing their
|
|
|
|
|
fingerprints or key IDs.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
If @var{secret_only} is not @code{0}, the list is restricted to secret
|
|
|
|
|
keys only.
|
|
|
|
|
|
|
|
|
|
The context will be busy until either all keys are received (and
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@code{gpgme_op_keylist_next} returns @code{GPG_ERR_EOF}), or
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@code{gpgme_op_keylist_end} is called to finish the operation.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} is not a valid pointer, and passes through any errors that
|
|
|
|
|
are reported by the crypto engine support routines.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_keylist_ext_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}[]}, @w{int @var{secret_only}}, @w{int @var{reserved}})
|
2002-02-27 00:59:31 +00:00
|
|
|
|
The function @code{gpgme_op_keylist_ext_start} initiates an extended
|
|
|
|
|
key listing operation inside the context @var{ctx}. It sets
|
|
|
|
|
everything up so that subsequent invocations of
|
|
|
|
|
@code{gpgme_op_keylist_next} return the keys in the list.
|
|
|
|
|
|
|
|
|
|
If @var{pattern} or @var{*pattern} is @code{NULL}, all available keys
|
|
|
|
|
are returned. Otherwise, @var{pattern} is a @code{NULL} terminated
|
|
|
|
|
array of strings that are used to limit the list to all keys matching
|
2004-06-08 17:39:40 +00:00
|
|
|
|
at least one of the patterns verbatim. Note that the total length of
|
|
|
|
|
all patterns is restricted to an engine-specific maximum (the exact
|
|
|
|
|
limit also depends on the number of patterns and amount of quoting
|
|
|
|
|
required, but a couple of hundred characters are usually accepted).
|
|
|
|
|
Patterns should be used to restrict the search to a certain common
|
|
|
|
|
name or user, not to list many specific keys at once by listing their
|
|
|
|
|
fingerprints or key IDs.
|
2002-02-27 00:59:31 +00:00
|
|
|
|
|
|
|
|
|
If @var{secret_only} is not @code{0}, the list is restricted to secret
|
|
|
|
|
keys only.
|
|
|
|
|
|
|
|
|
|
The value of @var{reserved} must be @code{0}.
|
|
|
|
|
|
|
|
|
|
The context will be busy until either all keys are received (and
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@code{gpgme_op_keylist_next} returns @code{GPG_ERR_EOF}), or
|
2002-02-27 00:59:31 +00:00
|
|
|
|
@code{gpgme_op_keylist_end} is called to finish the operation.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} is not a valid pointer, and passes through any errors that
|
|
|
|
|
are reported by the crypto engine support routines.
|
2002-02-27 00:59:31 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_keylist_next (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t *@var{r_key}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_op_keylist_next} returns the next key in the
|
|
|
|
|
list created by a previous @code{gpgme_op_keylist_start} operation in
|
|
|
|
|
the context @var{ctx}. The key will have one reference for the user.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@xref{Manipulating Keys}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
This is the only way to get at @code{gpgme_key_t} objects in
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@acronym{GPGME}.
|
|
|
|
|
|
|
|
|
|
If the last key in the list has already been returned,
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@code{gpgme_op_keylist_next} returns @code{GPG_ERR_EOF}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} or @var{r_key} is not a valid pointer, and
|
|
|
|
|
@code{GPG_ERR_ENOMEM} if there is not enough memory for the operation.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_keylist_end (@w{gpgme_ctx_t @var{ctx}})
|
2011-01-07 12:53:26 +00:00
|
|
|
|
The function @code{gpgme_op_keylist_end} ends a pending key list
|
2002-01-16 00:41:10 +00:00
|
|
|
|
operation in the context @var{ctx}.
|
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
After the operation completed successfully, the result of the key
|
|
|
|
|
listing operation can be retrieved with
|
|
|
|
|
@code{gpgme_op_keylist_result}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} is not a valid pointer, and @code{GPG_ERR_ENOMEM} if at some
|
|
|
|
|
time during the operation there was not enough memory available.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-03-06 00:33:50 +00:00
|
|
|
|
The following example illustrates how all keys containing a certain
|
|
|
|
|
string (@code{g10code}) can be listed with their key ID and the name
|
|
|
|
|
and e-mail address of the main user ID:
|
|
|
|
|
|
|
|
|
|
@example
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_ctx_t ctx;
|
2008-06-25 01:44:50 +00:00
|
|
|
|
gpgme_key_t key;
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_error_t err = gpgme_new (&ctx);
|
2002-03-06 00:33:50 +00:00
|
|
|
|
|
|
|
|
|
if (!err)
|
|
|
|
|
@{
|
|
|
|
|
err = gpgme_op_keylist_start (ctx, "g10code", 0);
|
2003-06-05 23:20:29 +00:00
|
|
|
|
while (!err)
|
2002-03-06 00:33:50 +00:00
|
|
|
|
@{
|
2003-06-05 23:20:29 +00:00
|
|
|
|
err = gpgme_op_keylist_next (ctx, &key);
|
|
|
|
|
if (err)
|
|
|
|
|
break;
|
2008-06-25 01:44:50 +00:00
|
|
|
|
printf ("%s:", key->subkeys->keyid);
|
|
|
|
|
if (key->uids && key->uids->name)
|
|
|
|
|
printf (" %s", key->uids->name);
|
|
|
|
|
if (key->uids && key->uids->email)
|
|
|
|
|
printf (" <%s>", key->uids->email);
|
|
|
|
|
putchar ('\n');
|
2002-03-06 00:33:50 +00:00
|
|
|
|
gpgme_key_release (key);
|
|
|
|
|
@}
|
|
|
|
|
gpgme_release (ctx);
|
|
|
|
|
@}
|
2003-06-05 23:20:29 +00:00
|
|
|
|
if (gpg_err_code (err) != GPG_ERR_EOF)
|
2002-03-06 00:33:50 +00:00
|
|
|
|
@{
|
2008-06-25 01:44:50 +00:00
|
|
|
|
fprintf (stderr, "can not list keys: %s\n", gpgme_strerror (err));
|
2002-03-06 00:33:50 +00:00
|
|
|
|
exit (1);
|
|
|
|
|
@}
|
|
|
|
|
@end example
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_keylist_result_t}
|
2003-04-30 03:02:50 +00:00
|
|
|
|
This is a pointer to a structure used to store the result of a
|
|
|
|
|
@code{gpgme_op_keylist_*} operation. After successfully ending a key
|
|
|
|
|
listing operation, you can retrieve the pointer to the result with
|
|
|
|
|
@code{gpgme_op_keylist_result}. The structure contains the following
|
|
|
|
|
member:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item unsigned int truncated : 1
|
|
|
|
|
This is true if the crypto backend had to truncate the result, and
|
|
|
|
|
less than the desired keys could be listed.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_keylist_result_t gpgme_op_keylist_result (@w{gpgme_ctx_t @var{ctx}})
|
2003-04-30 03:02:50 +00:00
|
|
|
|
The function @code{gpgme_op_keylist_result} returns a
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@code{gpgme_keylist_result_t} pointer to a structure holding the
|
|
|
|
|
result of a @code{gpgme_op_keylist_*} operation. The pointer is only
|
|
|
|
|
valid if the last operation on the context was a key listing
|
|
|
|
|
operation, and if this operation finished successfully. The returned
|
|
|
|
|
pointer is only valid until the next operation is started on the
|
|
|
|
|
context.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-12-23 17:12:48 +00:00
|
|
|
|
In a simple program, for which a blocking operation is acceptable, the
|
|
|
|
|
following function can be used to retrieve a single key.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_get_key (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{fpr}}, @w{gpgme_key_t *@var{r_key}}, @w{int @var{secret}})
|
2002-12-23 17:12:48 +00:00
|
|
|
|
The function @code{gpgme_get_key} gets the key with the fingerprint
|
2003-04-29 22:24:37 +00:00
|
|
|
|
(or key ID) @var{fpr} from the crypto backend and return it in
|
2003-07-28 12:09:42 +00:00
|
|
|
|
@var{r_key}. If @var{secret} is true, get the secret key. The
|
2003-12-23 09:08:06 +00:00
|
|
|
|
currently active keylist mode is used to retrieve the key. The key
|
|
|
|
|
will have one reference for the user.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2003-05-04 20:49:44 +00:00
|
|
|
|
If the key is not found in the keyring, @code{gpgme_get_key} returns
|
2008-11-28 10:32:12 +00:00
|
|
|
|
the error code @code{GPG_ERR_EOF} and *@var{r_key} will be set to
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@code{NULL}.
|
2003-05-04 20:49:44 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} or @var{r_key} is not a valid pointer or @var{fpr} is not a
|
2003-07-31 16:01:13 +00:00
|
|
|
|
fingerprint or key ID, @code{GPG_ERR_AMBIGUOUS_NAME} if the key ID was
|
|
|
|
|
not a unique specifier for a key, and @code{GPG_ERR_ENOMEM} if at some
|
|
|
|
|
time during the operation there was not enough memory available.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Information About Keys
|
|
|
|
|
@subsection Information About Keys
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex key, information about
|
|
|
|
|
@cindex key, attributes
|
|
|
|
|
@cindex attributes, of a key
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
Please see the beginning of this section for more information about
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_key_t} objects.
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} gpgme_validity_t
|
|
|
|
|
The @code{gpgme_validity_t} type is used to specify the validity of a user ID
|
2003-04-30 03:02:50 +00:00
|
|
|
|
in a key. The following validities are defined:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_VALIDITY_UNKNOWN
|
|
|
|
|
The user ID is of unknown validity. The string representation of this
|
|
|
|
|
validity is ``?''.
|
|
|
|
|
|
|
|
|
|
@item GPGME_VALIDITY_UNDEFINED
|
|
|
|
|
The validity of the user ID is undefined. The string representation of this
|
|
|
|
|
validity is ``q''.
|
|
|
|
|
|
|
|
|
|
@item GPGME_VALIDITY_NEVER
|
|
|
|
|
The user ID is never valid. The string representation of this
|
|
|
|
|
validity is ``n''.
|
|
|
|
|
|
|
|
|
|
@item GPGME_VALIDITY_MARGINAL
|
|
|
|
|
The user ID is marginally valid. The string representation of this
|
|
|
|
|
validity is ``m''.
|
|
|
|
|
|
|
|
|
|
@item GPGME_VALIDITY_FULL
|
|
|
|
|
The user ID is fully valid. The string representation of this
|
|
|
|
|
validity is ``f''.
|
|
|
|
|
|
|
|
|
|
@item GPGME_VALIDITY_ULTIMATE
|
|
|
|
|
The user ID is ultimately valid. The string representation of this
|
|
|
|
|
validity is ``u''.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@node Manipulating Keys
|
|
|
|
|
@subsection Manipulating Keys
|
|
|
|
|
@cindex key, manipulation
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun void gpgme_key_ref (@w{gpgme_key_t @var{key}})
|
|
|
|
|
The function @code{gpgme_key_ref} acquires an additional reference for
|
|
|
|
|
the key @var{key}.
|
|
|
|
|
@end deftypefun
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun void gpgme_key_unref (@w{gpgme_key_t @var{key}})
|
|
|
|
|
The function @code{gpgme_key_unref} releases a reference for the key
|
|
|
|
|
@var{key}. If this was the last reference, the key will be destroyed
|
|
|
|
|
and all resources associated to it will be released.
|
|
|
|
|
@end deftypefun
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@node Generating Keys
|
|
|
|
|
@subsection Generating Keys
|
|
|
|
|
@cindex key, creation
|
|
|
|
|
@cindex key ring, add
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
GPGME provides a set of functions to create public key pairs. Most of
|
|
|
|
|
these functions require the use of GnuPG 2.1 and later; for older
|
|
|
|
|
GnuPG versions the @code{gpgme_op_genkey} function can be used.
|
|
|
|
|
Existing code which wants to update to the new functions or new code
|
|
|
|
|
which shall supports older GnuPG versions may try the new functions
|
|
|
|
|
first and provide a fallback to the old function if the error code
|
|
|
|
|
@code{GPG_ERR_NOT_SUPPORTED} is received.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@c
|
|
|
|
|
@c gpgme_op_createkey
|
|
|
|
|
@c
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_createkey @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{const char *@var{userid}}, @
|
|
|
|
|
@w{const char *@var{algo}}, @
|
|
|
|
|
@w{unsigned long @var{reserved}}, @
|
|
|
|
|
@w{unsigned long @var{expires}}, @
|
|
|
|
|
@w{gpgme_key_t @var{extrakey}}, @
|
|
|
|
|
@w{unsigned int @var{flags}});
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_createkey} generates a new key for the
|
|
|
|
|
procotol active in the context @var{ctx}. As of now this function
|
|
|
|
|
does only work for OpenPGP and requires at least version 2.1.13 of
|
|
|
|
|
GnuPG.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{userid} is commonly the mail address associated with the key.
|
|
|
|
|
GPGME does not require a specificy syntax but if more than a mail
|
|
|
|
|
address is given, RFC-822 style format is suggested. The value is
|
|
|
|
|
expected to be in UTF-8 encoding (i.e. no IDN encoding for mail
|
|
|
|
|
addresses). This is a required parameter.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{algo} specifies the algorithm for the new key (actually a keypair
|
|
|
|
|
of public and private key). For a list of supported algorithms, see
|
|
|
|
|
the GnuPG manual. If @var{algo} is @code{NULL} or the string
|
|
|
|
|
"default", the key is generated using the default algorithm of the
|
|
|
|
|
engine. If the string "future-default" is used the engine may use an
|
|
|
|
|
algorithm which is planned to be the default in a future release of
|
|
|
|
|
the engine; however existing implementation of the protocol may not be
|
|
|
|
|
able to already handle such future algorithms. For the OpenPGP
|
|
|
|
|
protocol, the specification of a default algorithm, without requesting
|
|
|
|
|
a non-default usage via @var{flags}, triggers the creation of a
|
|
|
|
|
primary key plus a secondary key (subkey).
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{reserved} must be set to zero.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2017-02-15 15:17:13 +00:00
|
|
|
|
@var{expires} specifies the expiration time in seconds. If you supply
|
|
|
|
|
0, a reasonable expiration time is chosen. Use the flag
|
|
|
|
|
@code{GPGME_CREATE_NOEXPIRE} to create keys that do not expire. Note
|
|
|
|
|
that this parameter takes an unsigned long value and not a
|
|
|
|
|
@code{time_t} to avoid problems on systems which use a signed 32 bit
|
|
|
|
|
@code{time_t}. Note further that the OpenPGP protocol uses 32 bit
|
|
|
|
|
values for timestamps and thus can only encode dates up to the year
|
|
|
|
|
2106.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{extrakey} is currently not used and must be set to @code{NULL}.
|
|
|
|
|
A future version of GPGME may use this parameter to create X.509 keys.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{flags} can be set to the bit-wise OR of the following flags:
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_CREATE_SIGN
|
|
|
|
|
@itemx GPGME_CREATE_ENCR
|
|
|
|
|
@itemx GPGME_CREATE_CERT
|
|
|
|
|
@itemx GPGME_CREATE_AUTH
|
|
|
|
|
Do not create the key with the default capabilities (key usage) of the
|
|
|
|
|
requested algorithm but use those explicitly given by these flags:
|
|
|
|
|
``signing'', ``encryption'', ``certification'', or ``authentication''.
|
|
|
|
|
The allowed combinations depend on the algorithm.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
If any of these flags are set and a default algorithm has been
|
|
|
|
|
selected only one key is created in the case of the OpenPGP
|
|
|
|
|
protocol.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@item GPGME_CREATE_NOPASSWD
|
|
|
|
|
Request generation of the key without password protection.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@item GPGME_CREATE_SELFSIGNED
|
|
|
|
|
For an X.509 key do not create a CSR but a self-signed certificate.
|
|
|
|
|
This has not yet been implemented.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@item GPGME_CREATE_NOSTORE
|
|
|
|
|
Do not store the created key in the local key database.
|
|
|
|
|
This has not yet been implemented.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@item GPGME_CREATE_WANTPUB
|
|
|
|
|
@itemx GPGME_CREATE_WANTSEC
|
|
|
|
|
Return the public or secret key as part of the result structure.
|
|
|
|
|
This has not yet been implemented.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@item GPGME_CREATE_FORCE
|
|
|
|
|
The engine does not allow the creation of a key with a user ID
|
|
|
|
|
already existing in the local key database. This flag can be used to
|
|
|
|
|
override this check.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2017-02-15 15:17:13 +00:00
|
|
|
|
@item GPGME_CREATE_NOEXPIRE
|
|
|
|
|
Request generation of keys that do not expire.
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@end table
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
After the operation completed successfully, information about the
|
|
|
|
|
created key can be retrieved with @code{gpgme_op_genkey_result}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function returns zero on success, @code{GPG_ERR_NOT_SUPPORTED} if
|
|
|
|
|
the engine does not support the command, or a bunch of other error
|
|
|
|
|
codes.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@end deftypefun
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_createkey_start @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{const char *@var{userid}}, @
|
|
|
|
|
@w{const char *@var{algo}}, @
|
|
|
|
|
@w{unsigned long @var{reserved}}, @
|
|
|
|
|
@w{unsigned long @var{expires}}, @
|
|
|
|
|
@w{gpgme_key_t @var{extrakey}}, @
|
|
|
|
|
@w{unsigned int @var{flags}});
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_createkey_start} initiates a
|
|
|
|
|
@code{gpgme_op_createkey} operation; see there for details. It must
|
|
|
|
|
be completed by calling @code{gpgme_wait} on the context.
|
|
|
|
|
@xref{Waiting For Completion}.
|
2002-07-25 15:50:46 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@end deftypefun
|
2002-07-25 15:50:46 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@c
|
|
|
|
|
@c gpgme_op_createsubkey
|
|
|
|
|
@c
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_createsubkey @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{const char *@var{algo}}, @
|
|
|
|
|
@w{unsigned long @var{reserved}}, @
|
|
|
|
|
@w{unsigned long @var{expires}}, @
|
|
|
|
|
@w{unsigned int @var{flags}});
|
2002-07-25 15:50:46 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_createsubkey} creates and adds a new
|
|
|
|
|
subkey to the primary OpenPGP key given by @var{KEY}. The only
|
|
|
|
|
allowed protocol in @var{ctx} is @code{GPGME_PROTOCOL_OPENPGP}.
|
|
|
|
|
Subkeys (aka secondary keys) are a concept in the OpenPGP protocol to
|
|
|
|
|
bind several keys to a primary key. As of now this function requires
|
|
|
|
|
at least version 2.1.13 of GnuPG.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{key} specifies the key to operate on.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{algo} specifies the algorithm for the new subkey. For a list of
|
|
|
|
|
supported algorithms, see the GnuPG manual. If @var{algo} is
|
|
|
|
|
@code{NULL} or the string "default", the subkey is generated using the
|
|
|
|
|
default algorithm for an encryption subkey of the engine. If the
|
|
|
|
|
string "future-default" is used the engine may use an encryption
|
|
|
|
|
algorithm which is planned to be the default in a future release of
|
|
|
|
|
the engine; however existing implementation of the protocol may not be
|
|
|
|
|
able to already handle such future algorithms.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{reserved} must be set to zero.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2017-02-15 15:17:13 +00:00
|
|
|
|
@var{expires} specifies the expiration time in seconds. If you supply
|
|
|
|
|
0, a reasonable expiration time is chosen. Use the flag
|
|
|
|
|
@code{GPGME_CREATE_NOEXPIRE} to create keys that do not expire. Note
|
|
|
|
|
that this parameter takes an unsigned long value and not a
|
|
|
|
|
@code{time_t} to avoid problems on systems which use a signed 32 bit
|
|
|
|
|
@code{time_t}. Note further that the OpenPGP protocol uses 32 bit
|
|
|
|
|
values for timestamps and thus can only encode dates up to the year
|
|
|
|
|
2106.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{flags} takes the same values as described above for
|
|
|
|
|
@code{gpgme_op_createkey}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
After the operation completed successfully, information about the
|
|
|
|
|
created key can be retrieved with @code{gpgme_op_genkey_result}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function returns zero on success, @code{GPG_ERR_NOT_SUPPORTED} if
|
|
|
|
|
the engine does not support the command, or a bunch of other error
|
|
|
|
|
codes.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@end deftypefun
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_createsubkey_start @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{const char *@var{algo}}, @
|
|
|
|
|
@w{unsigned long @var{reserved}}, @
|
|
|
|
|
@w{unsigned long @var{expires}}, @
|
|
|
|
|
@w{unsigned int @var{flags}});
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_createsubkey_start} initiates a
|
|
|
|
|
@code{gpgme_op_createsubkey} operation; see there for details. It must
|
|
|
|
|
be completed by calling @code{gpgme_wait} on the context.
|
|
|
|
|
@xref{Waiting For Completion}.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@end deftypefun
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@c
|
|
|
|
|
@c gpgme_op_adduid
|
|
|
|
|
@c
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_adduid @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{const char *@var{userid}}, @
|
|
|
|
|
@w{unsigned int @var{flags}});
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_adduid} adds a new user ID to the OpenPGP
|
|
|
|
|
key given by @var{KEY}. Adding additional user IDs after key creation
|
|
|
|
|
is a feature of the OpenPGP protocol and thus the protocol for the
|
|
|
|
|
context @var{ctx} must be set to OpenPGP. As of now this function
|
|
|
|
|
requires at least version 2.1.13 of GnuPG.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{key} specifies the key to operate on.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{userid} is the user ID to add to the key. A user ID is commonly
|
|
|
|
|
the mail address to be associated with the key. GPGME does not
|
|
|
|
|
require a specificy syntax but if more than a mail address is given,
|
|
|
|
|
RFC-822 style format is suggested. The value is expected to be in
|
|
|
|
|
UTF-8 encoding (i.e. no IDN encoding for mail addresses). This is a
|
|
|
|
|
required parameter.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{flags} are currently not used and must be set to zero.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function returns zero on success, @code{GPG_ERR_NOT_SUPPORTED} if
|
|
|
|
|
the engine does not support the command, or a bunch of other error
|
|
|
|
|
codes.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@end deftypefun
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_adduid_start @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{const char *@var{userid}}, @
|
|
|
|
|
@w{unsigned int @var{flags}});
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_adduid_start} initiates a
|
|
|
|
|
@code{gpgme_op_adduid} operation; see there for details. It must
|
|
|
|
|
be completed by calling @code{gpgme_wait} on the context.
|
|
|
|
|
@xref{Waiting For Completion}.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@end deftypefun
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@c
|
|
|
|
|
@c gpgme_op_revuid
|
|
|
|
|
@c
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_revuid @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{const char *@var{userid}}, @
|
|
|
|
|
@w{unsigned int @var{flags}});
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_revuid} revokes a user ID from the OpenPGP
|
|
|
|
|
key given by @var{KEY}. Revoking user IDs after key creation is a
|
|
|
|
|
feature of the OpenPGP protocol and thus the protocol for the context
|
|
|
|
|
@var{ctx} must be set to OpenPGP. As of now this function requires at
|
|
|
|
|
least version 2.1.13 of GnuPG.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{key} specifies the key to operate on.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{userid} is the user ID to be revoked from the key. The user ID
|
|
|
|
|
must be given verbatim because the engine does an exact and case
|
|
|
|
|
sensitive match. Thus the @code{uid} field from the user ID object
|
|
|
|
|
(@code{gpgme_user_id_t}) is to be used. This is a required parameter.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@var{flags} are currently not used and must be set to zero.
|
2002-12-23 17:12:48 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
Note that the engine won't allow to revoke the last valid user ID. To
|
|
|
|
|
change a user ID is better to first add the new user ID, then revoke
|
|
|
|
|
the old one, and finally publish the key.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function returns zero on success, @code{GPG_ERR_NOT_SUPPORTED} if
|
|
|
|
|
the engine does not support the command, or a bunch of other error
|
|
|
|
|
codes.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_revuid_start @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{const char *@var{userid}}, @
|
|
|
|
|
@w{unsigned int @var{flags}});
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_revuid_start} initiates a
|
|
|
|
|
@code{gpgme_op_revuid} operation; see there for details. It must
|
|
|
|
|
be completed by calling @code{gpgme_wait} on the context.
|
|
|
|
|
@xref{Waiting For Completion}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@c
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@c gpgme_op_genkey
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@c
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_genkey @
|
2016-09-16 09:48:29 +00:00
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@w{const char *@var{parms}}, @
|
|
|
|
|
@w{gpgme_data_t @var{public}}, @
|
|
|
|
|
@w{gpgme_data_t @var{secret}})
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_genkey} generates a new key pair in the
|
|
|
|
|
context @var{ctx}. The meaning of @var{public} and @var{secret}
|
|
|
|
|
depends on the crypto backend.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
GPG does not support @var{public} and @var{secret}, they should be
|
|
|
|
|
@code{NULL}. GnuPG will generate a key pair and add it to the
|
|
|
|
|
standard key ring. The fingerprint of the generated key is available
|
|
|
|
|
with @code{gpgme_op_genkey_result}.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
GpgSM requires @var{public} to be a writable data object. GpgSM will
|
|
|
|
|
generate a secret key (which will be stored by @command{gpg-agent},
|
|
|
|
|
and return a certificate request in @var{public}, which then needs to
|
|
|
|
|
be signed by the certification authority and imported before it can be
|
|
|
|
|
used. GpgSM does not make the fingerprint available.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2017-01-26 23:36:39 +00:00
|
|
|
|
The argument @var{parms} specifies parameters for the key in an string
|
|
|
|
|
that looks something like XML. The details about the format of
|
|
|
|
|
@var{parms} are specific to the crypto engine used by @var{ctx}. The
|
|
|
|
|
first line of the parameters must be @code{<GnupgKeyParams
|
|
|
|
|
format="internal">} and the last line must be
|
|
|
|
|
@code{</GnupgKeyParams>}. Every line in between the first and last
|
|
|
|
|
lines is treated as a Header: Value pair. In particular, no XML
|
|
|
|
|
escaping is necessary if you need to include the characters @code{<},
|
|
|
|
|
@code{>}, or @code{&}.
|
|
|
|
|
|
|
|
|
|
Here is an example for GnuPG as the crypto engine (all parameters of
|
|
|
|
|
OpenPGP key generation are documented in the GPG manual):
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@example
|
|
|
|
|
<GnupgKeyParms format="internal">
|
|
|
|
|
Key-Type: default
|
|
|
|
|
Subkey-Type: default
|
|
|
|
|
Name-Real: Joe Tester
|
|
|
|
|
Name-Comment: with stupid passphrase
|
|
|
|
|
Name-Email: joe@@foo.bar
|
|
|
|
|
Expire-Date: 0
|
|
|
|
|
Passphrase: abc
|
|
|
|
|
</GnupgKeyParms>
|
|
|
|
|
@end example
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
Here is an example for GpgSM as the crypto engine (all parameters of
|
|
|
|
|
OpenPGP key generation are documented in the GPGSM manual):
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@example
|
|
|
|
|
<GnupgKeyParms format="internal">
|
|
|
|
|
Key-Type: RSA
|
|
|
|
|
Key-Length: 1024
|
|
|
|
|
Name-DN: C=de,O=g10 code,OU=Testlab,CN=Joe 2 Tester
|
|
|
|
|
Name-Email: joe@@foo.bar
|
|
|
|
|
</GnupgKeyParms>
|
|
|
|
|
@end example
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
Strings should be given in UTF-8 encoding. The only format supported
|
|
|
|
|
for now is ``internal''. The content of the @code{GnupgKeyParms}
|
|
|
|
|
container is passed verbatim to the crypto backend. Control
|
|
|
|
|
statements are not allowed.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
After the operation completed successfully, the result can be
|
|
|
|
|
retrieved with @code{gpgme_op_genkey_result}.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be started successfully, @code{GPG_ERR_INV_VALUE} if
|
2017-01-26 23:36:39 +00:00
|
|
|
|
@var{parms} is not a well-formed string (e.g. does not have the
|
|
|
|
|
expected tag-like headers and footers), @code{GPG_ERR_NOT_SUPPORTED}
|
|
|
|
|
if @var{public} or @var{secret} is not valid, and
|
|
|
|
|
@code{GPG_ERR_GENERAL} if no key was created by the backend.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_genkey_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{parms}}, @w{gpgme_data_t @var{public}}, @w{gpgme_data_t @var{secret}})
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_genkey_start} initiates a
|
|
|
|
|
@code{gpgme_op_genkey} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be started successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{parms} is not a valid XML string, and
|
|
|
|
|
@code{GPG_ERR_NOT_SUPPORTED} if @var{public} or @var{secret} is not
|
|
|
|
|
@code{NULL}.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@c
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@c gpgme_op_genkey_result
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@c
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftp {Data type} {gpgme_genkey_result_t}
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
This is a pointer to a structure used to store the result of a
|
|
|
|
|
@code{gpgme_op_genkey} operation. After successfully generating a
|
|
|
|
|
key, you can retrieve the pointer to the result with
|
|
|
|
|
@code{gpgme_op_genkey_result}. The structure contains the following
|
|
|
|
|
members:
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@table @code
|
|
|
|
|
@item unsigned int primary : 1
|
|
|
|
|
This flag is set to 1 if a primary key was created and to 0
|
|
|
|
|
if not.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@item unsigned int sub : 1
|
|
|
|
|
This flag is set to 1 if a subkey was created and to 0 if not.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@item unsigned int uid : 1
|
|
|
|
|
This flag is set to 1 if a user ID was created and to 0 if not.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@item char *fpr
|
|
|
|
|
This is the fingerprint of the key that was created. If both a
|
|
|
|
|
primary and a subkey were generated, the fingerprint of the primary
|
|
|
|
|
key will be returned. If the crypto engine does not provide the
|
|
|
|
|
fingerprint, @code{fpr} will be a null pointer.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@item gpgme_data_t pubkey
|
|
|
|
|
This will eventually be used to return the public key. It is
|
|
|
|
|
currently not used.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@item gpgme_data_t seckey
|
|
|
|
|
This will eventually be used to return the secret key. It is
|
|
|
|
|
currently not used.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun gpgme_genkey_result_t gpgme_op_genkey_result (@w{gpgme_ctx_t @var{ctx}})
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_genkey_result} returns a
|
|
|
|
|
@code{gpgme_genkey_result_t} pointer to a structure holding the result of
|
|
|
|
|
a @code{gpgme_op_genkey} operation. The pointer is only valid if the
|
|
|
|
|
last operation on the context was a @code{gpgme_op_genkey} or
|
|
|
|
|
@code{gpgme_op_genkey_start} operation, and if this operation finished
|
|
|
|
|
successfully. The returned pointer is only valid until the next
|
|
|
|
|
operation is started on the context.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@c
|
|
|
|
|
@c SIGNING KEYS
|
|
|
|
|
@c
|
|
|
|
|
@node Signing Keys
|
|
|
|
|
@subsection Signing Keys
|
|
|
|
|
@cindex key, signing
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
Key signatures are a unique concept of the OpenPGP protocol. They can
|
|
|
|
|
be used to certify the validity of a key and are used to create the
|
|
|
|
|
Web-of-Trust (WoT). Instead of using the @code{gpgme_op_interact}
|
|
|
|
|
function along with a finite state machine, GPGME provides a
|
|
|
|
|
convenient function to create key signatures when using modern GnuPG
|
|
|
|
|
versions.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@c
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@c gpgme_op_keysign
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@c
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_keysign @
|
2016-09-16 09:48:29 +00:00
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{const char *@var{userid}}, @
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@w{unsigned long @var{expires}}, @
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@w{unsigned int @var{flags}});
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_keysign} adds a new key signature to the
|
|
|
|
|
public key @var{KEY}. This function requires at least version 2.1.12 of
|
|
|
|
|
GnuPG.
|
|
|
|
|
|
|
|
|
|
@var{CTX} is the usual context which describes the protocol to use
|
|
|
|
|
(which must be OpenPGP) and has also the list of signer keys to be
|
|
|
|
|
used for the signature. The common case is to use the default key for
|
|
|
|
|
signing other keys. If another key or more than one key shall be used
|
|
|
|
|
for a key signature, @code{gpgme_signers_add} can be used.
|
|
|
|
|
@xref{Selecting Signers}.
|
|
|
|
|
|
|
|
|
|
@var{key} specifies the key to operate on.
|
|
|
|
|
|
|
|
|
|
@var{userid} selects the user ID or user IDs to be signed. If
|
|
|
|
|
@var{userid} is set to @code{NULL} all valid user IDs are signed. The
|
|
|
|
|
user ID must be given verbatim because the engine does an exact and
|
|
|
|
|
case sensitive match. Thus the @code{uid} field from the user ID
|
|
|
|
|
object (@code{gpgme_user_id_t}) is to be used. To select more than
|
|
|
|
|
one user ID put them all into one string separated by linefeeds
|
|
|
|
|
characters (@code{\n}) and set the flag @code{GPGME_KEYSIGN_LFSEP}.
|
|
|
|
|
|
2017-02-17 14:44:35 +00:00
|
|
|
|
@var{expires} specifies the expiration time of the new signature in
|
|
|
|
|
seconds. The common case is to use 0 to not set an expiration date.
|
|
|
|
|
However, if the configuration of the engine defines a default
|
|
|
|
|
expiration for key signatures, that is still used unless the flag
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@code{GPGME_KEYSIGN_NOEXPIRE} is used. Note that this parameter takes
|
|
|
|
|
an unsigned long value and not a @code{time_t} to avoid problems on
|
|
|
|
|
systems which use a signed 32 bit @code{time_t}. Note further that
|
|
|
|
|
the OpenPGP protocol uses 32 bit values for timestamps and thus can
|
|
|
|
|
only encode dates up to the year 2106.
|
|
|
|
|
|
|
|
|
|
@var{flags} can be set to the bit-wise OR of the following flags:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_KEYSIGN_LOCAL
|
|
|
|
|
Instead of creating an exportable key signature, create a key
|
|
|
|
|
signature which is is marked as non-exportable.
|
|
|
|
|
|
|
|
|
|
@item GPGME_KEYSIGN_LFSEP
|
|
|
|
|
Although linefeeds are uncommon in user IDs this flag is required to
|
|
|
|
|
explicitly declare that @var{userid} may contain several linefeed
|
|
|
|
|
separated user IDs.
|
|
|
|
|
|
|
|
|
|
@item GPGME_KEYSIGN_NOEXPIRE
|
|
|
|
|
Force the creation of a key signature without an expiration date. This
|
|
|
|
|
overrides @var{expire} and any local configuration of the engine.
|
|
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
The function returns zero on success, @code{GPG_ERR_NOT_SUPPORTED} if
|
|
|
|
|
the engine does not support the command, or a bunch of other error
|
|
|
|
|
codes.
|
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_keysign_start @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{const char *@var{userid}}, @
|
|
|
|
|
@w{unsigned long @var{expires}}, @
|
|
|
|
|
@w{unsigned int @var{flags}});
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_keysign_start} initiates a
|
|
|
|
|
@code{gpgme_op_keysign} operation; see there for details. It must
|
|
|
|
|
be completed by calling @code{gpgme_wait} on the context.
|
|
|
|
|
@xref{Waiting For Completion}.
|
|
|
|
|
|
2003-04-24 17:16:28 +00:00
|
|
|
|
@end deftypefun
|
2002-01-22 14:23:56 +00:00
|
|
|
|
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@c
|
|
|
|
|
@c EXPORTING KEYS
|
|
|
|
|
@c
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Exporting Keys
|
|
|
|
|
@subsection Exporting Keys
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex key, export
|
|
|
|
|
@cindex key ring, export from
|
2002-01-22 14:23:56 +00:00
|
|
|
|
|
2009-06-16 11:42:21 +00:00
|
|
|
|
Exporting keys means the same as running @command{gpg} with the command
|
|
|
|
|
@option{--export}. However, a mode flag can be used to change the way
|
|
|
|
|
the export works. The available mode flags are described below, they
|
|
|
|
|
may be or-ed together.
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
|
|
|
|
|
@item GPGME_EXPORT_MODE_EXTERN
|
|
|
|
|
If this bit is set, the output is send directly to the default
|
|
|
|
|
keyserver. This is currently only allowed for OpenPGP keys. It is good
|
|
|
|
|
practise to not send more than a few dozens key to a keyserver at one
|
|
|
|
|
time. Using this flag requires that the @var{keydata} argument of the
|
|
|
|
|
export function is set to @code{NULL}.
|
|
|
|
|
|
2010-02-16 20:07:03 +00:00
|
|
|
|
@item GPGME_EXPORT_MODE_MINIMAL
|
|
|
|
|
If this bit is set, the smallest possible key is exported. For OpenPGP
|
|
|
|
|
keys it removes all signatures except for the latest self-signatures.
|
|
|
|
|
For X.509 keys it has no effect.
|
|
|
|
|
|
|
|
|
|
|
2015-08-24 10:41:24 +00:00
|
|
|
|
@item GPGME_EXPORT_MODE_SECRET
|
|
|
|
|
Instead of exporting the public key, the secret key is exported. This
|
|
|
|
|
may not be combined with @code{GPGME_EXPORT_MODE_EXTERN}. For X.509
|
|
|
|
|
the export format is PKCS#8.
|
|
|
|
|
|
|
|
|
|
@item GPGME_EXPORT_MODE_RAW
|
|
|
|
|
If this flag is used with @code{GPGME_EXPORT_MODE_SECRET} for an X.509
|
|
|
|
|
key the export format will be changed to PKCS#1. This flag may not be
|
|
|
|
|
used with OpenPGP.
|
|
|
|
|
|
|
|
|
|
@item GPGME_EXPORT_MODE_PKCS12
|
|
|
|
|
If this flag is used with @code{GPGME_EXPORT_MODE_SECRET} for an X.509
|
|
|
|
|
key the export format will be changed to PKCS#12 which also includes
|
|
|
|
|
the certificate. This flag may not be used with OpenPGP.
|
|
|
|
|
|
2009-06-16 11:42:21 +00:00
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_export (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}})
|
2003-05-29 03:21:02 +00:00
|
|
|
|
The function @code{gpgme_op_export} extracts public keys and returns
|
|
|
|
|
them in the data buffer @var{keydata}. The output format of the key
|
|
|
|
|
data returned is determined by the @acronym{ASCII} armor attribute set
|
2008-01-28 19:41:26 +00:00
|
|
|
|
for the context @var{ctx}, or, if that is not set, by the encoding
|
|
|
|
|
specified for @var{keydata}.
|
2003-05-29 03:21:02 +00:00
|
|
|
|
|
|
|
|
|
If @var{pattern} is @code{NULL}, all available keys are returned.
|
|
|
|
|
Otherwise, @var{pattern} contains an engine specific expression that
|
|
|
|
|
is used to limit the list to all keys matching the pattern.
|
|
|
|
|
|
2009-06-16 11:42:21 +00:00
|
|
|
|
@var{mode} is usually 0; other values are described above.
|
2002-01-22 14:23:56 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation completed successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{keydata} is not a valid empty data buffer, and passes through any
|
|
|
|
|
errors that are reported by the crypto engine support routines.
|
2002-01-22 14:23:56 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2009-06-16 11:42:21 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_export_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}})
|
2002-01-30 01:17:30 +00:00
|
|
|
|
The function @code{gpgme_op_export_start} initiates a
|
|
|
|
|
@code{gpgme_op_export} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be started successfully, and @code{GPG_ERR_INV_VALUE}
|
|
|
|
|
if @var{keydata} is not a valid empty data buffer.
|
2003-05-29 03:21:02 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2009-06-16 11:42:21 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_export_ext (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}[]}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}})
|
2003-05-29 03:21:02 +00:00
|
|
|
|
The function @code{gpgme_op_export} extracts public keys and returns
|
|
|
|
|
them in the data buffer @var{keydata}. The output format of the key
|
|
|
|
|
data returned is determined by the @acronym{ASCII} armor attribute set
|
2008-01-28 19:41:26 +00:00
|
|
|
|
for the context @var{ctx}, or, if that is not set, by the encoding
|
|
|
|
|
specified for @var{keydata}.
|
2003-05-29 03:21:02 +00:00
|
|
|
|
|
|
|
|
|
If @var{pattern} or @var{*pattern} is @code{NULL}, all available keys
|
|
|
|
|
are returned. Otherwise, @var{pattern} is a @code{NULL} terminated
|
|
|
|
|
array of strings that are used to limit the list to all keys matching
|
|
|
|
|
at least one of the patterns verbatim.
|
|
|
|
|
|
2009-06-16 11:42:21 +00:00
|
|
|
|
@var{mode} is usually 0; other values are described above.
|
2003-05-29 03:21:02 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation completed successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{keydata} is not a valid empty data buffer, and passes through any
|
|
|
|
|
errors that are reported by the crypto engine support routines.
|
2003-05-29 03:21:02 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2009-06-16 11:42:21 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_export_ext_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}[]}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}})
|
2003-05-29 03:21:02 +00:00
|
|
|
|
The function @code{gpgme_op_export_ext_start} initiates a
|
|
|
|
|
@code{gpgme_op_export_ext} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be started successfully, and @code{GPG_ERR_INV_VALUE}
|
|
|
|
|
if @var{keydata} is not a valid empty data buffer.
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-01-22 14:23:56 +00:00
|
|
|
|
|
2009-06-16 11:42:21 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_export_keys (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t keys[]}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}})
|
|
|
|
|
The function @code{gpgme_op_export_keys} extracts public keys and returns
|
|
|
|
|
them in the data buffer @var{keydata}. The output format of the key
|
|
|
|
|
data returned is determined by the @acronym{ASCII} armor attribute set
|
|
|
|
|
for the context @var{ctx}, or, if that is not set, by the encoding
|
|
|
|
|
specified for @var{keydata}.
|
|
|
|
|
|
|
|
|
|
The keys to export are taken form the @code{NULL} terminated array
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@var{keys}. Only keys of the currently selected protocol of
|
2009-06-16 11:42:21 +00:00
|
|
|
|
@var{ctx} which do have a fingerprint set are considered for export.
|
|
|
|
|
Other keys specified by the @var{keys} are ignored. In particular
|
|
|
|
|
OpenPGP keys retrieved via an external key listing are not included.
|
|
|
|
|
|
|
|
|
|
@var{mode} is usually 0; other values are described above.
|
|
|
|
|
|
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation completed successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{keydata} is not a valid empty data buffer, @code{GPG_ERR_NO_DATA}
|
|
|
|
|
if no useful keys are in @var{keys} and passes through any errors that
|
|
|
|
|
are reported by the crypto engine support routines.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_export_keys_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{keys}[]}, @w{gpgme_export_mode_t @var{mode}}, @w{gpgme_data_t @var{keydata}})
|
|
|
|
|
The function @code{gpgme_op_export_keys_start} initiates a
|
|
|
|
|
@code{gpgme_op_export_ext} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be started successfully, and @code{GPG_ERR_INV_VALUE}
|
|
|
|
|
if @var{keydata} is not a valid empty data buffer, @code{GPG_ERR_NO_DATA}
|
|
|
|
|
if no useful keys are in @var{keys} and passes through any errors that
|
|
|
|
|
are reported by the crypto engine support routines.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Importing Keys
|
|
|
|
|
@subsection Importing Keys
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex key, import
|
|
|
|
|
@cindex key ring, import to
|
2002-01-22 14:23:56 +00:00
|
|
|
|
|
2009-06-16 11:42:21 +00:00
|
|
|
|
Importing keys means the same as running @command{gpg} with the command
|
2012-05-02 08:35:47 +00:00
|
|
|
|
@option{--import}.
|
2009-06-16 11:42:21 +00:00
|
|
|
|
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_import (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{keydata}})
|
2002-01-22 14:23:56 +00:00
|
|
|
|
The function @code{gpgme_op_import} adds the keys in the data buffer
|
|
|
|
|
@var{keydata} to the key ring of the crypto engine used by @var{ctx}.
|
2003-05-27 05:41:43 +00:00
|
|
|
|
The format of @var{keydata} can be @acronym{ASCII} armored, for example,
|
2002-01-22 14:23:56 +00:00
|
|
|
|
but the details are specific to the crypto engine.
|
2002-01-30 21:52:32 +00:00
|
|
|
|
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
After the operation completed successfully, the result can be
|
|
|
|
|
retrieved with @code{gpgme_op_import_result}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
import was completed successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{keydata} if @var{ctx} or @var{keydata} is not a valid pointer,
|
|
|
|
|
and @code{GPG_ERR_NO_DATA} if @var{keydata} is an empty data buffer.
|
2002-01-22 14:23:56 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_import_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{keydata}})
|
2002-01-30 01:17:30 +00:00
|
|
|
|
The function @code{gpgme_op_import_start} initiates a
|
|
|
|
|
@code{gpgme_op_import} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
import could be started successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{keydata} if @var{ctx} or @var{keydata} is not a valid pointer,
|
|
|
|
|
and @code{GPG_ERR_NO_DATA} if @var{keydata} is an empty data buffer.
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2009-06-16 11:42:21 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_import_keys (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t *@var{keys}})
|
|
|
|
|
The function @code{gpgme_op_import_keys} adds the keys described by the
|
|
|
|
|
@code{NULL} terminated array @var{keys} to the key ring of the crypto
|
|
|
|
|
engine used by @var{ctx}. This function is the general interface to
|
|
|
|
|
move a key from one crypto engine to another as long as they are
|
|
|
|
|
compatible. In particular it is used to actually import and make keys
|
|
|
|
|
permanent which have been retrieved from an external source (i.e. using
|
|
|
|
|
@code{GPGME_KEYLIST_MODE_EXTERN}). @footnote{Thus it is a replacement
|
|
|
|
|
for the usual workaround of exporting and then importing a key to make
|
|
|
|
|
an X.509 key permanent.}
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
Only keys of the currently selected protocol of @var{ctx} are
|
2009-06-16 11:42:21 +00:00
|
|
|
|
considered for import. Other keys specified by the @var{keys} are
|
|
|
|
|
ignored. As of now all considered keys must have been retrieved using
|
|
|
|
|
the same method, that is the used key listing mode must be identical.
|
|
|
|
|
|
|
|
|
|
After the operation completed successfully, the result can be
|
|
|
|
|
retrieved with @code{gpgme_op_import_result}.
|
|
|
|
|
|
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
import was completed successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{keydata} if @var{ctx} or @var{keydata} is not a valid pointer,
|
|
|
|
|
@code{GPG_ERR_CONFLICT} if the key listing mode does not match, and
|
|
|
|
|
@code{GPG_ERR_NO_DATA} if no keys are considered for export.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_import_keys_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t *@var{keys}})
|
|
|
|
|
The function @code{gpgme_op_import_keys_start} initiates a
|
|
|
|
|
@code{gpgme_op_import_keys} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
import was completed successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{keydata} if @var{ctx} or @var{keydata} is not a valid pointer,
|
|
|
|
|
@code{GPG_ERR_CONFLICT} if the key listing mode does not match, and
|
|
|
|
|
@code{GPG_ERR_NO_DATA} if no keys are considered for export.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_import_status_t}
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
This is a pointer to a structure used to store a part of the result of
|
2003-05-04 14:57:24 +00:00
|
|
|
|
a @code{gpgme_op_import} operation. For each considered key one
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
status is added that contains information about the result of the
|
|
|
|
|
import. The structure contains the following members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_import_status_t next
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
This is a pointer to the next status structure in the linked list, or
|
|
|
|
|
@code{NULL} if this is the last element.
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
|
|
|
|
|
@item char *fpr
|
|
|
|
|
This is the fingerprint of the key that was considered.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_error_t result
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
If the import was not successful, this is the error value that caused
|
2003-06-05 23:20:29 +00:00
|
|
|
|
the import to fail. Otherwise the error code is
|
|
|
|
|
@code{GPG_ERR_NO_ERROR}.
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
|
|
|
|
|
@item unsigned int status
|
|
|
|
|
This is a bit-wise OR of the following flags that give more
|
|
|
|
|
information about what part of the key was imported. If the key was
|
|
|
|
|
already known, this might be 0.
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_IMPORT_NEW
|
|
|
|
|
The key was new.
|
|
|
|
|
|
|
|
|
|
@item GPGME_IMPORT_UID
|
|
|
|
|
The key contained new user IDs.
|
|
|
|
|
|
|
|
|
|
@item GPGME_IMPORT_SIG
|
|
|
|
|
The key contained new signatures.
|
|
|
|
|
|
|
|
|
|
@item GPGME_IMPORT_SUBKEY
|
|
|
|
|
The key contained new sub keys.
|
|
|
|
|
|
2003-04-25 17:08:00 +00:00
|
|
|
|
@item GPGME_IMPORT_SECRET
|
|
|
|
|
The key contained a secret key.
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_import_result_t}
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
This is a pointer to a structure used to store the result of a
|
2003-05-04 14:57:24 +00:00
|
|
|
|
@code{gpgme_op_import} operation. After a successful import
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
operation, you can retrieve the pointer to the result with
|
|
|
|
|
@code{gpgme_op_import_result}. The structure contains the following
|
|
|
|
|
members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item int considered
|
|
|
|
|
The total number of considered keys.
|
|
|
|
|
|
|
|
|
|
@item int no_user_id
|
|
|
|
|
The number of keys without user ID.
|
|
|
|
|
|
|
|
|
|
@item int imported
|
|
|
|
|
The total number of imported keys.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@item int imported_rsa
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The number of imported RSA keys.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@item int unchanged
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The number of unchanged keys.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@item int new_user_ids
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The number of new user IDs.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@item int new_sub_keys
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The number of new sub keys.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@item int new_signatures
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The number of new signatures.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@item int new_revocations
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The number of new revocations.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@item int secret_read
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The total number of secret keys read.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@item int secret_imported
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The number of imported secret keys.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@item int secret_unchanged
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The number of unchanged secret keys.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
@item int not_imported
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The number of keys not imported.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_import_status_t imports
|
|
|
|
|
A list of gpgme_import_status_t objects which contain more information
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
about the keys for which an import was attempted.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_import_result_t gpgme_op_import_result (@w{gpgme_ctx_t @var{ctx}})
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
The function @code{gpgme_op_import_result} returns a
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@code{gpgme_import_result_t} pointer to a structure holding the result
|
|
|
|
|
of a @code{gpgme_op_import} operation. The pointer is only valid if
|
|
|
|
|
the last operation on the context was a @code{gpgme_op_import} or
|
doc/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Importing Keys): Add documentation for
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
gpgme/
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: New enum for GPGME_IMPORT_NEW, GPGME_IMPORT_UID,
GPGME_IMPORT_SIG, GPGME_IMPORT_SUBKEY, GPGME_IMPORT_PRIVATE.
(GpgmeError): GPGME_Unknown_Reason, GPGME_Not_Found,
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
GPGME_Bad_Signature, GPGME_No_Public_Key): New error codes.
(struct _gpgme_import_status): New structure.
(GpgmeImportStatus): New type.
(struct _gpgme_op_import_result): New structure.
(GpgmeImportResult): New type.
(gpgme_op_import_result): New function.
* import.c: Include <errno.h> and "gpgme.h", but not "util.h".
(struct import_result): Change to type op_data_t.
(release_import_result): Rename to ...
(release_op_data): ... this.
(append_xml_impinfo): Function removed.
(gpgme_op_import_result): New function.
(parse_import): New function.
(parse_import_res): Likewise.
(import_status_handler): Change first argument to void *. Rewrite
to use new functions.
(_gpgme_op_import_start): Rework error handling.
2003-04-25 15:56:24 +00:00
|
|
|
|
@code{gpgme_op_import_start} operation, and if this operation finished
|
|
|
|
|
successfully. The returned pointer is only valid until the next
|
|
|
|
|
operation is started on the context.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Deleting Keys
|
|
|
|
|
@subsection Deleting Keys
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex key, delete
|
|
|
|
|
@cindex key ring, delete from
|
2002-01-22 14:23:56 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_delete (@w{gpgme_ctx_t @var{ctx}}, @w{const gpgme_key_t @var{key}}, @w{int @var{allow_secret}})
|
2002-01-22 14:23:56 +00:00
|
|
|
|
The function @code{gpgme_op_delete} deletes the key @var{key} from the
|
|
|
|
|
key ring of the crypto engine used by @var{ctx}. If
|
|
|
|
|
@var{allow_secret} is @code{0}, only public keys are deleted,
|
2002-07-25 18:50:23 +00:00
|
|
|
|
otherwise secret keys are deleted as well, if that is supported.
|
2002-01-22 14:23:56 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the key
|
|
|
|
|
was deleted successfully, @code{GPG_ERR_INV_VALUE} if @var{ctx} or
|
|
|
|
|
@var{key} is not a valid pointer, @code{GPG_ERR_NO_PUBKEY} if
|
|
|
|
|
@var{key} could not be found in the keyring,
|
|
|
|
|
@code{GPG_ERR_AMBIGUOUS_NAME} if the key was not specified
|
|
|
|
|
unambiguously, and @code{GPG_ERR_CONFLICT} if the secret key for
|
|
|
|
|
@var{key} is available, but @var{allow_secret} is zero.
|
2002-01-22 14:23:56 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_delete_start (@w{gpgme_ctx_t @var{ctx}}, @w{const gpgme_key_t @var{key}}, @w{int @var{allow_secret}})
|
2002-01-30 01:17:30 +00:00
|
|
|
|
The function @code{gpgme_op_delete_start} initiates a
|
|
|
|
|
@code{gpgme_op_delete} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation was started successfully, and @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} or @var{key} is not a valid pointer.
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-01-22 14:23:56 +00:00
|
|
|
|
|
2010-01-05 17:36:53 +00:00
|
|
|
|
@node Changing Passphrases
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@subsection Changing Passphrases
|
2010-01-05 17:36:53 +00:00
|
|
|
|
@cindex passphrase, change
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_passwd @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{const gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{unsigned int @var{flags}})
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_passwd} changes the passphrase of the
|
|
|
|
|
private key associated with @var{key}. The only allowed value for
|
|
|
|
|
@var{flags} is @code{0}. The backend engine will usually popup a window
|
|
|
|
|
to ask for the old and the new passphrase. Thus this function is not
|
|
|
|
|
useful in a server application (where passphrases are not required
|
|
|
|
|
anyway).
|
2010-01-08 19:15:06 +00:00
|
|
|
|
|
|
|
|
|
Note that old @code{gpg} engines (before version 2.0.15) do not support
|
2010-01-25 16:04:27 +00:00
|
|
|
|
this command and will silently ignore it.
|
2010-01-05 17:36:53 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_passwd_start @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{const gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{unsigned int @var{flags}})
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_passwd_start} initiates a
|
|
|
|
|
@code{gpgme_op_passwd} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
|
|
|
|
The function returns @code{0} if the operation was started successfully,
|
|
|
|
|
and an error code if one of the arguments is not valid or the oepration
|
|
|
|
|
could not be started.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@c
|
|
|
|
|
@c CHANGING TOFU DATA
|
|
|
|
|
@c
|
|
|
|
|
@node Changing TOFU Data
|
|
|
|
|
@subsection Changing TOFU Data
|
|
|
|
|
@cindex validity, TOFU
|
|
|
|
|
|
|
|
|
|
The OpenPGP engine features a Trust-On-First-Use (TOFU) key validation
|
2017-02-17 16:07:05 +00:00
|
|
|
|
model. For resolving conflicts it is necessary to declare the policy
|
2016-09-16 09:48:29 +00:00
|
|
|
|
for a key. See the GnuPG manual for details on the TOFU
|
|
|
|
|
implementation.
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {enum gpgme_tofu_policy_t}
|
|
|
|
|
@tindex gpgme_tofu_policy_t
|
|
|
|
|
The @code{gpgme_tofu_policy_t} type specifies the set of possible
|
|
|
|
|
policy values that are supported by @acronym{GPGME}:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_TOFU_POLICY_AUTO
|
|
|
|
|
Set the policy to ``auto''.
|
|
|
|
|
@item GPGME_TOFU_POLICY_GOOD
|
2017-02-17 16:07:05 +00:00
|
|
|
|
Set the policy to ``good''.
|
2016-09-16 09:48:29 +00:00
|
|
|
|
@item GPGME_TOFU_POLICY_BAD
|
|
|
|
|
Set the policy to ``bad''.
|
|
|
|
|
@item GPGME_TOFU_POLICY_ASK
|
|
|
|
|
Set the policy to ``ask''.
|
|
|
|
|
@item GPGME_TOFU_POLICY_UNKNOWN
|
|
|
|
|
Set the policy to ``unknown''.
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
To change the policy for a key the following functions can be used:
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_tofu_policy @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{const gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{gpgme_tofu_policy_t @var{policy}})
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_tofu_policy} changes the TOFU policy of
|
|
|
|
|
@var{key}. The valid values for @var{policy} are listed above. As of
|
|
|
|
|
now this function does only work for OpenPGP and requires at least
|
|
|
|
|
version 2.1.10 of GnuPG.
|
|
|
|
|
|
|
|
|
|
The function returns zero on success, @code{GPG_ERR_NOT_SUPPORTED} if
|
|
|
|
|
the engine does not support the command, or a bunch of other error
|
|
|
|
|
codes.
|
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_tofu_policy_start @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{const gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{gpgme_tofu_policy_t @var{policy}})
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_tofu_policy_start} initiates a
|
|
|
|
|
@code{gpgme_op_tofu_policy} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
|
|
|
|
The function returns @code{0} if the operation was started successfully,
|
|
|
|
|
and an error code if one of the arguments is not valid or the oepration
|
|
|
|
|
could not be started.
|
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2007-06-05 14:47:18 +00:00
|
|
|
|
@node Advanced Key Editing
|
|
|
|
|
@subsection Advanced Key Editing
|
|
|
|
|
@cindex key, edit
|
|
|
|
|
|
2016-09-15 08:45:04 +00:00
|
|
|
|
@deftp {Data type} {gpgme_error_t (*gpgme_interact_cb_t) @
|
|
|
|
|
(@w{void *@var{handle}}, @
|
|
|
|
|
@w{const char *@var{status}}, @
|
|
|
|
|
@w{const char *@var{args}}, @
|
|
|
|
|
@w{int @var{fd}})}
|
|
|
|
|
@tindex gpgme_interact_cb_t
|
|
|
|
|
The @code{gpgme_interact_cb_t} type is the type of functions which
|
|
|
|
|
@acronym{GPGME} calls if it a key interact operation is on-going. The
|
2016-09-16 13:06:26 +00:00
|
|
|
|
status keyword @var{status} and the argument line @var{args} are
|
|
|
|
|
passed through by @acronym{GPGME} from the crypto engine. An empty
|
|
|
|
|
string represents EOF. The file descriptor @var{fd} is -1 for normal
|
|
|
|
|
status messages. If @var{status} indicates a command rather than a
|
|
|
|
|
status message, the response to the command should be written to
|
|
|
|
|
@var{fd}. The @var{handle} is provided by the user at start of
|
|
|
|
|
operation.
|
2016-09-15 08:45:04 +00:00
|
|
|
|
|
|
|
|
|
The function should return @code{GPG_ERR_FALSE} if it did not handle
|
|
|
|
|
the status code, @code{0} for success, or any other error value.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_interact (@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{unsigned int @var{flags}}, @
|
|
|
|
|
@w{gpgme_interact_cb_t @var{fnc}}, @
|
|
|
|
|
@w{void *@var{handle}}, @
|
|
|
|
|
@w{gpgme_data_t @var{out}})
|
|
|
|
|
The function @code{gpgme_op_interact} processes the key @var{KEY}
|
|
|
|
|
interactively, using the interact callback function @var{FNC} with the
|
|
|
|
|
handle @var{HANDLE}. The callback is invoked for every status and
|
|
|
|
|
command request from the crypto engine. The output of the crypto
|
|
|
|
|
engine is written to the data object @var{out}.
|
|
|
|
|
|
|
|
|
|
Note that the protocol between the callback function and the crypto
|
|
|
|
|
engine is specific to the crypto engine and no further support in
|
|
|
|
|
implementing this protocol correctly is provided by @acronym{GPGME}.
|
|
|
|
|
|
|
|
|
|
@var{flags} modifies the behaviour of the function; the only defined
|
|
|
|
|
bit value is:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_INTERACT_CARD
|
|
|
|
|
This is used for smartcard based keys and uses gpg’s
|
|
|
|
|
@code{--card-edit} command.
|
|
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
The function returns @code{0} if the edit operation completes
|
|
|
|
|
successfully, @code{GPG_ERR_INV_VALUE} if @var{ctx} or @var{key} is
|
|
|
|
|
not a valid pointer, and any error returned by the crypto engine or
|
|
|
|
|
the edit callback handler.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_interact_start (@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{gpgme_key_t @var{key}}, @
|
|
|
|
|
@w{unsigned int @var{flags}}, @
|
|
|
|
|
@w{gpgme_interact_cb_t @var{fnc}}, @
|
|
|
|
|
@w{void *@var{handle}}, @
|
|
|
|
|
@w{gpgme_data_t @var{out}})
|
|
|
|
|
The function @code{gpgme_op_interact_start} initiates a
|
|
|
|
|
@code{gpgme_op_interact} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
|
|
|
|
The function returns @code{0} if the operation was started
|
|
|
|
|
successfully, and @code{GPG_ERR_INV_VALUE} if @var{ctx} or @var{key}
|
|
|
|
|
is not a valid pointer.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2007-06-05 14:47:18 +00:00
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@node Trust Item Management
|
|
|
|
|
@section Trust Item Management
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex trust item
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@strong{Caution:} The trust items interface is experimental.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} gpgme_trust_item_t
|
|
|
|
|
The @code{gpgme_trust_item_t} type is a pointer to a trust item object.
|
2003-04-29 21:53:58 +00:00
|
|
|
|
It has the following members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item char *keyid
|
|
|
|
|
This is a string describing the key to which this trust items belongs.
|
|
|
|
|
|
|
|
|
|
@item int type
|
|
|
|
|
This is the type of the trust item. A value of 1 refers to a key, a
|
|
|
|
|
value of 2 refers to a user ID.
|
|
|
|
|
|
|
|
|
|
@item int level
|
|
|
|
|
This is the trust level.
|
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
@item char *owner_trust
|
2003-04-29 21:53:58 +00:00
|
|
|
|
The owner trust if @code{type} is 1.
|
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
@item char *validity
|
2003-04-29 21:53:58 +00:00
|
|
|
|
The calculated validity.
|
|
|
|
|
|
|
|
|
|
@item char *name
|
|
|
|
|
The user name if @code{type} is 2.
|
|
|
|
|
@end table
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@menu
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Listing Trust Items:: Browsing the list of available trust items.
|
|
|
|
|
* Manipulating Trust Items:: Operations on trust items.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Listing Trust Items
|
|
|
|
|
@subsection Listing Trust Items
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex trust item list
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_trustlist_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}}, @w{int @var{max_level}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_op_trustlist_start} initiates a trust item
|
|
|
|
|
listing operation inside the context @var{ctx}. It sets everything up
|
|
|
|
|
so that subsequent invocations of @code{gpgme_op_trustlist_next} return
|
2002-01-30 01:43:05 +00:00
|
|
|
|
the trust items in the list.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
The string @var{pattern} contains an engine specific expression that
|
|
|
|
|
is used to limit the list to all trust items matching the pattern. It
|
|
|
|
|
can not be the empty string.
|
|
|
|
|
|
|
|
|
|
The argument @var{max_level} is currently ignored.
|
|
|
|
|
|
|
|
|
|
The context will be busy until either all trust items are received
|
2003-06-05 23:20:29 +00:00
|
|
|
|
(and @code{gpgme_op_trustlist_next} returns @code{GPG_ERR_EOF}), or
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@code{gpgme_op_trustlist_end} is called to finish the operation.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} is not a valid pointer, and passes through any errors that
|
|
|
|
|
are reported by the crypto engine support routines.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_trustlist_next (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_trust_item_t *@var{r_item}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_op_trustlist_next} returns the next trust
|
|
|
|
|
item in the list created by a previous @code{gpgme_op_trustlist_start}
|
|
|
|
|
operation in the context @var{ctx}. The trust item can be destroyed
|
2002-01-29 22:58:25 +00:00
|
|
|
|
with @code{gpgme_trust_item_release}. @xref{Manipulating Trust Items}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
This is the only way to get at @code{gpgme_trust_item_t} objects in
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@acronym{GPGME}.
|
|
|
|
|
|
|
|
|
|
If the last trust item in the list has already been returned,
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@code{gpgme_op_trustlist_next} returns @code{GPG_ERR_EOF}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_INV_VALUE} if @var{ctx} or
|
|
|
|
|
@var{r_item} is not a valid pointer, and @code{GPG_ERR_ENOMEM} if
|
2003-04-24 14:33:13 +00:00
|
|
|
|
there is not enough memory for the operation.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_trustlist_end (@w{gpgme_ctx_t @var{ctx}})
|
2011-01-07 12:53:26 +00:00
|
|
|
|
The function @code{gpgme_op_trustlist_end} ends a pending trust list
|
2002-01-16 00:41:10 +00:00
|
|
|
|
operation in the context @var{ctx}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} is not a valid pointer, and @code{GPG_ERR_ENOMEM} if at some
|
|
|
|
|
time during the operation there was not enough memory available.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Manipulating Trust Items
|
|
|
|
|
@subsection Manipulating Trust Items
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex trust item, manipulation
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_trust_item_ref (@w{gpgme_trust_item_t @var{item}})
|
2003-04-29 21:53:58 +00:00
|
|
|
|
The function @code{gpgme_trust_item_ref} acquires an additional
|
|
|
|
|
reference for the trust item @var{item}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun void gpgme_trust_item_unref (@w{gpgme_trust_item_t @var{item}})
|
2003-04-29 21:53:58 +00:00
|
|
|
|
The function @code{gpgme_trust_item_unref} releases a reference for
|
|
|
|
|
the trust item @var{item}. If this was the last reference, the trust
|
|
|
|
|
item will be destroyed and all resources associated to it will be
|
|
|
|
|
released.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@node Crypto Operations
|
|
|
|
|
@section Crypto Operations
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex cryptographic operation
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
Sometimes, the result of a crypto operation returns a list of invalid
|
2003-06-06 00:56:03 +00:00
|
|
|
|
keys encountered in processing the request. The following structure
|
|
|
|
|
is used to hold information about such a key.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
|
2003-06-06 00:56:03 +00:00
|
|
|
|
@deftp {Data type} {gpgme_invalid_key_t}
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
This is a pointer to a structure used to store a part of the result of
|
|
|
|
|
a crypto operation which takes user IDs as one input parameter. The
|
|
|
|
|
structure contains the following members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2003-06-06 00:56:03 +00:00
|
|
|
|
@item gpgme_invalid_key_t next
|
|
|
|
|
This is a pointer to the next invalid key structure in the linked
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
list, or @code{NULL} if this is the last element.
|
|
|
|
|
|
2003-06-06 00:56:03 +00:00
|
|
|
|
@item char *fpr
|
|
|
|
|
The fingerprint or key ID of the invalid key encountered.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_error_t reason
|
2003-06-06 00:56:03 +00:00
|
|
|
|
An error code describing the reason why the key was found invalid.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@menu
|
|
|
|
|
* Decrypt:: Decrypting a ciphertext.
|
|
|
|
|
* Verify:: Verifying a signature.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Decrypt and Verify:: Decrypting a signed ciphertext.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
* Sign:: Creating a signature.
|
|
|
|
|
* Encrypt:: Encrypting a plaintext.
|
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Decrypt
|
|
|
|
|
@subsection Decrypt
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex decryption
|
|
|
|
|
@cindex cryptographic operation, decryption
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_decrypt (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{cipher}}, @w{gpgme_data_t @var{plain}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_op_decrypt} decrypts the ciphertext in the
|
|
|
|
|
data object @var{cipher} and stores it into the data object
|
|
|
|
|
@var{plain}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
ciphertext could be decrypted successfully, @code{GPG_ERR_INV_VALUE}
|
|
|
|
|
if @var{ctx}, @var{cipher} or @var{plain} is not a valid pointer,
|
|
|
|
|
@code{GPG_ERR_NO_DATA} if @var{cipher} does not contain any data to
|
|
|
|
|
decrypt, @code{GPG_ERR_DECRYPT_FAILED} if @var{cipher} is not a valid
|
|
|
|
|
cipher text, @code{GPG_ERR_BAD_PASSPHRASE} if the passphrase for the
|
2002-01-16 00:41:10 +00:00
|
|
|
|
secret key could not be retrieved, and passes through any errors that
|
|
|
|
|
are reported by the crypto engine support routines.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_decrypt_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{cipher}}, @w{gpgme_data_t @var{plain}})
|
2002-01-30 01:17:30 +00:00
|
|
|
|
The function @code{gpgme_op_decrypt_start} initiates a
|
|
|
|
|
@code{gpgme_op_decrypt} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be started successfully, and @code{GPG_ERR_INV_VALUE}
|
|
|
|
|
if @var{cipher} or @var{plain} is not a valid pointer.
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@end deftypefun
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2005-06-03 00:42:08 +00:00
|
|
|
|
@deftp {Data type} {gpgme_recipient_t}
|
|
|
|
|
This is a pointer to a structure used to store information about the
|
|
|
|
|
recipient of an encrypted text which is decrypted in a
|
|
|
|
|
@code{gpgme_op_decrypt} operation. This information (except for the
|
|
|
|
|
status field) is even available before the operation finished
|
|
|
|
|
successfully, for example in a passphrase callback. The structure
|
|
|
|
|
contains the following members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item gpgme_recipient_t next
|
|
|
|
|
This is a pointer to the next recipient structure in the linked list,
|
|
|
|
|
or @code{NULL} if this is the last element.
|
|
|
|
|
|
|
|
|
|
@item gpgme_pubkey_algo_t
|
|
|
|
|
The public key algorithm used in the encryption.
|
|
|
|
|
|
|
|
|
|
@item char *keyid
|
|
|
|
|
This is the key ID of the key (in hexadecimal digits) used as
|
|
|
|
|
recipient.
|
|
|
|
|
|
|
|
|
|
@item gpgme_error_t status
|
|
|
|
|
This is an error number with the error code GPG_ERR_NO_SECKEY if the
|
|
|
|
|
secret key for this recipient is not available, and 0 otherwise.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_decrypt_result_t}
|
2003-04-28 21:17:15 +00:00
|
|
|
|
This is a pointer to a structure used to store the result of a
|
2005-06-03 00:42:08 +00:00
|
|
|
|
@code{gpgme_op_decrypt} operation. After successfully decrypting
|
2003-04-28 21:17:15 +00:00
|
|
|
|
data, you can retrieve the pointer to the result with
|
2016-11-15 09:29:48 +00:00
|
|
|
|
@code{gpgme_op_decrypt_result}. As with all result structures, it
|
|
|
|
|
this structure shall be considered read-only and an application must
|
|
|
|
|
not allocated such a strucure on its own. The structure contains the
|
|
|
|
|
following members:
|
2003-04-28 21:17:15 +00:00
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item char *unsupported_algorithm
|
|
|
|
|
If an unsupported algorithm was encountered, this string describes the
|
|
|
|
|
algorithm that is not supported.
|
2004-05-21 15:51:53 +00:00
|
|
|
|
|
|
|
|
|
@item unsigned int wrong_key_usage : 1
|
|
|
|
|
This is true if the key was not used according to its policy.
|
2005-06-03 00:42:08 +00:00
|
|
|
|
|
2012-05-02 08:35:47 +00:00
|
|
|
|
@item gpgme_recipient_t recipients
|
2005-06-03 00:42:08 +00:00
|
|
|
|
This is a linked list of recipients to which this message was encrypted.
|
2005-07-27 01:50:08 +00:00
|
|
|
|
|
2005-09-30 13:24:40 +00:00
|
|
|
|
@item char *file_name
|
2005-07-27 01:50:08 +00:00
|
|
|
|
This is the filename of the original plaintext message file if it is
|
|
|
|
|
known, otherwise this is a null pointer.
|
core: Enable extraction of session keys.
* src/gpgme.c (gpgme_set_export_session_keys): New function.
(gpgme_get_export_session_keys): New function.
* src/gpgme.h.in (struct _gpgme_op_decrypt_result): Add session_key
member.
(gpgme_{set,get}_export_session_keys): Declare new functions.
* src/libgpgme.vers, src/gpgme.def: Export new functions in shared
object.
* src/engine.h: (_gpgme_engine_op_decrypt) Add export_session_key
parameter.
(_gpgme_engine_op_decrypt_verify): Add export_session_key parameter.
* src/engine-backend.h: (struct engine_ops): Change function
pointer declarations to match.
* src/context.h (struct gpgme_context): Add export_session_keys member.
* src/decrypt.c (release_op_data): Free result.session_key.
(_gpgme_decrypt_status_handler): Store a copy of the exported session
key.
(decrypt_start): Pass export_session_keys from the context.
* src/decrypt-verify.c (decrypt_verify_start): Pass
export_session_keys from context.
* src/engine.c (_gpgme_engine_op_decrypt): Pass through
export_session_key flag.
(_gpgme_engine_op_decrypt_verify): Pass through export_session_key
flag.
* src/engine-gpg.c (gpg_decrypt): If export_session_key is set, add
--export-session-key to argument list.
* src/engine-gpgsm.c (gpgsm_decrypt): Ignore export_session_key for
now, since gpgsm offers no such mechanism.
* src/engine-uiserver.c (_uiserver_decrypt): If export_session_key is
set, add --export-session-key flag to cmd.
* doc/gpgme.texi: Document new functions and session_key member of
decrypt_result_t.
* doc/uiserver.texi: Add --export-session-key flag to DECRYPT command.
--
gpg(1) documents session key export as useful for key escrow, and is
rightly dubious of that use case. However, session key export is also
useful in other use cases. Two examples from MUA development (where
this functionality would be specifically useful to me right now):
* If the MUA stores a local copy of the session key upon decrypting
the message, it can re-decrypt the message without expensive
asymmetric operations. When rendering a thread with dozens of
encrypted messages, this can represent a significant speedup.
* A user may have expired encryption-capable secret key material,
along with many messages encrypted to that material. If she stores
the session keys for those messages she wants to keep, she can
destroy her secret key material and make any messages she has
deleted completely unrecoverable, even to an attacker who gets her
remaining secret keys in the future.
This patchset makes a two specific implementation decisions that could
have gone in different ways. I welcome feedback on preferred outcomes.
0) session key representation: we currently represent the session key
as an opaque textual string, rather than trying to provide any
sort of in-memory structure. While it wouldn't be hard to parse
the data produced by gpg's --export-session-key, I chose to use
the opaque string rather than lock in a particular data format.
1) API/ABI: i've added a member to gpgme_op_decrypt_result_t. This
has the potential to cause an out-of-bound memory access if
someone uses code compiled against the newer verision, but linked
at runtime against an older version. I've attempted to limit that
risk by documenting that users must verify
gpgme_get_export_session_keys() before accessing this new struct
member -- this means that code expecting this capability will
require the symbol at link-time, and will refuse to link against
older versions.
Another approach to solving this problem would be to avoid
modifying gpgme_op_decrypt_result_t, and to introduce instead a
new function gpgme_op_session_key(), which could be called in the
same places as gpgme_op_decrypt_result(). Depending on the
representation of the session key, this might introduce new
memory-management burdens on the user of the library, and the
session key is certainly part of a decryption result, so it seemed
simpler to go with what i have here.
If anyone has strong preferences that these choices should be solved
in a different way, i'm happy to hear them.
Additionally, I note that i'm also still pretty unclear about how the
"UI Server" fits into this whole ecosystem. In particular, I don't
know whether it's kosher to just add an --export-session-key flag to
the DECRYPT operation without actually having implemented it anywhere,
but i don't see where i would actually implement it either :/
If this patch (or some variant) is adopted, i will supply another
patch that permits offering a session key during decryption (e.g. "gpg
--override-session-key"), but I wanted to get these implementation
choices ironed out first.
Gnupg-Bug-Id: 2754
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
On the concern of adding a new field to a structure: It may not be
clearly documented but we don't expect that a user ever allocates such
a structure - those result structure may only be created bu gpgme and
are read-only for the user. Adding a new member constitutes a
compatible ABI change and thus an older SO may not be used by code
compiled with a header for the newer API. Unless someone tinkers with
the build system, this should never happen. We have added new fields
to result structure may times and I can't remember any problems.
- wk
2016-11-11 07:49:28 +00:00
|
|
|
|
|
|
|
|
|
@item char *session_key
|
2016-11-15 09:29:48 +00:00
|
|
|
|
A textual representation (nul-terminated string) of the session key
|
core: Enable extraction of session keys.
* src/gpgme.c (gpgme_set_export_session_keys): New function.
(gpgme_get_export_session_keys): New function.
* src/gpgme.h.in (struct _gpgme_op_decrypt_result): Add session_key
member.
(gpgme_{set,get}_export_session_keys): Declare new functions.
* src/libgpgme.vers, src/gpgme.def: Export new functions in shared
object.
* src/engine.h: (_gpgme_engine_op_decrypt) Add export_session_key
parameter.
(_gpgme_engine_op_decrypt_verify): Add export_session_key parameter.
* src/engine-backend.h: (struct engine_ops): Change function
pointer declarations to match.
* src/context.h (struct gpgme_context): Add export_session_keys member.
* src/decrypt.c (release_op_data): Free result.session_key.
(_gpgme_decrypt_status_handler): Store a copy of the exported session
key.
(decrypt_start): Pass export_session_keys from the context.
* src/decrypt-verify.c (decrypt_verify_start): Pass
export_session_keys from context.
* src/engine.c (_gpgme_engine_op_decrypt): Pass through
export_session_key flag.
(_gpgme_engine_op_decrypt_verify): Pass through export_session_key
flag.
* src/engine-gpg.c (gpg_decrypt): If export_session_key is set, add
--export-session-key to argument list.
* src/engine-gpgsm.c (gpgsm_decrypt): Ignore export_session_key for
now, since gpgsm offers no such mechanism.
* src/engine-uiserver.c (_uiserver_decrypt): If export_session_key is
set, add --export-session-key flag to cmd.
* doc/gpgme.texi: Document new functions and session_key member of
decrypt_result_t.
* doc/uiserver.texi: Add --export-session-key flag to DECRYPT command.
--
gpg(1) documents session key export as useful for key escrow, and is
rightly dubious of that use case. However, session key export is also
useful in other use cases. Two examples from MUA development (where
this functionality would be specifically useful to me right now):
* If the MUA stores a local copy of the session key upon decrypting
the message, it can re-decrypt the message without expensive
asymmetric operations. When rendering a thread with dozens of
encrypted messages, this can represent a significant speedup.
* A user may have expired encryption-capable secret key material,
along with many messages encrypted to that material. If she stores
the session keys for those messages she wants to keep, she can
destroy her secret key material and make any messages she has
deleted completely unrecoverable, even to an attacker who gets her
remaining secret keys in the future.
This patchset makes a two specific implementation decisions that could
have gone in different ways. I welcome feedback on preferred outcomes.
0) session key representation: we currently represent the session key
as an opaque textual string, rather than trying to provide any
sort of in-memory structure. While it wouldn't be hard to parse
the data produced by gpg's --export-session-key, I chose to use
the opaque string rather than lock in a particular data format.
1) API/ABI: i've added a member to gpgme_op_decrypt_result_t. This
has the potential to cause an out-of-bound memory access if
someone uses code compiled against the newer verision, but linked
at runtime against an older version. I've attempted to limit that
risk by documenting that users must verify
gpgme_get_export_session_keys() before accessing this new struct
member -- this means that code expecting this capability will
require the symbol at link-time, and will refuse to link against
older versions.
Another approach to solving this problem would be to avoid
modifying gpgme_op_decrypt_result_t, and to introduce instead a
new function gpgme_op_session_key(), which could be called in the
same places as gpgme_op_decrypt_result(). Depending on the
representation of the session key, this might introduce new
memory-management burdens on the user of the library, and the
session key is certainly part of a decryption result, so it seemed
simpler to go with what i have here.
If anyone has strong preferences that these choices should be solved
in a different way, i'm happy to hear them.
Additionally, I note that i'm also still pretty unclear about how the
"UI Server" fits into this whole ecosystem. In particular, I don't
know whether it's kosher to just add an --export-session-key flag to
the DECRYPT operation without actually having implemented it anywhere,
but i don't see where i would actually implement it either :/
If this patch (or some variant) is adopted, i will supply another
patch that permits offering a session key during decryption (e.g. "gpg
--override-session-key"), but I wanted to get these implementation
choices ironed out first.
Gnupg-Bug-Id: 2754
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
On the concern of adding a new field to a structure: It may not be
clearly documented but we don't expect that a user ever allocates such
a structure - those result structure may only be created bu gpgme and
are read-only for the user. Adding a new member constitutes a
compatible ABI change and thus an older SO may not be used by code
compiled with a header for the newer API. Unless someone tinkers with
the build system, this should never happen. We have added new fields
to result structure may times and I can't remember any problems.
- wk
2016-11-11 07:49:28 +00:00
|
|
|
|
used in symmetric encryption of the message, if the context has been
|
2016-11-15 09:29:48 +00:00
|
|
|
|
set to export session keys (see @code{gpgme_set_ctx_flag,
|
|
|
|
|
"export-session-key"}), and a session key was available for the most
|
|
|
|
|
recent decryption operation. Otherwise, this is a null pointer.
|
|
|
|
|
|
2016-11-16 05:10:22 +00:00
|
|
|
|
You must not try to access this member of the struct unless
|
|
|
|
|
@code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns success
|
|
|
|
|
or @code{gpgme_get_ctx_flag (ctx, "export-session-key")} returns true
|
|
|
|
|
(non-empty string).
|
|
|
|
|
|
2003-04-28 21:17:15 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_decrypt_result_t gpgme_op_decrypt_result (@w{gpgme_ctx_t @var{ctx}})
|
2003-04-28 21:17:15 +00:00
|
|
|
|
The function @code{gpgme_op_decrypt_result} returns a
|
2003-07-28 12:09:42 +00:00
|
|
|
|
@code{gpgme_decrypt_result_t} pointer to a structure holding the
|
|
|
|
|
result of a @code{gpgme_op_decrypt} operation. The pointer is only
|
|
|
|
|
valid if the last operation on the context was a
|
|
|
|
|
@code{gpgme_op_decrypt} or @code{gpgme_op_decrypt_start} operation.
|
|
|
|
|
If the operation failed this might be a @code{NULL} pointer. The
|
|
|
|
|
returned pointer is only valid until the next operation is started on
|
|
|
|
|
the context.
|
2003-04-28 21:17:15 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@node Verify
|
|
|
|
|
@subsection Verify
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex verification
|
|
|
|
|
@cindex signature, verification
|
|
|
|
|
@cindex cryptographic operation, verification
|
|
|
|
|
@cindex cryptographic operation, signature check
|
2005-10-01 02:33:35 +00:00
|
|
|
|
@cindex signature notation data
|
|
|
|
|
@cindex notation data
|
2002-11-21 13:45:00 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_verify (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{sig}}, @w{gpgme_data_t @var{signed_text}}, @w{gpgme_data_t @var{plain}})
|
2002-03-03 16:46:33 +00:00
|
|
|
|
The function @code{gpgme_op_verify} verifies that the signature in the
|
2002-11-21 13:45:00 +00:00
|
|
|
|
data object @var{sig} is a valid signature. If @var{sig} is a
|
|
|
|
|
detached signature, then the signed text should be provided in
|
|
|
|
|
@var{signed_text} and @var{plain} should be a null pointer.
|
|
|
|
|
Otherwise, if @var{sig} is a normal (or cleartext) signature,
|
|
|
|
|
@var{signed_text} should be a null pointer and @var{plain} should be a
|
|
|
|
|
writable data object that will contain the plaintext after successful
|
|
|
|
|
verification.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
The results of the individual signature verifications can be retrieved
|
2003-04-28 23:59:03 +00:00
|
|
|
|
with @code{gpgme_op_verify_result}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be completed successfully, @code{GPG_ERR_INV_VALUE} if
|
2003-07-28 12:09:42 +00:00
|
|
|
|
@var{ctx}, @var{sig} or @var{plain} is not a valid pointer,
|
|
|
|
|
@code{GPG_ERR_NO_DATA} if @var{sig} does not contain any data to
|
|
|
|
|
verify, and passes through any errors that are reported by the crypto
|
|
|
|
|
engine support routines.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_verify_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{sig}}, @w{gpgme_data_t @var{signed_text}}, @w{gpgme_data_t @var{plain}})
|
2002-01-30 01:17:30 +00:00
|
|
|
|
The function @code{gpgme_op_verify_start} initiates a
|
|
|
|
|
@code{gpgme_op_verify} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be started successfully, @code{GPG_ERR_INV_VALUE} if
|
2003-07-28 12:09:42 +00:00
|
|
|
|
@var{ctx}, @var{sig} or @var{plain} is not a valid pointer, and
|
|
|
|
|
@code{GPG_ERR_NO_DATA} if @var{sig} or @var{plain} does not contain
|
|
|
|
|
any data to verify.
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@end deftypefun
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_sig_notation_t}
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This is a pointer to a structure used to store a part of the result of
|
|
|
|
|
a @code{gpgme_op_verify} operation. The structure contains the
|
|
|
|
|
following members:
|
2002-05-03 18:20:24 +00:00
|
|
|
|
|
2002-06-20 12:13:44 +00:00
|
|
|
|
@table @code
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_sig_notation_t next
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This is a pointer to the next new signature notation structure in the
|
|
|
|
|
linked list, or @code{NULL} if this is the last element.
|
2002-06-20 12:13:44 +00:00
|
|
|
|
|
2003-04-28 23:59:03 +00:00
|
|
|
|
@item char *name
|
|
|
|
|
The name of the notation field. If this is @code{NULL}, then the
|
|
|
|
|
member @code{value} will contain a policy URL.
|
2002-06-20 12:13:44 +00:00
|
|
|
|
|
2005-10-01 02:33:35 +00:00
|
|
|
|
@item int name_len
|
|
|
|
|
The length of the @code{name} field. For strings the length is
|
|
|
|
|
counted without the trailing binary zero.
|
|
|
|
|
|
2003-04-28 23:59:03 +00:00
|
|
|
|
@item char *value
|
|
|
|
|
The value of the notation field. If @code{name} is @code{NULL}, then
|
|
|
|
|
this is a policy URL.
|
2005-10-01 02:33:35 +00:00
|
|
|
|
|
|
|
|
|
@item int value_len
|
|
|
|
|
The length of the @code{value} field. For strings the length is
|
|
|
|
|
counted without the trailing binary zero.
|
|
|
|
|
|
|
|
|
|
@item gpgme_sig_notation_flags_t flags
|
|
|
|
|
The accumulated flags field. This field contains the flags associated
|
|
|
|
|
with the notation data in an accumulated form which can be used as an
|
|
|
|
|
argument to the function @code{gpgme_sig_notation_add}. The value
|
|
|
|
|
@code{flags} is a bitwise-or combination of one or multiple of the
|
|
|
|
|
following bit values:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_SIG_NOTATION_HUMAN_READABLE
|
|
|
|
|
The @code{GPGME_SIG_NOTATION_HUMAN_READABLE} symbol specifies that the
|
|
|
|
|
notation data is in human readable form
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_NOTATION_CRITICAL
|
|
|
|
|
The @code{GPGME_SIG_NOTATION_CRITICAL} symbol specifies that the
|
|
|
|
|
notation data is critical.
|
|
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
@item unsigned int human_readable : 1
|
|
|
|
|
This is true if the @code{GPGME_SIG_NOTATION_HUMAN_READABLE} flag is
|
|
|
|
|
set and false otherwise. This flag is only valid for notation data,
|
|
|
|
|
not for policy URLs.
|
|
|
|
|
|
|
|
|
|
@item unsigned int critical : 1
|
|
|
|
|
This is true if the @code{GPGME_SIG_NOTATION_CRITICAL} flag is set and
|
|
|
|
|
false otherwise. This flag is valid for notation data and policy URLs.
|
|
|
|
|
|
2002-06-20 12:13:44 +00:00
|
|
|
|
@end table
|
2003-04-28 23:59:03 +00:00
|
|
|
|
@end deftp
|
2002-05-03 18:20:24 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_signature_t}
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This is a pointer to a structure used to store a part of the result of
|
|
|
|
|
a @code{gpgme_op_verify} operation. The structure contains the
|
|
|
|
|
following members:
|
2002-05-03 18:20:24 +00:00
|
|
|
|
|
2003-04-28 23:59:03 +00:00
|
|
|
|
@table @code
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_signature_t next
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This is a pointer to the next new signature structure in the linked
|
|
|
|
|
list, or @code{NULL} if this is the last element.
|
2002-05-03 18:20:24 +00:00
|
|
|
|
|
2004-05-21 15:51:53 +00:00
|
|
|
|
@item gpgme_sigsum_t summary
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This is a bit vector giving a summary of the signature status. It
|
|
|
|
|
provides an easy interface to a defined semantic of the signature
|
|
|
|
|
status. Checking just one bit is sufficient to see whether a
|
2016-12-07 20:41:34 +00:00
|
|
|
|
signature is valid without any restrictions. This means that
|
|
|
|
|
you can check for GPGME_SIGSUM_VALID like this:
|
|
|
|
|
|
|
|
|
|
@example
|
2016-12-07 22:25:50 +00:00
|
|
|
|
if ((sig.summary & GPGME_SIGSUM_VALID))
|
2016-12-07 20:41:34 +00:00
|
|
|
|
@{
|
|
|
|
|
..do stuff if valid..
|
|
|
|
|
@}
|
|
|
|
|
else
|
|
|
|
|
@{
|
|
|
|
|
..do stuff if not fully valid..
|
|
|
|
|
@}
|
|
|
|
|
@end example
|
2002-06-12 14:34:15 +00:00
|
|
|
|
|
|
|
|
|
The defined bits are:
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_SIGSUM_VALID
|
|
|
|
|
The signature is fully valid.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIGSUM_GREEN
|
|
|
|
|
The signature is good but one might want to display some extra
|
|
|
|
|
information. Check the other bits.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIGSUM_RED
|
2003-07-28 12:09:42 +00:00
|
|
|
|
The signature is bad. It might be useful to check other bits and
|
|
|
|
|
display more information, i.e. a revoked certificate might not render a
|
2002-06-12 14:34:15 +00:00
|
|
|
|
signature invalid when the message was received prior to the cause for
|
|
|
|
|
the revocation.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIGSUM_KEY_REVOKED
|
|
|
|
|
The key or at least one certificate has been revoked.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIGSUM_KEY_EXPIRED
|
|
|
|
|
The key or one of the certificates has expired. It is probably a good
|
|
|
|
|
idea to display the date of the expiration.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIGSUM_SIG_EXPIRED
|
|
|
|
|
The signature has expired.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIGSUM_KEY_MISSING
|
2003-07-28 12:09:42 +00:00
|
|
|
|
Can't verify due to a missing key or certificate.
|
2002-06-12 14:34:15 +00:00
|
|
|
|
|
|
|
|
|
@item GPGME_SIGSUM_CRL_MISSING
|
2012-05-02 08:35:47 +00:00
|
|
|
|
The CRL (or an equivalent mechanism) is not available.
|
2002-06-12 14:34:15 +00:00
|
|
|
|
|
|
|
|
|
@item GPGME_SIGSUM_CRL_TOO_OLD
|
|
|
|
|
Available CRL is too old.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIGSUM_BAD_POLICY
|
2012-05-02 08:35:47 +00:00
|
|
|
|
A policy requirement was not met.
|
2002-06-12 14:34:15 +00:00
|
|
|
|
|
|
|
|
|
@item GPGME_SIGSUM_SYS_ERROR
|
2012-05-02 08:35:47 +00:00
|
|
|
|
A system error occured.
|
2003-04-28 23:59:03 +00:00
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
@item char *fpr
|
|
|
|
|
This is the fingerprint or key ID of the signature.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_error_t status
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This is the status of the signature. In particular, the following
|
|
|
|
|
status codes are of interest:
|
2002-06-12 14:34:15 +00:00
|
|
|
|
|
2003-04-28 23:59:03 +00:00
|
|
|
|
@table @code
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_NO_ERROR
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This status indicates that the signature is valid. For the combined
|
|
|
|
|
result this status means that all signatures are valid.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_SIG_EXPIRED
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This status indicates that the signature is valid but expired. For
|
|
|
|
|
the combined result this status means that all signatures are valid
|
|
|
|
|
and expired.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_KEY_EXPIRED
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This status indicates that the signature is valid but the key used to
|
|
|
|
|
verify the signature has expired. For the combined result this status
|
|
|
|
|
means that all signatures are valid and all keys are expired.
|
|
|
|
|
|
2004-05-21 16:38:59 +00:00
|
|
|
|
@item GPG_ERR_CERT_REVOKED
|
|
|
|
|
This status indicates that the signature is valid but the key used
|
|
|
|
|
to verify the signature has been revoked. For the combined result
|
|
|
|
|
this status means that all signatures are valid and all keys are
|
|
|
|
|
revoked.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_BAD_SIGNATURE
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This status indicates that the signature is invalid. For the combined
|
|
|
|
|
result this status means that all signatures are invalid.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_NO_PUBKEY
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This status indicates that the signature could not be verified due to
|
|
|
|
|
a missing key. For the combined result this status means that all
|
|
|
|
|
signatures could not be checked due to missing keys.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
@item GPG_ERR_GENERAL
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This status indicates that there was some other error which prevented
|
|
|
|
|
the signature verification.
|
2002-06-12 14:34:15 +00:00
|
|
|
|
@end table
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_sig_notation_t notations
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This is a linked list with the notation data and policy URLs.
|
|
|
|
|
|
|
|
|
|
@item unsigned long timestamp
|
|
|
|
|
The creation timestamp of this signature.
|
|
|
|
|
|
|
|
|
|
@item unsigned long exp_timestamp
|
|
|
|
|
The expiration timestamp of this signature, or 0 if the signature does
|
|
|
|
|
not expire.
|
|
|
|
|
|
2004-05-21 15:51:53 +00:00
|
|
|
|
@item unsigned int wrong_key_usage : 1
|
2003-07-28 12:09:42 +00:00
|
|
|
|
This is true if the key was not used according to its policy.
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2005-12-20 20:22:19 +00:00
|
|
|
|
@item unsigned int pka_trust : 2
|
|
|
|
|
This is set to the trust information gained by means of the PKA system.
|
|
|
|
|
Values are:
|
|
|
|
|
@table @code
|
|
|
|
|
@item 0
|
|
|
|
|
No PKA information available or verification not possible.
|
|
|
|
|
@item 1
|
2012-05-02 08:35:47 +00:00
|
|
|
|
PKA verification failed.
|
2005-12-20 20:22:19 +00:00
|
|
|
|
@item 2
|
|
|
|
|
PKA verification succeeded.
|
|
|
|
|
@item 3
|
|
|
|
|
Reserved for future use.
|
|
|
|
|
@end table
|
|
|
|
|
Depending on the configuration of the engine, this metric may also be
|
|
|
|
|
reflected by the validity of the signature.
|
|
|
|
|
|
2007-08-07 15:21:50 +00:00
|
|
|
|
@item unsigned int chain_model : 1
|
|
|
|
|
This is true if the validity of the signature has been checked using the
|
|
|
|
|
chain model. In the chain model the time the signature has been created
|
|
|
|
|
must be within the validity period of the certificate and the time the
|
|
|
|
|
certificate itself has been created must be within the validity period
|
|
|
|
|
of the issuing certificate. In contrast the default validation model
|
|
|
|
|
checks the validity of signature as well at the entire certificate chain
|
|
|
|
|
at the current time.
|
|
|
|
|
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_validity_t validity
|
2003-07-28 12:09:42 +00:00
|
|
|
|
The validity of the signature.
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_error_t validity_reason
|
2003-07-28 12:09:42 +00:00
|
|
|
|
If a signature is not valid, this provides a reason why.
|
|
|
|
|
|
2005-06-03 19:41:56 +00:00
|
|
|
|
@item gpgme_pubkey_algo_t
|
|
|
|
|
The public key algorithm used to create this signature.
|
|
|
|
|
|
|
|
|
|
@item gpgme_hash_algo_t
|
|
|
|
|
The hash algorithm used to create this signature.
|
2014-03-05 05:52:49 +00:00
|
|
|
|
|
|
|
|
|
@item char *pka_address
|
|
|
|
|
The mailbox from the PKA information or @code{NULL}.
|
2016-08-23 13:22:28 +00:00
|
|
|
|
|
|
|
|
|
@item gpgme_key_t key
|
|
|
|
|
An object describing the key used to create the signature. This key
|
|
|
|
|
object may be incomplete in that it only conveys information
|
|
|
|
|
availabale directly with a signature. It may also be @code{NULL} if
|
|
|
|
|
such information is not readily available.
|
|
|
|
|
|
2003-04-28 23:59:03 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_verify_result_t}
|
2003-04-28 23:59:03 +00:00
|
|
|
|
This is a pointer to a structure used to store the result of a
|
2003-07-28 12:09:42 +00:00
|
|
|
|
@code{gpgme_op_verify} operation. After verifying a signature, you
|
|
|
|
|
can retrieve the pointer to the result with
|
|
|
|
|
@code{gpgme_op_verify_result}. If the operation failed this might be
|
|
|
|
|
a @code{NULL} pointer. The structure contains the following member:
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
|
|
|
|
@table @code
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_signature_t signatures
|
2003-04-28 23:59:03 +00:00
|
|
|
|
A linked list with information about all signatures for which a
|
|
|
|
|
verification was attempted.
|
2005-07-27 01:50:08 +00:00
|
|
|
|
|
2005-09-30 13:24:40 +00:00
|
|
|
|
@item char *file_name
|
2005-07-27 01:50:08 +00:00
|
|
|
|
This is the filename of the original plaintext message file if it is
|
|
|
|
|
known, otherwise this is a null pointer.
|
2003-04-28 23:59:03 +00:00
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2004-03-29 18:42:41 +00:00
|
|
|
|
@deftypefun gpgme_verify_result_t gpgme_op_verify_result (@w{gpgme_ctx_t @var{ctx}})
|
2003-04-28 23:59:03 +00:00
|
|
|
|
The function @code{gpgme_op_verify_result} returns a
|
2004-06-08 17:26:48 +00:00
|
|
|
|
@code{gpgme_verify_result_t} pointer to a structure holding the result
|
|
|
|
|
of a @code{gpgme_op_verify} operation. The pointer is only valid if
|
|
|
|
|
the last operation on the context was a @code{gpgme_op_verify},
|
|
|
|
|
@code{gpgme_op_verify_start}, @code{gpgme_op_decrypt_verify} or
|
|
|
|
|
@code{gpgme_op_decrypt_verify_start} operation, and if this operation
|
|
|
|
|
finished successfully (for @code{gpgme_op_decrypt_verify} and
|
|
|
|
|
@code{gpgme_op_decrypt_verify_start}, the error code
|
|
|
|
|
@code{GPG_ERR_NO_DATA} counts as successful in this context). The
|
|
|
|
|
returned pointer is only valid until the next operation is started on
|
|
|
|
|
the context.
|
2003-04-28 23:59:03 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@node Decrypt and Verify
|
|
|
|
|
@subsection Decrypt and Verify
|
|
|
|
|
@cindex decryption and verification
|
|
|
|
|
@cindex verification and decryption
|
|
|
|
|
@cindex signature check
|
|
|
|
|
@cindex cryptographic operation, decryption and verification
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_decrypt_verify (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{cipher}}, @w{gpgme_data_t @var{plain}})
|
|
|
|
|
The function @code{gpgme_op_decrypt_verify} decrypts the ciphertext in
|
|
|
|
|
the data object @var{cipher} and stores it into the data object
|
|
|
|
|
@var{plain}. If @var{cipher} contains signatures, they will be
|
|
|
|
|
verified.
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
After the operation completed, @code{gpgme_op_decrypt_result} and
|
|
|
|
|
@code{gpgme_op_verify_result} can be used to retrieve more information
|
|
|
|
|
about the signatures.
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
If the error code @code{GPG_ERR_NO_DATA} is returned, @var{cipher}
|
|
|
|
|
does not contain any data to decrypt. However, it might still be
|
|
|
|
|
signed. The information about detected signatures is available with
|
|
|
|
|
@code{gpgme_op_verify_result} in this case.
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
ciphertext could be decrypted successfully, @code{GPG_ERR_INV_VALUE}
|
|
|
|
|
if @var{ctx}, @var{cipher} or @var{plain} is not a valid pointer,
|
|
|
|
|
@code{GPG_ERR_NO_DATA} if @var{cipher} does not contain any data to
|
|
|
|
|
decrypt, @code{GPG_ERR_DECRYPT_FAILED} if @var{cipher} is not a valid
|
|
|
|
|
cipher text, @code{GPG_ERR_BAD_PASSPHRASE} if the passphrase for the
|
|
|
|
|
secret key could not be retrieved, and passes through any errors that
|
|
|
|
|
are reported by the crypto engine support routines.
|
|
|
|
|
@end deftypefun
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-11-11 06:16:43 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_decrypt_verify_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{cipher}}, @w{gpgme_data_t @var{plain}})
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function @code{gpgme_op_decrypt_verify_start} initiates a
|
|
|
|
|
@code{gpgme_op_decrypt_verify} operation. It can be completed by
|
|
|
|
|
calling @code{gpgme_wait} on the context. @xref{Waiting For
|
|
|
|
|
Completion}.
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be started successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx}, @var{cipher}, @var{plain} or @var{r_stat} is not a valid
|
|
|
|
|
pointer, and @code{GPG_ERR_NO_DATA} if @var{cipher} does not contain
|
|
|
|
|
any data to decrypt.
|
|
|
|
|
@end deftypefun
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-10-08 19:14:52 +00:00
|
|
|
|
When processing mails it is sometimes useful to extract the actual
|
|
|
|
|
mail address (the ``addr-spec'') from a string. GPGME provides this
|
|
|
|
|
helper function which uses the same semantics as the internal
|
|
|
|
|
functions in GPGME and GnuPG:
|
|
|
|
|
|
|
|
|
|
@deftypefun @w{char *} gpgme_addrspec_from_uid (@w{const char *@var{uid}})
|
|
|
|
|
|
|
|
|
|
Return the mail address (called ``addr-spec'' in RFC-5322) from the
|
|
|
|
|
string @var{uid} which is assumed to be a user id (called ``address''
|
|
|
|
|
in RFC-5322). All plain ASCII characters (i.e. those with bit 7
|
|
|
|
|
cleared) in the result are converted to lowercase. Caller must free
|
|
|
|
|
the result using @code{gpgme_free}. Returns @code{NULL} if no valid
|
|
|
|
|
address was found (in which case @code{ERRNO} is set to @code{EINVAL})
|
|
|
|
|
or for other errors.
|
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@node Sign
|
|
|
|
|
@subsection Sign
|
|
|
|
|
@cindex signature, creation
|
|
|
|
|
@cindex sign
|
|
|
|
|
@cindex cryptographic operation, signing
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
A signature can contain signatures by one or more keys. The set of
|
|
|
|
|
keys used to create a signatures is contained in a context, and is
|
|
|
|
|
applied to all following signing operations in this context (until the
|
|
|
|
|
set is changed).
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@menu
|
|
|
|
|
* Selecting Signers:: How to choose the keys to sign with.
|
|
|
|
|
* Creating a Signature:: How to create a signature.
|
|
|
|
|
* Signature Notation Data:: How to add notation data to a signature.
|
|
|
|
|
@end menu
|
2012-05-02 08:35:47 +00:00
|
|
|
|
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@node Selecting Signers
|
|
|
|
|
@subsubsection Selecting Signers
|
|
|
|
|
@cindex signature, selecting signers
|
|
|
|
|
@cindex signers, selecting
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
The key or the keys used to create a signature are stored in the
|
|
|
|
|
context. The following functions can be used to manipulate this list.
|
|
|
|
|
If no signer has been set into the context a default key is used for
|
|
|
|
|
signing.
|
2003-04-28 23:59:03 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun void gpgme_signers_clear (@w{gpgme_ctx_t @var{ctx}})
|
|
|
|
|
The function @code{gpgme_signers_clear} releases a reference for each
|
|
|
|
|
key on the signers list and removes the list of signers from the
|
|
|
|
|
context @var{ctx}.
|
2012-05-02 08:35:47 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
Every context starts with an empty list.
|
|
|
|
|
@end deftypefun
|
2012-05-02 08:35:47 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_signers_add (@w{gpgme_ctx_t @var{ctx}}, @w{const gpgme_key_t @var{key}})
|
|
|
|
|
The function @code{gpgme_signers_add} adds the key @var{key} to the
|
|
|
|
|
list of signers in the context @var{ctx}.
|
2012-05-02 08:35:47 +00:00
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
Calling this function acquires an additional reference for the key.
|
|
|
|
|
@end deftypefun
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2013-06-18 08:27:46 +00:00
|
|
|
|
@deftypefun @w{unsigned int} gpgme_signers_count (@w{const gpgme_ctx_t @var{ctx}})
|
|
|
|
|
The function @code{gpgme_signers_count} returns the number of signer keys in
|
|
|
|
|
the context @var{ctx}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_key_t gpgme_signers_enum (@w{const gpgme_ctx_t @var{ctx}}, @w{int @var{seq}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_signers_enum} returns the @var{seq}th key in
|
|
|
|
|
the list of signers in the context @var{ctx}. An additional reference
|
|
|
|
|
is acquired for the user.
|
|
|
|
|
|
|
|
|
|
If @var{seq} is out of range, @code{NULL} is returned.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Creating a Signature
|
|
|
|
|
@subsubsection Creating a Signature
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {enum gpgme_sig_mode_t}
|
|
|
|
|
@tindex gpgme_sig_mode_t
|
|
|
|
|
The @code{gpgme_sig_mode_t} type is used to specify the desired type of a
|
2002-01-16 00:41:10 +00:00
|
|
|
|
signature. The following modes are available:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_SIG_MODE_NORMAL
|
|
|
|
|
A normal signature is made, the output includes the plaintext and the
|
|
|
|
|
signature.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_MODE_DETACH
|
|
|
|
|
A detached signature is made.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_MODE_CLEAR
|
|
|
|
|
A clear text signature is made. The @acronym{ASCII} armor and text
|
|
|
|
|
mode settings of the context are ignored.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_sign (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{plain}}, @w{gpgme_data_t @var{sig}}, @w{gpgme_sig_mode_t @var{mode}})
|
2002-01-16 00:41:10 +00:00
|
|
|
|
The function @code{gpgme_op_sign} creates a signature for the text in
|
|
|
|
|
the data object @var{plain} and returns it in the data object
|
|
|
|
|
@var{sig}. The type of the signature created is determined by the
|
2008-01-28 19:41:26 +00:00
|
|
|
|
@acronym{ASCII} armor (or, if that is not set, by the encoding
|
|
|
|
|
specified for @var{sig}), the text mode attributes set for the context
|
2002-01-22 14:23:56 +00:00
|
|
|
|
@var{ctx} and the requested signature mode @var{mode}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
After the operation completed successfully, the result can be
|
|
|
|
|
retrieved with @code{gpgme_op_sign_result}.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
|
2002-02-25 18:31:07 +00:00
|
|
|
|
If an S/MIME signed message is created using the CMS crypto engine,
|
|
|
|
|
the number of certificates to include in the message can be specified
|
|
|
|
|
with @code{gpgme_set_include_certs}. @xref{Included Certificates}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
signature could be created successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx}, @var{plain} or @var{sig} is not a valid pointer,
|
|
|
|
|
@code{GPG_ERR_NO_DATA} if the signature could not be created,
|
|
|
|
|
@code{GPG_ERR_BAD_PASSPHRASE} if the passphrase for the secret key
|
2003-07-29 18:31:46 +00:00
|
|
|
|
could not be retrieved, @code{GPG_ERR_UNUSABLE_SECKEY} if there are
|
|
|
|
|
invalid signers, and passes through any errors that are reported by the
|
|
|
|
|
crypto engine support routines.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_sign_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{plain}}, @w{gpgme_data_t @var{sig}}, @w{gpgme_sig_mode_t @var{mode}})
|
2002-01-30 01:17:30 +00:00
|
|
|
|
The function @code{gpgme_op_sign_start} initiates a
|
|
|
|
|
@code{gpgme_op_sign} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the operation could be
|
|
|
|
|
started successfully, and @code{GPG_ERR_INV_VALUE} if @var{ctx},
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@var{plain} or @var{sig} is not a valid pointer.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_new_signature_t}
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
This is a pointer to a structure used to store a part of the result of
|
|
|
|
|
a @code{gpgme_op_sign} operation. The structure contains the
|
|
|
|
|
following members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_new_signature_t next
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
This is a pointer to the next new signature structure in the linked
|
|
|
|
|
list, or @code{NULL} if this is the last element.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_sig_mode_t type
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
The type of this signature.
|
|
|
|
|
|
2014-03-05 05:52:49 +00:00
|
|
|
|
@item gpgme_pubkey_algo_t pubkey_algo
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
The public key algorithm used to create this signature.
|
|
|
|
|
|
2014-03-05 05:52:49 +00:00
|
|
|
|
@item gpgme_hash_algo_t hash_algo
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
The hash algorithm used to create this signature.
|
|
|
|
|
|
2003-12-25 14:38:40 +00:00
|
|
|
|
@item unsigned int sig_class
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
The signature class of this signature.
|
|
|
|
|
|
2003-04-28 23:59:03 +00:00
|
|
|
|
@item long int timestamp
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
The creation timestamp of this signature.
|
|
|
|
|
|
|
|
|
|
@item char *fpr
|
|
|
|
|
The fingerprint of the key which was used to create this signature.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_sign_result_t}
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
This is a pointer to a structure used to store the result of a
|
|
|
|
|
@code{gpgme_op_sign} operation. After successfully generating a
|
|
|
|
|
signature, you can retrieve the pointer to the result with
|
|
|
|
|
@code{gpgme_op_sign_result}. The structure contains the following
|
|
|
|
|
members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2003-06-06 00:56:03 +00:00
|
|
|
|
@item gpgme_invalid_key_t invalid_signers
|
|
|
|
|
A linked list with information about all invalid keys for which a
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
signature could not be created.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_new_signature_t signatures
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
A linked list with information about all signatures created.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_sign_result_t gpgme_op_sign_result (@w{gpgme_ctx_t @var{ctx}})
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
The function @code{gpgme_op_sign_result} returns a
|
2003-07-29 18:25:27 +00:00
|
|
|
|
@code{gpgme_sign_result_t} pointer to a structure holding the result
|
|
|
|
|
of a @code{gpgme_op_sign} operation. The pointer is only valid if the
|
|
|
|
|
last operation on the context was a @code{gpgme_op_sign},
|
|
|
|
|
@code{gpgme_op_sign_start}, @code{gpgme_op_encrypt_sign} or
|
|
|
|
|
@code{gpgme_op_encrypt_sign_start} operation. If that operation
|
2009-08-06 17:17:18 +00:00
|
|
|
|
failed, the function might return a @code{NULL} pointer. The returned
|
2003-07-29 18:25:27 +00:00
|
|
|
|
pointer is only valid until the next operation is started on the
|
|
|
|
|
context.
|
doc/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Creating a Signature): Add info about
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
(Crypto Operations): Add GpgmeInvalidUserID.
(Algorithms): New chapter.
gpgme/
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePubKeyAlgo, GpgmeHashAlgo, GpgmeInvalidUserID,
GpgmeNewSignature, GpgmeSignResult): New data types.
(gpgme_op_sign_result, gpgme_pubkey_algo_name,
gpgme_hash_algo_name): New prototypes.
* gpgme.c (gpgme_pubkey_algo_name): New function.
(gpgme_hash_algo_name): Likewise.
* ops.h (_gpgme_parse_inv_userid, _gpgme_op_sign_init_result): New
prototype.
(_gpgme_op_sign_status_handler): Fix prototype.
* op-support.c: Include <errno.h> and <string.h>.
(_gpgme_parse_inv_userid): New function.
* sign.c: Include <errno.h> and "gpgme.h", but not <stdio.h>,
<assert.h> and "util.h".
(SKIP_TOKEN_OR_RETURN): Remove macro.
(struct sign_result): Change to op_data_t type and rework it.
(release_sign_result): Rename to ...
(release_op_data): ... this and rewrite it.
(append_xml_info): Remove function.
(gpgme_op_sign_result): New function.
(parse_sig_created): New function.
(_gpgme_sign_status_handler): Change first argument to void *.
Rewrite the function to use the new result structure and functions.
(_gpgme_op_sign_init_result): New function.
(_gpgme_op_sign_start): Rename to ...
(sign_start): ... this. Call _gpgme_op_sign_init_result.
(gpgme_op_sign_start): Use sign_start instead _gpgme_op_sign_start.
(gpgme_op_sign): Likewise.
2003-04-27 20:53:04 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2005-10-01 02:33:35 +00:00
|
|
|
|
@node Signature Notation Data
|
|
|
|
|
@subsubsection Signature Notation Data
|
|
|
|
|
@cindex notation data
|
|
|
|
|
@cindex signature notation data
|
|
|
|
|
@cindex policy URL
|
|
|
|
|
|
|
|
|
|
Using the following functions, you can attach arbitrary notation data
|
|
|
|
|
to a signature. This information is then available to the user when
|
|
|
|
|
the signature is verified.
|
|
|
|
|
|
|
|
|
|
@deftypefun void gpgme_sig_notation_clear (@w{gpgme_ctx_t @var{ctx}})
|
|
|
|
|
The function @code{gpgme_sig_notation_clear} removes the notation data
|
|
|
|
|
from the context @var{ctx}. Subsequent signing operations from this
|
|
|
|
|
context will not include any notation data.
|
|
|
|
|
|
|
|
|
|
Every context starts with an empty notation data list.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_sig_notation_add (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{name}}, @w{const char *@var{value}}, @w{gpgme_sig_notation_flags_t @var{flags}})
|
|
|
|
|
The function @code{gpgme_sig_notation_add} adds the notation data with
|
|
|
|
|
the name @var{name} and the value @var{value} to the context
|
|
|
|
|
@var{ctx}.
|
|
|
|
|
|
|
|
|
|
Subsequent signing operations will include this notation data, as well
|
|
|
|
|
as any other notation data that was added since the creation of the
|
|
|
|
|
context or the last @code{gpgme_sig_notation_clear} operation.
|
|
|
|
|
|
|
|
|
|
The arguments @var{name} and @var{value} must be @code{NUL}-terminated
|
|
|
|
|
strings in human-readable form. The flag
|
|
|
|
|
@code{GPGME_SIG_NOTATION_HUMAN_READABLE} is implied
|
|
|
|
|
(non-human-readable notation data is currently not supported). The
|
|
|
|
|
strings must be in UTF-8 encoding.
|
|
|
|
|
|
|
|
|
|
If @var{name} is @code{NULL}, then @var{value} should be a policy URL.
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_sig_notation_add} returns the error code
|
|
|
|
|
@code{GPG_ERR_NO_ERROR} if the notation data could be added
|
|
|
|
|
successfully, @code{GPG_ERR_INV_VALUE} if @var{ctx} is not a valid
|
|
|
|
|
pointer, or if @var{name}, @var{value} and @var{flags} are an invalid
|
|
|
|
|
combination. The function also passes through any errors that are
|
|
|
|
|
reported by the crypto engine support routines.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_sig_notation_t gpgme_sig_notation_get (@w{const gpgme_ctx_t @var{ctx}})
|
|
|
|
|
The function @code{gpgme_sig_notation_get} returns the linked list of
|
|
|
|
|
notation data structures that are contained in the context @var{ctx}.
|
|
|
|
|
|
|
|
|
|
If @var{ctx} is not a valid pointer, or there is no notation data
|
|
|
|
|
added for this context, @code{NULL} is returned.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@node Encrypt
|
|
|
|
|
@subsection Encrypt
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex encryption
|
|
|
|
|
@cindex cryptographic operation, encryption
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
One plaintext can be encrypted for several recipients at the same
|
|
|
|
|
time. The list of recipients is created independently of any context,
|
|
|
|
|
and then passed to the encryption operation.
|
|
|
|
|
|
|
|
|
|
@menu
|
2002-01-29 22:58:25 +00:00
|
|
|
|
* Encrypting a Plaintext:: How to encrypt a plaintext.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Encrypting a Plaintext
|
|
|
|
|
@subsubsection Encrypting a Plaintext
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2003-05-29 03:21:02 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_encrypt (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{recp}[]}, @w{gpgme_encrypt_flags_t @var{flags}}, @w{gpgme_data_t @var{plain}}, @w{gpgme_data_t @var{cipher}})
|
2008-01-28 19:41:26 +00:00
|
|
|
|
The function @code{gpgme_op_encrypt} encrypts the plaintext in the
|
|
|
|
|
data object @var{plain} for the recipients @var{recp} and stores the
|
2002-01-16 00:41:10 +00:00
|
|
|
|
ciphertext in the data object @var{cipher}. The type of the
|
2008-01-28 19:41:26 +00:00
|
|
|
|
ciphertext created is determined by the @acronym{ASCII} armor (or, if
|
|
|
|
|
that is not set, by the encoding specified for @var{cipher}) and the
|
|
|
|
|
text mode attributes set for the context @var{ctx}.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2013-06-18 08:46:04 +00:00
|
|
|
|
@var{recp} must be a @code{NULL}-terminated array of keys. The user
|
2003-05-29 03:21:02 +00:00
|
|
|
|
must keep references for all keys during the whole duration of the
|
|
|
|
|
call (but see @code{gpgme_op_encrypt_start} for the requirements with
|
|
|
|
|
the asynchronous variant).
|
|
|
|
|
|
|
|
|
|
The value in @var{flags} is a bitwise-or combination of one or
|
|
|
|
|
multiple of the following bit values:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_ENCRYPT_ALWAYS_TRUST
|
|
|
|
|
The @code{GPGME_ENCRYPT_ALWAYS_TRUST} symbol specifies that all the
|
|
|
|
|
recipients in @var{recp} should be trusted, even if the keys do not
|
|
|
|
|
have a high enough validity in the keyring. This flag should be used
|
|
|
|
|
with care; in general it is not a good idea to use any untrusted keys.
|
2009-05-18 17:38:31 +00:00
|
|
|
|
|
|
|
|
|
@item GPGME_ENCRYPT_NO_ENCRYPT_TO
|
|
|
|
|
The @code{GPGME_ENCRYPT_NO_ENCRYPT_TO} symbol specifies that no
|
|
|
|
|
default or hidden default recipients as configured in the crypto
|
|
|
|
|
backend should be included. This can be useful for managing different
|
|
|
|
|
user profiles.
|
2014-05-08 09:31:30 +00:00
|
|
|
|
|
|
|
|
|
@item GPGME_ENCRYPT_NO_COMPRESS
|
|
|
|
|
The @code{GPGME_ENCRYPT_NO_COMPRESS} symbol specifies that the
|
|
|
|
|
plaintext shall not be compressed before it is encrypted. This is
|
|
|
|
|
in some cases useful if the length of the encrypted message
|
|
|
|
|
may reveal information about the plaintext.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ENCRYPT_PREPARE
|
|
|
|
|
@itemx GPGME_ENCRYPT_EXPECT_SIGN
|
|
|
|
|
The @code{GPGME_ENCRYPT_PREPARE} symbol is used with the UI Server
|
|
|
|
|
protocol to prepare an encryption (i.e. sending the
|
|
|
|
|
@code{PREP_ENCRYPT} command). With the
|
|
|
|
|
@code{GPGME_ENCRYPT_EXPECT_SIGN} symbol the UI Server is advised to
|
|
|
|
|
also expect a sign command.
|
|
|
|
|
|
2016-08-09 09:40:29 +00:00
|
|
|
|
@item GPGME_ENCRYPT_SYMMETRIC
|
|
|
|
|
The @code{GPGME_ENCRYPT_SYMMETRIC} symbol specifies that the
|
|
|
|
|
output should be additionally encrypted symmetically even
|
|
|
|
|
if recipients are provided. This feature is only supported for
|
|
|
|
|
for the OpenPGP crypto engine.
|
|
|
|
|
|
2003-05-29 03:21:02 +00:00
|
|
|
|
@end table
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
If @code{GPG_ERR_UNUSABLE_PUBKEY} is returned, some recipients in
|
|
|
|
|
@var{recp} are invalid, but not all. In this case the plaintext might
|
|
|
|
|
be encrypted for all valid recipients and returned in @var{cipher} (if
|
2003-05-29 03:21:02 +00:00
|
|
|
|
this happens depends on the crypto engine). More information about
|
|
|
|
|
the invalid recipients is available with
|
doc/
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/
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.
tests/
2003-04-30 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-eventloop.c (main): Do not call print_op_info.
(print_op_info): Function removed.
2003-04-30 03:34:30 +00:00
|
|
|
|
@code{gpgme_op_encrypt_result}.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
|
2002-03-06 01:40:25 +00:00
|
|
|
|
If @var{recp} is @code{NULL}, symmetric rather than public key
|
|
|
|
|
encryption is performed. Symmetrically encrypted cipher text can be
|
|
|
|
|
deciphered with @code{gpgme_op_decrypt}. Note that in this case the
|
|
|
|
|
crypto backend needs to retrieve a passphrase from the user.
|
|
|
|
|
Symmetric encryption is currently only supported for the OpenPGP
|
|
|
|
|
crypto backend.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
ciphertext could be created successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx}, @var{recp}, @var{plain} or @var{cipher} is not a valid
|
|
|
|
|
pointer, @code{GPG_ERR_UNUSABLE_PUBKEY} if @var{recp} contains some
|
|
|
|
|
invalid recipients, @code{GPG_ERR_BAD_PASSPHRASE} if the passphrase
|
2003-07-29 18:46:30 +00:00
|
|
|
|
for the symmetric key could not be retrieved, and passes through any
|
2003-06-05 23:20:29 +00:00
|
|
|
|
errors that are reported by the crypto engine support routines.
|
2002-01-16 00:41:10 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-29 03:21:02 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_encrypt_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{recp}[]}, @w{gpgme_encrypt_flags_t @var{flags}}, @w{gpgme_data_t @var{plain}}, @w{gpgme_data_t @var{cipher}})
|
2002-01-30 01:17:30 +00:00
|
|
|
|
The function @code{gpgme_op_encrypt_start} initiates a
|
|
|
|
|
@code{gpgme_op_encrypt} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
2003-05-29 03:21:02 +00:00
|
|
|
|
References to the keys only need to be held for the duration of this
|
|
|
|
|
call. The user can release its references to the keys after this
|
|
|
|
|
function returns, even if the operation is not yet finished.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be started successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx}, @var{rset}, @var{plain} or @var{cipher} is not a valid
|
|
|
|
|
pointer, and @code{GPG_ERR_UNUSABLE_PUBKEY} if @var{rset} does not
|
|
|
|
|
contain any valid recipients.
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@end deftypefun
|
2002-02-26 00:08:09 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_encrypt_result_t}
|
2003-04-27 22:24:37 +00:00
|
|
|
|
This is a pointer to a structure used to store the result of a
|
|
|
|
|
@code{gpgme_op_encrypt} operation. After successfully encrypting
|
|
|
|
|
data, you can retrieve the pointer to the result with
|
|
|
|
|
@code{gpgme_op_encrypt_result}. The structure contains the following
|
|
|
|
|
members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2003-06-06 00:56:03 +00:00
|
|
|
|
@item gpgme_invalid_key_t invalid_recipients
|
|
|
|
|
A linked list with information about all invalid keys for which
|
2003-04-27 22:24:37 +00:00
|
|
|
|
the data could not be encrypted.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_encrypt_result_t gpgme_op_encrypt_result (@w{gpgme_ctx_t @var{ctx}})
|
2003-04-27 22:24:37 +00:00
|
|
|
|
The function @code{gpgme_op_encrypt_result} returns a
|
2003-07-29 18:25:27 +00:00
|
|
|
|
@code{gpgme_encrypt_result_t} pointer to a structure holding the
|
|
|
|
|
result of a @code{gpgme_op_encrypt} operation. The pointer is only
|
|
|
|
|
valid if the last operation on the context was a
|
|
|
|
|
@code{gpgme_op_encrypt}, @code{gpgme_op_encrypt_start},
|
|
|
|
|
@code{gpgme_op_sign} or @code{gpgme_op_sign_start} operation. If this
|
|
|
|
|
operation failed, this might be a @code{NULL} pointer. The returned
|
|
|
|
|
pointer is only valid until the next operation is started on the
|
|
|
|
|
context.
|
2003-04-27 22:24:37 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2002-02-26 00:08:09 +00:00
|
|
|
|
|
2003-05-29 03:21:02 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_encrypt_sign (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{recp}[]}, @w{gpgme_encrypt_flags_t @var{flags}}, @w{gpgme_data_t @var{plain}}, @w{gpgme_data_t @var{cipher}})
|
2002-02-26 00:08:09 +00:00
|
|
|
|
The function @code{gpgme_op_encrypt_sign} does a combined encrypt and
|
|
|
|
|
sign operation. It is used like @code{gpgme_op_encrypt}, but the
|
|
|
|
|
ciphertext also contains signatures for the signers listed in
|
|
|
|
|
@var{ctx}.
|
|
|
|
|
|
|
|
|
|
The combined encrypt and sign operation is currently only available
|
|
|
|
|
for the OpenPGP crypto engine.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2003-05-29 03:21:02 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_encrypt_sign_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{recp}}, @w{gpgme_encrypt_flags_t @var{flags}}, @w{gpgme_data_t @var{plain}}, @w{gpgme_data_t @var{cipher}})
|
2002-02-26 00:08:09 +00:00
|
|
|
|
The function @code{gpgme_op_encrypt_sign_start} initiates a
|
|
|
|
|
@code{gpgme_op_encrypt_sign} operation. It can be completed by
|
|
|
|
|
calling @code{gpgme_wait} on the context. @xref{Waiting For
|
|
|
|
|
Completion}.
|
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation could be started successfully, and @code{GPG_ERR_INV_VALUE}
|
|
|
|
|
if @var{ctx}, @var{rset}, @var{plain} or @var{cipher} is not a valid
|
|
|
|
|
pointer.
|
2002-02-26 00:08:09 +00:00
|
|
|
|
@end deftypefun
|
2002-01-30 01:17:30 +00:00
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2014-04-10 11:01:00 +00:00
|
|
|
|
@node Miscellaneous
|
|
|
|
|
@section Miscellaneous operations
|
|
|
|
|
|
|
|
|
|
Here are some support functions which are sometimes useful.
|
|
|
|
|
|
|
|
|
|
@menu
|
|
|
|
|
* Running other Programs:: Running other Programs
|
2016-08-02 14:51:08 +00:00
|
|
|
|
* Using the Assuan protocol:: Using the Assuan protocol
|
2016-11-03 15:29:45 +00:00
|
|
|
|
* Checking for updates:: How to check for software updates
|
2014-04-10 11:01:00 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Running other Programs
|
|
|
|
|
@subsection Running other Programs
|
|
|
|
|
|
|
|
|
|
GPGME features an internal subsystem to run the actual backend
|
|
|
|
|
engines. Along with data abstraction object this subsystem can be
|
|
|
|
|
used to run arbitrary simple programs which even need not be related
|
|
|
|
|
to cryptographic features. It may for example be used to run tools
|
|
|
|
|
which are part of the GnuPG system but are not directly accessible
|
|
|
|
|
with the GPGME API.
|
|
|
|
|
|
|
|
|
|
|
2016-08-02 14:50:54 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_spawn @
|
2014-04-10 11:01:00 +00:00
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{file}}, @
|
|
|
|
|
@w{const char *@var{argv}[]}, @w{gpgme_data_t @var{datain}}, @
|
|
|
|
|
@w{gpgme_data_t @var{dataout}}, @w{gpgme_data_t @var{dataerr}}, @
|
|
|
|
|
@w{unsigned int @var{flags}})
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_spawn} runs the program @var{file} with
|
|
|
|
|
the arguments taken from the NULL terminated array @var{argv}. If no
|
2014-04-10 12:17:19 +00:00
|
|
|
|
arguments are required @var{argv} may be given as @code{NULL}. In the
|
|
|
|
|
latter case or if @code{argv[0]} is the empty string, GPGME uses the
|
|
|
|
|
basename of @var{file} for @code{argv[0]}. The file descriptors
|
|
|
|
|
@code{stdin}, @code{stdout}, and @code{stderr} are connected to the
|
|
|
|
|
data objects @var{datain}, @var{dataout}, and @var{dataerr}. If NULL
|
|
|
|
|
is passed for one of these data objects the corresponding file
|
|
|
|
|
descriptor is connected to @file{/dev/null}.
|
2014-04-10 11:01:00 +00:00
|
|
|
|
|
|
|
|
|
The value in @var{flags} is a bitwise-or combination of one or
|
|
|
|
|
multiple of the following bit values:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_SPAWN_DETACHED
|
|
|
|
|
Under Windows this flag inhibits the allocation of a new console for
|
|
|
|
|
the program. This is useful for a GUI application which needs to call
|
|
|
|
|
a command line helper tool.
|
|
|
|
|
@item GPGME_SPAWN_ALLOW_SET_FG
|
|
|
|
|
Under Windows this flag allows the called program to put itself into
|
|
|
|
|
the foreground.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2016-08-02 14:50:54 +00:00
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_spawn_start @
|
2014-04-10 11:01:00 +00:00
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{file}}, @
|
|
|
|
|
@w{const char *@var{argv}[]}, @w{gpgme_data_t @var{datain}}, @
|
|
|
|
|
@w{gpgme_data_t @var{dataout}}, @w{gpgme_data_t @var{dataerr}}, @
|
|
|
|
|
@w{unsigned int @var{flags}})
|
|
|
|
|
|
|
|
|
|
This is the asynchronous variant of @code{gpgme_op_spawn}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2016-08-02 14:51:08 +00:00
|
|
|
|
@node Using the Assuan protocol
|
|
|
|
|
@subsection Using the Assuan protocol
|
|
|
|
|
|
|
|
|
|
The Assuan protocol can be used to talk to arbitrary Assuan servers.
|
|
|
|
|
By default it is connected to the GnuPG agent, but it may be connected
|
|
|
|
|
to arbitrary servers by using @code{gpgme_ctx_set_engine_info},
|
|
|
|
|
passing the location of the servers socket as @var{file_name}
|
|
|
|
|
argument, and an empty string as @var{home_dir} argument.
|
|
|
|
|
|
|
|
|
|
The Assuan protocol functions use three kinds of callbacks to transfer
|
|
|
|
|
data:
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {gpgme_error_t (*gpgme_assuan_data_cb_t) @
|
|
|
|
|
(@w{void *@var{opaque}}, @w{const void *@var{data}}, @
|
|
|
|
|
@w{size_t @var{datalen}})}
|
|
|
|
|
|
|
|
|
|
This callback receives any data sent by the server. @var{opaque} is
|
|
|
|
|
the pointer passed to @code{gpgme_op_assuan_transact_start},
|
|
|
|
|
@var{data} of length @var{datalen} refers to the data sent.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {gpgme_error_t (*gpgme_assuan_inquire_cb_t) @
|
|
|
|
|
(@w{void *@var{opaque}}, @w{const char *@var{name}}, @
|
|
|
|
|
@w{const char *@var{args}}, @w{gpgme_data_t *@var{r_data}})}
|
|
|
|
|
|
|
|
|
|
This callback is used to provide additional data to the Assuan server.
|
|
|
|
|
@var{opaque} is the pointer passed to
|
|
|
|
|
@code{gpgme_op_assuan_transact_start}, @var{name} and @var{args}
|
|
|
|
|
specify what kind of data the server requested, and @var{r_data} is
|
|
|
|
|
used to return the actual data.
|
|
|
|
|
|
|
|
|
|
Note: Returning data is currently not implemented in @acronym{GPGME}.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {gpgme_error_t (*gpgme_assuan_status_cb_t) @
|
|
|
|
|
(@w{void *@var{opaque}}, @w{const char *@var{status}}, @
|
|
|
|
|
@w{const char *@var{args}})}
|
|
|
|
|
|
|
|
|
|
This callback receives any status lines sent by the server.
|
|
|
|
|
@var{opaque} is the pointer passed to
|
|
|
|
|
@code{gpgme_op_assuan_transact_start}, @var{status} and @var{args}
|
|
|
|
|
denote the status update sent.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_assuan_transact_start @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{command}}, @
|
|
|
|
|
@w{gpgme_assuan_data_cb_t @var{data_cb}}, @
|
|
|
|
|
@w{void * @var{data_cb_value}}, @
|
|
|
|
|
@w{gpgme_assuan_inquire_cb_t @var{inquire_cb}}, @
|
|
|
|
|
@w{void * @var{inquire_cb_value}}, @
|
|
|
|
|
@w{gpgme_assuan_status_cb_t @var{status_cb}}, @
|
|
|
|
|
@w{void * @var{status_cb_value}})
|
|
|
|
|
|
|
|
|
|
Send the Assuan @var{command} and return results via the callbacks.
|
|
|
|
|
Any callback may be @code{NULL}. The result of the operation may be
|
|
|
|
|
retrieved using @code{gpgme_wait_ext}.
|
|
|
|
|
|
|
|
|
|
Asynchronous variant.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_assuan_transact_ext @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{command}}, @
|
|
|
|
|
@w{gpgme_assuan_data_cb_t @var{data_cb}}, @
|
|
|
|
|
@w{void * @var{data_cb_value}}, @
|
|
|
|
|
@w{gpgme_assuan_inquire_cb_t @var{inquire_cb}}, @
|
|
|
|
|
@w{void * @var{inquire_cb_value}}, @
|
|
|
|
|
@w{gpgme_assuan_status_cb_t @var{status_cb}}, @
|
|
|
|
|
@w{void * @var{status_cb_value}}, @
|
|
|
|
|
@w{gpgme_error_t *@var{op_err}})
|
|
|
|
|
|
|
|
|
|
Send the Assuan @var{command} and return results via the callbacks.
|
|
|
|
|
The result of the operation is returned in @var{op_err}.
|
|
|
|
|
|
|
|
|
|
Synchronous variant.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2016-11-03 15:29:45 +00:00
|
|
|
|
@node Checking for updates
|
|
|
|
|
@subsection How to check for software updates
|
|
|
|
|
|
|
|
|
|
The GnuPG Project operates a server to query the current versions of
|
|
|
|
|
software packages related to GnuPG. GPGME can be used to
|
|
|
|
|
access this online database and check whether a new version of a
|
|
|
|
|
software package is available.
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {gpgme_query_swdb_result_t}
|
|
|
|
|
This is a pointer to a structure used to store the result of a
|
|
|
|
|
@code{gpgme_op_query_swdb} operation. After success full call to that
|
|
|
|
|
function, you can retrieve the pointer to the result with
|
|
|
|
|
@code{gpgme_op_query_swdb_result}. The structure contains the
|
|
|
|
|
following member:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item name
|
|
|
|
|
This is the name of the package.
|
|
|
|
|
|
|
|
|
|
@item iversion
|
|
|
|
|
The currently installed version or an empty string. This value is
|
|
|
|
|
either a copy of the argument given to @code{gpgme_op_query_swdb} or
|
|
|
|
|
the version of the installed software as figured out by GPGME or GnuPG.
|
|
|
|
|
|
|
|
|
|
@item created
|
|
|
|
|
This gives the date the file with the list of version numbers has
|
|
|
|
|
originally be created by the GnuPG project.
|
|
|
|
|
|
|
|
|
|
@item retrieved
|
|
|
|
|
This gives the date the file was downloaded.
|
|
|
|
|
|
|
|
|
|
@item warning
|
|
|
|
|
If this flag is set either an error has occurred or some of the
|
|
|
|
|
information in this structure are not properly set. For example if
|
|
|
|
|
the version number of the installed software could not be figured out,
|
|
|
|
|
the @code{update} flag may not reflect a required update status.
|
|
|
|
|
|
|
|
|
|
@item update
|
|
|
|
|
If this flag is set an update of the software is available.
|
|
|
|
|
|
|
|
|
|
@item urgent
|
|
|
|
|
If this flag is set an available update is important.
|
|
|
|
|
|
|
|
|
|
@item noinfo
|
|
|
|
|
If this flag is set, no valid information could be retrieved.
|
|
|
|
|
|
|
|
|
|
@item unknown
|
|
|
|
|
If this flag is set the given @code{name} is not known.
|
|
|
|
|
|
|
|
|
|
@item tooold
|
|
|
|
|
If this flag is set the available information is not fresh enough.
|
|
|
|
|
|
|
|
|
|
@item error
|
|
|
|
|
If this flag is set some other error has occured.
|
|
|
|
|
|
|
|
|
|
@item version
|
|
|
|
|
The version string of the latest released version.
|
|
|
|
|
|
|
|
|
|
@item reldate
|
|
|
|
|
The release date of the latest released version.
|
|
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_query_swdb @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}}, @
|
|
|
|
|
@w{const char *@var{name}}, @
|
|
|
|
|
@w{const char *@var{iversion}}, @
|
|
|
|
|
@w{gpgme_data_t @var{reserved}})
|
|
|
|
|
|
|
|
|
|
Query the software version database for software package @var{name}
|
|
|
|
|
and check against the installed version given by @var{iversion}. If
|
|
|
|
|
@var{iversion} is given as @code{NULL} a check is only done if GPGME
|
|
|
|
|
can figure out the version by itself (for example when using
|
|
|
|
|
"gpgme" or "gnupg"). If @code{NULL} is used for @var{name} the
|
|
|
|
|
current gpgme version is checked. @var{reserved} must be set to 0.
|
|
|
|
|
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_query_swdb_result_t gpgme_op_query_swdb_result @
|
|
|
|
|
(@w{gpgme_ctx_t @var{ctx}})
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_query_swdb_result} returns a
|
|
|
|
|
@code{gpgme_query_swdb_result_t} pointer to a structure holding the
|
|
|
|
|
result of a @code{gpgme_op_query_swdb} operation. The pointer is only
|
|
|
|
|
valid if the last operation on the context was a sucessful call to
|
|
|
|
|
@code{gpgme_op_query_swdb}. If that call failed, the result might
|
|
|
|
|
be a @code{NULL} pointer. The returned pointer is only valid until
|
|
|
|
|
the next operation is started on the context @var{ctx}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@noindent
|
|
|
|
|
Here is an example on how to check whether GnuPG is current:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
#include <gpgme.h>
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
main (void)
|
|
|
|
|
@{
|
|
|
|
|
gpg_error_t err;
|
|
|
|
|
gpgme_ctx_t ctx;
|
|
|
|
|
gpgme_query_swdb_result_t result;
|
|
|
|
|
|
|
|
|
|
gpgme_check_version (NULL);
|
|
|
|
|
err = gpgme_new (&ctx);
|
|
|
|
|
if (err)
|
|
|
|
|
fprintf (stderr, "error creating context: %s\n", gpg_strerror (err));
|
|
|
|
|
else
|
|
|
|
|
@{
|
|
|
|
|
gpgme_set_protocol (ctx, GPGME_PROTOCOL_GPGCONF);
|
|
|
|
|
|
|
|
|
|
err = gpgme_op_query_swdb (ctx, "gnupg", NULL, 0);
|
|
|
|
|
if (err)
|
|
|
|
|
fprintf (stderr, "error querying swdb: %s\n", gpg_strerror (err));
|
|
|
|
|
else
|
|
|
|
|
@{
|
|
|
|
|
result = gpgme_op_query_swdb_result (ctx);
|
|
|
|
|
if (!result)
|
|
|
|
|
fprintf (stderr, "error querying swdb\n");
|
|
|
|
|
if (!result->warning && !result->update)
|
|
|
|
|
printf ("GnuPG version %s is current\n",
|
|
|
|
|
result->iversion);
|
|
|
|
|
else if (!result->warning && result->update)
|
|
|
|
|
printf ("GnuPG version %s can be updated to %s\n",
|
|
|
|
|
result->iversion, result->version);
|
|
|
|
|
else
|
|
|
|
|
fprintf (stderr, "error finding the update status\n");
|
|
|
|
|
@}
|
|
|
|
|
gpgme_release (ctx);
|
|
|
|
|
@}
|
|
|
|
|
return 0;
|
|
|
|
|
@}
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@node Run Control
|
|
|
|
|
@section Run Control
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex run control
|
|
|
|
|
@cindex cryptographic operation, running
|
2002-01-29 22:58:25 +00:00
|
|
|
|
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@acronym{GPGME} supports running operations synchronously and
|
|
|
|
|
asynchronously. You can use asynchronous operation to set up a
|
|
|
|
|
context up to initiating the desired operation, but delay performing
|
|
|
|
|
it to a later point.
|
|
|
|
|
|
|
|
|
|
Furthermore, you can use an external event loop to control exactly
|
|
|
|
|
when @acronym{GPGME} runs. This ensures that @acronym{GPGME} only
|
|
|
|
|
runs when necessary and also prevents it from blocking for a long
|
|
|
|
|
time.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
|
|
|
|
|
@menu
|
|
|
|
|
* Waiting For Completion:: Waiting until an operation is completed.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
* Using External Event Loops:: Advanced control over what happens when.
|
2004-02-24 23:08:48 +00:00
|
|
|
|
* Cancellation:: How to end pending operations prematurely.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Waiting For Completion
|
|
|
|
|
@subsection Waiting For Completion
|
2002-01-30 01:17:30 +00:00
|
|
|
|
@cindex cryptographic operation, wait for
|
|
|
|
|
@cindex wait for completion
|
2002-01-29 22:58:25 +00:00
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftypefun gpgme_ctx_t gpgme_wait (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_error_t *@var{status}}, @w{int @var{hang}})
|
2002-07-03 02:22:38 +00:00
|
|
|
|
The function @code{gpgme_wait} continues the pending operation within
|
|
|
|
|
the context @var{ctx}. In particular, it ensures the data exchange
|
|
|
|
|
between @acronym{GPGME} and the crypto backend and watches over the
|
|
|
|
|
run time status of the backend process.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
|
|
|
|
|
If @var{hang} is true, the function does not return until the
|
|
|
|
|
operation is completed or cancelled. Otherwise the function will not
|
|
|
|
|
block for a long time.
|
|
|
|
|
|
2002-07-03 02:22:38 +00:00
|
|
|
|
The error status of the finished operation is returned in @var{status}
|
|
|
|
|
if @code{gpgme_wait} does not return @code{NULL}.
|
2002-02-06 01:20:49 +00:00
|
|
|
|
|
|
|
|
|
The @var{ctx} argument can be @code{NULL}. In that case,
|
|
|
|
|
@code{gpgme_wait} waits for any context to complete its operation.
|
|
|
|
|
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@code{gpgme_wait} can be used only in conjunction with any context
|
|
|
|
|
that has a pending operation initiated with one of the
|
|
|
|
|
@code{gpgme_op_*_start} functions except @code{gpgme_op_keylist_start}
|
|
|
|
|
and @code{gpgme_op_trustlist_start} (for which you should use the
|
|
|
|
|
corresponding @code{gpgme_op_*_next} functions). If @var{ctx} is
|
|
|
|
|
@code{NULL}, all of such contexts are waited upon and possibly
|
|
|
|
|
returned. Synchronous operations running in parallel, as well as key
|
|
|
|
|
and trust item list operations, do not affect @code{gpgme_wait}.
|
|
|
|
|
|
|
|
|
|
In a multi-threaded environment, only one thread should ever call
|
|
|
|
|
@code{gpgme_wait} at any time, irregardless if @var{ctx} is specified
|
|
|
|
|
or not. This means that all calls to this function should be fully
|
doc/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (I/O Callback Interface): Document new even
GPGME_EVENT_START.
(Waiting For Completion): Document new possible return values.
(I/O Callback Interface): Document return type of GpgmeIOCb.
gpgme/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* context.h (gpgme_context_s): Remove member ERROR.
* types.h (GpgmeStatusHandler): Change return type to GpgmeError.
(GpgmeCommandHandler): Change return type to GpgmeError and add
new argument RESULT.
* gpgme.h (GpgmeIOCb): Change return type to GpgmeError.
(GpgmeEventIO): New event GPGME_EVENT_START.
(GpgmeIdleFunc): Remove type.
(gpgme_register_idle): Remove prototype.
* data.c: Include <assert.h>.
(_gpgme_data_inbound_handler): Change return type to GpgmeError.
Return any error instead ignoring it, don't close file descriptor
on error.
(_gpgme_data_outbound_handler): Likewise.
* decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(_gpgme_decrypt_status_handler): Change return type to GpgmeError.
Return error instead setting ctx->error. Return success at end of
function.
(gpgme_op_decrypt): Don't work around the old kludge anymore.
* decrypt-verify.c (decrypt_verify_status_handler): Change return
type to GpgmeError. Return possible errors.
* delete.c: Do not include <stdio.h>, <string.h>, <time.h> and
<assert.h>.
(delete_status_handler): Change return type to GpgmeError. Return
error instead setting ctx->error. Return success at end of
function.
* edit.c: Do not include <stdio.h> and <string.h>.
(_gpgme_edit_status_handler): Change type to GpgmeError,
make static and rename to ...
(edit_status_handler): ... this. Return error directly.
(command_handler): Change return type to GpgmeError, add result
argument. Return error directly.
* encrypt.c (status_handler_finish): Remove function.
(_gpgme_encrypt_status_handler): Change return type to GpgmeError.
Return error directly.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (close_notify_handler): Do not signal done event
anymore.
(status_handler): Change return type to GpgmeError. Diddle things
around a bit to return errors directly.
(start): Send start event.
* export.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(export_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* genkey.c: Do not include <stdio.h> and <assert.h>.
(genkey_status_handler): Change return type to GpgmeError. Don't
check ctx->error. Return errors directly.
* gpgme.c (_gpgme_release_result): Do not initialize ctx->error.
(_gpgme_op_event_cb): Function removed.
(_gpgme_op_event_cb_user): Likewise.
* import.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(import_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* keylist.c (keylist_colon_handler, keylist_status_handler, finish_key):
Change return type to GpgmeError, return error directly.
* Makefile (libgpgme_la_SOURCES): Add wait-global.c,
wait-private.c and wait-user.c
* ops.h (test_and_allocate_result): Return error instead setting
ctx->error.
(_gpgme_data_inbound_handler, _gpgme_data_outbound_handler,
_gpgme_verify_status_handler, _gpgme_decrypt_status_handler,
_gpgme_sign_status_handler, _gpgme_encrypt_staus_handler,
_gpgme_passphrase_status_handler, _gpgme_progress_status_handler):
Change return type to GpgmeError.
(_gpgme_passphease_command_handler): Change return type to
GpgmeError and add new argument RESULT.
* op-support.c: Use new callback functions, and change private
data to ctx everywhere.
* passphrase.c (_gpgme_passphrase_status_handler): Change return
type to GpgmeError, return error directly.
(_gpgme_passphrase_command_handler): Change return type to
GpgmeError, add result argument. Return results accordingly.
* progress.c (_gpgme_progress_status_handler): Change return type
to GpgmeError, return errors directly.
* rungpg.c (status_handler): Change return type to GpgmeError.
Return error directly.
(close_notify_handler): Don't send done event.
(colon_line_handler): Change return type to GpgmeError, return
errors directly.
* rungpg.c (start): Send start event.
* sign.c (_gpgme_sign_status_handler): Change return type to
GpgmeError, return errors directly.
* trustlist.c (trustlist_status_handler): Change return type to
GpgmeError. Return 0.
(trustlist_colon_handler): Change return type GpgmeError. Return
errors directly.
* verify.c (add_notation): Change return type to GpgmeError,
return errors directly.
(_gpgme_verify_status_handler): Likewise.
* wait.h (struct fd_table): Remove lock member.
(struct wait_item_s): Moved here from wait.c.
(struct tag): New structure.
(_gpgme_wait_event_cb): Remove prototype.
(_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb,
_gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb,
_gpgme_wait_user_event_io_cb): New prototypes.
* wait.c: Don't include <stdio.h>.
(ftd_global, ctx_done_list, ctx_done_list_size,
ctx_done_list_length, ctx_done_list_lock, idle_function): Remove
global variable.
(gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove
function.
(gpgme_wait): Move to file wait-global.c.
(_gpgme_add_io_cb): Take ctx as private argument, initialize ctx
member in wait item and tag.
(_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock.
(_gpgme_wait_one, _gpgme_wait_on_condition): Move to
wait-private.c.
(gpgme_fd_table_init): Don't initialize FDT->lock.
(gpgme_fd_table_deinit): Don't destroy FDT->lock.
(_gpgme_fd_table_put): Make static and rename to ...
(fd_table_put): ... this function. Don't use FDT->lock.
(struct wait_item_s): Move to wait.h.
* wait-global.c: New file.
* wait-private.c: New file.
* wait-user.c: New file.
2003-01-29 15:20:58 +00:00
|
|
|
|
synchronized by locking primitives. It is safe to start asynchronous
|
|
|
|
|
operations while a thread is running in @code{gpgme_wait}.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
2002-02-06 01:20:49 +00:00
|
|
|
|
The function returns the @var{ctx} of the context which has finished
|
doc/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (I/O Callback Interface): Document new even
GPGME_EVENT_START.
(Waiting For Completion): Document new possible return values.
(I/O Callback Interface): Document return type of GpgmeIOCb.
gpgme/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* context.h (gpgme_context_s): Remove member ERROR.
* types.h (GpgmeStatusHandler): Change return type to GpgmeError.
(GpgmeCommandHandler): Change return type to GpgmeError and add
new argument RESULT.
* gpgme.h (GpgmeIOCb): Change return type to GpgmeError.
(GpgmeEventIO): New event GPGME_EVENT_START.
(GpgmeIdleFunc): Remove type.
(gpgme_register_idle): Remove prototype.
* data.c: Include <assert.h>.
(_gpgme_data_inbound_handler): Change return type to GpgmeError.
Return any error instead ignoring it, don't close file descriptor
on error.
(_gpgme_data_outbound_handler): Likewise.
* decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(_gpgme_decrypt_status_handler): Change return type to GpgmeError.
Return error instead setting ctx->error. Return success at end of
function.
(gpgme_op_decrypt): Don't work around the old kludge anymore.
* decrypt-verify.c (decrypt_verify_status_handler): Change return
type to GpgmeError. Return possible errors.
* delete.c: Do not include <stdio.h>, <string.h>, <time.h> and
<assert.h>.
(delete_status_handler): Change return type to GpgmeError. Return
error instead setting ctx->error. Return success at end of
function.
* edit.c: Do not include <stdio.h> and <string.h>.
(_gpgme_edit_status_handler): Change type to GpgmeError,
make static and rename to ...
(edit_status_handler): ... this. Return error directly.
(command_handler): Change return type to GpgmeError, add result
argument. Return error directly.
* encrypt.c (status_handler_finish): Remove function.
(_gpgme_encrypt_status_handler): Change return type to GpgmeError.
Return error directly.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (close_notify_handler): Do not signal done event
anymore.
(status_handler): Change return type to GpgmeError. Diddle things
around a bit to return errors directly.
(start): Send start event.
* export.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(export_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* genkey.c: Do not include <stdio.h> and <assert.h>.
(genkey_status_handler): Change return type to GpgmeError. Don't
check ctx->error. Return errors directly.
* gpgme.c (_gpgme_release_result): Do not initialize ctx->error.
(_gpgme_op_event_cb): Function removed.
(_gpgme_op_event_cb_user): Likewise.
* import.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(import_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* keylist.c (keylist_colon_handler, keylist_status_handler, finish_key):
Change return type to GpgmeError, return error directly.
* Makefile (libgpgme_la_SOURCES): Add wait-global.c,
wait-private.c and wait-user.c
* ops.h (test_and_allocate_result): Return error instead setting
ctx->error.
(_gpgme_data_inbound_handler, _gpgme_data_outbound_handler,
_gpgme_verify_status_handler, _gpgme_decrypt_status_handler,
_gpgme_sign_status_handler, _gpgme_encrypt_staus_handler,
_gpgme_passphrase_status_handler, _gpgme_progress_status_handler):
Change return type to GpgmeError.
(_gpgme_passphease_command_handler): Change return type to
GpgmeError and add new argument RESULT.
* op-support.c: Use new callback functions, and change private
data to ctx everywhere.
* passphrase.c (_gpgme_passphrase_status_handler): Change return
type to GpgmeError, return error directly.
(_gpgme_passphrase_command_handler): Change return type to
GpgmeError, add result argument. Return results accordingly.
* progress.c (_gpgme_progress_status_handler): Change return type
to GpgmeError, return errors directly.
* rungpg.c (status_handler): Change return type to GpgmeError.
Return error directly.
(close_notify_handler): Don't send done event.
(colon_line_handler): Change return type to GpgmeError, return
errors directly.
* rungpg.c (start): Send start event.
* sign.c (_gpgme_sign_status_handler): Change return type to
GpgmeError, return errors directly.
* trustlist.c (trustlist_status_handler): Change return type to
GpgmeError. Return 0.
(trustlist_colon_handler): Change return type GpgmeError. Return
errors directly.
* verify.c (add_notation): Change return type to GpgmeError,
return errors directly.
(_gpgme_verify_status_handler): Likewise.
* wait.h (struct fd_table): Remove lock member.
(struct wait_item_s): Moved here from wait.c.
(struct tag): New structure.
(_gpgme_wait_event_cb): Remove prototype.
(_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb,
_gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb,
_gpgme_wait_user_event_io_cb): New prototypes.
* wait.c: Don't include <stdio.h>.
(ftd_global, ctx_done_list, ctx_done_list_size,
ctx_done_list_length, ctx_done_list_lock, idle_function): Remove
global variable.
(gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove
function.
(gpgme_wait): Move to file wait-global.c.
(_gpgme_add_io_cb): Take ctx as private argument, initialize ctx
member in wait item and tag.
(_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock.
(_gpgme_wait_one, _gpgme_wait_on_condition): Move to
wait-private.c.
(gpgme_fd_table_init): Don't initialize FDT->lock.
(gpgme_fd_table_deinit): Don't destroy FDT->lock.
(_gpgme_fd_table_put): Make static and rename to ...
(fd_table_put): ... this function. Don't use FDT->lock.
(struct wait_item_s): Move to wait.h.
* wait-global.c: New file.
* wait-private.c: New file.
* wait-user.c: New file.
2003-01-29 15:20:58 +00:00
|
|
|
|
the operation. If @var{hang} is false, and the timeout expires,
|
|
|
|
|
@code{NULL} is returned and @code{*status} will be set to 0. If an
|
|
|
|
|
error occurs, @code{NULL} is returned and the error is returned in
|
|
|
|
|
@code{*status}.
|
2002-01-29 22:58:25 +00:00
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@node Using External Event Loops
|
|
|
|
|
@subsection Using External Event Loops
|
|
|
|
|
@cindex event loop, external
|
|
|
|
|
|
|
|
|
|
@acronym{GPGME} hides the complexity of the communication between the
|
|
|
|
|
library and the crypto engine. The price of this convenience is that
|
|
|
|
|
the calling thread can block arbitrary long waiting for the data
|
|
|
|
|
returned by the crypto engine. In single-threaded programs, in
|
|
|
|
|
particular if they are interactive, this is an unwanted side-effect.
|
|
|
|
|
OTOH, if @code{gpgme_wait} is used without the @var{hang} option being
|
|
|
|
|
enabled, it might be called unnecessarily often, wasting CPU time that
|
|
|
|
|
could be used otherwise.
|
|
|
|
|
|
|
|
|
|
The I/O callback interface described in this section lets the user
|
|
|
|
|
take control over what happens when. @acronym{GPGME} will provide the
|
|
|
|
|
user with the file descriptors that should be monitored, and the
|
|
|
|
|
callback functions that should be invoked when a file descriptor is
|
|
|
|
|
ready for reading or writing. It is then the user's responsibility to
|
|
|
|
|
decide when to check the file descriptors and when to invoke the
|
|
|
|
|
callback functions. Usually this is done in an event loop, that also
|
|
|
|
|
checks for events in other parts of the program. If the callback
|
|
|
|
|
functions are only called when the file descriptors are ready,
|
2005-11-18 16:52:38 +00:00
|
|
|
|
@acronym{GPGME} will never block. This gives the user more control
|
2002-07-03 02:22:38 +00:00
|
|
|
|
over the program flow, and allows to perform other tasks when
|
|
|
|
|
@acronym{GPGME} would block otherwise.
|
|
|
|
|
|
|
|
|
|
By using this advanced mechanism, @acronym{GPGME} can be integrated
|
|
|
|
|
smoothly into GUI toolkits like GTK+ even for single-threaded
|
|
|
|
|
programs.
|
|
|
|
|
|
|
|
|
|
@menu
|
|
|
|
|
* I/O Callback Interface:: How I/O callbacks are registered.
|
|
|
|
|
* Registering I/O Callbacks:: How to use I/O callbacks for a context.
|
|
|
|
|
* I/O Callback Example:: An example how to use I/O callbacks.
|
|
|
|
|
* I/O Callback Example GTK+:: How to use @acronym{GPGME} with GTK+.
|
|
|
|
|
* I/O Callback Example GDK:: How to use @acronym{GPGME} with GDK.
|
2004-03-07 22:32:49 +00:00
|
|
|
|
* I/O Callback Example Qt:: How to use @acronym{GPGME} with Qt.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node I/O Callback Interface
|
|
|
|
|
@subsubsection I/O Callback Interface
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_error_t (*gpgme_io_cb_t) (@w{void *@var{data}}, @w{int @var{fd}})}
|
|
|
|
|
@tindex gpgme_io_cb_t
|
|
|
|
|
The @code{gpgme_io_cb_t} type is the type of functions which
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@acronym{GPGME} wants to register as I/O callback handlers using the
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_register_io_cb_t} functions provided by the user.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
|
|
|
|
@var{data} and @var{fd} are provided by @acronym{GPGME} when the I/O
|
|
|
|
|
callback handler is registered, and should be passed through to the
|
|
|
|
|
handler when it is invoked by the user because it noticed activity on
|
|
|
|
|
the file descriptor @var{fd}.
|
doc/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (I/O Callback Interface): Document new even
GPGME_EVENT_START.
(Waiting For Completion): Document new possible return values.
(I/O Callback Interface): Document return type of GpgmeIOCb.
gpgme/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* context.h (gpgme_context_s): Remove member ERROR.
* types.h (GpgmeStatusHandler): Change return type to GpgmeError.
(GpgmeCommandHandler): Change return type to GpgmeError and add
new argument RESULT.
* gpgme.h (GpgmeIOCb): Change return type to GpgmeError.
(GpgmeEventIO): New event GPGME_EVENT_START.
(GpgmeIdleFunc): Remove type.
(gpgme_register_idle): Remove prototype.
* data.c: Include <assert.h>.
(_gpgme_data_inbound_handler): Change return type to GpgmeError.
Return any error instead ignoring it, don't close file descriptor
on error.
(_gpgme_data_outbound_handler): Likewise.
* decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(_gpgme_decrypt_status_handler): Change return type to GpgmeError.
Return error instead setting ctx->error. Return success at end of
function.
(gpgme_op_decrypt): Don't work around the old kludge anymore.
* decrypt-verify.c (decrypt_verify_status_handler): Change return
type to GpgmeError. Return possible errors.
* delete.c: Do not include <stdio.h>, <string.h>, <time.h> and
<assert.h>.
(delete_status_handler): Change return type to GpgmeError. Return
error instead setting ctx->error. Return success at end of
function.
* edit.c: Do not include <stdio.h> and <string.h>.
(_gpgme_edit_status_handler): Change type to GpgmeError,
make static and rename to ...
(edit_status_handler): ... this. Return error directly.
(command_handler): Change return type to GpgmeError, add result
argument. Return error directly.
* encrypt.c (status_handler_finish): Remove function.
(_gpgme_encrypt_status_handler): Change return type to GpgmeError.
Return error directly.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (close_notify_handler): Do not signal done event
anymore.
(status_handler): Change return type to GpgmeError. Diddle things
around a bit to return errors directly.
(start): Send start event.
* export.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(export_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* genkey.c: Do not include <stdio.h> and <assert.h>.
(genkey_status_handler): Change return type to GpgmeError. Don't
check ctx->error. Return errors directly.
* gpgme.c (_gpgme_release_result): Do not initialize ctx->error.
(_gpgme_op_event_cb): Function removed.
(_gpgme_op_event_cb_user): Likewise.
* import.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(import_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* keylist.c (keylist_colon_handler, keylist_status_handler, finish_key):
Change return type to GpgmeError, return error directly.
* Makefile (libgpgme_la_SOURCES): Add wait-global.c,
wait-private.c and wait-user.c
* ops.h (test_and_allocate_result): Return error instead setting
ctx->error.
(_gpgme_data_inbound_handler, _gpgme_data_outbound_handler,
_gpgme_verify_status_handler, _gpgme_decrypt_status_handler,
_gpgme_sign_status_handler, _gpgme_encrypt_staus_handler,
_gpgme_passphrase_status_handler, _gpgme_progress_status_handler):
Change return type to GpgmeError.
(_gpgme_passphease_command_handler): Change return type to
GpgmeError and add new argument RESULT.
* op-support.c: Use new callback functions, and change private
data to ctx everywhere.
* passphrase.c (_gpgme_passphrase_status_handler): Change return
type to GpgmeError, return error directly.
(_gpgme_passphrase_command_handler): Change return type to
GpgmeError, add result argument. Return results accordingly.
* progress.c (_gpgme_progress_status_handler): Change return type
to GpgmeError, return errors directly.
* rungpg.c (status_handler): Change return type to GpgmeError.
Return error directly.
(close_notify_handler): Don't send done event.
(colon_line_handler): Change return type to GpgmeError, return
errors directly.
* rungpg.c (start): Send start event.
* sign.c (_gpgme_sign_status_handler): Change return type to
GpgmeError, return errors directly.
* trustlist.c (trustlist_status_handler): Change return type to
GpgmeError. Return 0.
(trustlist_colon_handler): Change return type GpgmeError. Return
errors directly.
* verify.c (add_notation): Change return type to GpgmeError,
return errors directly.
(_gpgme_verify_status_handler): Likewise.
* wait.h (struct fd_table): Remove lock member.
(struct wait_item_s): Moved here from wait.c.
(struct tag): New structure.
(_gpgme_wait_event_cb): Remove prototype.
(_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb,
_gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb,
_gpgme_wait_user_event_io_cb): New prototypes.
* wait.c: Don't include <stdio.h>.
(ftd_global, ctx_done_list, ctx_done_list_size,
ctx_done_list_length, ctx_done_list_lock, idle_function): Remove
global variable.
(gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove
function.
(gpgme_wait): Move to file wait-global.c.
(_gpgme_add_io_cb): Take ctx as private argument, initialize ctx
member in wait item and tag.
(_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock.
(_gpgme_wait_one, _gpgme_wait_on_condition): Move to
wait-private.c.
(gpgme_fd_table_init): Don't initialize FDT->lock.
(gpgme_fd_table_deinit): Don't destroy FDT->lock.
(_gpgme_fd_table_put): Make static and rename to ...
(fd_table_put): ... this function. Don't use FDT->lock.
(struct wait_item_s): Move to wait.h.
* wait-global.c: New file.
* wait-private.c: New file.
* wait-user.c: New file.
2003-01-29 15:20:58 +00:00
|
|
|
|
|
|
|
|
|
The callback handler always returns @code{0}, but you should consider
|
|
|
|
|
the return value to be reserved for later use.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {gpgme_error_t (*gpgme_register_io_cb_t) (@w{void *@var{data}}, @w{int @var{fd}}, @w{int @var{dir}}, @w{gpgme_io_cb_t @var{fnc}}, @w{void *@var{fnc_data}}, @w{void **@var{tag}})}
|
|
|
|
|
@tindex gpgme_register_io_cb_t
|
|
|
|
|
The @code{gpgme_register_io_cb_t} type is the type of functions which can
|
2005-11-18 16:52:38 +00:00
|
|
|
|
be called by @acronym{GPGME} to register an I/O callback function
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@var{fnc} for the file descriptor @var{fd} with the user.
|
|
|
|
|
@var{fnc_data} should be passed as the first argument to @var{fnc}
|
|
|
|
|
when the handler is invoked (the second argument should be @var{fd}).
|
|
|
|
|
If @var{dir} is 0, @var{fnc} should be called by the user when
|
|
|
|
|
@var{fd} is ready for writing. If @var{dir} is 1, @var{fnc} should be
|
|
|
|
|
called when @var{fd} is ready for reading.
|
|
|
|
|
|
|
|
|
|
@var{data} was provided by the user when registering the
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_register_io_cb_t} function with @acronym{GPGME} and will always
|
2002-07-03 02:22:38 +00:00
|
|
|
|
be passed as the first argument when registering a callback function.
|
|
|
|
|
For example, the user can use this to determine the event loop to
|
|
|
|
|
which the file descriptor should be added.
|
|
|
|
|
|
|
|
|
|
@acronym{GPGME} will call this function when a crypto operation is
|
|
|
|
|
initiated in a context for which the user has registered I/O callback
|
|
|
|
|
handler functions with @code{gpgme_set_io_cbs}. It can also call this
|
|
|
|
|
function when it is in an I/O callback handler for a file descriptor
|
|
|
|
|
associated to this context.
|
|
|
|
|
|
|
|
|
|
The user should return a unique handle in @var{tag} identifying this
|
|
|
|
|
I/O callback registration, which will be passed to the
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_register_io_cb_t} function without interpretation when the file
|
2002-07-03 02:22:38 +00:00
|
|
|
|
descriptor should not be monitored anymore.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {void (*gpgme_remove_io_cb_t) (@w{void *@var{tag}})}
|
|
|
|
|
The @code{gpgme_remove_io_cb_t} type is the type of functions which can be
|
2002-07-03 02:22:38 +00:00
|
|
|
|
called by @acronym{GPGME} to remove an I/O callback handler that was
|
|
|
|
|
registered before. @var{tag} is the handle that was returned by the
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_register_io_cb_t} for this I/O callback.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
|
|
|
|
@acronym{GPGME} can call this function when a crypto operation is in
|
|
|
|
|
an I/O callback. It will also call this function when the context is
|
|
|
|
|
destroyed while an operation is pending.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {enum gpgme_event_io_t}
|
|
|
|
|
@tindex gpgme_event_io_t
|
|
|
|
|
The @code{gpgme_event_io_t} type specifies the type of an event that is
|
2002-07-03 02:22:38 +00:00
|
|
|
|
reported to the user by @acronym{GPGME} as a consequence of an I/O
|
|
|
|
|
operation. The following events are defined:
|
|
|
|
|
|
|
|
|
|
@table @code
|
doc/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (I/O Callback Interface): Document new even
GPGME_EVENT_START.
(Waiting For Completion): Document new possible return values.
(I/O Callback Interface): Document return type of GpgmeIOCb.
gpgme/
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
* context.h (gpgme_context_s): Remove member ERROR.
* types.h (GpgmeStatusHandler): Change return type to GpgmeError.
(GpgmeCommandHandler): Change return type to GpgmeError and add
new argument RESULT.
* gpgme.h (GpgmeIOCb): Change return type to GpgmeError.
(GpgmeEventIO): New event GPGME_EVENT_START.
(GpgmeIdleFunc): Remove type.
(gpgme_register_idle): Remove prototype.
* data.c: Include <assert.h>.
(_gpgme_data_inbound_handler): Change return type to GpgmeError.
Return any error instead ignoring it, don't close file descriptor
on error.
(_gpgme_data_outbound_handler): Likewise.
* decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(_gpgme_decrypt_status_handler): Change return type to GpgmeError.
Return error instead setting ctx->error. Return success at end of
function.
(gpgme_op_decrypt): Don't work around the old kludge anymore.
* decrypt-verify.c (decrypt_verify_status_handler): Change return
type to GpgmeError. Return possible errors.
* delete.c: Do not include <stdio.h>, <string.h>, <time.h> and
<assert.h>.
(delete_status_handler): Change return type to GpgmeError. Return
error instead setting ctx->error. Return success at end of
function.
* edit.c: Do not include <stdio.h> and <string.h>.
(_gpgme_edit_status_handler): Change type to GpgmeError,
make static and rename to ...
(edit_status_handler): ... this. Return error directly.
(command_handler): Change return type to GpgmeError, add result
argument. Return error directly.
* encrypt.c (status_handler_finish): Remove function.
(_gpgme_encrypt_status_handler): Change return type to GpgmeError.
Return error directly.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (close_notify_handler): Do not signal done event
anymore.
(status_handler): Change return type to GpgmeError. Diddle things
around a bit to return errors directly.
(start): Send start event.
* export.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(export_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* genkey.c: Do not include <stdio.h> and <assert.h>.
(genkey_status_handler): Change return type to GpgmeError. Don't
check ctx->error. Return errors directly.
* gpgme.c (_gpgme_release_result): Do not initialize ctx->error.
(_gpgme_op_event_cb): Function removed.
(_gpgme_op_event_cb_user): Likewise.
* import.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(import_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* keylist.c (keylist_colon_handler, keylist_status_handler, finish_key):
Change return type to GpgmeError, return error directly.
* Makefile (libgpgme_la_SOURCES): Add wait-global.c,
wait-private.c and wait-user.c
* ops.h (test_and_allocate_result): Return error instead setting
ctx->error.
(_gpgme_data_inbound_handler, _gpgme_data_outbound_handler,
_gpgme_verify_status_handler, _gpgme_decrypt_status_handler,
_gpgme_sign_status_handler, _gpgme_encrypt_staus_handler,
_gpgme_passphrase_status_handler, _gpgme_progress_status_handler):
Change return type to GpgmeError.
(_gpgme_passphease_command_handler): Change return type to
GpgmeError and add new argument RESULT.
* op-support.c: Use new callback functions, and change private
data to ctx everywhere.
* passphrase.c (_gpgme_passphrase_status_handler): Change return
type to GpgmeError, return error directly.
(_gpgme_passphrase_command_handler): Change return type to
GpgmeError, add result argument. Return results accordingly.
* progress.c (_gpgme_progress_status_handler): Change return type
to GpgmeError, return errors directly.
* rungpg.c (status_handler): Change return type to GpgmeError.
Return error directly.
(close_notify_handler): Don't send done event.
(colon_line_handler): Change return type to GpgmeError, return
errors directly.
* rungpg.c (start): Send start event.
* sign.c (_gpgme_sign_status_handler): Change return type to
GpgmeError, return errors directly.
* trustlist.c (trustlist_status_handler): Change return type to
GpgmeError. Return 0.
(trustlist_colon_handler): Change return type GpgmeError. Return
errors directly.
* verify.c (add_notation): Change return type to GpgmeError,
return errors directly.
(_gpgme_verify_status_handler): Likewise.
* wait.h (struct fd_table): Remove lock member.
(struct wait_item_s): Moved here from wait.c.
(struct tag): New structure.
(_gpgme_wait_event_cb): Remove prototype.
(_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb,
_gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb,
_gpgme_wait_user_event_io_cb): New prototypes.
* wait.c: Don't include <stdio.h>.
(ftd_global, ctx_done_list, ctx_done_list_size,
ctx_done_list_length, ctx_done_list_lock, idle_function): Remove
global variable.
(gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove
function.
(gpgme_wait): Move to file wait-global.c.
(_gpgme_add_io_cb): Take ctx as private argument, initialize ctx
member in wait item and tag.
(_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock.
(_gpgme_wait_one, _gpgme_wait_on_condition): Move to
wait-private.c.
(gpgme_fd_table_init): Don't initialize FDT->lock.
(gpgme_fd_table_deinit): Don't destroy FDT->lock.
(_gpgme_fd_table_put): Make static and rename to ...
(fd_table_put): ... this function. Don't use FDT->lock.
(struct wait_item_s): Move to wait.h.
* wait-global.c: New file.
* wait-private.c: New file.
* wait-user.c: New file.
2003-01-29 15:20:58 +00:00
|
|
|
|
@item GPGME_EVENT_START
|
|
|
|
|
The operation is fully initialized now, and you can start to run the
|
|
|
|
|
registered I/O callback handlers now. Note that registered I/O
|
|
|
|
|
callback handlers must not be run before this event is signalled.
|
|
|
|
|
@var{type_data} is @code{NULL} and reserved for later use.
|
|
|
|
|
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@item GPGME_EVENT_DONE
|
|
|
|
|
The operation is finished, the last I/O callback for this operation
|
|
|
|
|
was removed. The accompanying @var{type_data} points to a
|
2013-08-19 18:43:19 +00:00
|
|
|
|
@code{struct gpgme_io_event_done_data} variable that contains the
|
|
|
|
|
status of the operation that finished. This event is signalled after
|
|
|
|
|
the last I/O callback has been removed.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
|
|
|
|
@item GPGME_EVENT_NEXT_KEY
|
|
|
|
|
In a @code{gpgme_op_keylist_start} operation, the next key was
|
|
|
|
|
received from the crypto engine. The accompanying @var{type_data} is
|
2003-05-18 20:45:24 +00:00
|
|
|
|
a @code{gpgme_key_t} variable that contains the key with one reference
|
2002-07-03 02:22:38 +00:00
|
|
|
|
for the user.
|
|
|
|
|
|
|
|
|
|
@item GPGME_EVENT_NEXT_TRUSTITEM
|
|
|
|
|
In a @code{gpgme_op_trustlist_start} operation, the next trust item
|
|
|
|
|
was received from the crypto engine. The accompanying @var{type_data}
|
2003-05-18 20:45:24 +00:00
|
|
|
|
is a @code{gpgme_trust_item_t} variable that contains the trust item with
|
2002-07-03 02:22:38 +00:00
|
|
|
|
one reference for the user.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@deftp {Data type} {void (*gpgme_event_io_cb_t) (@w{void *@var{data}}, @w{gpgme_event_io_t @var{type}}, @w{void *@var{type_data}})}
|
|
|
|
|
The @code{gpgme_event_io_cb_t} type is the type of functions which can be
|
2002-07-03 02:22:38 +00:00
|
|
|
|
called by @acronym{GPGME} to signal an event for an operation running
|
|
|
|
|
in a context which has I/O callback functions registered by the user.
|
|
|
|
|
|
|
|
|
|
@var{data} was provided by the user when registering the
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@code{gpgme_event_io_cb_t} function with @acronym{GPGME} and will always be
|
2002-07-03 02:22:38 +00:00
|
|
|
|
passed as the first argument when registering a callback function.
|
|
|
|
|
For example, the user can use this to determine the context in which
|
|
|
|
|
this event has occured.
|
|
|
|
|
|
|
|
|
|
@var{type} will specify the type of event that has occured.
|
|
|
|
|
@var{type_data} specifies the event further, as described in the above
|
2003-05-18 20:45:24 +00:00
|
|
|
|
list of possible @code{gpgme_event_io_t} types.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
|
|
|
|
@acronym{GPGME} can call this function in an I/O callback handler.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node Registering I/O Callbacks
|
|
|
|
|
@subsubsection Registering I/O Callbacks
|
|
|
|
|
|
2014-03-05 05:52:49 +00:00
|
|
|
|
@deftp {Data type} {struct gpgme_io_cbs}
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@tindex gpgme_event_io_t
|
2002-07-03 02:22:38 +00:00
|
|
|
|
This structure is used to store the I/O callback interface functions
|
|
|
|
|
described in the previous section. It has the following members:
|
|
|
|
|
|
|
|
|
|
@table @code
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_register_io_cb_t add
|
2002-07-03 02:22:38 +00:00
|
|
|
|
This is the function called by @acronym{GPGME} to register an I/O
|
|
|
|
|
callback handler. It must be specified.
|
|
|
|
|
|
2014-03-05 05:52:49 +00:00
|
|
|
|
@item void *add_priv
|
2002-07-03 02:22:38 +00:00
|
|
|
|
This is passed as the first argument to the @code{add} function when
|
|
|
|
|
it is called by @acronym{GPGME}. For example, it can be used to
|
|
|
|
|
determine the event loop to which the file descriptor should be added.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_remove_io_cb_t remove
|
2002-07-03 02:22:38 +00:00
|
|
|
|
This is the function called by @acronym{GPGME} to remove an I/O
|
|
|
|
|
callback handler. It must be specified.
|
|
|
|
|
|
2003-05-18 20:45:24 +00:00
|
|
|
|
@item gpgme_event_io_cb_t event
|
2002-07-03 02:22:38 +00:00
|
|
|
|
This is the function called by @acronym{GPGME} to signal an event for
|
2007-05-03 20:12:40 +00:00
|
|
|
|
an operation. It must be specified, because at least the start event
|
|
|
|
|
must be processed.
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
2014-03-05 05:52:49 +00:00
|
|
|
|
@item void *event_priv
|
2002-07-03 02:22:38 +00:00
|
|
|
|
This is passed as the first argument to the @code{event} function when
|
|
|
|
|
it is called by @acronym{GPGME}. For example, it can be used to
|
|
|
|
|
determine the context in which the event has occured.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
2014-03-05 05:52:49 +00:00
|
|
|
|
@deftypefun void gpgme_set_io_cbs (@w{gpgme_ctx_t @var{ctx}}, @w{struct gpgme_io_cbs *@var{io_cbs}})
|
2002-07-03 02:22:38 +00:00
|
|
|
|
The function @code{gpgme_set_io_cbs} enables the I/O callback
|
|
|
|
|
interface for the context @var{ctx}. The I/O callback functions are
|
|
|
|
|
specified by @var{io_cbs}.
|
|
|
|
|
|
|
|
|
|
If @var{io_cbs}->@code{add} is @code{NULL}, the I/O callback interface
|
|
|
|
|
is disabled for the context, and normal operation is restored.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2014-03-05 05:52:49 +00:00
|
|
|
|
@deftypefun void gpgme_get_io_cbs (@w{gpgme_ctx_t @var{ctx}}, @w{struct gpgme_io_cbs *@var{io_cbs}})
|
2002-07-03 02:22:38 +00:00
|
|
|
|
The function @code{gpgme_get_io_cbs} returns the I/O callback
|
|
|
|
|
functions set with @code{gpgme_set_io_cbs} in @var{io_cbs}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node I/O Callback Example
|
|
|
|
|
@subsubsection I/O Callback Example
|
|
|
|
|
|
|
|
|
|
To actually use an external event loop, you have to implement the I/O
|
|
|
|
|
callback functions that are used by @acronym{GPGME} to register and
|
|
|
|
|
unregister file descriptors. Furthermore, you have to actually
|
|
|
|
|
monitor these file descriptors for activity and call the appropriate
|
|
|
|
|
I/O callbacks.
|
|
|
|
|
|
|
|
|
|
The following example illustrates how to do that. The example uses
|
2007-09-14 12:27:54 +00:00
|
|
|
|
locking to show in which way the callbacks and the event loop can
|
2002-07-03 02:22:38 +00:00
|
|
|
|
run concurrently. For the event loop, we use a fixed array. For a
|
|
|
|
|
real-world implementation, you should use a dynamically sized
|
|
|
|
|
structure because the number of file descriptors needed for a crypto
|
|
|
|
|
operation in @acronym{GPGME} is not predictable.
|
|
|
|
|
|
|
|
|
|
@example
|
2011-05-12 12:45:46 +00:00
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <stdlib.h>
|
2002-07-03 02:22:38 +00:00
|
|
|
|
#include <pthread.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <gpgme.h>
|
|
|
|
|
|
|
|
|
|
/* The following structure holds the result of a crypto operation. */
|
|
|
|
|
struct op_result
|
|
|
|
|
@{
|
|
|
|
|
int done;
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_error_t err;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@};
|
|
|
|
|
|
|
|
|
|
/* The following structure holds the data associated with one I/O
|
|
|
|
|
callback. */
|
|
|
|
|
struct one_fd
|
|
|
|
|
@{
|
|
|
|
|
int fd;
|
|
|
|
|
int dir;
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_io_cb_t fnc;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
void *fnc_data;
|
2011-05-12 12:45:46 +00:00
|
|
|
|
void *loop;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@};
|
|
|
|
|
|
|
|
|
|
struct event_loop
|
|
|
|
|
@{
|
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
|
#define MAX_FDS 32
|
|
|
|
|
/* Unused slots are marked with FD being -1. */
|
|
|
|
|
struct one_fd fds[MAX_FDS];
|
|
|
|
|
@};
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
The following functions implement the I/O callback interface.
|
|
|
|
|
|
|
|
|
|
@example
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_error_t
|
|
|
|
|
add_io_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc, void *fnc_data,
|
2002-07-03 02:22:38 +00:00
|
|
|
|
void **r_tag)
|
|
|
|
|
@{
|
|
|
|
|
struct event_loop *loop = data;
|
|
|
|
|
struct one_fd *fds = loop->fds;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
pthread_mutex_lock (&loop->lock);
|
|
|
|
|
for (i = 0; i < MAX_FDS; i++)
|
|
|
|
|
@{
|
|
|
|
|
if (fds[i].fd == -1)
|
|
|
|
|
@{
|
|
|
|
|
fds[i].fd = fd;
|
|
|
|
|
fds[i].dir = dir;
|
|
|
|
|
fds[i].fnc = fnc;
|
|
|
|
|
fds[i].fnc_data = fnc_data;
|
2011-05-12 12:45:46 +00:00
|
|
|
|
fds[i].loop = loop;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
break;
|
|
|
|
|
@}
|
|
|
|
|
@}
|
|
|
|
|
pthread_mutex_unlock (&loop->lock);
|
|
|
|
|
if (i == MAX_FDS)
|
2003-06-05 23:20:29 +00:00
|
|
|
|
return gpg_error (GPG_ERR_GENERAL);
|
2002-07-03 02:22:38 +00:00
|
|
|
|
*r_tag = &fds[i];
|
|
|
|
|
return 0;
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
remove_io_cb (void *tag)
|
|
|
|
|
@{
|
|
|
|
|
struct one_fd *fd = tag;
|
2011-05-12 12:45:46 +00:00
|
|
|
|
struct event_loop *loop = fd->loop;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
|
|
|
|
pthread_mutex_lock (&loop->lock);
|
|
|
|
|
fd->fd = -1;
|
|
|
|
|
pthread_mutex_unlock (&loop->lock);
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
void
|
2003-05-18 20:45:24 +00:00
|
|
|
|
event_io_cb (void *data, gpgme_event_io_t type, void *type_data)
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@{
|
|
|
|
|
struct op_result *result = data;
|
|
|
|
|
|
|
|
|
|
/* We don't support list operations here. */
|
|
|
|
|
if (type == GPGME_EVENT_DONE)
|
|
|
|
|
@{
|
|
|
|
|
result->done = 1;
|
2003-06-05 23:20:29 +00:00
|
|
|
|
result->err = *type_data;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@}
|
|
|
|
|
@}
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
The final missing piece is the event loop, which will be presented
|
|
|
|
|
next. We only support waiting for the success of a single operation.
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
int
|
|
|
|
|
do_select (struct event_loop *loop)
|
|
|
|
|
@{
|
|
|
|
|
fd_set rfds;
|
|
|
|
|
fd_set wfds;
|
|
|
|
|
int i, n;
|
|
|
|
|
int any = 0;
|
2016-02-09 08:03:50 +00:00
|
|
|
|
struct timeval tv;
|
2011-05-12 12:45:46 +00:00
|
|
|
|
struct one_fd *fdlist = loop->fds;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
|
|
|
|
pthread_mutex_lock (&loop->lock);
|
|
|
|
|
FD_ZERO (&rfds);
|
|
|
|
|
FD_ZERO (&wfds);
|
2011-05-12 12:45:46 +00:00
|
|
|
|
for (i = 0; i < MAX_FDS; i++)
|
2002-07-03 02:22:38 +00:00
|
|
|
|
if (fdlist[i].fd != -1)
|
|
|
|
|
FD_SET (fdlist[i].fd, fdlist[i].dir ? &rfds : &wfds);
|
2016-02-09 08:03:50 +00:00
|
|
|
|
pthread_mutex_unlock (&loop->lock);
|
|
|
|
|
|
|
|
|
|
tv.tv_sec = 0;
|
|
|
|
|
tv.tv_usec = 1000;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
@{
|
2016-02-09 08:03:50 +00:00
|
|
|
|
n = select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@}
|
|
|
|
|
while (n < 0 && errno == EINTR);
|
|
|
|
|
|
|
|
|
|
if (n < 0)
|
|
|
|
|
return n; /* Error or timeout. */
|
|
|
|
|
|
|
|
|
|
pthread_mutex_lock (&loop->lock);
|
2011-05-12 12:45:46 +00:00
|
|
|
|
for (i = 0; i < MAX_FDS && n; i++)
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@{
|
|
|
|
|
if (fdlist[i].fd != -1)
|
|
|
|
|
@{
|
|
|
|
|
if (FD_ISSET (fdlist[i].fd, fdlist[i].dir ? &rfds : &wfds))
|
|
|
|
|
@{
|
|
|
|
|
assert (n);
|
|
|
|
|
n--;
|
|
|
|
|
any = 1;
|
|
|
|
|
/* The I/O callback handler can register/remove callbacks,
|
|
|
|
|
so we have to unlock the file descriptor list. */
|
|
|
|
|
pthread_mutex_unlock (&loop->lock);
|
|
|
|
|
(*fdlist[i].fnc) (fdlist[i].fnc_data, fdlist[i].fd);
|
|
|
|
|
pthread_mutex_lock (&loop->lock);
|
|
|
|
|
@}
|
|
|
|
|
@}
|
|
|
|
|
@}
|
|
|
|
|
pthread_mutex_unlock (&loop->lock);
|
|
|
|
|
return any;
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
wait_for_op (struct event_loop *loop, struct op_result *result)
|
|
|
|
|
@{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
@{
|
|
|
|
|
ret = do_select (loop);
|
|
|
|
|
@}
|
|
|
|
|
while (ret >= 0 && !result->done);
|
|
|
|
|
@}
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
The main function shows how to put it all together.
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
int
|
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
|
@{
|
|
|
|
|
struct event_loop loop;
|
|
|
|
|
struct op_result result;
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_ctx_t ctx;
|
|
|
|
|
gpgme_error_t err;
|
|
|
|
|
gpgme_data_t sig, text;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
int i;
|
2016-02-09 08:03:50 +00:00
|
|
|
|
pthread_mutexattr_t attr;
|
2014-03-05 05:52:49 +00:00
|
|
|
|
struct gpgme_io_cbs io_cbs =
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@{
|
|
|
|
|
add_io_cb,
|
|
|
|
|
&loop,
|
|
|
|
|
remove_io_cb,
|
|
|
|
|
event_io_cb,
|
|
|
|
|
&result
|
|
|
|
|
@};
|
|
|
|
|
|
2016-02-09 08:03:50 +00:00
|
|
|
|
init_gpgme ();
|
2008-03-05 12:00:57 +00:00
|
|
|
|
|
2002-07-03 02:22:38 +00:00
|
|
|
|
/* Initialize the loop structure. */
|
2016-02-09 08:03:50 +00:00
|
|
|
|
|
|
|
|
|
/* The mutex must be recursive, since remove_io_cb (which acquires a
|
|
|
|
|
lock) can be called while holding a lock acquired in do_select. */
|
|
|
|
|
pthread_mutexattr_init (&attr);
|
|
|
|
|
pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
|
|
|
|
|
pthread_mutex_init (&loop.lock, &attr);
|
|
|
|
|
pthread_mutexattr_destroy (&attr);
|
|
|
|
|
|
2002-07-03 02:22:38 +00:00
|
|
|
|
for (i = 0; i < MAX_FDS; i++)
|
2016-02-09 08:03:50 +00:00
|
|
|
|
loop.fds[i].fd = -1;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
|
|
|
|
|
/* Initialize the result structure. */
|
|
|
|
|
result.done = 0;
|
|
|
|
|
|
|
|
|
|
err = gpgme_data_new_from_file (&sig, "signature", 1);
|
|
|
|
|
if (!err)
|
|
|
|
|
err = gpgme_data_new_from_file (&text, "text", 1);
|
|
|
|
|
if (!err)
|
|
|
|
|
err = gpgme_new (&ctx);
|
|
|
|
|
if (!err)
|
|
|
|
|
@{
|
|
|
|
|
gpgme_set_io_cbs (ctx, &io_cbs);
|
2011-05-12 12:45:46 +00:00
|
|
|
|
err = gpgme_op_verify_start (ctx, sig, text, NULL);
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@}
|
|
|
|
|
if (err)
|
|
|
|
|
@{
|
2003-06-05 23:20:29 +00:00
|
|
|
|
fprintf (stderr, "gpgme error: %s: %s\n",
|
|
|
|
|
gpgme_strsource (err), gpgme_strerror (err));
|
2002-07-03 02:22:38 +00:00
|
|
|
|
exit (1);
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
wait_for_op (&loop, &result);
|
|
|
|
|
if (!result.done)
|
|
|
|
|
@{
|
|
|
|
|
fprintf (stderr, "select error\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
@}
|
|
|
|
|
if (!result.err)
|
|
|
|
|
@{
|
2003-06-05 23:20:29 +00:00
|
|
|
|
fprintf (stderr, "verification failed: %s: %s\n",
|
|
|
|
|
gpgme_strsource (result.err), gpgme_strerror (result.err));
|
2002-07-03 02:22:38 +00:00
|
|
|
|
exit (1);
|
|
|
|
|
@}
|
2011-05-12 12:45:46 +00:00
|
|
|
|
/* Evaluate verify result. */
|
2002-07-03 02:22:38 +00:00
|
|
|
|
@dots{}
|
|
|
|
|
return 0;
|
|
|
|
|
@}
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node I/O Callback Example GTK+
|
|
|
|
|
@subsubsection I/O Callback Example GTK+
|
|
|
|
|
@cindex GTK+, using @acronym{GPGME} with
|
|
|
|
|
|
|
|
|
|
The I/O callback interface can be used to integrate @acronym{GPGME}
|
|
|
|
|
with the GTK+ event loop. The following code snippets shows how this
|
|
|
|
|
can be done using the appropriate register and remove I/O callback
|
|
|
|
|
functions. In this example, the private data of the register I/O
|
|
|
|
|
callback function is unused. The event notifications is missing
|
|
|
|
|
because it does not require any GTK+ specific setup.
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
|
struct my_gpgme_io_cb
|
|
|
|
|
@{
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_io_cb_t fnc;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
void *fnc_data;
|
|
|
|
|
guint input_handler_id
|
|
|
|
|
@};
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
my_gpgme_io_cb (gpointer data, gint source, GdkInputCondition condition)
|
|
|
|
|
@{
|
|
|
|
|
struct my_gpgme_io_cb *iocb = data;
|
|
|
|
|
(*(iocb->fnc)) (iocb->data, source);
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
my_gpgme_remove_io_cb (void *data)
|
|
|
|
|
@{
|
|
|
|
|
struct my_gpgme_io_cb *iocb = data;
|
|
|
|
|
gtk_input_remove (data->input_handler_id);
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
void
|
2003-05-18 20:45:24 +00:00
|
|
|
|
my_gpgme_register_io_callback (void *data, int fd, int dir, gpgme_io_cb_t fnc,
|
2002-07-03 02:22:38 +00:00
|
|
|
|
void *fnc_data, void **tag)
|
|
|
|
|
@{
|
|
|
|
|
struct my_gpgme_io_cb *iocb = g_malloc (sizeof (struct my_gpgme_io_cb));
|
|
|
|
|
iocb->fnc = fnc;
|
|
|
|
|
iocb->data = fnc_data;
|
|
|
|
|
iocb->input_handler_id = gtk_input_add_full (fd, dir
|
|
|
|
|
? GDK_INPUT_READ
|
|
|
|
|
: GDK_INPUT_WRITE,
|
|
|
|
|
my_gpgme_io_callback,
|
|
|
|
|
0, iocb, NULL);
|
|
|
|
|
*tag = iocb;
|
|
|
|
|
return 0;
|
|
|
|
|
@}
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node I/O Callback Example GDK
|
|
|
|
|
@subsubsection I/O Callback Example GDK
|
|
|
|
|
@cindex GDK, using @acronym{GPGME} with
|
|
|
|
|
|
|
|
|
|
The I/O callback interface can also be used to integrate
|
|
|
|
|
@acronym{GPGME} with the GDK event loop. The following code snippets
|
|
|
|
|
shows how this can be done using the appropriate register and remove
|
|
|
|
|
I/O callback functions. In this example, the private data of the
|
|
|
|
|
register I/O callback function is unused. The event notifications is
|
|
|
|
|
missing because it does not require any GDK specific setup.
|
|
|
|
|
|
|
|
|
|
It is very similar to the GTK+ example in the previous section.
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
#include <gdk/gdk.h>
|
|
|
|
|
|
|
|
|
|
struct my_gpgme_io_cb
|
|
|
|
|
@{
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_io_cb_t fnc;
|
2002-07-03 02:22:38 +00:00
|
|
|
|
void *fnc_data;
|
|
|
|
|
gint tag;
|
|
|
|
|
@};
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
my_gpgme_io_cb (gpointer data, gint source, GdkInputCondition condition)
|
|
|
|
|
@{
|
|
|
|
|
struct my_gpgme_io_cb *iocb = data;
|
|
|
|
|
(*(iocb->fnc)) (iocb->data, source);
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
my_gpgme_remove_io_cb (void *data)
|
|
|
|
|
@{
|
|
|
|
|
struct my_gpgme_io_cb *iocb = data;
|
|
|
|
|
gdk_input_remove (data->tag);
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
void
|
2003-05-18 20:45:24 +00:00
|
|
|
|
my_gpgme_register_io_callback (void *data, int fd, int dir, gpgme_io_cb_t fnc,
|
2002-07-03 02:22:38 +00:00
|
|
|
|
void *fnc_data, void **tag)
|
|
|
|
|
@{
|
|
|
|
|
struct my_gpgme_io_cb *iocb = g_malloc (sizeof (struct my_gpgme_io_cb));
|
|
|
|
|
iocb->fnc = fnc;
|
|
|
|
|
iocb->data = fnc_data;
|
|
|
|
|
iocb->tag = gtk_input_add_full (fd, dir ? GDK_INPUT_READ : GDK_INPUT_WRITE,
|
|
|
|
|
my_gpgme_io_callback, iocb, NULL);
|
|
|
|
|
*tag = iocb;
|
|
|
|
|
return 0;
|
|
|
|
|
@}
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
|
2004-03-07 22:32:49 +00:00
|
|
|
|
@node I/O Callback Example Qt
|
|
|
|
|
@subsubsection I/O Callback Example Qt
|
|
|
|
|
@cindex Qt, using @acronym{GPGME} with
|
|
|
|
|
|
|
|
|
|
The I/O callback interface can also be used to integrate
|
|
|
|
|
@acronym{GPGME} with the Qt event loop. The following code snippets
|
|
|
|
|
show how this can be done using the appropriate register and remove
|
|
|
|
|
I/O callback functions. In this example, the private data of the
|
|
|
|
|
register I/O callback function is unused. The event notifications is
|
|
|
|
|
missing because it does not require any Qt specific setup.
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
#include <qsocketnotifier.h>
|
|
|
|
|
#include <qapplication.h>
|
|
|
|
|
|
|
|
|
|
struct IOCB @{
|
|
|
|
|
IOCB( GpgmeIOCb f, void * d, QSocketNotifier * n )
|
|
|
|
|
: func( f ), data( d ), notifier( n ) @{@}
|
|
|
|
|
GpgmeIOCb func;
|
|
|
|
|
void * data;
|
|
|
|
|
QSocketNotifier * notifier;
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
class MyApp : public QApplication @{
|
|
|
|
|
|
|
|
|
|
// ...
|
2012-05-02 08:35:47 +00:00
|
|
|
|
|
2004-03-07 22:32:49 +00:00
|
|
|
|
static void registerGpgmeIOCallback( void * data, int fd, int dir,
|
|
|
|
|
GpgmeIOCb func, void * func_data,
|
|
|
|
|
void ** tag ) @{
|
|
|
|
|
QSocketNotifier * n =
|
|
|
|
|
new QSocketNotifier( fd, dir ? QSocketNotifier::Read
|
|
|
|
|
: QSocketNotifier::Write );
|
|
|
|
|
connect( n, SIGNAL(activated(int)),
|
|
|
|
|
qApp, SLOT(slotGpgmeIOCallback(int)) );
|
|
|
|
|
qApp->mIOCBs.push_back( IOCB( func, func_data, n ) );
|
|
|
|
|
*tag = (void*)n;
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
static void removeGpgmeIOCallback( void * tag ) @{
|
|
|
|
|
if ( !tag ) return;
|
|
|
|
|
QSocketNotifier * n = static_cast<QSocketNotifier*>( tag );
|
|
|
|
|
for ( QValueList<IOCB>::iterator it = qApp->mIOCBs.begin() ;
|
|
|
|
|
it != qApp->mIOCBs.end() ; ++it )
|
|
|
|
|
if ( it->notifier == n ) @{
|
|
|
|
|
delete it->notifier;
|
|
|
|
|
qApp->mIOCBs.erase( it );
|
|
|
|
|
return;
|
|
|
|
|
@}
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void slotGpgmeIOCallback( int fd ) @{
|
|
|
|
|
for ( QValueList<IOCB>::const_iterator it = mIOCBs.begin() ;
|
|
|
|
|
it != mIOCBs.end() ; ++it )
|
|
|
|
|
if ( it->notifier && it->notifier->socket() == fd )
|
|
|
|
|
(*(it->func)) ( it->func_data, fd );
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
// ...
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QValueList<IOCB> mIOCBs;
|
|
|
|
|
// ...
|
|
|
|
|
@};
|
|
|
|
|
@end example
|
|
|
|
|
|
|
|
|
|
|
2004-02-24 23:08:48 +00:00
|
|
|
|
@node Cancellation
|
|
|
|
|
@subsection Cancellation
|
|
|
|
|
@cindex cryptographic operation, aborting
|
|
|
|
|
@cindex cryptographic operation, cancelling
|
|
|
|
|
@cindex aborting operations
|
|
|
|
|
@cindex cancelling operations
|
|
|
|
|
|
2008-06-27 16:07:33 +00:00
|
|
|
|
Sometimes you do not want to wait for an operation to finish.
|
|
|
|
|
@acronym{GPGME} provides two different functions to achieve that. The
|
|
|
|
|
function @code{gpgme_cancel} takes effect immediately. When it
|
|
|
|
|
returns, the operation is effectively canceled. However, it has some
|
|
|
|
|
limitations and can not be used with synchronous operations. In
|
|
|
|
|
contrast, the function @code{gpgme_cancel_async} can be used with any
|
|
|
|
|
context and from any thread, but it is not guaranteed to take effect
|
|
|
|
|
immediately. Instead, cancellation occurs at the next possible time
|
|
|
|
|
(typically the next time I/O occurs in the target context).
|
2004-02-24 23:08:48 +00:00
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_ctx_t gpgme_cancel (@w{gpgme_ctx_t @var{ctx}})
|
|
|
|
|
The function @code{gpgme_cancel} attempts to cancel a pending
|
|
|
|
|
operation in the context @var{ctx}. This only works if you use the
|
|
|
|
|
global event loop or your own event loop.
|
|
|
|
|
|
|
|
|
|
If you use the global event loop, you must not call @code{gpgme_wait}
|
2015-12-04 08:55:09 +00:00
|
|
|
|
during cancellation. After successful
|
2004-02-24 23:08:48 +00:00
|
|
|
|
cancellation, you can call @code{gpgme_wait} (optionally waiting on
|
|
|
|
|
@var{ctx}), and the context @var{ctx} will appear as if it had
|
|
|
|
|
finished with the error code @code{GPG_ERR_CANCEL}.
|
|
|
|
|
|
2015-12-04 08:55:09 +00:00
|
|
|
|
If you use an external event loop, you must ensure that no I/O
|
2004-02-24 23:08:48 +00:00
|
|
|
|
callbacks are invoked for this context (for example by halting the
|
|
|
|
|
event loop). On successful cancellation, all registered I/O callbacks
|
|
|
|
|
for this context will be unregistered, and a @code{GPGME_EVENT_DONE}
|
2015-12-04 08:55:09 +00:00
|
|
|
|
event with the error code @code{GPG_ERR_CANCEL} will be signalled.
|
2004-02-24 23:08:48 +00:00
|
|
|
|
|
|
|
|
|
The function returns an error code if the cancellation failed (in this
|
|
|
|
|
case the state of @var{ctx} is not modified).
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2008-06-27 16:07:33 +00:00
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_ctx_t gpgme_cancel_async (@w{gpgme_ctx_t @var{ctx}})
|
2016-11-11 05:25:19 +00:00
|
|
|
|
The function @code{gpgme_cancel_async} attempts to cancel a pending
|
2008-06-27 16:07:33 +00:00
|
|
|
|
operation in the context @var{ctx}. This can be called by any thread
|
|
|
|
|
at any time after starting an operation on the context, but will not
|
|
|
|
|
take effect immediately. The actual cancellation happens at the next
|
|
|
|
|
time GPGME processes I/O in that context.
|
|
|
|
|
|
|
|
|
|
The function returns an error code if the cancellation failed (in this
|
|
|
|
|
case the state of @var{ctx} is not modified).
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@c **********************************************************
|
|
|
|
|
@c ******************* Appendices *************************
|
|
|
|
|
@c **********************************************************
|
2004-02-24 23:08:48 +00:00
|
|
|
|
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@include uiserver.texi
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2013-04-16 16:30:20 +00:00
|
|
|
|
@node Debugging
|
|
|
|
|
@appendix How to solve problems
|
|
|
|
|
@cindex debug
|
|
|
|
|
@cindex GPGME_DEBUG
|
|
|
|
|
|
|
|
|
|
Everyone knows that software often does not do what it should do and thus
|
|
|
|
|
there is a need to track down problems. This is in particular true
|
|
|
|
|
for applications using a complex library like @acronym{GPGME} and of
|
|
|
|
|
course also for the library itself. Here we give a few hints on how
|
|
|
|
|
to solve such problems.
|
|
|
|
|
|
|
|
|
|
First of all you should make sure that the keys you want to use are
|
|
|
|
|
installed in the GnuPG engine and are usable. Thus the first test is
|
|
|
|
|
to run the desired operation using @command{gpg} or @command{gpgsm} on
|
|
|
|
|
the command line. If you can't figure out why things don't work, you
|
|
|
|
|
may use @acronym{GPGME}'s built in trace feature. This feature is
|
|
|
|
|
either enabled using the environment variable @code{GPGME_DEBUG} or,
|
|
|
|
|
if this is not possible, by calling the function
|
|
|
|
|
@code{gpgme_set_global_flag}. The value is the trace level and
|
2014-11-06 14:59:06 +00:00
|
|
|
|
an optional file name. If no file name is given the trace output is
|
|
|
|
|
printed to @code{stderr}.
|
2013-04-16 16:30:20 +00:00
|
|
|
|
|
2013-04-30 16:05:04 +00:00
|
|
|
|
@noindent
|
2013-04-16 16:30:20 +00:00
|
|
|
|
For example
|
|
|
|
|
@smallexample
|
|
|
|
|
GPGME_DEBUG=9:/home/user/mygpgme.log
|
|
|
|
|
@end smallexample
|
|
|
|
|
@noindent
|
|
|
|
|
(Note that under Windows you use a semicolon in place of the colon to
|
|
|
|
|
separate the fields.)
|
|
|
|
|
|
|
|
|
|
A trace level of 9 is pretty verbose and thus you may want to start
|
|
|
|
|
off with a lower level. The exact definition of the trace levels and
|
|
|
|
|
the output format may change with any release; you need to check the
|
|
|
|
|
source code for details. In any case the trace log should be helpful
|
|
|
|
|
to understand what is going going on. Warning: The trace log may
|
|
|
|
|
reveal sensitive details like passphrases or other data you use in
|
|
|
|
|
your application. If you are asked to send a log file, make sure that
|
|
|
|
|
you run your tests only with play data.
|
|
|
|
|
|
|
|
|
|
|
2016-09-16 10:20:33 +00:00
|
|
|
|
@node Deprecated Functions
|
|
|
|
|
@appendix Deprecated Functions
|
|
|
|
|
@cindex deprecated
|
|
|
|
|
|
|
|
|
|
For backward compatibility @acronym{GPGME} has a number of functions,
|
|
|
|
|
data types and constants which are deprecated and should not be used
|
|
|
|
|
anymore. We document here those which are really old to help
|
|
|
|
|
understanding old code and to allow migration to their modern
|
|
|
|
|
counterparts.
|
|
|
|
|
|
|
|
|
|
@strong{Warning:} These interfaces will be removed in a future version
|
|
|
|
|
of @acronym{GPGME}.
|
|
|
|
|
|
|
|
|
|
@deftypefun void gpgme_key_release (@w{gpgme_key_t @var{key}})
|
|
|
|
|
The function @code{gpgme_key_release} is equivalent to
|
|
|
|
|
@code{gpgme_key_unref}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun void gpgme_trust_item_release (@w{gpgme_trust_item_t @var{item}})
|
|
|
|
|
The function @code{gpgme_trust_item_release} is an alias for
|
|
|
|
|
@code{gpgme_trust_item_unref}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_import_ext (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{keydata}}, @w{int *@var{nr}})
|
|
|
|
|
The function @code{gpgme_op_import_ext} is equivalent to:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
gpgme_error_t err = gpgme_op_import (ctx, keydata);
|
|
|
|
|
if (!err)
|
|
|
|
|
@{
|
|
|
|
|
gpgme_import_result_t result = gpgme_op_import_result (ctx);
|
|
|
|
|
*nr = result->considered;
|
|
|
|
|
@}
|
|
|
|
|
@end example
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {gpgme_error_t (*gpgme_edit_cb_t) @
|
|
|
|
|
(@w{void *@var{handle}}, @
|
|
|
|
|
@w{gpgme_status_code_t @var{status}}, @
|
|
|
|
|
@w{const char *@var{args}}, @
|
|
|
|
|
@w{int @var{fd}})}
|
|
|
|
|
@tindex gpgme_edit_cb_t
|
|
|
|
|
The @code{gpgme_edit_cb_t} type is the type of functions which
|
|
|
|
|
@acronym{GPGME} calls if it a key edit operation is on-going. The
|
|
|
|
|
status code @var{status} and the argument line @var{args} are passed
|
|
|
|
|
through by @acronym{GPGME} from the crypto engine. The file
|
|
|
|
|
descriptor @var{fd} is -1 for normal status messages. If @var{status}
|
|
|
|
|
indicates a command rather than a status message, the response to the
|
|
|
|
|
command should be written to @var{fd}. The @var{handle} is provided
|
|
|
|
|
by the user at start of operation.
|
|
|
|
|
|
|
|
|
|
The function should return @code{GPG_ERR_FALSE} if it did not handle
|
|
|
|
|
the status code, @code{0} for success, or any other error value.
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_edit (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{key}}, @w{gpgme_edit_cb_t @var{fnc}}, @w{void *@var{handle}}, @w{gpgme_data_t @var{out}})
|
|
|
|
|
Note: This function is deprecated, please use
|
|
|
|
|
@code{gpgme_op_interact} instead.
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_edit} processes the key @var{KEY}
|
|
|
|
|
interactively, using the edit callback function @var{FNC} with the
|
|
|
|
|
handle @var{HANDLE}. The callback is invoked for every status and
|
|
|
|
|
command request from the crypto engine. The output of the crypto
|
|
|
|
|
engine is written to the data object @var{out}.
|
|
|
|
|
|
|
|
|
|
Note that the protocol between the callback function and the crypto
|
|
|
|
|
engine is specific to the crypto engine and no further support in
|
|
|
|
|
implementing this protocol correctly is provided by @acronym{GPGME}.
|
|
|
|
|
|
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
edit operation completes successfully, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} or @var{key} is not a valid pointer, and any error returned
|
|
|
|
|
by the crypto engine or the edit callback handler.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_edit_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{key}}, @w{gpgme_edit_cb_t @var{fnc}}, @w{void *@var{handle}}, @w{gpgme_data_t @var{out}})
|
|
|
|
|
Note: This function is deprecated, please use
|
|
|
|
|
@code{gpgme_op_interact_start} instead.
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_edit_start} initiates a
|
|
|
|
|
@code{gpgme_op_edit} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation was started successfully, and @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} or @var{key} is not a valid pointer.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_card_edit (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{key}}, @w{gpgme_edit_cb_t @var{fnc}}, @w{void *@var{handle}}, @w{gpgme_data_t @var{out}})
|
|
|
|
|
Note: This function is deprecated, please use @code{gpgme_op_interact}
|
|
|
|
|
with the flag @code{GPGME_INTERACT_CARD} instead.
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_card_edit} is analogous to
|
|
|
|
|
@code{gpgme_op_edit}, but should be used to process the smart card corresponding to the key @var{key}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_op_card_edit_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{key}}, @w{gpgme_edit_cb_t @var{fnc}}, @w{void *@var{handle}}, @w{gpgme_data_t @var{out}})
|
|
|
|
|
Note: This function is deprecated, please use @code{gpgme_op_interact_start}
|
|
|
|
|
with the flag @code{GPGME_INTERACT_CARD} instead.
|
|
|
|
|
|
|
|
|
|
The function @code{gpgme_op_card_edit_start} initiates a
|
|
|
|
|
@code{gpgme_op_card_edit} operation. It can be completed by calling
|
|
|
|
|
@code{gpgme_wait} on the context. @xref{Waiting For Completion}.
|
|
|
|
|
|
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
operation was started successfully, and @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{ctx} or @var{key} is not a valid pointer.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_new_with_read_cb (@w{gpgme_data_t *@var{dh}}, @w{int (*@var{readfunc})} (@w{void *@var{hook}}, @w{char *@var{buffer}}, @w{size_t @var{count}}, @w{size_t *@var{nread}}), @w{void *@var{hook_value}})
|
|
|
|
|
The function @code{gpgme_data_new_with_read_cb} creates a new
|
|
|
|
|
@code{gpgme_data_t} object and uses the callback function @var{readfunc}
|
|
|
|
|
to retrieve the data on demand. As the callback function can supply
|
|
|
|
|
the data in any way it wants, this is the most flexible data type
|
|
|
|
|
@acronym{GPGME} provides. However, it can not be used to write data.
|
|
|
|
|
|
|
|
|
|
The callback function receives @var{hook_value} as its first argument
|
|
|
|
|
whenever it is invoked. It should return up to @var{count} bytes in
|
|
|
|
|
@var{buffer}, and return the number of bytes actually read in
|
|
|
|
|
@var{nread}. It may return @code{0} in @var{nread} if no data is
|
|
|
|
|
currently available. To indicate @code{EOF} the function should
|
|
|
|
|
return with an error code of @code{-1} and set @var{nread} to
|
|
|
|
|
@code{0}. The callback function may support to reset its internal
|
|
|
|
|
read pointer if it is invoked with @var{buffer} and @var{nread} being
|
|
|
|
|
@code{NULL} and @var{count} being @code{0}.
|
|
|
|
|
|
|
|
|
|
The function returns the error code @code{GPG_ERR_NO_ERROR} if the
|
|
|
|
|
data object was successfully created, @code{GPG_ERR_INV_VALUE} if
|
|
|
|
|
@var{dh} or @var{readfunc} is not a valid pointer, and
|
|
|
|
|
@code{GPG_ERR_ENOMEM} if not enough memory is available.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun gpgme_error_t gpgme_data_rewind (@w{gpgme_data_t @var{dh}})
|
|
|
|
|
The function @code{gpgme_data_rewind} is equivalent to:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
return (gpgme_data_seek (dh, 0, SEEK_SET) == -1)
|
|
|
|
|
? gpgme_error_from_errno (errno) : 0;
|
|
|
|
|
@end example
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} gpgme_attr_t
|
|
|
|
|
The @code{gpgme_attr_t} type is used to specify a key or trust item
|
|
|
|
|
attribute. The following attributes are defined:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_ATTR_KEYID
|
|
|
|
|
This is the key ID of a sub key. It is representable as a string.
|
|
|
|
|
|
|
|
|
|
For trust items, the trust item refers to the key with this ID.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_FPR
|
|
|
|
|
This is the fingerprint of a sub key. It is representable as a
|
|
|
|
|
string.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_ALGO
|
|
|
|
|
This is the crypto algorithm for which the sub key can be used. It
|
|
|
|
|
is representable as a string and as a number. The numbers correspond
|
|
|
|
|
to the @code{enum gcry_pk_algos} values in the gcrypt library.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_LEN
|
|
|
|
|
This is the key length of a sub key. It is representable as a
|
|
|
|
|
number.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_CREATED
|
|
|
|
|
This is the timestamp at creation time of a sub key. It is
|
|
|
|
|
representable as a number.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_EXPIRE
|
|
|
|
|
This is the expiration time of a sub key. It is representable as a
|
|
|
|
|
number.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_OTRUST
|
|
|
|
|
XXX FIXME (also for trust items)
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_USERID
|
|
|
|
|
This is a user ID. There can be more than one user IDs in a
|
|
|
|
|
@var{gpgme_key_t} object. The first one (with index 0) is the primary
|
|
|
|
|
user ID. The user ID is representable as a number.
|
|
|
|
|
|
|
|
|
|
For trust items, this is the user ID associated with this trust item.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_NAME
|
|
|
|
|
This is the name belonging to a user ID. It is representable as a string.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_EMAIL
|
|
|
|
|
This is the email address belonging to a user ID. It is representable
|
|
|
|
|
as a string.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_COMMENT
|
|
|
|
|
This is the comment belonging to a user ID. It is representable as a
|
|
|
|
|
string.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_VALIDITY
|
|
|
|
|
This is the validity belonging to a user ID. It is representable as a
|
|
|
|
|
string and as a number. See below for a list of available validities.
|
|
|
|
|
|
|
|
|
|
For trust items, this is the validity that is associated with this
|
|
|
|
|
trust item.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_UID_REVOKED
|
|
|
|
|
This specifies if a user ID is revoked. It is representable as a
|
|
|
|
|
number, and is @code{1} if the user ID is revoked, and @code{0}
|
|
|
|
|
otherwise.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_UID_INVALID
|
|
|
|
|
This specifies if a user ID is invalid. It is representable as a
|
|
|
|
|
number, and is @code{1} if the user ID is invalid, and @code{0}
|
|
|
|
|
otherwise.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_LEVEL
|
|
|
|
|
This is the trust level of a trust item.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_TYPE
|
|
|
|
|
This returns information about the type of key. For the string function
|
|
|
|
|
this will eother be "PGP" or "X.509". The integer function returns 0
|
|
|
|
|
for PGP and 1 for X.509. It is also used for the type of a trust item.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_IS_SECRET
|
|
|
|
|
This specifies if the key is a secret key. It is representable as a
|
|
|
|
|
number, and is @code{1} if the key is revoked, and @code{0} otherwise.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_KEY_REVOKED
|
|
|
|
|
This specifies if a sub key is revoked. It is representable as a
|
|
|
|
|
number, and is @code{1} if the key is revoked, and @code{0} otherwise.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_KEY_INVALID
|
|
|
|
|
This specifies if a sub key is invalid. It is representable as a
|
|
|
|
|
number, and is @code{1} if the key is invalid, and @code{0} otherwise.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_KEY_EXPIRED
|
|
|
|
|
This specifies if a sub key is expired. It is representable as a
|
|
|
|
|
number, and is @code{1} if the key is expired, and @code{0} otherwise.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_KEY_DISABLED
|
|
|
|
|
This specifies if a sub key is disabled. It is representable as a
|
|
|
|
|
number, and is @code{1} if the key is disabled, and @code{0} otherwise.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_KEY_CAPS
|
|
|
|
|
This is a description of the capabilities of a sub key. It is
|
|
|
|
|
representable as a string. The string contains the letter ``e'' if
|
|
|
|
|
the key can be used for encryption, ``s'' if the key can be used for
|
|
|
|
|
signatures, and ``c'' if the key can be used for certifications.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_CAN_ENCRYPT
|
|
|
|
|
This specifies if a sub key can be used for encryption. It is
|
|
|
|
|
representable as a number, and is @code{1} if the sub key can be used
|
|
|
|
|
for encryption, and @code{0} otherwise.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_CAN_SIGN
|
|
|
|
|
This specifies if a sub key can be used to create data signatures. It
|
|
|
|
|
is representable as a number, and is @code{1} if the sub key can be
|
|
|
|
|
used for signatures, and @code{0} otherwise.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_CAN_CERTIFY
|
|
|
|
|
This specifies if a sub key can be used to create key certificates.
|
|
|
|
|
It is representable as a number, and is @code{1} if the sub key can be
|
|
|
|
|
used for certifications, and @code{0} otherwise.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_SERIAL
|
|
|
|
|
The X.509 issuer serial attribute of the key. It is representable as
|
|
|
|
|
a string.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_ISSUE
|
|
|
|
|
The X.509 issuer name attribute of the key. It is representable as a
|
|
|
|
|
string.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_CHAINID
|
|
|
|
|
The X.509 chain ID can be used to build the certification chain. It
|
|
|
|
|
is representable as a string.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftypefun {const char *} gpgme_key_get_string_attr (@w{gpgme_key_t @var{key}}, @w{gpgme_attr_t @var{what}}, @w{const void *@var{reserved}}, @w{int @var{idx}})
|
|
|
|
|
The function @code{gpgme_key_get_string_attr} returns the value of the
|
|
|
|
|
string-representable attribute @var{what} of key @var{key}. If the
|
|
|
|
|
attribute is an attribute of a sub key or an user ID, @var{idx}
|
|
|
|
|
specifies the sub key or user ID of which the attribute value is
|
|
|
|
|
returned. The argument @var{reserved} is reserved for later use and
|
|
|
|
|
should be @code{NULL}.
|
|
|
|
|
|
|
|
|
|
The string returned is only valid as long as the key is valid.
|
|
|
|
|
|
|
|
|
|
The function returns @code{0} if an attribute can't be returned as a
|
|
|
|
|
string, @var{key} is not a valid pointer, @var{idx} out of range,
|
|
|
|
|
or @var{reserved} not @code{NULL}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun {unsigned long} gpgme_key_get_ulong_attr (@w{gpgme_key_t @var{key}}, @w{gpgme_attr_t @var{what}}, @w{const void *@var{reserved}}, @w{int @var{idx}})
|
|
|
|
|
The function @code{gpgme_key_get_ulong_attr} returns the value of the
|
|
|
|
|
number-representable attribute @var{what} of key @var{key}. If the
|
|
|
|
|
attribute is an attribute of a sub key or an user ID, @var{idx}
|
|
|
|
|
specifies the sub key or user ID of which the attribute value is
|
|
|
|
|
returned. The argument @var{reserved} is reserved for later use and
|
|
|
|
|
should be @code{NULL}.
|
|
|
|
|
|
|
|
|
|
The function returns @code{0} if the attribute can't be returned as a
|
|
|
|
|
number, @var{key} is not a valid pointer, @var{idx} out of range, or
|
|
|
|
|
@var{reserved} not @code{NULL}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@c
|
|
|
|
|
@c Key Signatures
|
|
|
|
|
@c
|
|
|
|
|
The signatures on a key are only available if the key was retrieved
|
|
|
|
|
via a listing operation with the @code{GPGME_KEYLIST_MODE_SIGS} mode
|
|
|
|
|
enabled, because it is expensive to retrieve all signatures of a key.
|
|
|
|
|
|
|
|
|
|
So, before using the below interfaces to retrieve the signatures on a
|
|
|
|
|
key, you have to make sure that the key was listed with signatures
|
|
|
|
|
enabled. One convenient, but blocking, way to do this is to use the
|
|
|
|
|
function @code{gpgme_get_key}.
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} gpgme_attr_t
|
|
|
|
|
The @code{gpgme_attr_t} type is used to specify a key signature
|
|
|
|
|
attribute. The following attributes are defined:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_ATTR_KEYID
|
|
|
|
|
This is the key ID of the key which was used for the signature. It is
|
|
|
|
|
representable as a string.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_ALGO
|
|
|
|
|
This is the crypto algorithm used to create the signature. It is
|
|
|
|
|
representable as a string and as a number. The numbers correspond to
|
|
|
|
|
the @code{enum gcry_pk_algos} values in the gcrypt library.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_CREATED
|
|
|
|
|
This is the timestamp at creation time of the signature. It is
|
|
|
|
|
representable as a number.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_EXPIRE
|
|
|
|
|
This is the expiration time of the signature. It is representable as
|
|
|
|
|
a number.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_USERID
|
|
|
|
|
This is the user ID associated with the signing key. The user ID is
|
|
|
|
|
representable as a number.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_NAME
|
|
|
|
|
This is the name belonging to a user ID. It is representable as a string.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_EMAIL
|
|
|
|
|
This is the email address belonging to a user ID. It is representable
|
|
|
|
|
as a string.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_COMMENT
|
|
|
|
|
This is the comment belonging to a user ID. It is representable as a
|
|
|
|
|
string.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_KEY_REVOKED
|
|
|
|
|
This specifies if a key signature is a revocation signature. It is
|
|
|
|
|
representable as a number, and is @code{1} if the key is revoked, and
|
|
|
|
|
@code{0} otherwise.
|
|
|
|
|
|
|
|
|
|
@c @item GPGME_ATTR_KEY_EXPIRED
|
|
|
|
|
@c This specifies if a key signature is expired. It is representable as
|
|
|
|
|
@c a number, and is @code{1} if the key is revoked, and @code{0}
|
|
|
|
|
@c otherwise.
|
|
|
|
|
@c
|
|
|
|
|
@item GPGME_ATTR_SIG_CLASS
|
|
|
|
|
This specifies the signature class of a key signature. It is
|
|
|
|
|
representable as a number. The meaning is specific to the crypto
|
|
|
|
|
engine.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_SIG_CLASS
|
|
|
|
|
This specifies the signature class of a key signature. It is
|
|
|
|
|
representable as a number. The meaning is specific to the crypto
|
|
|
|
|
engine.
|
|
|
|
|
|
|
|
|
|
@item GPGME_ATTR_SIG_STATUS
|
|
|
|
|
This is the same value as returned by @code{gpgme_get_sig_status}.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftypefun {const char *} gpgme_key_sig_get_string_attr (@w{gpgme_key_t @var{key}}, @w{int @var{uid_idx}}, @w{gpgme_attr_t @var{what}}, @w{const void *@var{reserved}}, @w{int @var{idx}})
|
|
|
|
|
The function @code{gpgme_key_sig_get_string_attr} returns the value of
|
|
|
|
|
the string-representable attribute @var{what} of the signature
|
|
|
|
|
@var{idx} on the user ID @var{uid_idx} in the key @var{key}. The
|
|
|
|
|
argument @var{reserved} is reserved for later use and should be
|
|
|
|
|
@code{NULL}.
|
|
|
|
|
|
|
|
|
|
The string returned is only valid as long as the key is valid.
|
|
|
|
|
|
|
|
|
|
The function returns @code{0} if an attribute can't be returned as a
|
|
|
|
|
string, @var{key} is not a valid pointer, @var{uid_idx} or @var{idx}
|
|
|
|
|
out of range, or @var{reserved} not @code{NULL}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun {unsigned long} gpgme_key_sig_get_ulong_attr (@w{gpgme_key_t @var{key}}, @w{int @var{uid_idx}}, @w{gpgme_attr_t @var{what}}, @w{const void *@var{reserved}}, @w{int @var{idx}})
|
|
|
|
|
The function @code{gpgme_key_sig_get_ulong_attr} returns the value of
|
|
|
|
|
the number-representable attribute @var{what} of the signature
|
|
|
|
|
@var{idx} on the user ID @var{uid_idx} in the key @var{key}. The
|
|
|
|
|
argument @var{reserved} is reserved for later use and should be
|
|
|
|
|
@code{NULL}.
|
|
|
|
|
|
|
|
|
|
The function returns @code{0} if an attribute can't be returned as a
|
|
|
|
|
string, @var{key} is not a valid pointer, @var{uid_idx} or @var{idx}
|
|
|
|
|
out of range, or @var{reserved} not @code{NULL}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@c node Information About Trust Items
|
|
|
|
|
@c subsection Information About Trust Items
|
|
|
|
|
@c cindex trust item, information about
|
|
|
|
|
@c cindex trust item, attributes
|
|
|
|
|
@c cindex attributes, of a trust item
|
|
|
|
|
|
|
|
|
|
Trust items have attributes which can be queried using the interfaces
|
|
|
|
|
below. The attribute identifiers are shared with those for key
|
|
|
|
|
attributes. @xref{Information About Keys}.
|
|
|
|
|
|
|
|
|
|
@deftypefun {const char *} gpgme_trust_item_get_string_attr (@w{gpgme_trust_item_t @var{item}}, @w{gpgme_attr_t @var{what}}, @w{const void *@var{reserved}}, @w{int @var{idx}})
|
|
|
|
|
The function @code{gpgme_trust_item_get_string_attr} returns the value
|
|
|
|
|
of the string-representable attribute @var{what} of trust item
|
|
|
|
|
@var{item}. The arguments @var{idx} and @var{reserved} are reserved
|
|
|
|
|
for later use and should be @code{0} and @code{NULL} respectively.
|
|
|
|
|
|
|
|
|
|
The string returned is only valid as long as the key is valid.
|
|
|
|
|
|
|
|
|
|
The function returns @code{0} if an attribute can't be returned as a
|
|
|
|
|
string, @var{key} is not a valid pointer, @var{idx} out of range,
|
|
|
|
|
or @var{reserved} not @code{NULL}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun int gpgme_trust_item_get_int_attr (@w{gpgme_trust_item_t @var{item}}, @w{gpgme_attr_t @var{what}}, @w{const void *@var{reserved}}, @w{int @var{idx}})
|
|
|
|
|
The function @code{gpgme_trust_item_get_int_attr} returns the value of
|
|
|
|
|
the number-representable attribute @var{what} of trust item
|
|
|
|
|
@var{item}. If the attribute occurs more than once in the trust item,
|
|
|
|
|
the index is specified by @var{idx}. However, currently no such
|
|
|
|
|
attribute exists, so @var{idx} should be @code{0}. The argument
|
|
|
|
|
@var{reserved} is reserved for later use and should be @code{NULL}.
|
|
|
|
|
|
|
|
|
|
The function returns @code{0} if the attribute can't be returned as a
|
|
|
|
|
number, @var{key} is not a valid pointer, @var{idx} out of range,
|
|
|
|
|
or @var{reserved} not @code{NULL}.
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@deftp {Data type} {enum gpgme_sig_stat_t}
|
|
|
|
|
@tindex gpgme_sig_stat_t
|
|
|
|
|
The @code{gpgme_sig_stat_t} type holds the result of a signature check, or
|
|
|
|
|
the combined result of all signatures. The following results are
|
|
|
|
|
possible:
|
|
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
@item GPGME_SIG_STAT_NONE
|
|
|
|
|
This status should not occur in normal operation.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_STAT_GOOD
|
|
|
|
|
This status indicates that the signature is valid. For the combined
|
|
|
|
|
result this status means that all signatures are valid.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_STAT_GOOD_EXP
|
|
|
|
|
This status indicates that the signature is valid but expired. For
|
|
|
|
|
the combined result this status means that all signatures are valid
|
|
|
|
|
and expired.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_STAT_GOOD_EXPKEY
|
|
|
|
|
This status indicates that the signature is valid but the key used to
|
|
|
|
|
verify the signature has expired. For the combined result this status
|
|
|
|
|
means that all signatures are valid and all keys are expired.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_STAT_BAD
|
|
|
|
|
This status indicates that the signature is invalid. For the combined
|
|
|
|
|
result this status means that all signatures are invalid.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_STAT_NOKEY
|
|
|
|
|
This status indicates that the signature could not be verified due to
|
|
|
|
|
a missing key. For the combined result this status means that all
|
|
|
|
|
signatures could not be checked due to missing keys.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_STAT_NOSIG
|
|
|
|
|
This status indicates that the signature data provided was not a real
|
|
|
|
|
signature.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_STAT_ERROR
|
|
|
|
|
This status indicates that there was some other error which prevented
|
|
|
|
|
the signature verification.
|
|
|
|
|
|
|
|
|
|
@item GPGME_SIG_STAT_DIFF
|
|
|
|
|
For the combined result this status means that at least two signatures
|
|
|
|
|
have a different status. You can get each key's status with
|
|
|
|
|
@code{gpgme_get_sig_status}.
|
|
|
|
|
@end table
|
|
|
|
|
@end deftp
|
|
|
|
|
|
|
|
|
|
@deftypefun {const char *} gpgme_get_sig_status (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{idx}}, @w{gpgme_sig_stat_t *@var{r_stat}}, @w{time_t *@var{r_created}})
|
|
|
|
|
The function @code{gpgme_get_sig_status} is equivalent to:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
gpgme_verify_result_t result;
|
|
|
|
|
gpgme_signature_t sig;
|
|
|
|
|
|
|
|
|
|
result = gpgme_op_verify_result (ctx);
|
|
|
|
|
sig = result->signatures;
|
|
|
|
|
|
|
|
|
|
while (sig && idx)
|
|
|
|
|
@{
|
|
|
|
|
sig = sig->next;
|
|
|
|
|
idx--;
|
|
|
|
|
@}
|
|
|
|
|
if (!sig || idx)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (r_stat)
|
|
|
|
|
@{
|
|
|
|
|
switch (gpg_err_code (sig->status))
|
|
|
|
|
@{
|
|
|
|
|
case GPG_ERR_NO_ERROR:
|
|
|
|
|
*r_stat = GPGME_SIG_STAT_GOOD;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GPG_ERR_BAD_SIGNATURE:
|
|
|
|
|
*r_stat = GPGME_SIG_STAT_BAD;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GPG_ERR_NO_PUBKEY:
|
|
|
|
|
*r_stat = GPGME_SIG_STAT_NOKEY;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GPG_ERR_NO_DATA:
|
|
|
|
|
*r_stat = GPGME_SIG_STAT_NOSIG;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GPG_ERR_SIG_EXPIRED:
|
|
|
|
|
*r_stat = GPGME_SIG_STAT_GOOD_EXP;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GPG_ERR_KEY_EXPIRED:
|
|
|
|
|
*r_stat = GPGME_SIG_STAT_GOOD_EXPKEY;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
*r_stat = GPGME_SIG_STAT_ERROR;
|
|
|
|
|
break;
|
|
|
|
|
@}
|
|
|
|
|
@}
|
|
|
|
|
if (r_created)
|
|
|
|
|
*r_created = sig->timestamp;
|
|
|
|
|
return sig->fpr;
|
|
|
|
|
@end example
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun {const char *} gpgme_get_sig_string_attr (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{idx}}, @w{gpgme_attr_t @var{what}}, @w{int @var{whatidx}})
|
|
|
|
|
The function @code{gpgme_get_sig_string_attr} is equivalent to:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
gpgme_verify_result_t result;
|
|
|
|
|
gpgme_signature_t sig;
|
|
|
|
|
|
|
|
|
|
result = gpgme_op_verify_result (ctx);
|
|
|
|
|
sig = result->signatures;
|
|
|
|
|
|
|
|
|
|
while (sig && idx)
|
|
|
|
|
@{
|
|
|
|
|
sig = sig->next;
|
|
|
|
|
idx--;
|
|
|
|
|
@}
|
|
|
|
|
if (!sig || idx)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
switch (what)
|
|
|
|
|
@{
|
|
|
|
|
case GPGME_ATTR_FPR:
|
|
|
|
|
return sig->fpr;
|
|
|
|
|
|
|
|
|
|
case GPGME_ATTR_ERRTOK:
|
|
|
|
|
if (whatidx == 1)
|
|
|
|
|
return sig->wrong_key_usage ? "Wrong_Key_Usage" : "";
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
@end example
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun {const char *} gpgme_get_sig_ulong_attr (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{idx}}, @w{gpgme_attr_t @var{waht}}, @w{int @var{whatidx}})
|
|
|
|
|
The function @code{gpgme_get_sig_ulong_attr} is equivalent to:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
gpgme_verify_result_t result;
|
|
|
|
|
gpgme_signature_t sig;
|
|
|
|
|
|
|
|
|
|
result = gpgme_op_verify_result (ctx);
|
|
|
|
|
sig = result->signatures;
|
|
|
|
|
|
|
|
|
|
while (sig && idx)
|
|
|
|
|
@{
|
|
|
|
|
sig = sig->next;
|
|
|
|
|
idx--;
|
|
|
|
|
@}
|
|
|
|
|
if (!sig || idx)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
switch (what)
|
|
|
|
|
@{
|
|
|
|
|
case GPGME_ATTR_CREATED:
|
|
|
|
|
return sig->timestamp;
|
|
|
|
|
|
|
|
|
|
case GPGME_ATTR_EXPIRE:
|
|
|
|
|
return sig->exp_timestamp;
|
|
|
|
|
|
|
|
|
|
case GPGME_ATTR_VALIDITY:
|
|
|
|
|
return (unsigned long) sig->validity;
|
|
|
|
|
|
|
|
|
|
case GPGME_ATTR_SIG_STATUS:
|
|
|
|
|
switch (sig->status)
|
|
|
|
|
@{
|
|
|
|
|
case GPG_ERR_NO_ERROR:
|
|
|
|
|
return GPGME_SIG_STAT_GOOD;
|
|
|
|
|
|
|
|
|
|
case GPG_ERR_BAD_SIGNATURE:
|
|
|
|
|
return GPGME_SIG_STAT_BAD;
|
|
|
|
|
|
|
|
|
|
case GPG_ERR_NO_PUBKEY:
|
|
|
|
|
return GPGME_SIG_STAT_NOKEY;
|
|
|
|
|
|
|
|
|
|
case GPG_ERR_NO_DATA:
|
|
|
|
|
return GPGME_SIG_STAT_NOSIG;
|
|
|
|
|
|
|
|
|
|
case GPG_ERR_SIG_EXPIRED:
|
|
|
|
|
return GPGME_SIG_STAT_GOOD_EXP;
|
|
|
|
|
|
|
|
|
|
case GPG_ERR_KEY_EXPIRED:
|
|
|
|
|
return GPGME_SIG_STAT_GOOD_EXPKEY;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return GPGME_SIG_STAT_ERROR;
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
case GPGME_ATTR_SIG_SUMMARY:
|
|
|
|
|
return sig->summary;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
@}
|
|
|
|
|
return 0;
|
|
|
|
|
@end example
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
@deftypefun {const char *} gpgme_get_sig_key (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{idx}}, @w{gpgme_key_t *@var{r_key}})
|
|
|
|
|
The function @code{gpgme_get_sig_key} is equivalent to:
|
|
|
|
|
|
|
|
|
|
@example
|
|
|
|
|
gpgme_verify_result_t result;
|
|
|
|
|
gpgme_signature_t sig;
|
|
|
|
|
|
|
|
|
|
result = gpgme_op_verify_result (ctx);
|
|
|
|
|
sig = result->signatures;
|
|
|
|
|
|
|
|
|
|
while (sig && idx)
|
|
|
|
|
@{
|
|
|
|
|
sig = sig->next;
|
|
|
|
|
idx--;
|
|
|
|
|
@}
|
|
|
|
|
if (!sig || idx)
|
|
|
|
|
return gpg_error (GPG_ERR_EOF);
|
|
|
|
|
|
|
|
|
|
return gpgme_get_key (ctx, sig->fpr, r_key, 0);
|
|
|
|
|
@end example
|
|
|
|
|
@end deftypefun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-16 16:30:20 +00:00
|
|
|
|
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@include lesser.texi
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@include gpl.texi
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
2008-06-04 14:14:38 +00:00
|
|
|
|
@node Concept Index
|
|
|
|
|
@unnumbered Concept Index
|
|
|
|
|
|
|
|
|
|
@printindex cp
|
|
|
|
|
|
2015-08-26 07:28:32 +00:00
|
|
|
|
@node Function and Data Index
|
|
|
|
|
@unnumbered Function and Data Index
|
|
|
|
|
|
|
|
|
|
@printindex fn
|
|
|
|
|
|
2002-01-16 00:41:10 +00:00
|
|
|
|
|
|
|
|
|
@bye
|