summaryrefslogtreecommitdiff
path: root/doc/gpgme.info-1
diff options
context:
space:
mode:
Diffstat (limited to 'doc/gpgme.info-1')
-rw-r--r--doc/gpgme.info-12939
1 files changed, 1555 insertions, 1384 deletions
diff --git a/doc/gpgme.info-1 b/doc/gpgme.info-1
index 26184d8..839678b 100644
--- a/doc/gpgme.info-1
+++ b/doc/gpgme.info-1
@@ -1,7 +1,6 @@
This is gpgme.info, produced by makeinfo version 5.2 from gpgme.texi.
-Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012, 2013,
-2014 g10 Code GmbH.
+Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU General Public License as
@@ -20,11 +19,10 @@ END-INFO-DIR-ENTRY
This file documents the GPGME library.
- This is Edition 1.6.0, last updated 26 August 2015, of ‘The ‘GnuPG
-Made Easy’ Reference Manual’, for Version 1.6.0.
+ This is Edition 1.7.0-beta361, last updated 26 August 2015, of ‘The
+‘GnuPG Made Easy’ Reference Manual’, for Version 1.7.0-beta361.
- Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
-2013, 2014 g10 Code GmbH.
+ Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU General Public License as
@@ -43,8 +41,9 @@ File: gpgme.info, Node: Top, Next: Introduction, Up: (dir)
Main Menu
*********
-This is Edition 1.6.0, last updated 26 August 2015, of ‘The ‘GnuPG Made
-Easy’ Reference Manual’, for Version 1.6.0 of the GPGME library.
+This is Edition 1.7.0-beta361, last updated 26 August 2015, of ‘The
+‘GnuPG Made Easy’ Reference Manual’, for Version 1.7.0-beta361 of the
+GPGME library.
* Menu:
@@ -60,6 +59,7 @@ Appendices
* UI Server Protocol:: The GnuPG UI Server Protocol.
* Debugging:: How to solve problems.
+* Deprecated Functions:: Documentation of deprecated functions.
* Library Copying:: The GNU Lesser General Public License says
how you can copy and share ‘GnuPG Made Easy’.
@@ -156,21 +156,22 @@ Context Attributes
Key Management
+* Key objects:: Description of the key structures.
* Listing Keys:: Browsing the list of available keys.
* Information About Keys:: Requesting detailed information about keys.
-* Key Signatures:: Listing the signatures on a key.
* 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.
Trust Item Management
* Listing Trust Items:: Browsing the list of available trust items.
-* Information About Trust Items:: Requesting information about trust items.
* Manipulating Trust Items:: Operations on trust items.
Crypto Operations
@@ -256,6 +257,12 @@ 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.
+ The documentation for the language bindings is currently not included
+in this manual. Those languages bindings follow the general programming
+model of GPGME but may provide some extra high level abstraction on top
+of the GPGME style API. For now please see the README files in the
+‘lang/’ directory of the source distribution.
+

File: gpgme.info, Node: Features, Next: Overview, Prev: Getting Started, Up: Introduction
@@ -284,6 +291,10 @@ it’s easy
GPGME has been added to a program, it is easy to add support for
other crypto protocols once GPGME backends provide them.
+it’s language friendly
+ GPGME comes with languages bindings for several common programming
+ languages: Common Lisp, C++, Python 2, and Python 3.
+

File: gpgme.info, Node: Overview, Prev: Features, Up: Introduction
@@ -401,6 +412,15 @@ must specify the ‘--thread’ option before any other option to select the
thread package you want to link with. Supported thread packages are
‘--thread=pth’ and ‘--thread=pthread’.
+ If you need to detect the installed language bindings you can use
+list them using:
+
+ gpgme-config --print-lang
+
+ or test for the availability using
+
+ gpgme-config --have-lang=python && echo 'Bindings for Pythons available'
+

File: gpgme.info, Node: Largefile Support (LFS), Next: Using Automake, Prev: Building the Source, Up: Preparation
@@ -616,12 +636,12 @@ File: gpgme.info, Node: Library Version Check, Next: Signal Handling, Prev: U
called as early as possible — even before ‘gpgme_check_version’.
The features are identified by the following values for NAME:
- ‘"debug"’
+ ‘debug’
To enable debugging use the string “debug” for NAME and VALUE
identical to the value used with the environment variable
‘GPGME_DEBUG’.
- ‘"disable-gpgconf"’
+ ‘disable-gpgconf’
Using this feature with any 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
@@ -629,8 +649,8 @@ File: gpgme.info, Node: Library Version Check, Next: Signal Handling, Prev: U
Note that in general the use of ‘gpgme_set_engine_info’ is a
better way to select a specific engine version.
- ‘"gpgconf-name"’
- ‘"gpg-name"’
+ ‘gpgconf-name’
+ ‘gpg-name’
Set the name of the gpgconf respective gpg binary. The
defaults are ‘GNU/GnuPG/gpgconf’ and ‘GNU/GnuPG/gpg’. Under
Unix the leading directory part is ignored. Under Windows the
@@ -638,6 +658,23 @@ File: gpgme.info, Node: Library Version Check, Next: Signal Handling, Prev: U
directory; the ‘.exe’ suffix is added by GPGME. Use forward
slashed even under Windows.
+ ‘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".
+
+ ‘w32-inst-dir’
+ 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.
+
This function returns ‘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
@@ -775,10 +812,13 @@ further interfaces.
‘GPGME_PROTOCOL_CMS’
This specifies the Cryptographic Message Syntax.
- ‘GPGME_PROTOCOL_ASSUAN’
+ ‘GPGME_PROTOCOL_GPGCONF’
Under development. Please ask on <gnupg-devel@gnupg.org> for
help.
+ ‘GPGME_PROTOCOL_ASSUAN’
+ This specifies the raw Assuan protocol.
+
‘GPGME_PROTOCOL_G13’
Under development. Please ask on <gnupg-devel@gnupg.org> for
help.
@@ -809,6 +849,7 @@ further interfaces.
* Engine Configuration:: Changing the engine configuration.
* OpenPGP:: Support for the OpenPGP protocol.
* Cryptographic Message Syntax:: Support for the CMS.
+* Assuan:: Support for the raw Assuan protocol.

File: gpgme.info, Node: Engine Version Check, Next: Engine Information, Up: Protocols and Engines
@@ -826,9 +867,36 @@ File: gpgme.info, Node: Engine Version Check, Next: Engine Information, Up: P
‘homedir’
Return the default home directory.
+ ‘sysconfdir’
+ Return the name of the system configuration directory
+
+ ‘bindir’
+ Return the name of the directory with GnuPG program files.
+
+ ‘libdir’
+ Return the name of the directory with GnuPG related library
+ files.
+
+ ‘libexecdir’
+ Return the name of the directory with GnuPG helper program
+ files.
+
+ ‘datadir’
+ Return the name of the directory with GnuPG shared data.
+
+ ‘localedir’
+ Return the name of the directory with GnuPG locale data.
+
‘agent-socket’
Return the name of the socket to connect to the gpg-agent.
+ ‘agent-ssh-socket’
+ Return the name of the socket to connect to the ssh-agent
+ component of gpg-agent.
+
+ ‘dirmngr-socket’
+ Return the name of the socket to connect to the dirmngr.
+
‘uiserver-socket’
Return the name of the socket to connect to the user interface
server.
@@ -989,7 +1057,7 @@ first protocol that was supported by GPGME.
The OpenPGP protocol is specified by ‘GPGME_PROTOCOL_OpenPGP’.

-File: gpgme.info, Node: Cryptographic Message Syntax, Prev: OpenPGP, Up: Protocols and Engines
+File: gpgme.info, Node: Cryptographic Message Syntax, Next: Assuan, Prev: OpenPGP, Up: Protocols and Engines
3.5 Cryptographic Message Syntax
================================
@@ -999,6 +1067,18 @@ CMS is implemented by GpgSM, the S/MIME implementation for GnuPG.
The CMS protocol is specified by ‘GPGME_PROTOCOL_CMS’.

+File: gpgme.info, Node: Assuan, Prev: Cryptographic Message Syntax, Up: Protocols and Engines
+
+3.6 Assuan
+==========
+
+Assuan is the RPC library used by the various GnuPG components. The
+Assuan protocol allows one to talk to arbitrary Assuan servers using
+GPGME. *Note Using the Assuan protocol::.
+
+ The ASSUAN protocol is specified by ‘GPGME_PROTOCOL_ASSUAN’.
+
+
File: gpgme.info, Node: Algorithms, Next: Error Handling, Prev: Protocols and Engines, Up: Top
4 Algorithms
@@ -1065,6 +1145,9 @@ verification of signatures.
This value indicates ECDH, the Eliptic Curve Diffie-Hellmann
encryption algorithm as defined by RFC-6637.
+ ‘GPGME_PK_EDDSA’
+ This value indicates the EdDSA algorithm.
+
-- Function: const char * gpgme_pubkey_algo_name
(gpgme_pubkey_algo_t ALGO)
The function ‘gpgme_pubkey_algo_name’ returns a pointer to a
@@ -1074,6 +1157,13 @@ verification of signatures.
If ALGO is not a valid public key algorithm, ‘NULL’ is returned.
+ -- Function: char * gpgme_pubkey_algo_string (gpgme_subkey_t KEY)
+ The function ‘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 ‘gpgme_free’. On error (e.g. invalid argument or memory
+ exhausted), the function returns NULL and sets ‘ERRNO’.
+

File: gpgme.info, Node: Hash Algorithms, Prev: Public Key Algorithms, Up: Algorithms
@@ -1764,33 +1854,6 @@ yourself and create a data object from these callback functions.
object was successfully created, and ‘GPG_ERR_ENOMEM’ if not enough
memory is available.
- The following interface is deprecated and only provided for backward
-compatibility. Don’t use it. It will be removed in a future version of
-GPGME.
-
- -- Function: gpgme_error_t gpgme_data_new_with_read_cb
- (gpgme_data_t *DH, int (*READFUNC) (void *HOOK, char *BUFFER,
- size_t COUNT, size_t *NREAD), void *HOOK_VALUE)
- The function ‘gpgme_data_new_with_read_cb’ creates a new
- ‘gpgme_data_t’ object and uses the callback function 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
- GPGME provides. However, it can not be used to write data.
-
- The callback function receives HOOK_VALUE as its first argument
- whenever it is invoked. It should return up to COUNT bytes in
- BUFFER, and return the number of bytes actually read in NREAD. It
- may return ‘0’ in NREAD if no data is currently available. To
- indicate ‘EOF’ the function should return with an error code of
- ‘-1’ and set NREAD to ‘0’. The callback function may support to
- reset its internal read pointer if it is invoked with BUFFER and
- NREAD being ‘NULL’ and COUNT being ‘0’.
-
- The function returns the error code ‘GPG_ERR_NO_ERROR’ if the data
- object was successfully created, ‘GPG_ERR_INV_VALUE’ if DH or
- READFUNC is not a valid pointer, and ‘GPG_ERR_ENOMEM’ if not enough
- memory is available.
-

File: gpgme.info, Node: Destroying Data Buffers, Next: Manipulating Data Buffers, Prev: Creating Data Buffers, Up: Exchanging Data
@@ -1818,9 +1881,10 @@ File: gpgme.info, Node: Destroying Data Buffers, Next: Manipulating Data Buffe
-- Function: void gpgme_free (void *BUFFER)
The function ‘gpgme_free’ releases the memory returned by
- ‘gpgme_data_release_and_get_mem’. It should be used instead of the
- system libraries ‘free’ function in case different allocators are
- used in a single program.
+ ‘gpgme_data_release_and_get_mem’ and ‘gpgme_pubkey_algo_string’.
+ It should be used instead of the system libraries ‘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.

File: gpgme.info, Node: Manipulating Data Buffers, Prev: Destroying Data Buffers, Up: Exchanging Data
@@ -1894,15 +1958,6 @@ File: gpgme.info, Node: Data Buffer I/O Operations, Next: Data Buffer Meta-Dat
If the function fails, -1 is returned and ERRNO is set.
- The following function is deprecated and should not be used. It will
-be removed in a future version of GPGME.
-
- -- Function: gpgme_error_t gpgme_data_rewind (gpgme_data_t DH)
- The function ‘gpgme_data_rewind’ is equivalent to:
-
- return (gpgme_data_seek (dh, 0, SEEK_SET) == -1)
- ? gpgme_error_from_errno (errno) : 0;
-

File: gpgme.info, Node: Data Buffer Meta-Data, Next: Data Buffer Convenience, Prev: Data Buffer I/O Operations, Up: Manipulating Data Buffers
@@ -1956,6 +2011,9 @@ File: gpgme.info, Node: Data Buffer Meta-Data, Next: Data Buffer Convenience,
This specifies that the data is encoded in an armored form as
used by OpenPGP and PEM.
+ ‘GPGME_DATA_ENCODING_MIME’
+ This specifies that the data is encoded as a MIME part.
+
‘GPGME_DATA_ENCODING_URL’
The data is a list of linefeed delimited URLs. This is only
useful with ‘gpgme_op_import’.
@@ -1980,6 +2038,24 @@ File: gpgme.info, Node: Data Buffer Meta-Data, Next: Data Buffer Convenience,
The function ‘gpgme_data_set_encoding’ changes the encoding of the
data object with the handle DH to ENC.
+ -- Function: gpgme_error_t gpgme_data_set_flag (gpgme_data_t DH,
+ const char *NAME, const char *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 NAME:
+
+ ‘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.
+
+ This function returns ‘0’ on success.
+

File: gpgme.info, Node: Data Buffer Convenience, Prev: Data Buffer Meta-Data, Up: Manipulating Data Buffers
@@ -2126,6 +2202,7 @@ File: gpgme.info, Node: Context Attributes, Next: Key Management, Prev: Resul
* ASCII Armor:: Requesting ASCII armored output.
* Text Mode:: Choosing canonical text mode.
* Offline Mode:: Choosing offline mode.
+* Pinentry Mode:: Choosing the pinentry mode.
* Included Certificates:: Including a number of certificates.
* Key Listing Mode:: Selecting key listing mode.
* Passphrase Callback:: Getting the passphrase from the user.
@@ -2244,7 +2321,7 @@ File: gpgme.info, Node: Text Mode, Next: Offline Mode, Prev: ASCII Armor, Up
is enabled, and ‘0’ if it is not, or if CTX is not a valid pointer.

-File: gpgme.info, Node: Offline Mode, Next: Included Certificates, Prev: Text Mode, Up: Context Attributes
+File: gpgme.info, Node: Offline Mode, Next: Pinentry Mode, Prev: Text Mode, Up: Context Attributes
7.4.5 Offline Mode
------------------
@@ -2271,9 +2348,54 @@ File: gpgme.info, Node: Offline Mode, Next: Included Certificates, Prev: Text
enabled, and ‘0’ if it is not, or if CTX is not a valid pointer.

-File: gpgme.info, Node: Included Certificates, Next: Key Listing Mode, Prev: Offline Mode, Up: Context Attributes
+File: gpgme.info, Node: Pinentry Mode, Next: Included Certificates, Prev: Offline Mode, Up: Context Attributes
+
+7.4.6 Pinentry Mode
+-------------------
+
+ -- Function: gpgme_error_t gpgme_set_pinentry_mode (gpgme_ctx_t CTX,
+ gpgme_pinentry_mode_t MODE) The function ‘gpgme_set_pinentry_mode’
+ specifies the pinentry mode to be used.
+
+ For GnuPG >= 2.1 this option is required to be set to
+ ‘GPGME_PINENTRY_MODE_LOOPBACK’ to enable the passphrase callback
+ mechanism in GPGME through ‘gpgme_set_passphrase_cb’.
+
+ -- Function: gpgme_pinentry_mode_t gpgme_get_pinentry_mode
+ (gpgme_ctx_t CTX)
+ The function ‘gpgme_get_pinenty_mode’ returns the mode set for the
+ context.
+
+ -- Data type: enum gpgme_pinentry_mode_t
+ The ‘gpgme_minentry_mode_t’ type specifies the set of possible
+ pinentry modes that are supported by GPGME if GnuPG >= 2.1 is used.
+ The following modes are supported:
+
+ ‘GPGME_PINENTRY_MODE_DEFAULT’
+ Use the default of the agent, which is ask.
+
+ ‘GPGME_PINENTRY_MODE_ASK’
+ Force the use of the Pinentry.
+
+ ‘GPGME_PINENTRY_MODE_CANCEL’
+ Emulate use of Pinentry’s cancel button.
+
+ ‘GPGME_PINENTRY_MODE_ERROR’
+ Return a Pinentry error ‘No Pinentry’.
+
+ ‘GPGME_PINENTRY_MODE_LOOPBACK’
+ Redirect Pinentry queries to the caller. This enables the use
+ of ‘gpgme_set_passphrase_cb’ whis pinentry queries redirected
+ to gpgme.
+
+ Note: This mode requires ‘allow-loopback-pinentry’ to be
+ enabled in the ‘gpg-agent.conf’ or an agent started with that
+ option.
+
+
+File: gpgme.info, Node: Included Certificates, Next: Key Listing Mode, Prev: Pinentry Mode, Up: Context Attributes
-7.4.6 Included Certificates
+7.4.7 Included Certificates
---------------------------
-- Function: void gpgme_set_include_certs (gpgme_ctx_t CTX,
@@ -2311,7 +2433,7 @@ File: gpgme.info, Node: Included Certificates, Next: Key Listing Mode, Prev:

File: gpgme.info, Node: Key Listing Mode, Next: Passphrase Callback, Prev: Included Certificates, Up: Context Attributes
-7.4.7 Key Listing Mode
+7.4.8 Key Listing Mode
----------------------
-- Function: gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t CTX,
@@ -2343,6 +2465,11 @@ File: gpgme.info, Node: Key Listing Mode, Next: Passphrase Callback, Prev: In
in the listed keys. This only works if
‘GPGME_KEYLIST_MODE_SIGS’ is also enabled.
+ ‘GPGME_KEYLIST_MODE_WITH_TOFU’
+ The ‘GPGME_KEYLIST_MODE_WITH_TOFU’ symbol specifies that
+ information pertaining to the TOFU trust model should be
+ included in the listed keys.
+
‘GPGME_KEYLIST_MODE_WITH_SECRET’
The ‘GPGME_KEYLIST_MODE_WITH_SECRET’ returns information about
the presence of a corresponding secret key in a public key
@@ -2389,7 +2516,7 @@ File: gpgme.info, Node: Key Listing Mode, Next: Passphrase Callback, Prev: In

File: gpgme.info, Node: Passphrase Callback, Next: Progress Meter Callback, Prev: Key Listing Mode, Up: Context Attributes
-7.4.8 Passphrase Callback
+7.4.9 Passphrase Callback
-------------------------
-- Data type: gpgme_error_t (*gpgme_passphrase_cb_t)(void *HOOK, const
@@ -2437,6 +2564,10 @@ File: gpgme.info, Node: Passphrase Callback, Next: Progress Meter Callback, P
even support an external passphrase callback at all, in this case
the error code ‘GPG_ERR_NOT_SUPPORTED’ is returned.
+ For GnuPG >= 2.1 the pinentry mode has to be set to
+ ‘GPGME_PINENTRY_MODE_LOOPBACK’ to enable the passphrase callback.
+ See ‘gpgme_set_pinentry_mode’.
+
The user can disable the use of a passphrase callback function by
calling ‘gpgme_set_passphrase_cb’ with PASSFUNC being ‘NULL’.
@@ -2454,8 +2585,8 @@ File: gpgme.info, Node: Passphrase Callback, Next: Progress Meter Callback, P

File: gpgme.info, Node: Progress Meter Callback, Next: Status Message Callback, Prev: Passphrase Callback, Up: Context Attributes
-7.4.9 Progress Meter Callback
------------------------------
+7.4.10 Progress Meter Callback
+------------------------------
-- Data type: void (*gpgme_progress_cb_t)(void *HOOK, const char *WHAT,
int TYPE, int CURRENT, int TOTAL)
@@ -2496,7 +2627,7 @@ File: gpgme.info, Node: Progress Meter Callback, Next: Status Message Callback

File: gpgme.info, Node: Status Message Callback, Next: Locale, Prev: Progress Meter Callback, Up: Context Attributes
-7.4.10 Status Message Callback
+7.4.11 Status Message Callback
------------------------------
-- Data type: gpgme_error_t (*gpgme_status_cb_t)(void *HOOK, const char
@@ -2530,10 +2661,31 @@ File: gpgme.info, Node: Status Message Callback, Next: Locale, Prev: Progress
message callback is set, or CTX is not a valid pointer, ‘NULL’ is
returned in both variables.
+ -- Function: gpgme_error_t gpgme_set_ctx_flag (gpgme_ctx_t CTX,
+ const char *NAME, const char *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 NAME:
+
+ ‘"full-status"’
+ Using a 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.
+
+ ‘"raw-description"’
+ Setting the VALUE to "1" returns human readable strings in a
+ raw format. For example the non breaking space characters
+ ("~") will not be removed from the ‘description’ field of the
+ ‘gpgme_tofu_info_t’ object.
+
+ This function returns ‘0’ on success.
+

File: gpgme.info, Node: Locale, Prev: Status Message Callback, Up: Context Attributes
-7.4.11 Locale
+7.4.12 Locale
-------------
A locale setting can be associated with a context. This locale is
@@ -2578,13 +2730,123 @@ 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.
+* 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.
+
+
+File: gpgme.info, Node: Key objects, Next: Listing Keys, Up: Key Management
+
+7.5.1 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.
+
+ -- Data type: gpgme_key_t
+
+ The ‘gpgme_key_t’ type is a pointer to a key object. It has the
+ following members:
+
+ ‘gpgme_keylist_mode_t keylist_mode’
+ The keylist mode that was active when the key was retrieved.
+
+ ‘unsigned int revoked : 1’
+ This is true if the key is revoked.
+
+ ‘unsigned int expired : 1’
+ This is true if the key is expired.
+
+ ‘unsigned int disabled : 1’
+ This is true if the key is disabled.
+
+ ‘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.
+
+ ‘unsigned int can_encrypt : 1’
+ This is true if the key (ie one of its subkeys) can be used
+ for encryption.
+
+ ‘unsigned int can_sign : 1’
+ This is true if the key (ie one of its subkeys) can be used to
+ create data signatures.
+
+ ‘unsigned int can_certify : 1’
+ This is true if the key (ie one of its subkeys) can be used to
+ create key certificates.
+
+ ‘unsigned int can_authenticate : 1’
+ This is true if the key (ie one of its subkeys) can be used
+ for authentication.
+
+ ‘unsigned int is_qualified : 1’
+ This is true if the key can be used for qualified signatures
+ according to local government regulations.
+
+ ‘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
+ ‘GPGME_KEYLIST_MODE_WITH_SECRET’ is active.
+
+ ‘gpgme_protocol_t protocol’
+ This is the protocol supported by this key.
+
+ ‘char *issuer_serial’
+ If ‘protocol’ is ‘GPGME_PROTOCOL_CMS’, then this is the issuer
+ serial.
+
+ ‘char *issuer_name’
+ If ‘protocol’ is ‘GPGME_PROTOCOL_CMS’, then this is the issuer
+ name.
+
+ ‘char *chain_id’
+ If ‘protocol’ is ‘GPGME_PROTOCOL_CMS’, then this is the chain
+ ID, which can be used to built the certificate chain.
+
+ ‘gpgme_validity_t owner_trust’
+ If ‘protocol’ is ‘GPGME_PROTOCOL_OpenPGP’, then this is the
+ owner trust.
+
+ ‘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.
+
+ ‘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.
+
+ ‘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.
+
-- Data type: gpgme_subkey_t
- The ‘gpgme_subkey_t’ type is a pointer to a subkey structure. Sub
- keys are one component of a ‘gpgme_key_t’ object. In fact, subkeys
- are those parts that contains the real information about the
- individual cryptographic keys that belong to the same key object.
- One ‘gpgme_key_t’ can contain several subkeys. The first subkey in
- the linked list is also called the primary key.
+
+ The ‘gpgme_subkey_t’ type is a pointer to a subkey structure.
+ Subkeys are one component of a ‘gpgme_key_t’ object. In fact,
+ subkeys are those parts that contains the real information about
+ the individual cryptographic keys that belong to the same key
+ object. One ‘gpgme_key_t’ can contain several subkeys. The first
+ subkey in the linked list is also called the primary key.
The subkey structure has the following members:
@@ -2642,6 +2904,10 @@ how such keys can be selected and manipulated.
This is the fingerprint of the subkey in hexadecimal digits,
if available.
+ ‘char *keygrip’
+ The keygrip of the subkey in hex digit form or ‘NULL’ if not
+ availabale.
+
‘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.
@@ -2657,12 +2923,59 @@ how such keys can be selected and manipulated.
The serial number of a smart card holding this key or ‘NULL’.
‘char *curve’
- For ECC algoritms the name of the curve.
+ For ECC algorithms the name of the curve.
+
+ -- Data type: gpgme_user_id_t
+
+ A user ID is a component of a ‘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.
+
+ ‘gpgme_user_id_t next’
+ This is a pointer to the next user ID structure in the linked
+ list, or ‘NULL’ if this is the last element.
+
+ ‘unsigned int revoked : 1’
+ This is true if the user ID is revoked.
+
+ ‘unsigned int invalid : 1’
+ This is true if the user ID is invalid.
+
+ ‘gpgme_validity_t validity’
+ This specifies the validity of the user ID.
+
+ ‘char *uid’
+ This is the user ID string.
+
+ ‘char *name’
+ This is the name component of ‘uid’, if available.
+
+ ‘char *comment’
+ This is the comment component of ‘uid’, if available.
+
+ ‘char *email’
+ This is the email component of ‘uid’, if available.
+
+ ‘char *address;’
+ The mail address (addr-spec from RFC-5322) of the user ID
+ string. This is general the same as the ‘email’ part of this
+ structure but might be slightly different. If no mail address
+ is available ‘NULL’ is stored.
+
+ ‘gpgme_tofu_info_t tofu’
+ If not ‘NULL’ information from the TOFU database pertaining to
+ this user id.
+
+ ‘gpgme_key_sig_t signatures’
+ This is a linked list with the signatures on this user ID.
-- Data type: gpgme_key_sig_t
+
The ‘gpgme_key_sig_t’ type is a pointer to a key signature
structure. Key signatures are one component of a ‘gpgme_key_t’
- object, and validate user IDs on the key.
+ object, and validate user IDs on the key in the OpenPGP protocol.
The signatures on a key are only available if the key was retrieved
via a listing operation with the ‘GPGME_KEYLIST_MODE_SIGS’ mode
@@ -2732,134 +3045,10 @@ how such keys can be selected and manipulated.
‘gpgme_sig_notation_t notations’
This is a linked list with the notation data and policy URLs.
- -- Data type: gpgme_user_id_t
- A user ID is a component of a ‘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.
-
- ‘gpgme_user_id_t next’
- This is a pointer to the next user ID structure in the linked
- list, or ‘NULL’ if this is the last element.
-
- ‘unsigned int revoked : 1’
- This is true if the user ID is revoked.
-
- ‘unsigned int invalid : 1’
- This is true if the user ID is invalid.
-
- ‘gpgme_validity_t validity’
- This specifies the validity of the user ID.
-
- ‘char *uid’
- This is the user ID string.
-
- ‘char *name’
- This is the name component of ‘uid’, if available.
-
- ‘char *comment’
- This is the comment component of ‘uid’, if available.
-
- ‘char *email’
- This is the email component of ‘uid’, if available.
-
- ‘gpgme_key_sig_t signatures’
- This is a linked list with the signatures on this user ID.
-
- -- Data type: gpgme_key_t
- The ‘gpgme_key_t’ type is a pointer to a key object. It has the
- following members:
-
- ‘gpgme_keylist_mode_t keylist_mode’
- The keylist mode that was active when the key was retrieved.
-
- ‘unsigned int revoked : 1’
- This is true if the key is revoked.
-
- ‘unsigned int expired : 1’
- This is true if the key is expired.
-
- ‘unsigned int disabled : 1’
- This is true if the key is disabled.
-
- ‘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
- in during key listsing if the key could not be validated due
- to a missing certificates or unmatched policies.
-
- ‘unsigned int can_encrypt : 1’
- This is true if the key (ie one of its subkeys) can be used
- for encryption.
-
- ‘unsigned int can_sign : 1’
- This is true if the key (ie one of its subkeys) can be used to
- create data signatures.
-
- ‘unsigned int can_certify : 1’
- This is true if the key (ie one of its subkeys) can be used to
- create key certificates.
-
- ‘unsigned int can_authenticate : 1’
- This is true if the key (ie one of its subkeys) can be used
- for authentication.
-
- ‘unsigned int is_qualified : 1’
- This is true if the key can be used for qualified signatures
- according to local government regulations.
-
- ‘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
- ‘GPGME_KEYLIST_MODE_WITH_SECRET’ is active.
-
- ‘gpgme_protocol_t protocol’
- This is the protocol supported by this key.
-
- ‘char *issuer_serial’
- If ‘protocol’ is ‘GPGME_PROTOCOL_CMS’, then this is the issuer
- serial.
-
- ‘char *issuer_name’
- If ‘protocol’ is ‘GPGME_PROTOCOL_CMS’, then this is the issuer
- name.
-
- ‘char *chain_id’
- If ‘protocol’ is ‘GPGME_PROTOCOL_CMS’, then this is the chain
- ID, which can be used to built the certificate chain.
-
- ‘gpgme_validity_t owner_trust’
- If ‘protocol’ is ‘GPGME_PROTOCOL_OpenPGP’, then this is the
- owner trust.
-
- ‘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.
-
- ‘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.
-
-* Menu:
-
-* Listing Keys:: Browsing the list of available keys.
-* Information About Keys:: Requesting detailed information about keys.
-* Key Signatures:: Listing the signatures on a key.
-* Manipulating Keys:: Operations on keys.
-* Generating Keys:: Creating new key pairs.
-* 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.
-* Advanced Key Editing:: Advanced key edit operation.
-

-File: gpgme.info, Node: Listing Keys, Next: Information About Keys, Up: Key Management
+File: gpgme.info, Node: Listing Keys, Next: Information About Keys, Prev: Key objects, Up: Key Management
-7.5.1 Listing Keys
+7.5.2 Listing Keys
------------------
-- Function: gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t CTX,
@@ -3020,9 +3209,9 @@ the following function can be used to retrieve a single key.
operation there was not enough memory available.

-File: gpgme.info, Node: Information About Keys, Next: Key Signatures, Prev: Listing Keys, Up: Key Management
+File: gpgme.info, Node: Information About Keys, Next: Manipulating Keys, Prev: Listing Keys, Up: Key Management
-7.5.2 Information About Keys
+7.5.3 Information About Keys
----------------------------
Please see the beginning of this section for more information about
@@ -3056,281 +3245,8 @@ Please see the beginning of this section for more information about
The user ID is ultimately valid. The string representation of
this validity is “u”.
- The following interfaces are deprecated and only provided for
-backward compatibility. Don’t use them. They will be removed in a
-future version of GPGME.
-
- -- Data type: gpgme_attr_t
- The ‘gpgme_attr_t’ type is used to specify a key or trust item
- attribute. The following attributes are defined:
-
- ‘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.
-
- ‘GPGME_ATTR_FPR’
- This is the fingerprint of a sub key. It is representable as
- a string.
-
- ‘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 ‘enum gcry_pk_algos’ values in the
- gcrypt library.
-
- ‘GPGME_ATTR_LEN’
- This is the key length of a sub key. It is representable as a
- number.
-
- ‘GPGME_ATTR_CREATED’
- This is the timestamp at creation time of a sub key. It is
- representable as a number.
-
- ‘GPGME_ATTR_EXPIRE’
- This is the expiration time of a sub key. It is representable
- as a number.
-
- ‘GPGME_ATTR_OTRUST’
- XXX FIXME (also for trust items)
-
- ‘GPGME_ATTR_USERID’
- This is a user ID. There can be more than one user IDs in a
- 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.
-
- ‘GPGME_ATTR_NAME’
- This is the name belonging to a user ID. It is representable
- as a string.
-
- ‘GPGME_ATTR_EMAIL’
- This is the email address belonging to a user ID. It is
- representable as a string.
-
- ‘GPGME_ATTR_COMMENT’
- This is the comment belonging to a user ID. It is
- representable as a string.
-
- ‘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.
-
- ‘GPGME_ATTR_UID_REVOKED’
- This specifies if a user ID is revoked. It is representable
- as a number, and is ‘1’ if the user ID is revoked, and ‘0’
- otherwise.
-
- ‘GPGME_ATTR_UID_INVALID’
- This specifies if a user ID is invalid. It is representable
- as a number, and is ‘1’ if the user ID is invalid, and ‘0’
- otherwise.
-
- ‘GPGME_ATTR_LEVEL’
- This is the trust level of a trust 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.
-
- ‘GPGME_ATTR_IS_SECRET’
- This specifies if the key is a secret key. It is
- representable as a number, and is ‘1’ if the key is revoked,
- and ‘0’ otherwise.
-
- ‘GPGME_ATTR_KEY_REVOKED’
- This specifies if a sub key is revoked. It is representable
- as a number, and is ‘1’ if the key is revoked, and ‘0’
- otherwise.
-
- ‘GPGME_ATTR_KEY_INVALID’
- This specifies if a sub key is invalid. It is representable
- as a number, and is ‘1’ if the key is invalid, and ‘0’
- otherwise.
-
- ‘GPGME_ATTR_KEY_EXPIRED’
- This specifies if a sub key is expired. It is representable
- as a number, and is ‘1’ if the key is expired, and ‘0’
- otherwise.
-
- ‘GPGME_ATTR_KEY_DISABLED’
- This specifies if a sub key is disabled. It is representable
- as a number, and is ‘1’ if the key is disabled, and ‘0’
- otherwise.
-
- ‘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.
-
- ‘GPGME_ATTR_CAN_ENCRYPT’
- This specifies if a sub key can be used for encryption. It is
- representable as a number, and is ‘1’ if the sub key can be
- used for encryption, and ‘0’ otherwise.
-
- ‘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 ‘1’ if
- the sub key can be used for signatures, and ‘0’ otherwise.
-
- ‘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 ‘1’ if
- the sub key can be used for certifications, and ‘0’ otherwise.
-
- ‘GPGME_ATTR_SERIAL’
- The X.509 issuer serial attribute of the key. It is
- representable as a string.
-
- ‘GPGME_ATTR_ISSUE’
- The X.509 issuer name attribute of the key. It is
- representable as a string.
-
- ‘GPGME_ATTR_CHAINID’
- The X.509 chain ID can be used to build the certification
- chain. It is representable as a string.
-
- -- Function: const char * gpgme_key_get_string_attr (gpgme_key_t KEY,
- gpgme_attr_t WHAT, const void *RESERVED, int IDX)
- The function ‘gpgme_key_get_string_attr’ returns the value of the
- string-representable attribute WHAT of key KEY. If the attribute
- is an attribute of a sub key or an user ID, IDX specifies the sub
- key or user ID of which the attribute value is returned. The
- argument RESERVED is reserved for later use and should be ‘NULL’.
-
- The string returned is only valid as long as the key is valid.
-
- The function returns ‘0’ if an attribute can’t be returned as a
- string, KEY is not a valid pointer, IDX out of range, or RESERVED
- not ‘NULL’.
-
- -- Function: unsigned long gpgme_key_get_ulong_attr (gpgme_key_t KEY,
- gpgme_attr_t WHAT, const void *RESERVED, int IDX)
- The function ‘gpgme_key_get_ulong_attr’ returns the value of the
- number-representable attribute WHAT of key KEY. If the attribute
- is an attribute of a sub key or an user ID, IDX specifies the sub
- key or user ID of which the attribute value is returned. The
- argument RESERVED is reserved for later use and should be ‘NULL’.
-
- The function returns ‘0’ if the attribute can’t be returned as a
- number, KEY is not a valid pointer, IDX out of range, or RESERVED
- not ‘NULL’.
-
-
-File: gpgme.info, Node: Key Signatures, Next: Manipulating Keys, Prev: Information About Keys, Up: Key Management
-
-7.5.3 Key Signatures
---------------------
-
-The following interfaces are deprecated and only provided for backward
-compatibility. Don’t use them. They will be removed in a future
-version of GPGME.
-
- The signatures on a key are only available if the key was retrieved
-via a listing operation with the ‘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 ‘gpgme_get_key’.
-
- -- Data type: gpgme_attr_t
- The ‘gpgme_attr_t’ type is used to specify a key signature
- attribute. The following attributes are defined:
-
- ‘GPGME_ATTR_KEYID’
- This is the key ID of the key which was used for the
- signature. It is representable as a string.
-
- ‘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 ‘enum gcry_pk_algos’ values in the gcrypt
- library.
-
- ‘GPGME_ATTR_CREATED’
- This is the timestamp at creation time of the signature. It
- is representable as a number.
-
- ‘GPGME_ATTR_EXPIRE’
- This is the expiration time of the signature. It is
- representable as a number.
-
- ‘GPGME_ATTR_USERID’
- This is the user ID associated with the signing key. The user
- ID is representable as a number.
-
- ‘GPGME_ATTR_NAME’
- This is the name belonging to a user ID. It is representable
- as a string.
-
- ‘GPGME_ATTR_EMAIL’
- This is the email address belonging to a user ID. It is
- representable as a string.
-
- ‘GPGME_ATTR_COMMENT’
- This is the comment belonging to a user ID. It is
- representable as a string.
-
- ‘GPGME_ATTR_KEY_REVOKED’
- This specifies if a key signature is a revocation signature.
- It is representable as a number, and is ‘1’ if the key is
- revoked, and ‘0’ otherwise.
-
- ‘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.
-
- ‘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.
-
- ‘GPGME_ATTR_SIG_STATUS’
- This is the same value as returned by ‘gpgme_get_sig_status’.
-
- -- Function: const char * gpgme_key_sig_get_string_attr
- (gpgme_key_t KEY, int UID_IDX, gpgme_attr_t WHAT,
- const void *RESERVED, int IDX)
- The function ‘gpgme_key_sig_get_string_attr’ returns the value of
- the string-representable attribute WHAT of the signature IDX on the
- user ID UID_IDX in the key KEY. The argument RESERVED is reserved
- for later use and should be ‘NULL’.
-
- The string returned is only valid as long as the key is valid.
-
- The function returns ‘0’ if an attribute can’t be returned as a
- string, KEY is not a valid pointer, UID_IDX or IDX out of range, or
- RESERVED not ‘NULL’.
-
- -- Function: unsigned long gpgme_key_sig_get_ulong_attr
- (gpgme_key_t KEY, int UID_IDX, gpgme_attr_t WHAT,
- const void *RESERVED, int IDX)
- The function ‘gpgme_key_sig_get_ulong_attr’ returns the value of
- the number-representable attribute WHAT of the signature IDX on the
- user ID UID_IDX in the key KEY. The argument RESERVED is reserved
- for later use and should be ‘NULL’.
-
- The function returns ‘0’ if an attribute can’t be returned as a
- string, KEY is not a valid pointer, UID_IDX or IDX out of range, or
- RESERVED not ‘NULL’.
-

-File: gpgme.info, Node: Manipulating Keys, Next: Generating Keys, Prev: Key Signatures, Up: Key Management
+File: gpgme.info, Node: Manipulating Keys, Next: Generating Keys, Prev: Information About Keys, Up: Key Management
7.5.4 Manipulating Keys
-----------------------
@@ -3344,27 +3260,239 @@ File: gpgme.info, Node: Manipulating Keys, Next: Generating Keys, Prev: Key S
KEY. If this was the last reference, the key will be destroyed and
all resources associated to it will be released.
- The following interface is deprecated and only provided for backward
-compatibility. Don’t use it. It will be removed in a future version of
-GPGME.
-
- -- Function: void gpgme_key_release (gpgme_key_t KEY)
- The function ‘gpgme_key_release’ is equivalent to
- ‘gpgme_key_unref’.
-

-File: gpgme.info, Node: Generating Keys, Next: Exporting Keys, Prev: Manipulating Keys, Up: Key Management
+File: gpgme.info, Node: Generating Keys, Next: Signing Keys, Prev: Manipulating Keys, Up: Key Management
7.5.5 Generating Keys
---------------------
+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 ‘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
+‘GPG_ERR_NOT_SUPPORTED’ is received.
+
+ -- Function: gpgme_error_t gpgme_op_createkey (gpgme_ctx_t CTX,
+ const char *USERID, const char *ALGO, unsigned long RESERVED,
+ unsigned long EXPIRES, gpgme_key_t EXTRAKEY,
+ unsigned int FLAGS);
+
+ The function ‘gpgme_op_createkey’ generates a new key for the
+ procotol active in the context CTX. As of now this function does
+ only work for OpenPGP and requires at least version 2.1.13 of
+ GnuPG.
+
+ 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.
+
+ 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 ALGO is ‘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 FLAGS, triggers the creation of
+ a primary key plus a secondary key (subkey).
+
+ RESERVED must be set to zero.
+
+ EXPIRES can be set to the number of seconds since Epoch of the
+ desired expiration date in UTC for the new key. Using 0 does not
+ set an expiration date. Note that this parameter takes an unsigned
+ long value and not a ‘time_t’ to avoid problems on systems which
+ use a signed 32 bit ‘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.
+
+ EXTRAKEY is currently not used and must be set to ‘NULL’. A future
+ version of GPGME may use this parameter to create X.509 keys.
+
+ FLAGS can be set to the bit-wise OR of the following flags:
+
+ ‘GPGME_CREATE_SIGN’
+ ‘GPGME_CREATE_ENCR’
+ ‘GPGME_CREATE_CERT’
+ ‘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.
+
+ 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.
+
+ ‘GPGME_CREATE_NOPASSWD’
+ Request generation of the key without password protection.
+
+ ‘GPGME_CREATE_SELFSIGNED’
+ For an X.509 key do not create a CSR but a self-signed
+ certificate. This has not yet been implemented.
+
+ ‘GPGME_CREATE_NOSTORE’
+ Do not store the created key in the local key database. This
+ has not yet been implemented.
+
+ ‘GPGME_CREATE_WANTPUB’
+ ‘GPGME_CREATE_WANTSEC’
+ Return the public or secret key as part of the result
+ structure. This has not yet been implemented.
+
+ ‘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.
+
+ After the operation completed successfully, information about the
+ created key can be retrieved with ‘gpgme_op_genkey_result’.
+
+ The function returns zero on success, ‘GPG_ERR_NOT_SUPPORTED’ if
+ the engine does not support the command, or a bunch of other error
+ codes.
+
+ -- Function: gpgme_error_t gpgme_op_createkey_start (gpgme_ctx_t CTX,
+ const char *USERID, const char *ALGO, unsigned long RESERVED,
+ unsigned long EXPIRES, gpgme_key_t EXTRAKEY,
+ unsigned int FLAGS);
+
+ The function ‘gpgme_op_createkey_start’ initiates a
+ ‘gpgme_op_createkey’ operation; see there for details. It must be
+ completed by calling ‘gpgme_wait’ on the context. *Note Waiting
+ For Completion::.
+
+ -- Function: gpgme_error_t gpgme_op_createsubkey (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, const char *ALGO, unsigned long RESERVED,
+ unsigned long EXPIRES, unsigned int FLAGS);
+
+ The function ‘gpgme_op_createsubkey’ creates and adds a new subkey
+ to the primary OpenPGP key given by KEY. The only allowed protocol
+ in CTX is ‘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.
+
+ KEY specifies the key to operate on.
+
+ ALGO specifies the algorithm for the new subkey. For a list of
+ supported algorithms, see the GnuPG manual. If ALGO is ‘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.
+
+ RESERVED must be set to zero.
+
+ EXPIRES can be set to the number of seconds since Epoch of the
+ desired expiration date in UTC for the new subkey. Using 0 does
+ not set an expiration date. Note that this parameter takes an
+ unsigned long value and not a ‘time_t’ to avoid problems on systems
+ which use a signed 32 bit ‘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.
+
+ FLAGS takes the same values as described above for
+ ‘gpgme_op_createkey’.
+
+ After the operation completed successfully, information about the
+ created key can be retrieved with ‘gpgme_op_genkey_result’.
+
+ The function returns zero on success, ‘GPG_ERR_NOT_SUPPORTED’ if
+ the engine does not support the command, or a bunch of other error
+ codes.
+
+ -- Function: gpgme_error_t gpgme_op_createsubkey_start
+ (gpgme_ctx_t CTX, gpgme_key_t KEY, const char *ALGO,
+ unsigned long RESERVED, unsigned long EXPIRES,
+ unsigned int FLAGS);
+
+ The function ‘gpgme_op_createsubkey_start’ initiates a
+ ‘gpgme_op_createsubkey’ operation; see there for details. It must
+ be completed by calling ‘gpgme_wait’ on the context. *Note Waiting
+ For Completion::.
+
+ -- Function: gpgme_error_t gpgme_op_adduid (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, const char *USERID, unsigned int FLAGS);
+
+ The function ‘gpgme_op_adduid’ adds a new user ID to the OpenPGP
+ key given by KEY. Adding additional user IDs after key creation is
+ a feature of the OpenPGP protocol and thus the protocol for the
+ context CTX must be set to OpenPGP. As of now this function
+ requires at least version 2.1.13 of GnuPG.
+
+ KEY specifies the key to operate on.
+
+ 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.
+
+ FLAGS are currently not used and must be set to zero.
+
+ The function returns zero on success, ‘GPG_ERR_NOT_SUPPORTED’ if
+ the engine does not support the command, or a bunch of other error
+ codes.
+
+ -- Function: gpgme_error_t gpgme_op_adduid_start (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, const char *USERID, unsigned int FLAGS);
+
+ The function ‘gpgme_op_adduid_start’ initiates a ‘gpgme_op_adduid’
+ operation; see there for details. It must be completed by calling
+ ‘gpgme_wait’ on the context. *Note Waiting For Completion::.
+
+ -- Function: gpgme_error_t gpgme_op_revuid (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, const char *USERID, unsigned int FLAGS);
+
+ The function ‘gpgme_op_revuid’ revokes a user ID from the OpenPGP
+ key given by KEY. Revoking user IDs after key creation is a
+ feature of the OpenPGP protocol and thus the protocol for the
+ context CTX must be set to OpenPGP. As of now this function
+ requires at least version 2.1.13 of GnuPG.
+
+ KEY specifies the key to operate on.
+
+ 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 ‘uid’ field from the user ID object
+ (‘gpgme_user_id_t’) is to be used. This is a required parameter.
+
+ FLAGS are currently not used and must be set to zero.
+
+ 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.
+
+ The function returns zero on success, ‘GPG_ERR_NOT_SUPPORTED’ if
+ the engine does not support the command, or a bunch of other error
+ codes.
+
+ -- Function: gpgme_error_t gpgme_op_revuid_start (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, const char *USERID, unsigned int FLAGS);
+
+ The function ‘gpgme_op_revuid_start’ initiates a ‘gpgme_op_revuid’
+ operation; see there for details. It must be completed by calling
+ ‘gpgme_wait’ on the context. *Note Waiting For Completion::.
+
-- Function: gpgme_error_t gpgme_op_genkey (gpgme_ctx_t CTX,
const char *PARMS, gpgme_data_t PUBLIC, gpgme_data_t SECRET)
+
The function ‘gpgme_op_genkey’ generates a new key pair in the
context CTX. The meaning of PUBLIC and SECRET depends on the
crypto backend.
- GnuPG does not support PUBLIC and SECRET, they should be ‘NULL’.
+ GPG does not support PUBLIC and SECRET, they should be ‘NULL’.
GnuPG will generate a key pair and add it to the standard key ring.
The fingerprint of the generated key is available with
‘gpgme_op_genkey_result’.
@@ -3417,6 +3545,7 @@ File: gpgme.info, Node: Generating Keys, Next: Exporting Keys, Prev: Manipula
-- Function: gpgme_error_t gpgme_op_genkey_start (gpgme_ctx_t CTX,
const char *PARMS, gpgme_data_t PUBLIC, gpgme_data_t SECRET)
+
The function ‘gpgme_op_genkey_start’ initiates a ‘gpgme_op_genkey’
operation. It can be completed by calling ‘gpgme_wait’ on the
context. *Note Waiting For Completion::.
@@ -3427,6 +3556,7 @@ File: gpgme.info, Node: Generating Keys, Next: Exporting Keys, Prev: Manipula
PUBLIC or SECRET is not ‘NULL’.
-- Data type: gpgme_genkey_result_t
+
This is a pointer to a structure used to store the result of a
‘gpgme_op_genkey’ operation. After successfully generating a key,
you can retrieve the pointer to the result with
@@ -3434,21 +3564,33 @@ File: gpgme.info, Node: Generating Keys, Next: Exporting Keys, Prev: Manipula
members:
‘unsigned int primary : 1’
- This is a flag that is set to 1 if a primary key was created
- and to 0 if not.
+ This flag is set to 1 if a primary key was created and to 0 if
+ not.
‘unsigned int sub : 1’
- This is a flag that is set to 1 if a subkey was created and to
- 0 if not.
+ This flag is set to 1 if a subkey was created and to 0 if not.
+
+ ‘unsigned int uid : 1’
+ This flag is set to 1 if a user ID was created and to 0 if
+ not.
‘char *fpr’
This is the fingerprint of the key that was created. If both
- a primary and a sub key were generated, the fingerprint of the
+ 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, ‘fpr’ will be a null pointer.
+ ‘gpgme_data_t pubkey’
+ This will eventually be used to return the public key. It is
+ currently not used.
+
+ ‘gpgme_data_t seckey’
+ This will eventually be used to return the secret key. It is
+ currently not used.
+
-- Function: gpgme_genkey_result_t gpgme_op_genkey_result
(gpgme_ctx_t CTX)
+
The function ‘gpgme_op_genkey_result’ returns a
‘gpgme_genkey_result_t’ pointer to a structure holding the result
of a ‘gpgme_op_genkey’ operation. The pointer is only valid if the
@@ -3458,9 +3600,86 @@ File: gpgme.info, Node: Generating Keys, Next: Exporting Keys, Prev: Manipula
operation is started on the context.

-File: gpgme.info, Node: Exporting Keys, Next: Importing Keys, Prev: Generating Keys, Up: Key Management
+File: gpgme.info, Node: Signing Keys, Next: Exporting Keys, Prev: Generating Keys, Up: Key Management
-7.5.6 Exporting Keys
+7.5.6 Signing Keys
+------------------
+
+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 ‘gpgme_op_interact’ function
+along with a finite state machine, GPGME provides a convenient function
+to create key signatures when using modern GnuPG versions.
+
+ -- Function: gpgme_error_t gpgme_op_keysign (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, const char *USERID, unsigned long EXPIRES,
+ unsigned int FLAGS);
+
+ The function ‘gpgme_op_keysign’ adds a new key signature to the
+ public key KEY. This function requires at least version 2.1.12 of
+ GnuPG.
+
+ 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, ‘gpgme_signers_add’ can be used. *Note
+ Selecting Signers::.
+
+ KEY specifies the key to operate on.
+
+ USERID selects the user ID or user IDs to be signed. If USERID is
+ set to ‘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 ‘uid’ field from the user ID object
+ (‘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
+ (‘\n’) and set the flag ‘GPGME_KEYSIGN_LFSEP’.
+
+ EXPIRES can be set to the number of seconds since Epoch of the
+ desired expiration date in UTC for the new signature. 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
+ ‘GPGME_KEYSIGN_NOEXPIRE’ is used. Note that this parameter takes
+ an unsigned long value and not a ‘time_t’ to avoid problems on
+ systems which use a signed 32 bit ‘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.
+
+ FLAGS can be set to the bit-wise OR of the following flags:
+
+ ‘GPGME_KEYSIGN_LOCAL’
+ Instead of creating an exportable key signature, create a key
+ signature which is is marked as non-exportable.
+
+ ‘GPGME_KEYSIGN_LFSEP’
+ Although linefeeds are uncommon in user IDs this flag is
+ required to explicitly declare that USERID may contain several
+ linefeed separated user IDs.
+
+ ‘GPGME_KEYSIGN_NOEXPIRE’
+ Force the creation of a key signature without an expiration
+ date. This overrides EXPIRE and any local configuration of
+ the engine.
+
+ The function returns zero on success, ‘GPG_ERR_NOT_SUPPORTED’ if
+ the engine does not support the command, or a bunch of other error
+ codes.
+
+ -- Function: gpgme_error_t gpgme_op_keysign_start (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, const char *USERID, unsigned long EXPIRES,
+ unsigned int FLAGS);
+
+ The function ‘gpgme_op_keysign_start’ initiates a
+ ‘gpgme_op_keysign’ operation; see there for details. It must be
+ completed by calling ‘gpgme_wait’ on the context. *Note Waiting
+ For Completion::.
+
+
+File: gpgme.info, Node: Exporting Keys, Next: Importing Keys, Prev: Signing Keys, Up: Key Management
+
+7.5.7 Exporting Keys
--------------------
Exporting keys means the same as running ‘gpg’ with the command
@@ -3568,10 +3787,10 @@ or-ed together.
specified for KEYDATA.
The keys to export are taken form the ‘NULL’ terminated array KEYS.
- Only keys of the the currently selected protocol of CTX which do
- have a fingerprint set are considered for export. Other keys
- specified by the KEYS are ignored. In particular OpenPGP keys
- retrieved via an external key listing are not included.
+ Only keys of the currently selected protocol of CTX which do have a
+ fingerprint set are considered for export. Other keys specified by
+ the KEYS are ignored. In particular OpenPGP keys retrieved via an
+ external key listing are not included.
MODE is usually 0; other values are described above.
@@ -3597,7 +3816,7 @@ or-ed together.

File: gpgme.info, Node: Importing Keys, Next: Deleting Keys, Prev: Exporting Keys, Up: Key Management
-7.5.7 Importing Keys
+7.5.8 Importing Keys
--------------------
Importing keys means the same as running ‘gpg’ with the command
@@ -3639,11 +3858,10 @@ Importing keys means the same as running ‘gpg’ with the command
which have been retrieved from an external source (i.e. using
‘GPGME_KEYLIST_MODE_EXTERN’). (1)
- Only keys of the the currently selected protocol of CTX are
- considered for import. Other keys specified by the 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.
+ Only keys of the currently selected protocol of CTX are considered
+ for import. Other keys specified by the 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 ‘gpgme_op_import_result’.
@@ -3720,34 +3938,34 @@ Importing keys means the same as running ‘gpg’ with the command
‘int imported’
The total number of imported keys.
- ‘imported_rsa’
+ ‘int imported_rsa’
The number of imported RSA keys.
- ‘unchanged’
+ ‘int unchanged’
The number of unchanged keys.
- ‘new_user_ids’
+ ‘int new_user_ids’
The number of new user IDs.
- ‘new_sub_keys’
+ ‘int new_sub_keys’
The number of new sub keys.
- ‘new_signatures’
+ ‘int new_signatures’
The number of new signatures.
- ‘new_revocations’
+ ‘int new_revocations’
The number of new revocations.
- ‘secret_read’
+ ‘int secret_read’
The total number of secret keys read.
- ‘secret_imported’
+ ‘int secret_imported’
The number of imported secret keys.
- ‘secret_unchanged’
+ ‘int secret_unchanged’
The number of unchanged secret keys.
- ‘not_imported’
+ ‘int not_imported’
The number of keys not imported.
‘gpgme_import_status_t imports’
@@ -3764,21 +3982,6 @@ Importing keys means the same as running ‘gpg’ with the command
successfully. The returned pointer is only valid until the next
operation is started on the context.
- The following interface is deprecated and only provided for backward
-compatibility. Don’t use it. It will be removed in a future version of
-GPGME.
-
- -- Function: gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t CTX,
- gpgme_data_t KEYDATA, int *NR)
- The function ‘gpgme_op_import_ext’ is equivalent to:
-
- gpgme_error_t err = gpgme_op_import (ctx, keydata);
- if (!err)
- {
- gpgme_import_result_t result = gpgme_op_import_result (ctx);
- *nr = result->considered;
- }
-
---------- Footnotes ----------
(1) Thus it is a replacement for the usual workaround of exporting
@@ -3787,7 +3990,7 @@ and then importing a key to make an X.509 key permanent.

File: gpgme.info, Node: Deleting Keys, Next: Changing Passphrases, Prev: Importing Keys, Up: Key Management
-7.5.8 Deleting Keys
+7.5.9 Deleting Keys
-------------------
-- Function: gpgme_error_t gpgme_op_delete (gpgme_ctx_t CTX,
@@ -3815,10 +4018,10 @@ File: gpgme.info, Node: Deleting Keys, Next: Changing Passphrases, Prev: Impo
or KEY is not a valid pointer.

-File: gpgme.info, Node: Changing Passphrases, Next: Advanced Key Editing, Prev: Deleting Keys, Up: Key Management
+File: gpgme.info, Node: Changing Passphrases, Next: Changing TOFU Data, Prev: Deleting Keys, Up: Key Management
-7.5.9 Changing Passphrases
---------------------------
+7.5.10 Changing Passphrases
+---------------------------
-- Function: gpgme_error_t gpgme_op_passwd (gpgme_ctx_t CTX,
const gpgme_key_t KEY, unsigned int FLAGS)
@@ -3845,69 +4048,109 @@ File: gpgme.info, Node: Changing Passphrases, Next: Advanced Key Editing, Pre
oepration could not be started.

-File: gpgme.info, Node: Advanced Key Editing, Prev: Changing Passphrases, Up: Key Management
+File: gpgme.info, Node: Changing TOFU Data, Next: Advanced Key Editing, Prev: Changing Passphrases, Up: Key Management
-7.5.10 Advanced Key Editing
----------------------------
+7.5.11 Changing TOFU Data
+-------------------------
- -- Data type: gpgme_error_t (*gpgme_edit_cb_t) (void *HANDLE,
- gpgme_status_code_t STATUS, const char *ARGS, int FD)
- The ‘gpgme_edit_cb_t’ type is the type of functions which GPGME
- calls if it a key edit operation is on-going. The status code
- STATUS and the argument line ARGS are passed through by GPGME from
- the crypto engine. The file descriptor FD is -1 for normal status
- messages. If STATUS indicates a command rather than a status
- message, the response to the command should be written to FD. The
- HANDLE is provided by the user at start of operation.
+The OpenPGP engine features a Trust-On-First-Use (TOFU) key validation
+model. For resolving clonflics it is necessary to declare the policy
+for a key. See the GnuPG manual for details on the TOFU implementation.
- The function should return ‘GPG_ERR_NO_ERROR’ or an error value.
+ -- Data type: enum gpgme_tofu_policy_t
+ The ‘gpgme_tofu_policy_t’ type specifies the set of possible policy
+ values that are supported by GPGME:
- -- Function: gpgme_error_t gpgme_op_edit (gpgme_ctx_t CTX,
- gpgme_key_t KEY, gpgme_edit_cb_t FNC, void *HANDLE,
- gpgme_data_t OUT)
- The function ‘gpgme_op_edit’ processes the key KEY interactively,
- using the edit callback function FNC with the handle 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 OUT.
+ ‘GPGME_TOFU_POLICY_AUTO’
+ Set the policy to “auto”.
+ ‘GPGME_TOFU_POLICY_GOOD’
+ Set the policy to “goog”.
+ ‘GPGME_TOFU_POLICY_BAD’
+ Set the policy to “bad”.
+ ‘GPGME_TOFU_POLICY_ASK’
+ Set the policy to “ask”.
+ ‘GPGME_TOFU_POLICY_UNKNOWN’
+ Set the policy to “unknown”.
+
+ To change the policy for a key the following functions can be used:
+
+ -- Function: gpgme_error_t gpgme_op_tofu_policy (gpgme_ctx_t CTX,
+ const gpgme_key_t KEY, gpgme_tofu_policy_t POLICY)
+
+ The function ‘gpgme_op_tofu_policy’ changes the TOFU policy of KEY.
+ The valid values for 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, ‘GPG_ERR_NOT_SUPPORTED’ if
+ the engine does not support the command, or a bunch of other error
+ codes.
+
+ -- Function: gpgme_error_t gpgme_op_tofu_policy_start (gpgme_ctx_t CTX,
+ const gpgme_key_t KEY, gpgme_tofu_policy_t POLICY)
+
+ The function ‘gpgme_op_tofu_policy_start’ initiates a
+ ‘gpgme_op_tofu_policy’ operation. It can be completed by calling
+ ‘gpgme_wait’ on the context. *Note Waiting For Completion::.
+
+ The function returns ‘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.
+
+
+File: gpgme.info, Node: Advanced Key Editing, Prev: Changing TOFU Data, Up: Key Management
+
+7.5.12 Advanced Key Editing
+---------------------------
+
+ -- Data type: gpgme_error_t (*gpgme_interact_cb_t) (void *HANDLE,
+ const char *STATUS, const char *ARGS, int FD)
+ The ‘gpgme_interact_cb_t’ type is the type of functions which GPGME
+ calls if it a key interact operation is on-going. The status
+ keyword STATUS and the argument line ARGS are passed through by
+ GPGME from the crypto engine. An empty string represents EOF. The
+ file descriptor FD is -1 for normal status messages. If STATUS
+ indicates a command rather than a status message, the response to
+ the command should be written to FD. The HANDLE is provided by the
+ user at start of operation.
+
+ The function should return ‘GPG_ERR_FALSE’ if it did not handle the
+ status code, ‘0’ for success, or any other error value.
+
+ -- Function: gpgme_error_t gpgme_op_interact (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, unsigned int FLAGS, gpgme_interact_cb_t FNC,
+ void *HANDLE, gpgme_data_t OUT)
+ The function ‘gpgme_op_interact’ processes the key KEY
+ interactively, using the interact callback function FNC with the
+ handle 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 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 GPGME.
- The function returns the error code ‘GPG_ERR_NO_ERROR’ if the edit
- operation completes successfully, ‘GPG_ERR_INV_VALUE’ if CTX or KEY
- is not a valid pointer, and any error returned by the crypto engine
- or the edit callback handler.
+ FLAGS modifies the behaviour of the function; the only defined bit
+ value is:
- -- Function: gpgme_error_t gpgme_op_edit_start (gpgme_ctx_t CTX,
- gpgme_key_t KEY, gpgme_edit_cb_t FNC, void *HANDLE,
- gpgme_data_t OUT)
- The function ‘gpgme_op_edit_start’ initiates a ‘gpgme_op_edit’
- operation. It can be completed by calling ‘gpgme_wait’ on the
- context. *Note Waiting For Completion::.
-
- The function returns the error code ‘GPG_ERR_NO_ERROR’ if the
- operation was started successfully, and ‘GPG_ERR_INV_VALUE’ if CTX
- or KEY is not a valid pointer.
+ ‘GPGME_INTERACT_CARD’
+ This is used for smartcard based keys and uses gpg’s
+ ‘--card-edit’ command.
- -- Function: gpgme_error_t gpgme_op_card_edit (gpgme_ctx_t CTX,
- gpgme_key_t KEY, gpgme_edit_cb_t FNC, void *HANDLE,
- gpgme_data_t OUT)
- The function ‘gpgme_op_card_edit’ is analogous to ‘gpgme_op_edit’,
- but should be used to process the smart card corresponding to the
- key KEY.
+ The function returns ‘0’ if the edit operation completes
+ successfully, ‘GPG_ERR_INV_VALUE’ if CTX or KEY is not a valid
+ pointer, and any error returned by the crypto engine or the edit
+ callback handler.
- -- Function: gpgme_error_t gpgme_op_card_edit_start (gpgme_ctx_t CTX,
- gpgme_key_t KEY, gpgme_edit_cb_t FNC, void *HANDLE,
- gpgme_data_t OUT)
- The function ‘gpgme_op_card_edit_start’ initiates a
- ‘gpgme_op_card_edit’ operation. It can be completed by calling
+ -- Function: gpgme_error_t gpgme_op_interact_start (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, unsigned int FLAGS, gpgme_interact_cb_t FNC,
+ void *HANDLE, gpgme_data_t OUT)
+ The function ‘gpgme_op_interact_start’ initiates a
+ ‘gpgme_op_interact’ operation. It can be completed by calling
‘gpgme_wait’ on the context. *Note Waiting For Completion::.
- The function returns the error code ‘GPG_ERR_NO_ERROR’ if the
- operation was started successfully, and ‘GPG_ERR_INV_VALUE’ if CTX
- or KEY is not a valid pointer.
+ The function returns ‘0’ if the operation was started successfully,
+ and ‘GPG_ERR_INV_VALUE’ if CTX or KEY is not a valid pointer.

File: gpgme.info, Node: Trust Item Management, Next: Crypto Operations, Prev: Key Management, Up: Contexts
@@ -3944,11 +4187,10 @@ File: gpgme.info, Node: Trust Item Management, Next: Crypto Operations, Prev:
* Menu:
* Listing Trust Items:: Browsing the list of available trust items.
-* Information About Trust Items:: Requesting information about trust items.
* Manipulating Trust Items:: Operations on trust items.

-File: gpgme.info, Node: Listing Trust Items, Next: Information About Trust Items, Up: Trust Item Management
+File: gpgme.info, Node: Listing Trust Items, Next: Manipulating Trust Items, Up: Trust Item Management
7.6.1 Listing Trust Items
-------------------------
@@ -4000,51 +4242,9 @@ File: gpgme.info, Node: Listing Trust Items, Next: Information About Trust Ite
the operation there was not enough memory available.

-File: gpgme.info, Node: Information About Trust Items, Next: Manipulating Trust Items, Prev: Listing Trust Items, Up: Trust Item Management
-
-7.6.2 Information About Trust Items
------------------------------------
-
-The following interfaces are deprecated and only provided for backward
-compatibility. Don’t use them. They will be removed in a future
-version of GPGME.
+File: gpgme.info, Node: Manipulating Trust Items, Prev: Listing Trust Items, Up: Trust Item Management
- Trust items have attributes which can be queried using the interfaces
-below. The attribute identifiers are shared with those for key
-attributes. *Note Information About Keys::.
-
- -- Function: const char * gpgme_trust_item_get_string_attr
- (gpgme_trust_item_t ITEM, gpgme_attr_t WHAT,
- const void *RESERVED, int IDX)
- The function ‘gpgme_trust_item_get_string_attr’ returns the value
- of the string-representable attribute WHAT of trust item ITEM. The
- arguments IDX and RESERVED are reserved for later use and should be
- ‘0’ and ‘NULL’ respectively.
-
- The string returned is only valid as long as the key is valid.
-
- The function returns ‘0’ if an attribute can’t be returned as a
- string, KEY is not a valid pointer, IDX out of range, or RESERVED
- not ‘NULL’.
-
- -- Function: int gpgme_trust_item_get_int_attr
- (gpgme_trust_item_t ITEM, gpgme_attr_t WHAT,
- const void *RESERVED, int IDX)
- The function ‘gpgme_trust_item_get_int_attr’ returns the value of
- the number-representable attribute WHAT of trust item ITEM. If the
- attribute occurs more than once in the trust item, the index is
- specified by IDX. However, currently no such attribute exists, so
- IDX should be ‘0’. The argument RESERVED is reserved for later use
- and should be ‘NULL’.
-
- The function returns ‘0’ if the attribute can’t be returned as a
- number, KEY is not a valid pointer, IDX out of range, or RESERVED
- not ‘NULL’.
-
-
-File: gpgme.info, Node: Manipulating Trust Items, Prev: Information About Trust Items, Up: Trust Item Management
-
-7.6.3 Manipulating Trust Items
+7.6.2 Manipulating Trust Items
------------------------------
-- Function: void gpgme_trust_item_ref (gpgme_trust_item_t ITEM)
@@ -4057,14 +4257,6 @@ File: gpgme.info, Node: Manipulating Trust Items, Prev: Information About Trus
will be destroyed and all resources associated to it will be
released.
- The following interface is deprecated and only provided for backward
-compatibility. Don’t use it. It will be removed in a future version of
-GPGME.
-
- -- Function: void gpgme_trust_item_release (gpgme_trust_item_t ITEM)
- The function ‘gpgme_trust_item_release’ is an alias for
- ‘gpgme_trust_item_unref’.
-

File: gpgme.info, Node: Crypto Operations, Next: Miscellaneous, Prev: Trust Item Management, Up: Contexts
@@ -4426,6 +4618,12 @@ File: gpgme.info, Node: Verify, Next: Decrypt and Verify, Prev: Decrypt, Up:
‘char *pka_address’
The mailbox from the PKA information or ‘NULL’.
+ ‘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 ‘NULL’ if such information is not readily available.
+
-- Data type: gpgme_verify_result_t
This is a pointer to a structure used to store the result of a
‘gpgme_op_verify’ operation. After verifying a signature, you can
@@ -4454,229 +4652,6 @@ File: gpgme.info, Node: Verify, Next: Decrypt and Verify, Prev: Decrypt, Up:
counts as successful in this context). The returned pointer is
only valid until the next operation is started on the context.
- The following interfaces are deprecated and only provided for
-backward compatibility. Don’t use them. They will be removed in a
-future version of GPGME.
-
- -- Data type: enum gpgme_sig_stat_t
- The ‘gpgme_sig_stat_t’ type holds the result of a signature check,
- or the combined result of all signatures. The following results
- are possible:
-
- ‘GPGME_SIG_STAT_NONE’
- This status should not occur in normal operation.
-
- ‘GPGME_SIG_STAT_GOOD’
- This status indicates that the signature is valid. For the
- combined result this status means that all signatures are
- valid.
-
- ‘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.
-
- ‘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.
-
- ‘GPGME_SIG_STAT_BAD’
- This status indicates that the signature is invalid. For the
- combined result this status means that all signatures are
- invalid.
-
- ‘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.
-
- ‘GPGME_SIG_STAT_NOSIG’
- This status indicates that the signature data provided was not
- a real signature.
-
- ‘GPGME_SIG_STAT_ERROR’
- This status indicates that there was some other error which
- prevented the signature verification.
-
- ‘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 ‘gpgme_get_sig_status’.
-
- -- Function: const char * gpgme_get_sig_status (gpgme_ctx_t CTX,
- int IDX, gpgme_sig_stat_t *R_STAT, time_t *R_CREATED)
- The function ‘gpgme_get_sig_status’ is equivalent to:
-
- 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;
-
- -- Function: const char * gpgme_get_sig_string_attr (gpgme_ctx_t CTX,
- int IDX, gpgme_attr_t WHAT, int WHATIDX)
- The function ‘gpgme_get_sig_string_attr’ is equivalent to:
-
- 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;
-
- -- Function: const char * gpgme_get_sig_ulong_attr (gpgme_ctx_t CTX,
- int IDX, gpgme_attr_t WAHT, int WHATIDX)
- The function ‘gpgme_get_sig_ulong_attr’ is equivalent to:
-
- 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;
-
- -- Function: const char * gpgme_get_sig_key (gpgme_ctx_t CTX, int IDX,
- gpgme_key_t *R_KEY)
- The function ‘gpgme_get_sig_key’ is equivalent to:
-
- 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);
-

File: gpgme.info, Node: Decrypt and Verify, Next: Sign, Prev: Verify, Up: Crypto Operations
@@ -4742,6 +4717,11 @@ File: gpgme.info, Node: Selecting Signers, Next: Creating a Signature, Up: Si
7.7.4.1 Selecting Signers
.........................
+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.
+
-- Function: void gpgme_signers_clear (gpgme_ctx_t CTX)
The function ‘gpgme_signers_clear’ releases a reference for each
key on the signers list and removes the list of signers from the
@@ -4990,6 +4970,12 @@ File: gpgme.info, Node: Encrypting a Plaintext, Up: Encrypt
‘PREP_ENCRYPT’ command). With the ‘GPGME_ENCRYPT_EXPECT_SIGN’
symbol the UI Server is advised to also expect a sign command.
+ ‘GPGME_ENCRYPT_SYMMETRIC’
+ The ‘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.
+
If ‘GPG_ERR_UNUSABLE_PUBKEY’ is returned, some recipients in RECP
are invalid, but not all. In this case the plaintext might be
encrypted for all valid recipients and returned in CIPHER (if this
@@ -5082,9 +5068,10 @@ Here are some support functions which are sometimes useful.
* Menu:
* Running other Programs:: Running other Programs
+* Using the Assuan protocol:: Using the Assuan protocol

-File: gpgme.info, Node: Running other Programs, Up: Miscellaneous
+File: gpgme.info, Node: Running other Programs, Next: Using the Assuan protocol, Up: Miscellaneous
7.8.1 Running other Programs
----------------------------
@@ -5096,10 +5083,10 @@ 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.
- -- Function: gpgme_error_t gpgme_op_spawn
- (gpgme_ctx_t CTX, const char *FILE, const char *ARGV[],
- gpgme_data_t DATAIN, gpgme_data_t DATAOUT, gpgme_data_t DATAERR,
- unsigned int FLAGS)
+ -- Function: gpgme_error_t gpgme_op_spawn (gpgme_ctx_t CTX,
+ const char *FILE, const char *ARGV[], gpgme_data_t DATAIN,
+ gpgme_data_t DATAOUT, gpgme_data_t DATAERR,
+ unsigned int FLAGS)
The function ‘gpgme_op_spawn’ runs the program FILE with the
arguments taken from the NULL terminated array ARGV. If no
@@ -5121,14 +5108,78 @@ GPGME API.
Under Windows this flag allows the called program to put
itself into the foreground.
- -- Function: gpgme_error_t gpgme_op_spawn_start
- (gpgme_ctx_t CTX, const char *FILE, const char *ARGV[],
- gpgme_data_t DATAIN, gpgme_data_t DATAOUT, gpgme_data_t DATAERR,
- unsigned int FLAGS)
+ -- Function: gpgme_error_t gpgme_op_spawn_start (gpgme_ctx_t CTX,
+ const char *FILE, const char *ARGV[], gpgme_data_t DATAIN,
+ gpgme_data_t DATAOUT, gpgme_data_t DATAERR,
+ unsigned int FLAGS)
This is the asynchronous variant of ‘gpgme_op_spawn’.

+File: gpgme.info, Node: Using the Assuan protocol, Prev: Running other Programs, Up: Miscellaneous
+
+7.8.2 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 ‘gpgme_ctx_set_engine_info’, passing the
+location of the servers socket as FILE_NAME argument, and an empty
+string as HOME_DIR argument.
+
+ The Assuan protocol functions use three kinds of callbacks to
+transfer data:
+
+ -- Data type: gpgme_error_t (*gpgme_assuan_data_cb_t) (void *OPAQUE,
+ const void *DATA, size_t DATALEN)
+
+ This callback receives any data sent by the server. OPAQUE is the
+ pointer passed to ‘gpgme_op_assuan_transact_start’, DATA of length
+ DATALEN refers to the data sent.
+
+ -- Data type: gpgme_error_t (*gpgme_assuan_inquire_cb_t) (void *OPAQUE,
+ const char *NAME, const char *ARGS, gpgme_data_t *R_DATA)
+
+ This callback is used to provide additional data to the Assuan
+ server. OPAQUE is the pointer passed to
+ ‘gpgme_op_assuan_transact_start’, NAME and ARGS specify what kind
+ of data the server requested, and R_DATA is used to return the
+ actual data.
+
+ Note: Returning data is currently not implemented in GPGME.
+
+ -- Data type: gpgme_error_t (*gpgme_assuan_status_cb_t) (void *OPAQUE,
+ const char *STATUS, const char *ARGS)
+
+ This callback receives any status lines sent by the server. OPAQUE
+ is the pointer passed to ‘gpgme_op_assuan_transact_start’, STATUS
+ and ARGS denote the status update sent.
+
+ -- Function: gpgme_error_t gpgme_op_assuan_transact_start
+ (gpgme_ctx_t CTX, const char *COMMAND,
+ gpgme_assuan_data_cb_t DATA_CB, void * DATA_CB_VALUE,
+ gpgme_assuan_inquire_cb_t INQUIRE_CB, void * INQUIRE_CB_VALUE,
+ gpgme_assuan_status_cb_t STATUS_CB, void * STATUS_CB_VALUE)
+
+ Send the Assuan COMMAND and return results via the callbacks. Any
+ callback may be ‘NULL’. The result of the operation may be
+ retrieved using ‘gpgme_wait_ext’.
+
+ Asynchronous variant.
+
+ -- Function: gpgme_error_t gpgme_op_assuan_transact_ext
+ (gpgme_ctx_t CTX, const char *COMMAND,
+ gpgme_assuan_data_cb_t DATA_CB, void * DATA_CB_VALUE,
+ gpgme_assuan_inquire_cb_t INQUIRE_CB, void * INQUIRE_CB_VALUE,
+ gpgme_assuan_status_cb_t STATUS_CB, void * STATUS_CB_VALUE,
+ gpgme_error_t *OP_ERR)
+
+ Send the Assuan COMMAND and return results via the callbacks. The
+ result of the operation is returned in OP_ERR.
+
+ Synchronous variant.
+
+
File: gpgme.info, Node: Run Control, Prev: Miscellaneous, Up: Contexts
7.9 Run Control
@@ -5807,18 +5858,17 @@ I/O occurs in the target context).
in the context 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 ‘gpgme_wait’ or
- ‘gpgme_wait’ during cancellation. After successful cancellation,
- you can call ‘gpgme_wait’ (optionally waiting on CTX), and the
- context CTX will appear as if it had finished with the error code
- ‘GPG_ERR_CANCEL’.
+ If you use the global event loop, you must not call ‘gpgme_wait’
+ during cancellation. After successful cancellation, you can call
+ ‘gpgme_wait’ (optionally waiting on CTX), and the context CTX will
+ appear as if it had finished with the error code ‘GPG_ERR_CANCEL’.
- If you use your an external event loop, you must ensure that no I/O
+ If you use an external event loop, you must ensure that no I/O
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
‘GPGME_EVENT_DONE’ event with the error code ‘GPG_ERR_CANCEL’ will
- be signaled.
+ be signalled.
The function returns an error code if the cancellation failed (in
this case the state of CTX is not modified).
@@ -6388,7 +6438,7 @@ associate operations the server MAY support the command:
the last command. A ‘RESET’ undoes the effect of this command.

-File: gpgme.info, Node: Debugging, Next: Library Copying, Prev: UI Server Protocol, Up: Top
+File: gpgme.info, Node: Debugging, Next: Deprecated Functions, Prev: UI Server Protocol, Up: Top
Appendix B How to solve problems
********************************
@@ -6424,526 +6474,647 @@ application. If you are asked to send a log file, make sure that you
run your tests only with play data.

-File: gpgme.info, Node: Library Copying, Next: Copying, Prev: Debugging, Up: Top
-
-GNU Lesser General Public License
-*********************************
-
- Version 2.1, February 1999
-
- Copyright © 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place – Suite 330, Boston, MA 02111-1307, USA
-
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- [This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence the
- version number 2.1.]
-
-Preamble
-========
-
-The licenses for most software are designed to take away your freedom to
-share and change it. By contrast, the GNU General Public Licenses are
-intended to guarantee your freedom to share and change free software—to
-make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software—typically libraries—of the Free Software
-Foundation and other authors who decide to use it. You can use it too,
-but we suggest you first think carefully about whether this license or
-the ordinary General Public License is the better strategy to use in any
-particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of it
-in new free programs; and that you are informed that you can do these
-things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling it.
-And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that there
-is no warranty for the free library. Also, if the library is modified
-by someone else and passed on, the recipients should know that what they
-have is not the original version, so that the original author’s
-reputation will not be affected by problems that might be introduced by
-others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that any
-patent license obtained for a version of the library must be consistent
-with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and is
-quite different from the ordinary General Public License. We use this
-license for certain libraries in order to permit linking those libraries
-into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the entire
-combination fits its criteria of freedom. The Lesser General Public
-License permits more lax criteria for linking other code with the
-library.
-
- We call this license the "Lesser" General Public License because it
-does _Less_ to protect the user’s freedom than the ordinary General
-Public License. It also provides other free software developers Less of
-an advantage over competing non-free programs. These disadvantages are
-the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free library
-does the same job as widely used non-free libraries. In this case,
-there is little to gain by limiting the free library to free software
-only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of free
-software. For example, permission to use the GNU C Library in non-free
-programs enables many more people to use the whole GNU operating system,
-as well as its variant, the GNU/Linux operating system.
-
- Although the Lesser General Public License is Less protective of the
-users’ freedom, it does ensure that the user of a program that is linked
-with the Library has the freedom and the wherewithal to run that program
-using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-“work based on the library” and a “work that uses the library”. The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
- program which contains a notice placed by the copyright holder or
- other authorized party saying it may be distributed under the terms
- of this Lesser General Public License (also called “this License”).
- Each licensee is addressed as “you”.
-
- A “library” means a collection of software functions and/or data
- prepared so as to be conveniently linked with application programs
- (which use some of those functions and data) to form executables.
-
- The “Library”, below, refers to any such software library or work
- which has been distributed under these terms. A “work based on the
- Library” means either the Library or any derivative work under
- copyright law: that is to say, a work containing the Library or a
- portion of it, either verbatim or with modifications and/or
- translated straightforwardly into another language. (Hereinafter,
- translation is included without limitation in the term
- “modification”.)
-
- “Source code” for a work means the preferred form of the work for
- making modifications to it. For a library, complete source code
- means all the source code for all modules it contains, plus any
- associated interface definition files, plus the scripts used to
- control compilation and installation of the library.
-
- Activities other than copying, distribution and modification are
- not covered by this License; they are outside its scope. The act
- of running a program using the Library is not restricted, and
- output from such a program is covered only if its contents
- constitute a work based on the Library (independent of the use of
- the Library in a tool for writing it). Whether that is true
- depends on what the Library does and what the program that uses the
- Library does.
-
- 1. You may copy and distribute verbatim copies of the Library’s
- complete source code as you receive it, in any medium, provided
- that you conspicuously and appropriately publish on each copy an
- appropriate copyright notice and disclaimer of warranty; keep
- intact all the notices that refer to this License and to the
- absence of any warranty; and distribute a copy of this License
- along with the Library.
-
- You may charge a fee for the physical act of transferring a copy,
- and you may at your option offer warranty protection in exchange
- for a fee.
-
- 2. You may modify your copy or copies of the Library or any portion of
- it, thus forming a work based on the Library, and copy and
- distribute such modifications or work under the terms of Section 1
- above, provided that you also meet all of these conditions:
-
- a. The modified work must itself be a software library.
-
- b. You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c. You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d. If a facility in the modified Library refers to a function or
- a table of data to be supplied by an application program that
- uses the facility, other than as an argument passed when the
- facility is invoked, then you must make a good faith effort to
- ensure that, in the event an application does not supply such
- function or table, the facility still operates, and performs
- whatever part of its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots
- has a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function
- must be optional: if the application does not supply it, the
- square root function must still compute square roots.)
-
- These requirements apply to the modified work as a whole. If
- identifiable sections of that work are not derived from the
- Library, and can be reasonably considered independent and separate
- works in themselves, then this License, and its terms, do not apply
- to those sections when you distribute them as separate works. But
- when you distribute the same sections as part of a whole which is a
- work based on the Library, the distribution of the whole must be on
- the terms of this License, whose permissions for other licensees
- extend to the entire whole, and thus to each and every part
- regardless of who wrote it.
-
- Thus, it is not the intent of this section to claim rights or
- contest your rights to work written entirely by you; rather, the
- intent is to exercise the right to control the distribution of
- derivative or collective works based on the Library.
-
- In addition, mere aggregation of another work not based on the
- Library with the Library (or with a work based on the Library) on a
- volume of a storage or distribution medium does not bring the other
- work under the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
- License instead of this License to a given copy of the Library. To
- do this, you must alter all the notices that refer to this License,
- so that they refer to the ordinary GNU General Public License,
- version 2, instead of to this License. (If a newer version than
- version 2 of the ordinary GNU General Public License has appeared,
- then you can specify that version instead if you wish.) Do not
- make any other change in these notices.
-
- Once this change is made in a given copy, it is irreversible for
- that copy, so the ordinary GNU General Public License applies to
- all subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of the
- Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or derivative
- of it, under Section 2) in object code or executable form under the
- terms of Sections 1 and 2 above provided that you accompany it with
- the complete corresponding machine-readable source code, which must
- be distributed under the terms of Sections 1 and 2 above on a
- medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
- from a designated place, then offering equivalent access to copy
- the source code from the same place satisfies the requirement to
- distribute the source code, even though third parties are not
- compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
- Library, but is designed to work with the Library by being compiled
- or linked with it, is called a “work that uses the Library”. Such
- a work, in isolation, is not a derivative work of the Library, and
- therefore falls outside the scope of this License.
-
- However, linking a “work that uses the Library” with the Library
- creates an executable that is a derivative of the Library (because
- it contains portions of the Library), rather than a “work that uses
- the library”. The executable is therefore covered by this License.
- Section 6 states terms for distribution of such executables.
-
- When a “work that uses the Library” uses material from a header
- file that is part of the Library, the object code for the work may
- be a derivative work of the Library even though the source code is
- not. Whether this is true is especially significant if the work
- can be linked without the Library, or if the work is itself a
- library. The threshold for this to be true is not precisely
- defined by law.
-
- If such an object file uses only numerical parameters, data
- structure layouts and accessors, and small macros and small inline
- functions (ten lines or less in length), then the use of the object
- file is unrestricted, regardless of whether it is legally a
- derivative work. (Executables containing this object code plus
- portions of the Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
- distribute the object code for the work under the terms of Section
- 6. Any executables containing that work also fall under Section 6,
- whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or link
- a “work that uses the Library” with the Library to produce a work
- containing portions of the Library, and distribute that work under
- terms of your choice, provided that the terms permit modification
- of the work for the customer’s own use and reverse engineering for
- debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
- Library is used in it and that the Library and its use are covered
- by this License. You must supply a copy of this License. If the
- work during execution displays copyright notices, you must include
- the copyright notice for the Library among them, as well as a
- reference directing the user to the copy of this License. Also,
- you must do one of these things:
-
- a. Accompany the work with the complete corresponding
- machine-readable source code for the Library including
- whatever changes were used in the work (which must be
- distributed under Sections 1 and 2 above); and, if the work is
- an executable linked with the Library, with the complete
- machine-readable “work that uses the Library”, as object code
- and/or source code, so that the user can modify the Library
- and then relink to produce a modified executable containing
- the modified Library. (It is understood that the user who
- changes the contents of definitions files in the Library will
- not necessarily be able to recompile the application to use
- the modified definitions.)
-
- b. Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run
- time a copy of the library already present on the user’s
- computer system, rather than copying library functions into
- the executable, and (2) will operate properly with a modified
- version of the library, if the user installs one, as long as
- the modified version is interface-compatible with the version
- that the work was made with.
-
- c. Accompany the work with a written offer, valid for at least
- three years, to give the same user the materials specified in
- Subsection 6a, above, for a charge no more than the cost of
- performing this distribution.
-
- d. If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the
- above specified materials from the same place.
-
- e. Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the “work that uses the
- Library” must include any data and utility programs needed for
- reproducing the executable from it. However, as a special
- exception, the materials to be distributed need not include
- anything that is normally distributed (in either source or binary
- form) with the major components (compiler, kernel, and so on) of
- the operating system on which the executable runs, unless that
- component itself accompanies the executable.
-
- It may happen that this requirement contradicts the license
- restrictions of other proprietary libraries that do not normally
- accompany the operating system. Such a contradiction means you
- cannot use both them and the Library together in an executable that
- you distribute.
-
- 7. You may place library facilities that are a work based on the
- Library side-by-side in a single library together with other
- library facilities not covered by this License, and distribute such
- a combined library, provided that the separate distribution of the
- work based on the Library and of the other library facilities is
- otherwise permitted, and provided that you do these two things:
-
- a. Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b. Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same
- work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute the
- Library except as expressly provided under this License. Any
- attempt otherwise to copy, modify, sublicense, link with, or
- distribute the Library is void, and will automatically terminate
- your rights under this License. However, parties who have received
- copies, or rights, from you under this License will not have their
- licenses terminated so long as such parties remain in full
- compliance.
-
- 9. You are not required to accept this License, since you have not
- signed it. However, nothing else grants you permission to modify
- or distribute the Library or its derivative works. These actions
- are prohibited by law if you do not accept this License.
- Therefore, by modifying or distributing the Library (or any work
- based on the Library), you indicate your acceptance of this License
- to do so, and all its terms and conditions for copying,
- distributing or modifying the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
- Library), the recipient automatically receives a license from the
- original licensor to copy, distribute, link with or modify the
- Library subject to these terms and conditions. You may not impose
- any further restrictions on the recipients’ exercise of the rights
- granted herein. You are not responsible for enforcing compliance
- by third parties with this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
- infringement or for any other reason (not limited to patent
- issues), conditions are imposed on you (whether by court order,
- agreement or otherwise) that contradict the conditions of this
- License, they do not excuse you from the conditions of this
- License. If you cannot distribute so as to satisfy simultaneously
- your obligations under this License and any other pertinent
- obligations, then as a consequence you may not distribute the
- Library at all. For example, if a patent license would not permit
- royalty-free redistribution of the Library by all those who receive
- copies directly or indirectly through you, then the only way you
- could satisfy both it and this License would be to refrain entirely
- from distribution of the Library.
-
- If any portion of this section is held invalid or unenforceable
- under any particular circumstance, the balance of the section is
- intended to apply, and the section as a whole is intended to apply
- in other circumstances.
-
- It is not the purpose of this section to induce you to infringe any
- patents or other property right claims or to contest validity of
- any such claims; this section has the sole purpose of protecting
- the integrity of the free software distribution system which is
- implemented by public license practices. Many people have made
- generous contributions to the wide range of software distributed
- through that system in reliance on consistent application of that
- system; it is up to the author/donor to decide if he or she is
- willing to distribute software through any other system and a
- licensee cannot impose that choice.
-
- This section is intended to make thoroughly clear what is believed
- to be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
- certain countries either by patents or by copyrighted interfaces,
- the original copyright holder who places the Library under this
- License may add an explicit geographical distribution limitation
- excluding those countries, so that distribution is permitted only
- in or among countries not thus excluded. In such case, this
- License incorporates the limitation as if written in the body of
- this License.
-
- 13. The Free Software Foundation may publish revised and/or new
- versions of the Lesser General Public License from time to time.
- Such new versions will be similar in spirit to the present version,
- but may differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
- Library specifies a version number of this License which applies to
- it and “any later version”, you have the option of following the
- terms and conditions either of that version or of any later version
- published by the Free Software Foundation. If the Library does not
- specify a license version number, you may choose any version ever
- published by the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
- programs whose distribution conditions are incompatible with these,
- write to the author to ask for permission. For software which is
- copyrighted by the Free Software Foundation, write to the Free
- Software Foundation; we sometimes make exceptions for this. Our
- decision will be guided by the two goals of preserving the free
- status of all derivatives of our free software and of promoting the
- sharing and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
- WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE
- LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
- AND/OR OTHER PARTIES PROVIDE THE LIBRARY “AS IS” WITHOUT WARRANTY
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
- PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE
- DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR
- OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
- WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
- MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE
- LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
- INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
- INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
- OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY
- OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Libraries
-==============================================
+File: gpgme.info, Node: Deprecated Functions, Next: Library Copying, Prev: Debugging, Up: Top
+
+Appendix C Deprecated Functions
+*******************************
+
+For backward compatibility 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.
+
+ *Warning:* These interfaces will be removed in a future version of
+GPGME.
+
+ -- Function: void gpgme_key_release (gpgme_key_t KEY)
+ The function ‘gpgme_key_release’ is equivalent to
+ ‘gpgme_key_unref’.
+
+ -- Function: void gpgme_trust_item_release (gpgme_trust_item_t ITEM)
+ The function ‘gpgme_trust_item_release’ is an alias for
+ ‘gpgme_trust_item_unref’.
+
+ -- Function: gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t CTX,
+ gpgme_data_t KEYDATA, int *NR)
+ The function ‘gpgme_op_import_ext’ is equivalent to:
+
+ gpgme_error_t err = gpgme_op_import (ctx, keydata);
+ if (!err)
+ {
+ gpgme_import_result_t result = gpgme_op_import_result (ctx);
+ *nr = result->considered;
+ }
+
+ -- Data type: gpgme_error_t (*gpgme_edit_cb_t) (void *HANDLE,
+ gpgme_status_code_t STATUS, const char *ARGS, int FD)
+ The ‘gpgme_edit_cb_t’ type is the type of functions which GPGME
+ calls if it a key edit operation is on-going. The status code
+ STATUS and the argument line ARGS are passed through by GPGME from
+ the crypto engine. The file descriptor FD is -1 for normal status
+ messages. If STATUS indicates a command rather than a status
+ message, the response to the command should be written to FD. The
+ HANDLE is provided by the user at start of operation.
+
+ The function should return ‘GPG_ERR_FALSE’ if it did not handle the
+ status code, ‘0’ for success, or any other error value.
+
+ -- Function: gpgme_error_t gpgme_op_edit (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, gpgme_edit_cb_t FNC, void *HANDLE,
+ gpgme_data_t OUT)
+ Note: This function is deprecated, please use ‘gpgme_op_interact’
+ instead.
+
+ The function ‘gpgme_op_edit’ processes the key KEY interactively,
+ using the edit callback function FNC with the handle 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 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 GPGME.
+
+ The function returns the error code ‘GPG_ERR_NO_ERROR’ if the edit
+ operation completes successfully, ‘GPG_ERR_INV_VALUE’ if CTX or KEY
+ is not a valid pointer, and any error returned by the crypto engine
+ or the edit callback handler.
+
+ -- Function: gpgme_error_t gpgme_op_edit_start (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, gpgme_edit_cb_t FNC, void *HANDLE,
+ gpgme_data_t OUT)
+ Note: This function is deprecated, please use
+ ‘gpgme_op_interact_start’ instead.
+
+ The function ‘gpgme_op_edit_start’ initiates a ‘gpgme_op_edit’
+ operation. It can be completed by calling ‘gpgme_wait’ on the
+ context. *Note Waiting For Completion::.
+
+ The function returns the error code ‘GPG_ERR_NO_ERROR’ if the
+ operation was started successfully, and ‘GPG_ERR_INV_VALUE’ if CTX
+ or KEY is not a valid pointer.
+
+ -- Function: gpgme_error_t gpgme_op_card_edit (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, gpgme_edit_cb_t FNC, void *HANDLE,
+ gpgme_data_t OUT)
+ Note: This function is deprecated, please use ‘gpgme_op_interact’
+ with the flag ‘GPGME_INTERACT_CARD’ instead.
+
+ The function ‘gpgme_op_card_edit’ is analogous to ‘gpgme_op_edit’,
+ but should be used to process the smart card corresponding to the
+ key KEY.
+
+ -- Function: gpgme_error_t gpgme_op_card_edit_start (gpgme_ctx_t CTX,
+ gpgme_key_t KEY, gpgme_edit_cb_t FNC, void *HANDLE,
+ gpgme_data_t OUT)
+ Note: This function is deprecated, please use
+ ‘gpgme_op_interact_start’ with the flag ‘GPGME_INTERACT_CARD’
+ instead.
+
+ The function ‘gpgme_op_card_edit_start’ initiates a
+ ‘gpgme_op_card_edit’ operation. It can be completed by calling
+ ‘gpgme_wait’ on the context. *Note Waiting For Completion::.
+
+ The function returns the error code ‘GPG_ERR_NO_ERROR’ if the
+ operation was started successfully, and ‘GPG_ERR_INV_VALUE’ if CTX
+ or KEY is not a valid pointer.
+
+ -- Function: gpgme_error_t gpgme_data_new_with_read_cb
+ (gpgme_data_t *DH, int (*READFUNC) (void *HOOK, char *BUFFER,
+ size_t COUNT, size_t *NREAD), void *HOOK_VALUE)
+ The function ‘gpgme_data_new_with_read_cb’ creates a new
+ ‘gpgme_data_t’ object and uses the callback function 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
+ GPGME provides. However, it can not be used to write data.
+
+ The callback function receives HOOK_VALUE as its first argument
+ whenever it is invoked. It should return up to COUNT bytes in
+ BUFFER, and return the number of bytes actually read in NREAD. It
+ may return ‘0’ in NREAD if no data is currently available. To
+ indicate ‘EOF’ the function should return with an error code of
+ ‘-1’ and set NREAD to ‘0’. The callback function may support to
+ reset its internal read pointer if it is invoked with BUFFER and
+ NREAD being ‘NULL’ and COUNT being ‘0’.
+
+ The function returns the error code ‘GPG_ERR_NO_ERROR’ if the data
+ object was successfully created, ‘GPG_ERR_INV_VALUE’ if DH or
+ READFUNC is not a valid pointer, and ‘GPG_ERR_ENOMEM’ if not enough
+ memory is available.
+
+ -- Function: gpgme_error_t gpgme_data_rewind (gpgme_data_t DH)
+ The function ‘gpgme_data_rewind’ is equivalent to:
+
+ return (gpgme_data_seek (dh, 0, SEEK_SET) == -1)
+ ? gpgme_error_from_errno (errno) : 0;
+
+ -- Data type: gpgme_attr_t
+ The ‘gpgme_attr_t’ type is used to specify a key or trust item
+ attribute. The following attributes are defined:
+
+ ‘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.
+
+ ‘GPGME_ATTR_FPR’
+ This is the fingerprint of a sub key. It is representable as
+ a string.
+
+ ‘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 ‘enum gcry_pk_algos’ values in the
+ gcrypt library.
+
+ ‘GPGME_ATTR_LEN’
+ This is the key length of a sub key. It is representable as a
+ number.
+
+ ‘GPGME_ATTR_CREATED’
+ This is the timestamp at creation time of a sub key. It is
+ representable as a number.
+
+ ‘GPGME_ATTR_EXPIRE’
+ This is the expiration time of a sub key. It is representable
+ as a number.
+
+ ‘GPGME_ATTR_OTRUST’
+ XXX FIXME (also for trust items)
+
+ ‘GPGME_ATTR_USERID’
+ This is a user ID. There can be more than one user IDs in a
+ 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.
+
+ ‘GPGME_ATTR_NAME’
+ This is the name belonging to a user ID. It is representable
+ as a string.
+
+ ‘GPGME_ATTR_EMAIL’
+ This is the email address belonging to a user ID. It is
+ representable as a string.
+
+ ‘GPGME_ATTR_COMMENT’
+ This is the comment belonging to a user ID. It is
+ representable as a string.
+
+ ‘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.
+
+ ‘GPGME_ATTR_UID_REVOKED’
+ This specifies if a user ID is revoked. It is representable
+ as a number, and is ‘1’ if the user ID is revoked, and ‘0’
+ otherwise.
+
+ ‘GPGME_ATTR_UID_INVALID’
+ This specifies if a user ID is invalid. It is representable
+ as a number, and is ‘1’ if the user ID is invalid, and ‘0’
+ otherwise.
+
+ ‘GPGME_ATTR_LEVEL’
+ This is the trust level of a trust 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.
+
+ ‘GPGME_ATTR_IS_SECRET’
+ This specifies if the key is a secret key. It is
+ representable as a number, and is ‘1’ if the key is revoked,
+ and ‘0’ otherwise.
+
+ ‘GPGME_ATTR_KEY_REVOKED’
+ This specifies if a sub key is revoked. It is representable
+ as a number, and is ‘1’ if the key is revoked, and ‘0’
+ otherwise.
+
+ ‘GPGME_ATTR_KEY_INVALID’
+ This specifies if a sub key is invalid. It is representable
+ as a number, and is ‘1’ if the key is invalid, and ‘0’
+ otherwise.
+
+ ‘GPGME_ATTR_KEY_EXPIRED’
+ This specifies if a sub key is expired. It is representable
+ as a number, and is ‘1’ if the key is expired, and ‘0’
+ otherwise.
+
+ ‘GPGME_ATTR_KEY_DISABLED’
+ This specifies if a sub key is disabled. It is representable
+ as a number, and is ‘1’ if the key is disabled, and ‘0’
+ otherwise.
+
+ ‘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.
+
+ ‘GPGME_ATTR_CAN_ENCRYPT’
+ This specifies if a sub key can be used for encryption. It is
+ representable as a number, and is ‘1’ if the sub key can be
+ used for encryption, and ‘0’ otherwise.
+
+ ‘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 ‘1’ if
+ the sub key can be used for signatures, and ‘0’ otherwise.
+
+ ‘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 ‘1’ if
+ the sub key can be used for certifications, and ‘0’ otherwise.
+
+ ‘GPGME_ATTR_SERIAL’
+ The X.509 issuer serial attribute of the key. It is
+ representable as a string.
+
+ ‘GPGME_ATTR_ISSUE’
+ The X.509 issuer name attribute of the key. It is
+ representable as a string.
+
+ ‘GPGME_ATTR_CHAINID’
+ The X.509 chain ID can be used to build the certification
+ chain. It is representable as a string.
+
+ -- Function: const char * gpgme_key_get_string_attr (gpgme_key_t KEY,
+ gpgme_attr_t WHAT, const void *RESERVED, int IDX)
+ The function ‘gpgme_key_get_string_attr’ returns the value of the
+ string-representable attribute WHAT of key KEY. If the attribute
+ is an attribute of a sub key or an user ID, IDX specifies the sub
+ key or user ID of which the attribute value is returned. The
+ argument RESERVED is reserved for later use and should be ‘NULL’.
+
+ The string returned is only valid as long as the key is valid.
+
+ The function returns ‘0’ if an attribute can’t be returned as a
+ string, KEY is not a valid pointer, IDX out of range, or RESERVED
+ not ‘NULL’.
+
+ -- Function: unsigned long gpgme_key_get_ulong_attr (gpgme_key_t KEY,
+ gpgme_attr_t WHAT, const void *RESERVED, int IDX)
+ The function ‘gpgme_key_get_ulong_attr’ returns the value of the
+ number-representable attribute WHAT of key KEY. If the attribute
+ is an attribute of a sub key or an user ID, IDX specifies the sub
+ key or user ID of which the attribute value is returned. The
+ argument RESERVED is reserved for later use and should be ‘NULL’.
+
+ The function returns ‘0’ if the attribute can’t be returned as a
+ number, KEY is not a valid pointer, IDX out of range, or RESERVED
+ not ‘NULL’.
+
+ The signatures on a key are only available if the key was retrieved
+via a listing operation with the ‘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 ‘gpgme_get_key’.
+
+ -- Data type: gpgme_attr_t
+ The ‘gpgme_attr_t’ type is used to specify a key signature
+ attribute. The following attributes are defined:
+
+ ‘GPGME_ATTR_KEYID’
+ This is the key ID of the key which was used for the
+ signature. It is representable as a string.
+
+ ‘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 ‘enum gcry_pk_algos’ values in the gcrypt
+ library.
+
+ ‘GPGME_ATTR_CREATED’
+ This is the timestamp at creation time of the signature. It
+ is representable as a number.
+
+ ‘GPGME_ATTR_EXPIRE’
+ This is the expiration time of the signature. It is
+ representable as a number.
+
+ ‘GPGME_ATTR_USERID’
+ This is the user ID associated with the signing key. The user
+ ID is representable as a number.
+
+ ‘GPGME_ATTR_NAME’
+ This is the name belonging to a user ID. It is representable
+ as a string.
+
+ ‘GPGME_ATTR_EMAIL’
+ This is the email address belonging to a user ID. It is
+ representable as a string.
+
+ ‘GPGME_ATTR_COMMENT’
+ This is the comment belonging to a user ID. It is
+ representable as a string.
+
+ ‘GPGME_ATTR_KEY_REVOKED’
+ This specifies if a key signature is a revocation signature.
+ It is representable as a number, and is ‘1’ if the key is
+ revoked, and ‘0’ otherwise.
+
+ ‘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.
+
+ ‘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.
+
+ ‘GPGME_ATTR_SIG_STATUS’
+ This is the same value as returned by ‘gpgme_get_sig_status’.
+
+ -- Function: const char * gpgme_key_sig_get_string_attr
+ (gpgme_key_t KEY, int UID_IDX, gpgme_attr_t WHAT,
+ const void *RESERVED, int IDX)
+ The function ‘gpgme_key_sig_get_string_attr’ returns the value of
+ the string-representable attribute WHAT of the signature IDX on the
+ user ID UID_IDX in the key KEY. The argument RESERVED is reserved
+ for later use and should be ‘NULL’.
+
+ The string returned is only valid as long as the key is valid.
+
+ The function returns ‘0’ if an attribute can’t be returned as a
+ string, KEY is not a valid pointer, UID_IDX or IDX out of range, or
+ RESERVED not ‘NULL’.
+
+ -- Function: unsigned long gpgme_key_sig_get_ulong_attr
+ (gpgme_key_t KEY, int UID_IDX, gpgme_attr_t WHAT,
+ const void *RESERVED, int IDX)
+ The function ‘gpgme_key_sig_get_ulong_attr’ returns the value of
+ the number-representable attribute WHAT of the signature IDX on the
+ user ID UID_IDX in the key KEY. The argument RESERVED is reserved
+ for later use and should be ‘NULL’.
+
+ The function returns ‘0’ if an attribute can’t be returned as a
+ string, KEY is not a valid pointer, UID_IDX or IDX out of range, or
+ RESERVED not ‘NULL’.
+
+ Trust items have attributes which can be queried using the interfaces
+below. The attribute identifiers are shared with those for key
+attributes. *Note Information About Keys::.
+
+ -- Function: const char * gpgme_trust_item_get_string_attr
+ (gpgme_trust_item_t ITEM, gpgme_attr_t WHAT,
+ const void *RESERVED, int IDX)
+ The function ‘gpgme_trust_item_get_string_attr’ returns the value
+ of the string-representable attribute WHAT of trust item ITEM. The
+ arguments IDX and RESERVED are reserved for later use and should be
+ ‘0’ and ‘NULL’ respectively.
+
+ The string returned is only valid as long as the key is valid.
+
+ The function returns ‘0’ if an attribute can’t be returned as a
+ string, KEY is not a valid pointer, IDX out of range, or RESERVED
+ not ‘NULL’.
+
+ -- Function: int gpgme_trust_item_get_int_attr
+ (gpgme_trust_item_t ITEM, gpgme_attr_t WHAT,
+ const void *RESERVED, int IDX)
+ The function ‘gpgme_trust_item_get_int_attr’ returns the value of
+ the number-representable attribute WHAT of trust item ITEM. If the
+ attribute occurs more than once in the trust item, the index is
+ specified by IDX. However, currently no such attribute exists, so
+ IDX should be ‘0’. The argument RESERVED is reserved for later use
+ and should be ‘NULL’.
+
+ The function returns ‘0’ if the attribute can’t be returned as a
+ number, KEY is not a valid pointer, IDX out of range, or RESERVED
+ not ‘NULL’.
+
+ -- Data type: enum gpgme_sig_stat_t
+ The ‘gpgme_sig_stat_t’ type holds the result of a signature check,
+ or the combined result of all signatures. The following results
+ are possible:
+
+ ‘GPGME_SIG_STAT_NONE’
+ This status should not occur in normal operation.
+
+ ‘GPGME_SIG_STAT_GOOD’
+ This status indicates that the signature is valid. For the
+ combined result this status means that all signatures are
+ valid.
+
+ ‘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.
+
+ ‘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.
+
+ ‘GPGME_SIG_STAT_BAD’
+ This status indicates that the signature is invalid. For the
+ combined result this status means that all signatures are
+ invalid.
+
+ ‘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.
+
+ ‘GPGME_SIG_STAT_NOSIG’
+ This status indicates that the signature data provided was not
+ a real signature.
+
+ ‘GPGME_SIG_STAT_ERROR’
+ This status indicates that there was some other error which
+ prevented the signature verification.
+
+ ‘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 ‘gpgme_get_sig_status’.
+
+ -- Function: const char * gpgme_get_sig_status (gpgme_ctx_t CTX,
+ int IDX, gpgme_sig_stat_t *R_STAT, time_t *R_CREATED)
+ The function ‘gpgme_get_sig_status’ is equivalent to:
+
+ 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;
+
+ -- Function: const char * gpgme_get_sig_string_attr (gpgme_ctx_t CTX,
+ int IDX, gpgme_attr_t WHAT, int WHATIDX)
+ The function ‘gpgme_get_sig_string_attr’ is equivalent to:
-If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of
-the ordinary General Public License).
+ gpgme_verify_result_t result;
+ gpgme_signature_t sig;
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should have
-at least the “copyright” line and a pointer to where the full notice is
-found.
+ result = gpgme_op_verify_result (ctx);
+ sig = result->signatures;
- ONE LINE TO GIVE THE LIBRARY'S NAME AND AN IDEA OF WHAT IT DOES.
- Copyright (C) YEAR NAME OF AUTHOR
+ while (sig && idx)
+ {
+ sig = sig->next;
+ idx--;
+ }
+ if (!sig || idx)
+ return NULL;
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or (at
- your option) any later version.
+ switch (what)
+ {
+ case GPGME_ATTR_FPR:
+ return sig->fpr;
- This library 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
- Lesser General Public License for more details.
+ case GPGME_ATTR_ERRTOK:
+ if (whatidx == 1)
+ return sig->wrong_key_usage ? "Wrong_Key_Usage" : "";
+ else
+ return "";
+ default:
+ break;
+ }
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
- USA.
+ return NULL;
- Also add information on how to contact you by electronic and paper
-mail.
+ -- Function: const char * gpgme_get_sig_ulong_attr (gpgme_ctx_t CTX,
+ int IDX, gpgme_attr_t WAHT, int WHATIDX)
+ The function ‘gpgme_get_sig_ulong_attr’ is equivalent to:
- You should also get your employer (if you work as a programmer) or
-your school, if any, to sign a “copyright disclaimer” for the library,
-if necessary. Here is a sample; alter the names:
+ gpgme_verify_result_t result;
+ gpgme_signature_t sig;
- Yoyodyne, Inc., hereby disclaims all copyright interest in the library
- `Frob' (a library for tweaking knobs) written by James Random Hacker.
+ result = gpgme_op_verify_result (ctx);
+ sig = result->signatures;
- SIGNATURE OF TY COON, 1 April 1990
- Ty Coon, President of Vice
+ while (sig && idx)
+ {
+ sig = sig->next;
+ idx--;
+ }
+ if (!sig || idx)
+ return 0;
- That’s all there is to it!
+ 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;
+
+ -- Function: const char * gpgme_get_sig_key (gpgme_ctx_t CTX, int IDX,
+ gpgme_key_t *R_KEY)
+ The function ‘gpgme_get_sig_key’ is equivalent to:
+
+ 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);