LCOV - code coverage report
Current view: top level - build/lang/python/python2.7-gpg - gpgme.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 2 5 40.0 %
Date: 2017-03-02 17:11:10 Functions: 0 0 -

          Line data    Source code
       1             : /* gpgme.h - Public interface to GnuPG Made Easy.                   -*- c -*-
       2             :  * Copyright (C) 2000 Werner Koch (dd9jn)
       3             :  * Copyright (C) 2001-2017 g10 Code GmbH
       4             :  *
       5             :  * This file is part of GPGME.
       6             :  *
       7             :  * GPGME is free software; you can redistribute it and/or modify it
       8             :  * under the terms of the GNU Lesser General Public License as
       9             :  * published by the Free Software Foundation; either version 2.1 of
      10             :  * the License, or (at your option) any later version.
      11             :  *
      12             :  * GPGME is distributed in the hope that it will be useful, but
      13             :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15             :  * Lesser General Public License for more details.
      16             :  *
      17             :  * You should have received a copy of the GNU Lesser General Public
      18             :  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
      19             :  *
      20             :  * Generated from gpgme.h.in for x86_64-pc-linux-gnu.
      21             :  */
      22             : 
      23             : #ifndef GPGME_H
      24             : #define GPGME_H
      25             : 
      26             : /* Include stdio.h for the FILE type definition.  */
      27             : #include <stdio.h>
      28             : #include <time.h>
      29             : #include <gpg-error.h>
      30             : 
      31             : #ifdef __cplusplus
      32             : extern "C" {
      33             : #if 0 /*(Make Emacsen's auto-indent happy.)*/
      34             : }
      35             : #endif
      36             : #endif /* __cplusplus */
      37             : 
      38             : 
      39             : /* The version of this header should match the one of the library.  Do
      40             :    not use this symbol in your application, use gpgme_check_version
      41             :    instead.  The purpose of this macro is to let autoconf (using the
      42             :    AM_PATH_GPGME macro) check that this header matches the installed
      43             :    library.  */
      44             : #define GPGME_VERSION "1.8.1"
      45             : 
      46             : /* The version number of this header.  It may be used to handle minor
      47             :    API incompatibilities.  */
      48             : #define GPGME_VERSION_NUMBER 0x010801
      49             : 
      50             : 
      51             : /* System specific typedefs.  */
      52             : 
      53             : #include <sys/types.h>
      54             : typedef off_t   gpgme_off_t;
      55             : typedef ssize_t gpgme_ssize_t;
      56             : 
      57             : 
      58             : 
      59             : /*
      60             :  * Check for compiler features.
      61             :  */
      62             : #ifdef GPGRT_INLINE
      63             : # define _GPGME_INLINE GPGRT_INLINE
      64             : #elif defined(__GNUC__)
      65             : # define _GPGME_INLINE __inline__
      66             : #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
      67             : # define _GPGME_INLINE inline
      68             : #else
      69             : # define _GPGME_INLINE
      70             : #endif
      71             : 
      72             : 
      73             : /* The deprecated macro takes the version number of GPGME which
      74             :  * introduced the deprecation as parameter for documentation.  */
      75             : #ifdef GPGRT_ATTR_DEPRECATED
      76             : # define _GPGME_DEPRECATED(a,b) GPGRT_ATTR_DEPRECATED
      77             : #elif defined(__GNUC__)
      78             : # define _GPGME_GCC_VERSION (__GNUC__ * 10000 \
      79             :                              + __GNUC_MINOR__ * 100 \
      80             :                              + __GNUC_PATCHLEVEL__)
      81             : 
      82             : # if _GPGME_GCC_VERSION > 30100
      83             : #  define _GPGME_DEPRECATED(a,b)  __attribute__ ((__deprecated__))
      84             : # else
      85             : #  define _GPGME_DEPRECATED(a,b)
      86             : # endif
      87             : #else
      88             : # define _GPGME_DEPRECATED(a,b)
      89             : #endif
      90             : 
      91             : 
      92             : /* The macro _GPGME_DEPRECATED_OUTSIDE_GPGME suppresses warnings for
      93             :    fields we must access in GPGME for ABI compatibility.  */
      94             : #ifdef _GPGME_IN_GPGME
      95             : #define _GPGME_DEPRECATED_OUTSIDE_GPGME(a,b)
      96             : #else
      97             : #define _GPGME_DEPRECATED_OUTSIDE_GPGME(a,b) _GPGME_DEPRECATED(a,b)
      98             : #endif
      99             : 
     100             : 
     101             : /* Check for a matching _FILE_OFFSET_BITS definition.  */
     102             : #if 0
     103             : #ifndef _FILE_OFFSET_BITS
     104             : #error GPGME was compiled with _FILE_OFFSET_BITS = 0, please see the section "Largefile support (LFS)" in the GPGME manual.
     105             : #else
     106             : #if (_FILE_OFFSET_BITS) != (0)
     107             : #error GPGME was compiled with a different value for _FILE_OFFSET_BITS, namely 0, please see the section "Largefile support (LFS)" in the GPGME manual.
     108             : #endif
     109             : #endif
     110             : #endif
     111             : 
     112             : 
     113             : 
     114             : /*
     115             :  * Some opaque data types used by GPGME.
     116             :  */
     117             : 
     118             : /* The context holds some global state and configuration options, as
     119             :    well as the results of a crypto operation.  */
     120             : struct gpgme_context;
     121             : typedef struct gpgme_context *gpgme_ctx_t;
     122             : 
     123             : /* The data object is used by GPGME to exchange arbitrary data.  */
     124             : struct gpgme_data;
     125             : typedef struct gpgme_data *gpgme_data_t;
     126             : 
     127             : 
     128             : 
     129             : /*
     130             :  * Wrappers for the libgpg-error library.
     131             :  */
     132             : 
     133             : typedef gpg_error_t gpgme_error_t;
     134             : typedef gpg_err_code_t gpgme_err_code_t;
     135             : typedef gpg_err_source_t gpgme_err_source_t;
     136             : 
     137             : 
     138             : static _GPGME_INLINE gpgme_error_t
     139             : gpgme_err_make (gpgme_err_source_t source, gpgme_err_code_t code)
     140             : {
     141           0 :   return gpg_err_make (source, code);
     142             : }
     143             : 
     144             : 
     145             : /* The user can define GPGME_ERR_SOURCE_DEFAULT before including this
     146             :    file to specify a default source for gpgme_error.  */
     147             : #ifndef GPGME_ERR_SOURCE_DEFAULT
     148             : #define GPGME_ERR_SOURCE_DEFAULT  GPG_ERR_SOURCE_USER_1
     149             : #endif
     150             : 
     151             : static _GPGME_INLINE gpgme_error_t
     152             : gpgme_error (gpgme_err_code_t code)
     153             : {
     154           0 :   return gpgme_err_make (GPGME_ERR_SOURCE_DEFAULT, code);
     155             : }
     156             : 
     157             : 
     158             : static _GPGME_INLINE gpgme_err_code_t
     159             : gpgme_err_code (gpgme_error_t err)
     160             : {
     161          43 :   return gpg_err_code (err);
     162             : }
     163             : 
     164             : 
     165             : static _GPGME_INLINE gpgme_err_source_t
     166             : gpgme_err_source (gpgme_error_t err)
     167             : {
     168           1 :   return gpg_err_source (err);
     169             : }
     170             : 
     171             : 
     172             : /* Return a pointer to a string containing a description of the error
     173             :    code in the error value ERR.  This function is not thread safe.  */
     174             : const char *gpgme_strerror (gpgme_error_t err);
     175             : 
     176             : /* Return the error string for ERR in the user-supplied buffer BUF of
     177             :    size BUFLEN.  This function is, in contrast to gpg_strerror,
     178             :    thread-safe if a thread-safe strerror_r() function is provided by
     179             :    the system.  If the function succeeds, 0 is returned and BUF
     180             :    contains the string describing the error.  If the buffer was not
     181             :    large enough, ERANGE is returned and BUF contains as much of the
     182             :    beginning of the error string as fits into the buffer.  */
     183             : int gpgme_strerror_r (gpg_error_t err, char *buf, size_t buflen);
     184             : 
     185             : /* Return a pointer to a string containing a description of the error
     186             :    source in the error value ERR.  */
     187             : const char *gpgme_strsource (gpgme_error_t err);
     188             : 
     189             : /* Retrieve the error code for the system error ERR.  This returns
     190             :    GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
     191             :    this).  */
     192             : gpgme_err_code_t gpgme_err_code_from_errno (int err);
     193             : 
     194             : /* Retrieve the system error for the error code CODE.  This returns 0
     195             :    if CODE is not a system error code.  */
     196             : int gpgme_err_code_to_errno (gpgme_err_code_t code);
     197             : 
     198             : /* Retrieve the error code directly from the ERRNO variable.  This
     199             :    returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped
     200             :    (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
     201             : gpgme_err_code_t gpgme_err_code_from_syserror (void);
     202             : 
     203             : /* Set the ERRNO variable.  This function is the preferred way to set
     204             :    ERRNO due to peculiarities on WindowsCE.  */
     205             : void gpgme_err_set_errno (int err);
     206             : 
     207             : /* Return an error value with the error source SOURCE and the system
     208             :    error ERR.  FIXME: Should be inline.  */
     209             : gpgme_error_t gpgme_err_make_from_errno (gpgme_err_source_t source, int err);
     210             : 
     211             : /* Return an error value with the system error ERR.  FIXME: Should be inline.  */
     212             : gpgme_error_t gpgme_error_from_errno (int err);
     213             : 
     214             : 
     215             : static _GPGME_INLINE gpgme_error_t
     216             : gpgme_error_from_syserror (void)
     217             : {
     218           0 :   return gpgme_error (gpgme_err_code_from_syserror ());
     219             : }
     220             : 
     221             : 
     222             : 
     223             : /*
     224             :  * Various constants and types
     225             :  */
     226             : 
     227             : /* The possible encoding mode of gpgme_data_t objects.  */
     228             : typedef enum
     229             :   {
     230             :     GPGME_DATA_ENCODING_NONE   = 0,     /* Not specified.  */
     231             :     GPGME_DATA_ENCODING_BINARY = 1,
     232             :     GPGME_DATA_ENCODING_BASE64 = 2,
     233             :     GPGME_DATA_ENCODING_ARMOR  = 3,     /* Either PEM or OpenPGP Armor.  */
     234             :     GPGME_DATA_ENCODING_URL    = 4,     /* LF delimited URL list.        */
     235             :     GPGME_DATA_ENCODING_URLESC = 5,     /* Ditto, but percent escaped.   */
     236             :     GPGME_DATA_ENCODING_URL0   = 6,     /* Nul delimited URL list.       */
     237             :     GPGME_DATA_ENCODING_MIME   = 7      /* Data is a MIME part.          */
     238             :   }
     239             : gpgme_data_encoding_t;
     240             : 
     241             : 
     242             : /* Known data types.  */
     243             : typedef enum
     244             :   {
     245             :     GPGME_DATA_TYPE_INVALID      = 0,   /* Not detected.  */
     246             :     GPGME_DATA_TYPE_UNKNOWN      = 1,
     247             :     GPGME_DATA_TYPE_PGP_SIGNED   = 0x10,
     248             :     GPGME_DATA_TYPE_PGP_ENCRYPTED= 0x11,
     249             :     GPGME_DATA_TYPE_PGP_OTHER    = 0x12,
     250             :     GPGME_DATA_TYPE_PGP_KEY      = 0x13,
     251             :     GPGME_DATA_TYPE_PGP_SIGNATURE= 0x18, /* Detached signature */
     252             :     GPGME_DATA_TYPE_CMS_SIGNED   = 0x20,
     253             :     GPGME_DATA_TYPE_CMS_ENCRYPTED= 0x21,
     254             :     GPGME_DATA_TYPE_CMS_OTHER    = 0x22,
     255             :     GPGME_DATA_TYPE_X509_CERT    = 0x23,
     256             :     GPGME_DATA_TYPE_PKCS12       = 0x24,
     257             :   }
     258             : gpgme_data_type_t;
     259             : 
     260             : 
     261             : /* Public key algorithms.  */
     262             : typedef enum
     263             :   {
     264             :     GPGME_PK_RSA   = 1,
     265             :     GPGME_PK_RSA_E = 2,
     266             :     GPGME_PK_RSA_S = 3,
     267             :     GPGME_PK_ELG_E = 16,
     268             :     GPGME_PK_DSA   = 17,
     269             :     GPGME_PK_ECC   = 18,
     270             :     GPGME_PK_ELG   = 20,
     271             :     GPGME_PK_ECDSA = 301,
     272             :     GPGME_PK_ECDH  = 302,
     273             :     GPGME_PK_EDDSA = 303
     274             :   }
     275             : gpgme_pubkey_algo_t;
     276             : 
     277             : 
     278             : /* Hash algorithms (the values match those from libgcrypt).  */
     279             : typedef enum
     280             :   {
     281             :     GPGME_MD_NONE          = 0,
     282             :     GPGME_MD_MD5           = 1,
     283             :     GPGME_MD_SHA1          = 2,
     284             :     GPGME_MD_RMD160        = 3,
     285             :     GPGME_MD_MD2           = 5,
     286             :     GPGME_MD_TIGER         = 6,   /* TIGER/192. */
     287             :     GPGME_MD_HAVAL         = 7,   /* HAVAL, 5 pass, 160 bit. */
     288             :     GPGME_MD_SHA256        = 8,
     289             :     GPGME_MD_SHA384        = 9,
     290             :     GPGME_MD_SHA512        = 10,
     291             :     GPGME_MD_SHA224        = 11,
     292             :     GPGME_MD_MD4           = 301,
     293             :     GPGME_MD_CRC32         = 302,
     294             :     GPGME_MD_CRC32_RFC1510 = 303,
     295             :     GPGME_MD_CRC24_RFC2440 = 304
     296             :   }
     297             : gpgme_hash_algo_t;
     298             : 
     299             : 
     300             : /* The available signature modes.  */
     301             : typedef enum
     302             :   {
     303             :     GPGME_SIG_MODE_NORMAL = 0,
     304             :     GPGME_SIG_MODE_DETACH = 1,
     305             :     GPGME_SIG_MODE_CLEAR  = 2
     306             :   }
     307             : gpgme_sig_mode_t;
     308             : 
     309             : 
     310             : /* The available validities for a trust item or key.  */
     311             : typedef enum
     312             :   {
     313             :     GPGME_VALIDITY_UNKNOWN   = 0,
     314             :     GPGME_VALIDITY_UNDEFINED = 1,
     315             :     GPGME_VALIDITY_NEVER     = 2,
     316             :     GPGME_VALIDITY_MARGINAL  = 3,
     317             :     GPGME_VALIDITY_FULL      = 4,
     318             :     GPGME_VALIDITY_ULTIMATE  = 5
     319             :   }
     320             : gpgme_validity_t;
     321             : 
     322             : 
     323             : /* The TOFU policies. */
     324             : typedef enum
     325             :   {
     326             :     GPGME_TOFU_POLICY_NONE    = 0,
     327             :     GPGME_TOFU_POLICY_AUTO    = 1,
     328             :     GPGME_TOFU_POLICY_GOOD    = 2,
     329             :     GPGME_TOFU_POLICY_UNKNOWN = 3,
     330             :     GPGME_TOFU_POLICY_BAD     = 4,
     331             :     GPGME_TOFU_POLICY_ASK     = 5
     332             :   }
     333             : gpgme_tofu_policy_t;
     334             : 
     335             : 
     336             : /* The available protocols.  */
     337             : typedef enum
     338             :   {
     339             :     GPGME_PROTOCOL_OpenPGP = 0,  /* The default mode.  */
     340             :     GPGME_PROTOCOL_CMS     = 1,
     341             :     GPGME_PROTOCOL_GPGCONF = 2,  /* Special code for gpgconf.  */
     342             :     GPGME_PROTOCOL_ASSUAN  = 3,  /* Low-level access to an Assuan server.  */
     343             :     GPGME_PROTOCOL_G13     = 4,
     344             :     GPGME_PROTOCOL_UISERVER= 5,
     345             :     GPGME_PROTOCOL_SPAWN   = 6,  /* Direct access to any program.  */
     346             :     GPGME_PROTOCOL_DEFAULT = 254,
     347             :     GPGME_PROTOCOL_UNKNOWN = 255
     348             :   }
     349             : gpgme_protocol_t;
     350             : /* Convenience macro for the surprisingly mixed spelling.  */
     351             : #define GPGME_PROTOCOL_OPENPGP GPGME_PROTOCOL_OpenPGP
     352             : 
     353             : 
     354             : /* The available keylist mode flags.  */
     355             : #define GPGME_KEYLIST_MODE_LOCAL                1
     356             : #define GPGME_KEYLIST_MODE_EXTERN               2
     357             : #define GPGME_KEYLIST_MODE_SIGS                 4
     358             : #define GPGME_KEYLIST_MODE_SIG_NOTATIONS        8
     359             : #define GPGME_KEYLIST_MODE_WITH_SECRET          16
     360             : #define GPGME_KEYLIST_MODE_WITH_TOFU            32
     361             : #define GPGME_KEYLIST_MODE_EPHEMERAL            128
     362             : #define GPGME_KEYLIST_MODE_VALIDATE             256
     363             : 
     364             : typedef unsigned int gpgme_keylist_mode_t;
     365             : 
     366             : 
     367             : /* The pinentry modes. */
     368             : typedef enum
     369             :   {
     370             :     GPGME_PINENTRY_MODE_DEFAULT  = 0,
     371             :     GPGME_PINENTRY_MODE_ASK      = 1,
     372             :     GPGME_PINENTRY_MODE_CANCEL   = 2,
     373             :     GPGME_PINENTRY_MODE_ERROR    = 3,
     374             :     GPGME_PINENTRY_MODE_LOOPBACK = 4
     375             :   }
     376             : gpgme_pinentry_mode_t;
     377             : 
     378             : 
     379             : /* The available export mode flags.  */
     380             : #define GPGME_EXPORT_MODE_EXTERN                2
     381             : #define GPGME_EXPORT_MODE_MINIMAL               4
     382             : #define GPGME_EXPORT_MODE_SECRET               16
     383             : #define GPGME_EXPORT_MODE_RAW                  32
     384             : #define GPGME_EXPORT_MODE_PKCS12               64
     385             : 
     386             : typedef unsigned int gpgme_export_mode_t;
     387             : 
     388             : 
     389             : /* Flags for the audit log functions.  */
     390             : #define GPGME_AUDITLOG_HTML      1
     391             : #define GPGME_AUDITLOG_WITH_HELP 128
     392             : 
     393             : 
     394             : /* The available signature notation flags.  */
     395             : #define GPGME_SIG_NOTATION_HUMAN_READABLE       1
     396             : #define GPGME_SIG_NOTATION_CRITICAL             2
     397             : 
     398             : typedef unsigned int gpgme_sig_notation_flags_t;
     399             : 
     400             : /* An object to hold information about notation data.  This structure
     401             :  * shall be considered read-only and an application must not allocate
     402             :  * such a structure on its own.  */
     403             : struct _gpgme_sig_notation
     404             : {
     405             :   struct _gpgme_sig_notation *next;
     406             : 
     407             :   /* If NAME is a null pointer, then VALUE contains a policy URL
     408             :      rather than a notation.  */
     409             :   char *name;
     410             : 
     411             :   /* The value of the notation data.  */
     412             :   char *value;
     413             : 
     414             :   /* The length of the name of the notation data.  */
     415             :   int name_len;
     416             : 
     417             :   /* The length of the value of the notation data.  */
     418             :   int value_len;
     419             : 
     420             :   /* The accumulated flags.  */
     421             :   gpgme_sig_notation_flags_t flags;
     422             : 
     423             :   /* Notation data is human-readable.  */
     424             :   unsigned int human_readable : 1;
     425             : 
     426             :   /* Notation data is critical.  */
     427             :   unsigned int critical : 1;
     428             : 
     429             :   /* Internal to GPGME, do not use.  */
     430             :   int _unused : 30;
     431             : };
     432             : typedef struct _gpgme_sig_notation *gpgme_sig_notation_t;
     433             : 
     434             : 
     435             : 
     436             : /*
     437             :  * Public structures.
     438             :  */
     439             : 
     440             : /* The engine information structure.
     441             :  * This structure shall be considered read-only and an application
     442             :  * must not allocate such a structure on its own.  */
     443             : struct _gpgme_engine_info
     444             : {
     445             :   struct _gpgme_engine_info *next;
     446             : 
     447             :   /* The protocol ID.  */
     448             :   gpgme_protocol_t protocol;
     449             : 
     450             :   /* The file name of the engine binary.  */
     451             :   char *file_name;
     452             : 
     453             :   /* The version string of the installed engine.  */
     454             :   char *version;
     455             : 
     456             :   /* The minimum version required for GPGME.  */
     457             :   const char *req_version;
     458             : 
     459             :   /* The home directory used, or NULL if default.  */
     460             :   char *home_dir;
     461             : };
     462             : typedef struct _gpgme_engine_info *gpgme_engine_info_t;
     463             : 
     464             : 
     465             : /* An object with TOFU information.
     466             :  * This structure shall be considered read-only and an application
     467             :  * must not allocate such a structure on its own.  */
     468             : struct _gpgme_tofu_info
     469             : {
     470             :   struct _gpgme_tofu_info *next;
     471             : 
     472             :   /* The TOFU validity:
     473             :    *  0 := conflict
     474             :    *  1 := key without history
     475             :    *  2 := key with too little history
     476             :    *  3 := key with enough history for basic trust
     477             :    *  4 := key with a lot of history
     478             :    */
     479             :   unsigned int validity : 3;
     480             : 
     481             :   /* The TOFU policy (gpgme_tofu_policy_t).  */
     482             :   unsigned int policy : 4;
     483             : 
     484             :   unsigned int _rfu : 25;
     485             : 
     486             :   /* Number of signatures seen for this binding.  Capped at USHRT_MAX.  */
     487             :   unsigned short signcount;
     488             :   /* Number of encryptions done with this binding.  Capped at USHRT_MAX.  */
     489             :   unsigned short encrcount;
     490             : 
     491             :   /* Number of seconds since Epoch when the first and the most
     492             :    * recently seen message were verified/decrypted.  0 means unknown. */
     493             :   unsigned long signfirst;
     494             :   unsigned long signlast;
     495             :   unsigned long encrfirst;
     496             :   unsigned long encrlast;
     497             : 
     498             :   /* If non-NULL a human readable string summarizing the TOFU data. */
     499             :   char *description;
     500             : };
     501             : typedef struct _gpgme_tofu_info *gpgme_tofu_info_t;
     502             : 
     503             : 
     504             : /* A subkey from a key.
     505             :  * This structure shall be considered read-only and an application
     506             :  * must not allocate such a structure on its own.  */
     507             : struct _gpgme_subkey
     508             : {
     509             :   struct _gpgme_subkey *next;
     510             : 
     511             :   /* True if subkey is revoked.  */
     512             :   unsigned int revoked : 1;
     513             : 
     514             :   /* True if subkey is expired.  */
     515             :   unsigned int expired : 1;
     516             : 
     517             :   /* True if subkey is disabled.  */
     518             :   unsigned int disabled : 1;
     519             : 
     520             :   /* True if subkey is invalid.  */
     521             :   unsigned int invalid : 1;
     522             : 
     523             :   /* True if subkey can be used for encryption.  */
     524             :   unsigned int can_encrypt : 1;
     525             : 
     526             :   /* True if subkey can be used for signing.  */
     527             :   unsigned int can_sign : 1;
     528             : 
     529             :   /* True if subkey can be used for certification.  */
     530             :   unsigned int can_certify : 1;
     531             : 
     532             :   /* True if subkey is secret.  */
     533             :   unsigned int secret : 1;
     534             : 
     535             :   /* True if subkey can be used for authentication.  */
     536             :   unsigned int can_authenticate : 1;
     537             : 
     538             :   /* True if subkey is qualified for signatures according to German law.  */
     539             :   unsigned int is_qualified : 1;
     540             : 
     541             :   /* True if the secret key is stored on a smart card.  */
     542             :   unsigned int is_cardkey : 1;
     543             : 
     544             :   /* Internal to GPGME, do not use.  */
     545             :   unsigned int _unused : 21;
     546             : 
     547             :   /* Public key algorithm supported by this subkey.  */
     548             :   gpgme_pubkey_algo_t pubkey_algo;
     549             : 
     550             :   /* Length of the subkey.  */
     551             :   unsigned int length;
     552             : 
     553             :   /* The key ID of the subkey.  */
     554             :   char *keyid;
     555             : 
     556             :   /* Internal to GPGME, do not use.  */
     557             :   char _keyid[16 + 1];
     558             : 
     559             :   /* The fingerprint of the subkey in hex digit form.  */
     560             :   char *fpr;
     561             : 
     562             :   /* The creation timestamp, -1 if invalid, 0 if not available.  */
     563             :   long int timestamp;
     564             : 
     565             :   /* The expiration timestamp, 0 if the subkey does not expire.  */
     566             :   long int expires;
     567             : 
     568             :   /* The serial number of a smart card holding this key or NULL.  */
     569             :   char *card_number;
     570             : 
     571             :   /* The name of the curve for ECC algorithms or NULL.  */
     572             :   char *curve;
     573             : 
     574             :   /* The keygrip of the subkey in hex digit form or NULL if not availabale.  */
     575             :   char *keygrip;
     576             : };
     577             : typedef struct _gpgme_subkey *gpgme_subkey_t;
     578             : 
     579             : 
     580             : /* A signature on a user ID.
     581             :  * This structure shall be considered read-only and an application
     582             :  * must not allocate such a structure on its own.  */
     583             : struct _gpgme_key_sig
     584             : {
     585             :   struct _gpgme_key_sig *next;
     586             : 
     587             :   /* True if the signature is a revocation signature.  */
     588             :   unsigned int revoked : 1;
     589             : 
     590             :   /* True if the signature is expired.  */
     591             :   unsigned int expired : 1;
     592             : 
     593             :   /* True if the signature is invalid.  */
     594             :   unsigned int invalid : 1;
     595             : 
     596             :   /* True if the signature should be exported.  */
     597             :   unsigned int exportable : 1;
     598             : 
     599             :   /* Internal to GPGME, do not use.  */
     600             :   unsigned int _unused : 28;
     601             : 
     602             :   /* The public key algorithm used to create the signature.  */
     603             :   gpgme_pubkey_algo_t pubkey_algo;
     604             : 
     605             :   /* The key ID of key used to create the signature.  */
     606             :   char *keyid;
     607             : 
     608             :   /* Internal to GPGME, do not use.  */
     609             :   char _keyid[16 + 1];
     610             : 
     611             :   /* The creation timestamp, -1 if invalid, 0 if not available.  */
     612             :   long int timestamp;
     613             : 
     614             :   /* The expiration timestamp, 0 if the subkey does not expire.  */
     615             :   long int expires;
     616             : 
     617             :   /* Same as in gpgme_signature_t.  */
     618             :   gpgme_error_t status;
     619             : 
     620             : #ifdef __cplusplus
     621             : #else
     622             : #endif
     623             : 
     624             :   /* The user ID string.  */
     625             :   char *uid;
     626             : 
     627             :   /* The name part of the user ID.  */
     628             :   char *name;
     629             : 
     630             :   /* The email part of the user ID.  */
     631             :   char *email;
     632             : 
     633             :   /* The comment part of the user ID.  */
     634             :   char *comment;
     635             : 
     636             :   /* Crypto backend specific signature class.  */
     637             :   unsigned int sig_class;
     638             : 
     639             :   /* Notation data and policy URLs.  */
     640             :   gpgme_sig_notation_t notations;
     641             : 
     642             :   /* Internal to GPGME, do not use.  */
     643             :   gpgme_sig_notation_t _last_notation;
     644             : };
     645             : typedef struct _gpgme_key_sig *gpgme_key_sig_t;
     646             : 
     647             : 
     648             : /* An user ID from a key.
     649             :  * This structure shall be considered read-only and an application
     650             :  * must not allocate such a structure on its own.  */
     651             : struct _gpgme_user_id
     652             : {
     653             :   struct _gpgme_user_id *next;
     654             : 
     655             :   /* True if the user ID is revoked.  */
     656             :   unsigned int revoked : 1;
     657             : 
     658             :   /* True if the user ID is invalid.  */
     659             :   unsigned int invalid : 1;
     660             : 
     661             :   /* Internal to GPGME, do not use.  */
     662             :   unsigned int _unused : 30;
     663             : 
     664             :   /* The validity of the user ID.  */
     665             :   gpgme_validity_t validity;
     666             : 
     667             :   /* The user ID string.  */
     668             :   char *uid;
     669             : 
     670             :   /* The name part of the user ID.  */
     671             :   char *name;
     672             : 
     673             :   /* The email part of the user ID.  */
     674             :   char *email;
     675             : 
     676             :   /* The comment part of the user ID.  */
     677             :   char *comment;
     678             : 
     679             :   /* The signatures of the user ID.  */
     680             :   gpgme_key_sig_t signatures;
     681             : 
     682             :   /* Internal to GPGME, do not use.  */
     683             :   gpgme_key_sig_t _last_keysig;
     684             : 
     685             :   /* The mail address (addr-spec from RFC5322) of the UID string.
     686             :    * This is general the same as the EMAIL part of this struct but
     687             :    * might be slightly different.  If no mail address is available
     688             :    * NULL is stored.  */
     689             :   char *address;
     690             : 
     691             :   /* The malloced TOFU information or NULL.  */
     692             :   gpgme_tofu_info_t tofu;
     693             : };
     694             : typedef struct _gpgme_user_id *gpgme_user_id_t;
     695             : 
     696             : 
     697             : /* A key from the keyring.
     698             :  * This structure shall be considered read-only and an application
     699             :  * must not allocate such a structure on its own.  */
     700             : struct _gpgme_key
     701             : {
     702             :   /* Internal to GPGME, do not use.  */
     703             :   unsigned int _refs;
     704             : 
     705             :   /* True if key is revoked.  */
     706             :   unsigned int revoked : 1;
     707             : 
     708             :   /* True if key is expired.  */
     709             :   unsigned int expired : 1;
     710             : 
     711             :   /* True if key is disabled.  */
     712             :   unsigned int disabled : 1;
     713             : 
     714             :   /* True if key is invalid.  */
     715             :   unsigned int invalid : 1;
     716             : 
     717             :   /* True if key can be used for encryption.  */
     718             :   unsigned int can_encrypt : 1;
     719             : 
     720             :   /* True if key can be used for signing.  */
     721             :   unsigned int can_sign : 1;
     722             : 
     723             :   /* True if key can be used for certification.  */
     724             :   unsigned int can_certify : 1;
     725             : 
     726             :   /* True if key is secret.  */
     727             :   unsigned int secret : 1;
     728             : 
     729             :   /* True if key can be used for authentication.  */
     730             :   unsigned int can_authenticate : 1;
     731             : 
     732             :   /* True if subkey is qualified for signatures according to German law.  */
     733             :   unsigned int is_qualified : 1;
     734             : 
     735             :   /* Internal to GPGME, do not use.  */
     736             :   unsigned int _unused : 22;
     737             : 
     738             :   /* This is the protocol supported by this key.  */
     739             :   gpgme_protocol_t protocol;
     740             : 
     741             :   /* If protocol is GPGME_PROTOCOL_CMS, this string contains the
     742             :      issuer serial.  */
     743             :   char *issuer_serial;
     744             : 
     745             :   /* If protocol is GPGME_PROTOCOL_CMS, this string contains the
     746             :      issuer name.  */
     747             :   char *issuer_name;
     748             : 
     749             :   /* If protocol is GPGME_PROTOCOL_CMS, this string contains the chain
     750             :      ID.  */
     751             :   char *chain_id;
     752             : 
     753             :   /* If protocol is GPGME_PROTOCOL_OpenPGP, this field contains the
     754             :      owner trust.  */
     755             :   gpgme_validity_t owner_trust;
     756             : 
     757             :   /* The subkeys of the key.  */
     758             :   gpgme_subkey_t subkeys;
     759             : 
     760             :   /* The user IDs of the key.  */
     761             :   gpgme_user_id_t uids;
     762             : 
     763             :   /* Internal to GPGME, do not use.  */
     764             :   gpgme_subkey_t _last_subkey;
     765             : 
     766             :   /* Internal to GPGME, do not use.  */
     767             :   gpgme_user_id_t _last_uid;
     768             : 
     769             :   /* The keylist mode that was active when listing the key.  */
     770             :   gpgme_keylist_mode_t keylist_mode;
     771             : 
     772             :   /* This field gives the fingerprint of the primary key.  Note that
     773             :    * this is a copy of the FPR of the first subkey.  We need it here
     774             :    * to allow for an incomplete key object.  */
     775             :   char *fpr;
     776             : };
     777             : typedef struct _gpgme_key *gpgme_key_t;
     778             : 
     779             : 
     780             : /* An invalid key object.
     781             :  * This structure shall be considered read-only and an application
     782             :  * must not allocate such a structure on its own.  */
     783             : struct _gpgme_invalid_key
     784             : {
     785             :   struct _gpgme_invalid_key *next;
     786             : 
     787             :   /* The string used to request the key.  Despite the name this may
     788             :    * not be a fingerprint.  */
     789             :   char *fpr;
     790             : 
     791             :   /* The error code.  */
     792             :   gpgme_error_t reason;
     793             : };
     794             : typedef struct _gpgme_invalid_key *gpgme_invalid_key_t;
     795             : 
     796             : 
     797             : 
     798             : /*
     799             :  * Types for callback functions.
     800             :  */
     801             : 
     802             : /* Request a passphrase from the user.  */
     803             : typedef gpgme_error_t (*gpgme_passphrase_cb_t) (void *hook,
     804             :                                                 const char *uid_hint,
     805             :                                                 const char *passphrase_info,
     806             :                                                 int prev_was_bad, int fd);
     807             : 
     808             : /* Inform the user about progress made.  */
     809             : typedef void (*gpgme_progress_cb_t) (void *opaque, const char *what,
     810             :                                      int type, int current, int total);
     811             : 
     812             : /* Status messages from gpg. */
     813             : typedef gpgme_error_t (*gpgme_status_cb_t) (void *opaque, const char *keyword,
     814             :                                             const char *args);
     815             : 
     816             : /* Interact with the user about an edit operation.  */
     817             : typedef gpgme_error_t (*gpgme_interact_cb_t) (void *opaque,
     818             :                                               const char *keyword,
     819             :                                               const char *args, int fd);
     820             : 
     821             : 
     822             : 
     823             : /*
     824             :  * Context management functions.
     825             :  */
     826             : 
     827             : /* Create a new context and return it in CTX.  */
     828             : gpgme_error_t gpgme_new (gpgme_ctx_t *ctx);
     829             : 
     830             : /* Release the context CTX.  */
     831             : void gpgme_release (gpgme_ctx_t ctx);
     832             : 
     833             : /* Set the flag NAME for CTX to VALUE.  */
     834             : gpgme_error_t gpgme_set_ctx_flag (gpgme_ctx_t ctx,
     835             :                                   const char *name, const char *value);
     836             : 
     837             : /* Get the value of the flag NAME from CTX.  */
     838             : const char *gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name);
     839             : 
     840             : /* Set the protocol to be used by CTX to PROTO.  */
     841             : gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t proto);
     842             : 
     843             : /* Get the protocol used with CTX */
     844             : gpgme_protocol_t gpgme_get_protocol (gpgme_ctx_t ctx);
     845             : 
     846             : /* Set the crypto protocol to be used by CTX to PROTO.
     847             :    gpgme_set_protocol actually sets the backend engine.  This sets the
     848             :    crypto protocol used in engines that support more than one crypto
     849             :    prococol (for example, an UISERVER can support OpenPGP and CMS).
     850             :    This is reset to the default with gpgme_set_protocol.  */
     851             : gpgme_error_t gpgme_set_sub_protocol (gpgme_ctx_t ctx,
     852             :                                       gpgme_protocol_t proto);
     853             : 
     854             : /* Get the sub protocol.  */
     855             : gpgme_protocol_t gpgme_get_sub_protocol (gpgme_ctx_t ctx);
     856             : 
     857             : /* Get the string describing protocol PROTO, or NULL if invalid.  */
     858             : const char *gpgme_get_protocol_name (gpgme_protocol_t proto);
     859             : 
     860             : /* If YES is non-zero, enable armor mode in CTX, disable it otherwise.  */
     861             : void gpgme_set_armor (gpgme_ctx_t ctx, int yes);
     862             : 
     863             : /* Return non-zero if armor mode is set in CTX.  */
     864             : int gpgme_get_armor (gpgme_ctx_t ctx);
     865             : 
     866             : /* If YES is non-zero, enable text mode in CTX, disable it otherwise.  */
     867             : void gpgme_set_textmode (gpgme_ctx_t ctx, int yes);
     868             : 
     869             : /* Return non-zero if text mode is set in CTX.  */
     870             : int gpgme_get_textmode (gpgme_ctx_t ctx);
     871             : 
     872             : /* If YES is non-zero, enable offline mode in CTX, disable it otherwise.  */
     873             : void gpgme_set_offline (gpgme_ctx_t ctx, int yes);
     874             : 
     875             : /* Return non-zero if offline mode is set in CTX.  */
     876             : int gpgme_get_offline (gpgme_ctx_t ctx);
     877             : 
     878             : /* Use whatever the default of the backend crypto engine is.  */
     879             : #define GPGME_INCLUDE_CERTS_DEFAULT     -256
     880             : 
     881             : /* Include up to NR_OF_CERTS certificates in an S/MIME message.  */
     882             : void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs);
     883             : 
     884             : /* Return the number of certs to include in an S/MIME message.  */
     885             : int gpgme_get_include_certs (gpgme_ctx_t ctx);
     886             : 
     887             : /* Set keylist mode in CTX to MODE.  */
     888             : gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t ctx,
     889             :                                       gpgme_keylist_mode_t mode);
     890             : 
     891             : /* Get keylist mode in CTX.  */
     892             : gpgme_keylist_mode_t gpgme_get_keylist_mode (gpgme_ctx_t ctx);
     893             : 
     894             : /* Set the pinentry mode for CTX to MODE. */
     895             : gpgme_error_t gpgme_set_pinentry_mode (gpgme_ctx_t ctx,
     896             :                                        gpgme_pinentry_mode_t mode);
     897             : 
     898             : /* Get the pinentry mode of CTX.  */
     899             : gpgme_pinentry_mode_t gpgme_get_pinentry_mode (gpgme_ctx_t ctx);
     900             : 
     901             : /* Set the passphrase callback function in CTX to CB.  HOOK_VALUE is
     902             :    passed as first argument to the passphrase callback function.  */
     903             : void gpgme_set_passphrase_cb (gpgme_ctx_t ctx,
     904             :                               gpgme_passphrase_cb_t cb, void *hook_value);
     905             : 
     906             : /* Get the current passphrase callback function in *CB and the current
     907             :    hook value in *HOOK_VALUE.  */
     908             : void gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *cb,
     909             :                               void **hook_value);
     910             : 
     911             : /* Set the progress callback function in CTX to CB.  HOOK_VALUE is
     912             :    passed as first argument to the progress callback function.  */
     913             : void gpgme_set_progress_cb (gpgme_ctx_t c, gpgme_progress_cb_t cb,
     914             :                             void *hook_value);
     915             : 
     916             : /* Get the current progress callback function in *CB and the current
     917             :    hook value in *HOOK_VALUE.  */
     918             : void gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *cb,
     919             :                             void **hook_value);
     920             : 
     921             : /* Set the status callback function in CTX to CB.  HOOK_VALUE is
     922             :    passed as first argument to the status callback function.  */
     923             : void gpgme_set_status_cb (gpgme_ctx_t c, gpgme_status_cb_t cb,
     924             :                           void *hook_value);
     925             : 
     926             : /* Get the current status callback function in *CB and the current
     927             :    hook value in *HOOK_VALUE.  */
     928             : void gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *cb,
     929             :                           void **hook_value);
     930             : 
     931             : /* This function sets the locale for the context CTX, or the default
     932             :    locale if CTX is a null pointer.  */
     933             : gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category,
     934             :                                 const char *value);
     935             : 
     936             : /* Get the information about the configured engines.  A pointer to the
     937             :    first engine in the statically allocated linked list is returned.
     938             :    The returned data is valid until the next gpgme_ctx_set_engine_info.  */
     939             : gpgme_engine_info_t gpgme_ctx_get_engine_info (gpgme_ctx_t ctx);
     940             : 
     941             : /* Set the engine info for the context CTX, protocol PROTO, to the
     942             :    file name FILE_NAME and the home directory HOME_DIR.  */
     943             : gpgme_error_t gpgme_ctx_set_engine_info (gpgme_ctx_t ctx,
     944             :                                          gpgme_protocol_t proto,
     945             :                                          const char *file_name,
     946             :                                          const char *home_dir);
     947             : 
     948             : /* Delete all signers from CTX.  */
     949             : void gpgme_signers_clear (gpgme_ctx_t ctx);
     950             : 
     951             : /* Add KEY to list of signers in CTX.  */
     952             : gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key);
     953             : 
     954             : /* Return the number of signers in CTX.  */
     955             : unsigned int gpgme_signers_count (const gpgme_ctx_t ctx);
     956             : 
     957             : /* Return the SEQth signer's key in CTX.  */
     958             : gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq);
     959             : 
     960             : /* Clear all notation data from the context.  */
     961             : void gpgme_sig_notation_clear (gpgme_ctx_t ctx);
     962             : 
     963             : /* Add the human-readable notation data with name NAME and value VALUE
     964             :    to the context CTX, using the flags FLAGS.  If NAME is NULL, then
     965             :    VALUE should be a policy URL.  The flag
     966             :    GPGME_SIG_NOTATION_HUMAN_READABLE is forced to be true for notation
     967             :    data, and false for policy URLs.  */
     968             : gpgme_error_t gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name,
     969             :                                       const char *value,
     970             :                                       gpgme_sig_notation_flags_t flags);
     971             : 
     972             : /* Get the sig notations for this context.  */
     973             : gpgme_sig_notation_t gpgme_sig_notation_get (gpgme_ctx_t ctx);
     974             : 
     975             : /* Store a sender address in the context.  */
     976             : gpgme_error_t gpgme_set_sender (gpgme_ctx_t ctx, const char *address);
     977             : 
     978             : /* Get the sender address from the context.  */
     979             : const char *gpgme_get_sender (gpgme_ctx_t ctx);
     980             : 
     981             : 
     982             : 
     983             : /*
     984             :  * Run control.
     985             :  */
     986             : 
     987             : /* The type of an I/O callback function.  */
     988             : typedef gpgme_error_t (*gpgme_io_cb_t) (void *data, int fd);
     989             : 
     990             : /* The type of a function that can register FNC as the I/O callback
     991             :    function for the file descriptor FD with direction dir (0: for writing,
     992             :    1: for reading).  FNC_DATA should be passed as DATA to FNC.  The
     993             :    function should return a TAG suitable for the corresponding
     994             :    gpgme_remove_io_cb_t, and an error value.  */
     995             : typedef gpgme_error_t (*gpgme_register_io_cb_t) (void *data, int fd, int dir,
     996             :                                                  gpgme_io_cb_t fnc,
     997             :                                                  void *fnc_data, void **tag);
     998             : 
     999             : /* The type of a function that can remove a previously registered I/O
    1000             :    callback function given TAG as returned by the register
    1001             :    function.  */
    1002             : typedef void (*gpgme_remove_io_cb_t) (void *tag);
    1003             : 
    1004             : typedef enum
    1005             :   {
    1006             :     GPGME_EVENT_START,
    1007             :     GPGME_EVENT_DONE,
    1008             :     GPGME_EVENT_NEXT_KEY,
    1009             :     GPGME_EVENT_NEXT_TRUSTITEM
    1010             :   }
    1011             : gpgme_event_io_t;
    1012             : 
    1013             : struct gpgme_io_event_done_data
    1014             : {
    1015             :   /* A fatal IPC error or an operational error in state-less
    1016             :      protocols.  */
    1017             :   gpgme_error_t err;
    1018             : 
    1019             :   /* An operational errors in session-based protocols.  */
    1020             :   gpgme_error_t op_err;
    1021             : };
    1022             : typedef struct gpgme_io_event_done_data *gpgme_io_event_done_data_t;
    1023             : 
    1024             : /* The type of a function that is called when a context finished an
    1025             :    operation.  */
    1026             : typedef void (*gpgme_event_io_cb_t) (void *data, gpgme_event_io_t type,
    1027             :                                      void *type_data);
    1028             : 
    1029             : struct gpgme_io_cbs
    1030             : {
    1031             :   gpgme_register_io_cb_t add;
    1032             :   void *add_priv;
    1033             :   gpgme_remove_io_cb_t remove;
    1034             :   gpgme_event_io_cb_t event;
    1035             :   void *event_priv;
    1036             : };
    1037             : typedef struct gpgme_io_cbs *gpgme_io_cbs_t;
    1038             : 
    1039             : /* Set the I/O callback functions in CTX to IO_CBS.  */
    1040             : void gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
    1041             : 
    1042             : /* Get the current I/O callback functions.  */
    1043             : void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
    1044             : 
    1045             : /* Wrappers around the internal I/O functions for use with
    1046             :    gpgme_passphrase_cb_t and gpgme_interact_cb_t.  */
    1047             : ssize_t gpgme_io_read (int fd, void *buffer, size_t count);
    1048             : ssize_t gpgme_io_write (int fd, const void *buffer, size_t count);
    1049             : int     gpgme_io_writen (int fd, const void *buffer, size_t count);
    1050             : 
    1051             : /* Process the pending operation and, if HANG is non-zero, wait for
    1052             :    the pending operation to finish.  */
    1053             : gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang);
    1054             : 
    1055             : gpgme_ctx_t gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status,
    1056             :                             gpgme_error_t *op_err, int hang);
    1057             : 
    1058             : /* Cancel a pending asynchronous operation.  */
    1059             : gpgme_error_t gpgme_cancel (gpgme_ctx_t ctx);
    1060             : 
    1061             : /* Cancel a pending operation asynchronously.  */
    1062             : gpgme_error_t gpgme_cancel_async (gpgme_ctx_t ctx);
    1063             : 
    1064             : 
    1065             : 
    1066             : /*
    1067             :  * Functions to handle data objects.
    1068             :  */
    1069             : 
    1070             : /* Read up to SIZE bytes into buffer BUFFER from the data object with
    1071             :    the handle HANDLE.  Return the number of characters read, 0 on EOF
    1072             :    and -1 on error.  If an error occurs, errno is set.  */
    1073             : typedef ssize_t (*gpgme_data_read_cb_t) (void *handle, void *buffer,
    1074             :                                          size_t size);
    1075             : 
    1076             : /* Write up to SIZE bytes from buffer BUFFER to the data object with
    1077             :    the handle HANDLE.  Return the number of characters written, or -1
    1078             :    on error.  If an error occurs, errno is set.  */
    1079             : typedef ssize_t (*gpgme_data_write_cb_t) (void *handle, const void *buffer,
    1080             :                                           size_t size);
    1081             : 
    1082             : /* Set the current position from where the next read or write starts
    1083             :    in the data object with the handle HANDLE to OFFSET, relativ to
    1084             :    WHENCE.  Returns the new offset in bytes from the beginning of the
    1085             :    data object.  */
    1086             : typedef off_t (*gpgme_data_seek_cb_t) (void *handle,
    1087             :                                        off_t offset, int whence);
    1088             : 
    1089             : /* Close the data object with the handle HANDLE.  */
    1090             : typedef void (*gpgme_data_release_cb_t) (void *handle);
    1091             : 
    1092             : struct gpgme_data_cbs
    1093             : {
    1094             :   gpgme_data_read_cb_t read;
    1095             :   gpgme_data_write_cb_t write;
    1096             :   gpgme_data_seek_cb_t seek;
    1097             :   gpgme_data_release_cb_t release;
    1098             : };
    1099             : typedef struct gpgme_data_cbs *gpgme_data_cbs_t;
    1100             : 
    1101             : /* Read up to SIZE bytes into buffer BUFFER from the data object with
    1102             :    the handle DH.  Return the number of characters read, 0 on EOF and
    1103             :    -1 on error.  If an error occurs, errno is set.  */
    1104             : ssize_t gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size);
    1105             : 
    1106             : /* Write up to SIZE bytes from buffer BUFFER to the data object with
    1107             :    the handle DH.  Return the number of characters written, or -1 on
    1108             :    error.  If an error occurs, errno is set.  */
    1109             : ssize_t gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size);
    1110             : 
    1111             : /* Set the current position from where the next read or write starts
    1112             :    in the data object with the handle DH to OFFSET, relativ to WHENCE.
    1113             :    Returns the new offset in bytes from the beginning of the data
    1114             :    object.  */
    1115             : off_t gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence);
    1116             : 
    1117             : /* Create a new data buffer and return it in R_DH.  */
    1118             : gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh);
    1119             : 
    1120             : /* Destroy the data buffer DH.  */
    1121             : void gpgme_data_release (gpgme_data_t dh);
    1122             : 
    1123             : /* Create a new data buffer filled with SIZE bytes starting from
    1124             :    BUFFER.  If COPY is zero, copying is delayed until necessary, and
    1125             :    the data is taken from the original location when needed.  */
    1126             : gpgme_error_t gpgme_data_new_from_mem (gpgme_data_t *r_dh,
    1127             :                                        const char *buffer, size_t size,
    1128             :                                        int copy);
    1129             : 
    1130             : /* Destroy the data buffer DH and return a pointer to its content.
    1131             :    The memory has be to released with gpgme_free() by the user.  It's
    1132             :    size is returned in R_LEN.  */
    1133             : char *gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len);
    1134             : 
    1135             : /* Release the memory returned by gpgme_data_release_and_get_mem() and
    1136             :    some other functions.  */
    1137             : void gpgme_free (void *buffer);
    1138             : 
    1139             : gpgme_error_t gpgme_data_new_from_cbs (gpgme_data_t *dh,
    1140             :                                        gpgme_data_cbs_t cbs,
    1141             :                                        void *handle);
    1142             : 
    1143             : gpgme_error_t gpgme_data_new_from_fd (gpgme_data_t *dh, int fd);
    1144             : 
    1145             : gpgme_error_t gpgme_data_new_from_stream (gpgme_data_t *dh, FILE *stream);
    1146             : 
    1147             : /* Return the encoding attribute of the data buffer DH */
    1148             : gpgme_data_encoding_t gpgme_data_get_encoding (gpgme_data_t dh);
    1149             : 
    1150             : /* Set the encoding attribute of data buffer DH to ENC */
    1151             : gpgme_error_t gpgme_data_set_encoding (gpgme_data_t dh,
    1152             :                                        gpgme_data_encoding_t enc);
    1153             : 
    1154             : /* Get the file name associated with the data object with handle DH, or
    1155             :    NULL if there is none.  */
    1156             : char *gpgme_data_get_file_name (gpgme_data_t dh);
    1157             : 
    1158             : /* Set the file name associated with the data object with handle DH to
    1159             :    FILE_NAME.  */
    1160             : gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh,
    1161             :                                         const char *file_name);
    1162             : 
    1163             : /* Set a flag for the data object DH.  See the manual for details.  */
    1164             : gpg_error_t gpgme_data_set_flag (gpgme_data_t dh,
    1165             :                                  const char *name, const char *value);
    1166             : 
    1167             : /* Try to identify the type of the data in DH.  */
    1168             : gpgme_data_type_t gpgme_data_identify (gpgme_data_t dh, int reserved);
    1169             : 
    1170             : 
    1171             : /* Create a new data buffer filled with the content of file FNAME.
    1172             :    COPY must be non-zero.  For delayed read, please use
    1173             :    gpgme_data_new_from_fd or gpgme_data_new_from_stream instead.  */
    1174             : gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh,
    1175             :                                         const char *fname,
    1176             :                                         int copy);
    1177             : 
    1178             : /* Create a new data buffer filled with LENGTH bytes starting from
    1179             :    OFFSET within the file FNAME or stream FP (exactly one must be
    1180             :    non-zero).  */
    1181             : gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh,
    1182             :                                             const char *fname, FILE *fp,
    1183             :                                             off_t offset, size_t length);
    1184             : 
    1185             : /* Convenience function to do a gpgme_data_seek (dh, 0, SEEK_SET).  */
    1186             : gpgme_error_t gpgme_data_rewind (gpgme_data_t dh);
    1187             : 
    1188             : 
    1189             : 
    1190             : /*
    1191             :  * Key and trust functions.
    1192             :  */
    1193             : 
    1194             : /* Get the key with the fingerprint FPR from the crypto backend.  If
    1195             :    SECRET is true, get the secret key.  */
    1196             : gpgme_error_t gpgme_get_key (gpgme_ctx_t ctx, const char *fpr,
    1197             :                              gpgme_key_t *r_key, int secret);
    1198             : 
    1199             : /* Create a dummy key to specify an email address.  */
    1200             : gpgme_error_t gpgme_key_from_uid (gpgme_key_t *key, const char *name);
    1201             : 
    1202             : /* Acquire a reference to KEY.  */
    1203             : void gpgme_key_ref (gpgme_key_t key);
    1204             : 
    1205             : /* Release a reference to KEY.  If this was the last one the key is
    1206             :    destroyed.  */
    1207             : void gpgme_key_unref (gpgme_key_t key);
    1208             : void gpgme_key_release (gpgme_key_t key);
    1209             : 
    1210             : 
    1211             : 
    1212             : /*
    1213             :  * Encryption.
    1214             :  */
    1215             : 
    1216             : /* An object to return results from an encryption operation.
    1217             :  * This structure shall be considered read-only and an application
    1218             :  * must not allocate such a structure on its own.  */
    1219             : struct _gpgme_op_encrypt_result
    1220             : {
    1221             :   /* The list of invalid recipients.  */
    1222             :   gpgme_invalid_key_t invalid_recipients;
    1223             : };
    1224             : typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t;
    1225             : 
    1226             : /* Retrieve a pointer to the result of the encrypt operation.  */
    1227             : gpgme_encrypt_result_t gpgme_op_encrypt_result (gpgme_ctx_t ctx);
    1228             : 
    1229             : /* The valid encryption flags.  */
    1230             : typedef enum
    1231             :   {
    1232             :     GPGME_ENCRYPT_ALWAYS_TRUST = 1,
    1233             :     GPGME_ENCRYPT_NO_ENCRYPT_TO = 2,
    1234             :     GPGME_ENCRYPT_PREPARE = 4,
    1235             :     GPGME_ENCRYPT_EXPECT_SIGN = 8,
    1236             :     GPGME_ENCRYPT_NO_COMPRESS = 16,
    1237             :     GPGME_ENCRYPT_SYMMETRIC = 32
    1238             :   }
    1239             : gpgme_encrypt_flags_t;
    1240             : 
    1241             : /* Encrypt plaintext PLAIN within CTX for the recipients RECP and
    1242             :    store the resulting ciphertext in CIPHER.  */
    1243             : gpgme_error_t gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
    1244             :                                       gpgme_encrypt_flags_t flags,
    1245             :                                       gpgme_data_t plain, gpgme_data_t cipher);
    1246             : gpgme_error_t gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[],
    1247             :                                 gpgme_encrypt_flags_t flags,
    1248             :                                 gpgme_data_t plain, gpgme_data_t cipher);
    1249             : 
    1250             : /* Encrypt plaintext PLAIN within CTX for the recipients RECP and
    1251             :    store the resulting ciphertext in CIPHER.  Also sign the ciphertext
    1252             :    with the signers in CTX.  */
    1253             : gpgme_error_t gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx,
    1254             :                                            gpgme_key_t recp[],
    1255             :                                            gpgme_encrypt_flags_t flags,
    1256             :                                            gpgme_data_t plain,
    1257             :                                            gpgme_data_t cipher);
    1258             : gpgme_error_t gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[],
    1259             :                                      gpgme_encrypt_flags_t flags,
    1260             :                                      gpgme_data_t plain, gpgme_data_t cipher);
    1261             : 
    1262             : 
    1263             : /*
    1264             :  * Decryption.
    1265             :  */
    1266             : 
    1267             : /* An object to hold information about a recipient.
    1268             :  * This structure shall be considered read-only and an application
    1269             :  * must not allocate such a structure on its own.  */
    1270             : struct _gpgme_recipient
    1271             : {
    1272             :   struct _gpgme_recipient *next;
    1273             : 
    1274             :   /* The key ID of key for which the text was encrypted.  */
    1275             :   char *keyid;
    1276             : 
    1277             :   /* Internal to GPGME, do not use.  */
    1278             :   char _keyid[16 + 1];
    1279             : 
    1280             :   /* The public key algorithm of the recipient key.  */
    1281             :   gpgme_pubkey_algo_t pubkey_algo;
    1282             : 
    1283             :   /* The status of the recipient.  */
    1284             :   gpgme_error_t status;
    1285             : };
    1286             : typedef struct _gpgme_recipient *gpgme_recipient_t;
    1287             : 
    1288             : /* An object to return results from a decryption operation.
    1289             :  * This structure shall be considered read-only and an application
    1290             :  * must not allocate such a structure on its own.  */
    1291             : struct _gpgme_op_decrypt_result
    1292             : {
    1293             :   char *unsupported_algorithm;
    1294             : 
    1295             :   /* Key should not have been used for encryption.  */
    1296             :   unsigned int wrong_key_usage : 1;
    1297             : 
    1298             :   /* Internal to GPGME, do not use.  */
    1299             :   int _unused : 31;
    1300             : 
    1301             :   gpgme_recipient_t recipients;
    1302             : 
    1303             :   /* The original file name of the plaintext message, if
    1304             :      available.  */
    1305             :   char *file_name;
    1306             : 
    1307             :   /* A textual representation of the session key used to decrypt the
    1308             :    * message, if available */
    1309             :   char *session_key;
    1310             : };
    1311             : typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t;
    1312             : 
    1313             : /* Retrieve a pointer to the result of the decrypt operation.  */
    1314             : gpgme_decrypt_result_t gpgme_op_decrypt_result (gpgme_ctx_t ctx);
    1315             : 
    1316             : /* Decrypt ciphertext CIPHER within CTX and store the resulting
    1317             :    plaintext in PLAIN.  */
    1318             : gpgme_error_t gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
    1319             :                                       gpgme_data_t plain);
    1320             : gpgme_error_t gpgme_op_decrypt (gpgme_ctx_t ctx,
    1321             :                                 gpgme_data_t cipher, gpgme_data_t plain);
    1322             : 
    1323             : /* Decrypt ciphertext CIPHER and make a signature verification within
    1324             :    CTX and store the resulting plaintext in PLAIN.  */
    1325             : gpgme_error_t gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx,
    1326             :                                              gpgme_data_t cipher,
    1327             :                                              gpgme_data_t plain);
    1328             : gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher,
    1329             :                                        gpgme_data_t plain);
    1330             : 
    1331             : 
    1332             : /*
    1333             :  * Signing.
    1334             :  */
    1335             : 
    1336             : /* An object with signatures data.
    1337             :  * This structure shall be considered read-only and an application
    1338             :  * must not allocate such a structure on its own.  */
    1339             : struct _gpgme_new_signature
    1340             : {
    1341             :   struct _gpgme_new_signature *next;
    1342             : 
    1343             :   /* The type of the signature.  */
    1344             :   gpgme_sig_mode_t type;
    1345             : 
    1346             :   /* The public key algorithm used to create the signature.  */
    1347             :   gpgme_pubkey_algo_t pubkey_algo;
    1348             : 
    1349             :   /* The hash algorithm used to create the signature.  */
    1350             :   gpgme_hash_algo_t hash_algo;
    1351             : 
    1352             :   /* Internal to GPGME, do not use.  Must be set to the same value as
    1353             :      CLASS below.  */
    1354             :   unsigned long _obsolete_class;
    1355             : 
    1356             :   /* Signature creation time.  */
    1357             :   long int timestamp;
    1358             : 
    1359             :   /* The fingerprint of the signature.  */
    1360             :   char *fpr;
    1361             : 
    1362             : #ifdef __cplusplus
    1363             :   unsigned int _obsolete_class_2;
    1364             : #else
    1365             : #endif
    1366             : 
    1367             :   /* Crypto backend specific signature class.  */
    1368             :   unsigned int sig_class;
    1369             : };
    1370             : typedef struct _gpgme_new_signature *gpgme_new_signature_t;
    1371             : 
    1372             : 
    1373             : /* An object to return results from a signing operation.
    1374             :  * This structure shall be considered read-only and an application
    1375             :  * must not allocate such a structure on its own.  */
    1376             : struct _gpgme_op_sign_result
    1377             : {
    1378             :   /* The list of invalid signers.  */
    1379             :   gpgme_invalid_key_t invalid_signers;
    1380             :   gpgme_new_signature_t signatures;
    1381             : };
    1382             : typedef struct _gpgme_op_sign_result *gpgme_sign_result_t;
    1383             : 
    1384             : /* Retrieve a pointer to the result of the signing operation.  */
    1385             : gpgme_sign_result_t gpgme_op_sign_result (gpgme_ctx_t ctx);
    1386             : 
    1387             : /* Sign the plaintext PLAIN and store the signature in SIG.  */
    1388             : gpgme_error_t gpgme_op_sign_start (gpgme_ctx_t ctx,
    1389             :                                    gpgme_data_t plain, gpgme_data_t sig,
    1390             :                                    gpgme_sig_mode_t mode);
    1391             : gpgme_error_t gpgme_op_sign (gpgme_ctx_t ctx,
    1392             :                              gpgme_data_t plain, gpgme_data_t sig,
    1393             :                              gpgme_sig_mode_t mode);
    1394             : 
    1395             : 
    1396             : /*
    1397             :  * Verify.
    1398             :  */
    1399             : 
    1400             : /* Flags used for the SUMMARY field in a gpgme_signature_t.  */
    1401             : typedef enum
    1402             :   {
    1403             :     GPGME_SIGSUM_VALID       = 0x0001,  /* The signature is fully valid.  */
    1404             :     GPGME_SIGSUM_GREEN       = 0x0002,  /* The signature is good.  */
    1405             :     GPGME_SIGSUM_RED         = 0x0004,  /* The signature is bad.  */
    1406             :     GPGME_SIGSUM_KEY_REVOKED = 0x0010,  /* One key has been revoked.  */
    1407             :     GPGME_SIGSUM_KEY_EXPIRED = 0x0020,  /* One key has expired.  */
    1408             :     GPGME_SIGSUM_SIG_EXPIRED = 0x0040,  /* The signature has expired.  */
    1409             :     GPGME_SIGSUM_KEY_MISSING = 0x0080,  /* Can't verify: key missing.  */
    1410             :     GPGME_SIGSUM_CRL_MISSING = 0x0100,  /* CRL not available.  */
    1411             :     GPGME_SIGSUM_CRL_TOO_OLD = 0x0200,  /* Available CRL is too old.  */
    1412             :     GPGME_SIGSUM_BAD_POLICY  = 0x0400,  /* A policy was not met.  */
    1413             :     GPGME_SIGSUM_SYS_ERROR   = 0x0800,  /* A system error occurred.  */
    1414             :     GPGME_SIGSUM_TOFU_CONFLICT=0x1000   /* Tofu conflict detected.  */
    1415             :   }
    1416             : gpgme_sigsum_t;
    1417             : 
    1418             : 
    1419             : /* An object to hold the verification status of a signature.
    1420             :  * This structure shall be considered read-only and an application
    1421             :  * must not allocate such a structure on its own.  */
    1422             : struct _gpgme_signature
    1423             : {
    1424             :   struct _gpgme_signature *next;
    1425             : 
    1426             :   /* A summary of the signature status.  */
    1427             :   gpgme_sigsum_t summary;
    1428             : 
    1429             :   /* The fingerprint of the signature.  This can be a subkey.  */
    1430             :   char *fpr;
    1431             : 
    1432             :   /* The status of the signature.  */
    1433             :   gpgme_error_t status;
    1434             : 
    1435             :   /* Notation data and policy URLs.  */
    1436             :   gpgme_sig_notation_t notations;
    1437             : 
    1438             :   /* Signature creation time.  */
    1439             :   unsigned long timestamp;
    1440             : 
    1441             :   /* Signature expiration time or 0.  */
    1442             :   unsigned long exp_timestamp;
    1443             : 
    1444             :   /* Key should not have been used for signing.  */
    1445             :   unsigned int wrong_key_usage : 1;
    1446             : 
    1447             :   /* PKA status: 0 = not available, 1 = bad, 2 = okay, 3 = RFU. */
    1448             :   unsigned int pka_trust : 2;
    1449             : 
    1450             :   /* Validity has been verified using the chain model. */
    1451             :   unsigned int chain_model : 1;
    1452             : 
    1453             :   /* Internal to GPGME, do not use.  */
    1454             :   int _unused : 28;
    1455             : 
    1456             :   gpgme_validity_t validity;
    1457             :   gpgme_error_t validity_reason;
    1458             : 
    1459             :   /* The public key algorithm used to create the signature.  */
    1460             :   gpgme_pubkey_algo_t pubkey_algo;
    1461             : 
    1462             :   /* The hash algorithm used to create the signature.  */
    1463             :   gpgme_hash_algo_t hash_algo;
    1464             : 
    1465             :   /* The mailbox from the PKA information or NULL. */
    1466             :   char *pka_address;
    1467             : 
    1468             :   /* If non-NULL, a possible incomplete key object with the data
    1469             :    * available for the signature.  */
    1470             :   gpgme_key_t key;
    1471             : };
    1472             : typedef struct _gpgme_signature *gpgme_signature_t;
    1473             : 
    1474             : /* An object to return the results of a verify operation.
    1475             :  * This structure shall be considered read-only and an application
    1476             :  * must not allocate such a structure on its own.  */
    1477             : struct _gpgme_op_verify_result
    1478             : {
    1479             :   gpgme_signature_t signatures;
    1480             : 
    1481             :   /* The original file name of the plaintext message, if
    1482             :      available.  */
    1483             :   char *file_name;
    1484             : };
    1485             : typedef struct _gpgme_op_verify_result *gpgme_verify_result_t;
    1486             : 
    1487             : /* Retrieve a pointer to the result of the verify operation.  */
    1488             : gpgme_verify_result_t gpgme_op_verify_result (gpgme_ctx_t ctx);
    1489             : 
    1490             : /* Verify within CTX that SIG is a valid signature for TEXT.  */
    1491             : gpgme_error_t gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig,
    1492             :                                      gpgme_data_t signed_text,
    1493             :                                      gpgme_data_t plaintext);
    1494             : gpgme_error_t gpgme_op_verify (gpgme_ctx_t ctx, gpgme_data_t sig,
    1495             :                                gpgme_data_t signed_text,
    1496             :                                gpgme_data_t plaintext);
    1497             : 
    1498             : 
    1499             : /*
    1500             :  * Import/Export
    1501             :  */
    1502             : 
    1503             : #define GPGME_IMPORT_NEW        1  /* The key was new.  */
    1504             : #define GPGME_IMPORT_UID        2  /* The key contained new user IDs.  */
    1505             : #define GPGME_IMPORT_SIG        4  /* The key contained new signatures.  */
    1506             : #define GPGME_IMPORT_SUBKEY     8  /* The key contained new sub keys.  */
    1507             : #define GPGME_IMPORT_SECRET    16  /* The key contained a secret key.  */
    1508             : 
    1509             : 
    1510             : /* An object to hold results for one imported key.
    1511             :  * This structure shall be considered read-only and an application
    1512             :  * must not allocate such a structure on its own.  */
    1513             : struct _gpgme_import_status
    1514             : {
    1515             :   struct _gpgme_import_status *next;
    1516             : 
    1517             :   /* Fingerprint.  */
    1518             :   char *fpr;
    1519             : 
    1520             :   /* If a problem occurred, the reason why the key could not be
    1521             :      imported.  Otherwise GPGME_No_Error.  */
    1522             :   gpgme_error_t result;
    1523             : 
    1524             :   /* The result of the import, the GPGME_IMPORT_* values bit-wise
    1525             :      ORed.  0 means the key was already known and no new components
    1526             :      have been added.  */
    1527             :   unsigned int status;
    1528             : };
    1529             : typedef struct _gpgme_import_status *gpgme_import_status_t;
    1530             : 
    1531             : /* Import result object.
    1532             :  * This structure shall be considered read-only and an application
    1533             :  * must not allocate such a structure on its own.  */
    1534             : struct _gpgme_op_import_result
    1535             : {
    1536             :   /* Number of considered keys.  */
    1537             :   int considered;
    1538             : 
    1539             :   /* Keys without user ID.  */
    1540             :   int no_user_id;
    1541             : 
    1542             :   /* Imported keys.  */
    1543             :   int imported;
    1544             : 
    1545             :   /* Imported RSA keys.  */
    1546             :   int imported_rsa;
    1547             : 
    1548             :   /* Unchanged keys.  */
    1549             :   int unchanged;
    1550             : 
    1551             :   /* Number of new user ids.  */
    1552             :   int new_user_ids;
    1553             : 
    1554             :   /* Number of new sub keys.  */
    1555             :   int new_sub_keys;
    1556             : 
    1557             :   /* Number of new signatures.  */
    1558             :   int new_signatures;
    1559             : 
    1560             :   /* Number of new revocations.  */
    1561             :   int new_revocations;
    1562             : 
    1563             :   /* Number of secret keys read.  */
    1564             :   int secret_read;
    1565             : 
    1566             :   /* Number of secret keys imported.  */
    1567             :   int secret_imported;
    1568             : 
    1569             :   /* Number of secret keys unchanged.  */
    1570             :   int secret_unchanged;
    1571             : 
    1572             :   /* Number of new keys skipped.  */
    1573             :   int skipped_new_keys;
    1574             : 
    1575             :   /* Number of keys not imported.  */
    1576             :   int not_imported;
    1577             : 
    1578             :   /* List of keys for which an import was attempted.  */
    1579             :   gpgme_import_status_t imports;
    1580             : };
    1581             : typedef struct _gpgme_op_import_result *gpgme_import_result_t;
    1582             : 
    1583             : /* Retrieve a pointer to the result of the import operation.  */
    1584             : gpgme_import_result_t gpgme_op_import_result (gpgme_ctx_t ctx);
    1585             : 
    1586             : /* Import the key in KEYDATA into the keyring.  */
    1587             : gpgme_error_t gpgme_op_import_start (gpgme_ctx_t ctx, gpgme_data_t keydata);
    1588             : gpgme_error_t gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata);
    1589             : 
    1590             : /* Import the keys from the array KEYS into the keyring.  */
    1591             : gpgme_error_t gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t keys[]);
    1592             : gpgme_error_t gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t keys[]);
    1593             : 
    1594             : 
    1595             : /* Export the keys found by PATTERN into KEYDATA.  */
    1596             : gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern,
    1597             :                                      gpgme_export_mode_t mode,
    1598             :                                      gpgme_data_t keydata);
    1599             : gpgme_error_t gpgme_op_export (gpgme_ctx_t ctx, const char *pattern,
    1600             :                                gpgme_export_mode_t mode,
    1601             :                                gpgme_data_t keydata);
    1602             : 
    1603             : gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx,
    1604             :                                          const char *pattern[],
    1605             :                                          gpgme_export_mode_t mode,
    1606             :                                          gpgme_data_t keydata);
    1607             : gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[],
    1608             :                                    gpgme_export_mode_t mode,
    1609             :                                    gpgme_data_t keydata);
    1610             : 
    1611             : /* Export the keys from the array KEYS into KEYDATA.  */
    1612             : gpgme_error_t gpgme_op_export_keys_start (gpgme_ctx_t ctx,
    1613             :                                           gpgme_key_t keys[],
    1614             :                                           gpgme_export_mode_t mode,
    1615             :                                           gpgme_data_t keydata);
    1616             : gpgme_error_t gpgme_op_export_keys (gpgme_ctx_t ctx,
    1617             :                                     gpgme_key_t keys[],
    1618             :                                     gpgme_export_mode_t mode,
    1619             :                                     gpgme_data_t keydata);
    1620             : 
    1621             : 
    1622             : 
    1623             : /*
    1624             :  * Key generation.
    1625             :  */
    1626             : 
    1627             : /* Flags for the key creation functions.  */
    1628             : #define GPGME_CREATE_SIGN       (1 << 0)  /* Allow usage: signing.     */
    1629             : #define GPGME_CREATE_ENCR       (1 << 1)  /* Allow usage: encryption.  */
    1630             : #define GPGME_CREATE_CERT       (1 << 2)  /* Allow usage: certification.  */
    1631             : #define GPGME_CREATE_AUTH       (1 << 3)  /* Allow usage: authentication.  */
    1632             : #define GPGME_CREATE_NOPASSWD   (1 << 7)  /* Create w/o passphrase.    */
    1633             : #define GPGME_CREATE_SELFSIGNED (1 << 8)  /* Create self-signed cert.  */
    1634             : #define GPGME_CREATE_NOSTORE    (1 << 9)  /* Do not store the key.     */
    1635             : #define GPGME_CREATE_WANTPUB    (1 << 10) /* Return the public key.    */
    1636             : #define GPGME_CREATE_WANTSEC    (1 << 11) /* Return the secret key.    */
    1637             : #define GPGME_CREATE_FORCE      (1 << 12) /* Force creation.           */
    1638             : #define GPGME_CREATE_NOEXPIRE   (1 << 13) /* Create w/o expiration.    */
    1639             : 
    1640             : /* An object to return result from a key generation.
    1641             :  * This structure shall be considered read-only and an application
    1642             :  * must not allocate such a structure on its own.  */
    1643             : struct _gpgme_op_genkey_result
    1644             : {
    1645             :   /* A primary key was generated.  */
    1646             :   unsigned int primary : 1;
    1647             : 
    1648             :   /* A sub key was generated.  */
    1649             :   unsigned int sub : 1;
    1650             : 
    1651             :   /* A user id was generated.  */
    1652             :   unsigned int uid : 1;
    1653             : 
    1654             :   /* Internal to GPGME, do not use.  */
    1655             :   unsigned int _unused : 29;
    1656             : 
    1657             :   /* The fingerprint of the generated key.  */
    1658             :   char *fpr;
    1659             : 
    1660             :   /* A memory data object with the created public key.  Only set when
    1661             :    * GPGME_CREATE_WANTPUB has been used. */
    1662             :   gpgme_data_t pubkey;
    1663             : 
    1664             :   /* A memory data object with the created secret key.  Only set when
    1665             :    * GPGME_CREATE_WANTSEC has been used. */
    1666             :   gpgme_data_t seckey;
    1667             : };
    1668             : typedef struct _gpgme_op_genkey_result *gpgme_genkey_result_t;
    1669             : 
    1670             : /* Generate a new keypair and add it to the keyring.  PUBKEY and
    1671             :    SECKEY should be null for now.  PARMS specifies what keys should be
    1672             :    generated.  */
    1673             : gpgme_error_t gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms,
    1674             :                                      gpgme_data_t pubkey, gpgme_data_t seckey);
    1675             : gpgme_error_t gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms,
    1676             :                                gpgme_data_t pubkey, gpgme_data_t seckey);
    1677             : 
    1678             : /* Generate a key pair using the modern interface.  */
    1679             : gpgme_error_t gpgme_op_createkey_start (gpgme_ctx_t ctx,
    1680             :                                         const char *userid,
    1681             :                                         const char *algo,
    1682             :                                         unsigned long reserved,
    1683             :                                         unsigned long expires,
    1684             :                                         gpgme_key_t certkey,
    1685             :                                         unsigned int flags);
    1686             : gpgme_error_t gpgme_op_createkey       (gpgme_ctx_t ctx,
    1687             :                                         const char *userid,
    1688             :                                         const char *algo,
    1689             :                                         unsigned long reserved,
    1690             :                                         unsigned long expires,
    1691             :                                         gpgme_key_t certkey,
    1692             :                                         unsigned int flags);
    1693             : /* Add a new subkey to KEY.  */
    1694             : gpgme_error_t gpgme_op_createsubkey_start (gpgme_ctx_t ctx,
    1695             :                                            gpgme_key_t key,
    1696             :                                            const char *algo,
    1697             :                                            unsigned long reserved,
    1698             :                                            unsigned long expires,
    1699             :                                            unsigned int flags);
    1700             : gpgme_error_t gpgme_op_createsubkey       (gpgme_ctx_t ctx,
    1701             :                                            gpgme_key_t key,
    1702             :                                            const char *algo,
    1703             :                                            unsigned long reserved,
    1704             :                                            unsigned long expires,
    1705             :                                            unsigned int flags);
    1706             : 
    1707             : /* Add USERID to an existing KEY.  */
    1708             : gpgme_error_t gpgme_op_adduid_start (gpgme_ctx_t ctx,
    1709             :                                      gpgme_key_t key, const char *userid,
    1710             :                                      unsigned int reserved);
    1711             : gpgme_error_t gpgme_op_adduid       (gpgme_ctx_t ctx,
    1712             :                                      gpgme_key_t key, const char *userid,
    1713             :                                      unsigned int reserved);
    1714             : 
    1715             : /* Revoke a USERID from a KEY.  */
    1716             : gpgme_error_t gpgme_op_revuid_start (gpgme_ctx_t ctx,
    1717             :                                      gpgme_key_t key, const char *userid,
    1718             :                                      unsigned int reserved);
    1719             : gpgme_error_t gpgme_op_revuid       (gpgme_ctx_t ctx,
    1720             :                                      gpgme_key_t key, const char *userid,
    1721             :                                      unsigned int reserved);
    1722             : 
    1723             : 
    1724             : 
    1725             : /* Retrieve a pointer to the result of a genkey, createkey, or
    1726             :  * createsubkey operation.  */
    1727             : gpgme_genkey_result_t gpgme_op_genkey_result (gpgme_ctx_t ctx);
    1728             : 
    1729             : 
    1730             : /* Delete KEY from the keyring.  If ALLOW_SECRET is non-zero, secret
    1731             :    keys are also deleted.  */
    1732             : gpgme_error_t gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key,
    1733             :                                      int allow_secret);
    1734             : gpgme_error_t gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key,
    1735             :                                int allow_secret);
    1736             : 
    1737             : 
    1738             : /*
    1739             :  * Key signing interface
    1740             :  */
    1741             : 
    1742             : /* Flags for the key signing functions.  */
    1743             : #define GPGME_KEYSIGN_LOCAL     (1 << 7)  /* Create a local signature.  */
    1744             : #define GPGME_KEYSIGN_LFSEP     (1 << 8)  /* Indicate LF separated user ids. */
    1745             : #define GPGME_KEYSIGN_NOEXPIRE  (1 << 9)  /* Force no expiration.  */
    1746             : 
    1747             : 
    1748             : /* Sign the USERID of KEY using the current set of signers.  */
    1749             : gpgme_error_t gpgme_op_keysign_start (gpgme_ctx_t ctx,
    1750             :                                       gpgme_key_t key, const char *userid,
    1751             :                                       unsigned long expires,
    1752             :                                       unsigned int flags);
    1753             : gpgme_error_t gpgme_op_keysign       (gpgme_ctx_t ctx,
    1754             :                                       gpgme_key_t key, const char *userid,
    1755             :                                       unsigned long expires,
    1756             :                                       unsigned int flags);
    1757             : 
    1758             : 
    1759             : 
    1760             : 
    1761             : /*
    1762             :  * Key edit interface
    1763             :  */
    1764             : 
    1765             : /* Flags to select the mode of the interact.  */
    1766             : #define GPGME_INTERACT_CARD   (1 << 0)  /* Use --card-edit mode. */
    1767             : 
    1768             : 
    1769             : /* Edit the KEY.  Send status and command requests to FNC and
    1770             :    output of edit commands to OUT.  */
    1771             : gpgme_error_t gpgme_op_interact_start (gpgme_ctx_t ctx,
    1772             :                                        gpgme_key_t key,
    1773             :                                        unsigned int flags,
    1774             :                                        gpgme_interact_cb_t fnc,
    1775             :                                        void *fnc_value,
    1776             :                                        gpgme_data_t out);
    1777             : gpgme_error_t gpgme_op_interact (gpgme_ctx_t ctx, gpgme_key_t key,
    1778             :                                  unsigned int flags,
    1779             :                                  gpgme_interact_cb_t fnc,
    1780             :                                  void *fnc_value,
    1781             :                                  gpgme_data_t out);
    1782             : 
    1783             : 
    1784             : /* Set the Tofu policy of KEY to POLCIY.  */
    1785             : gpgme_error_t gpgme_op_tofu_policy_start (gpgme_ctx_t ctx,
    1786             :                                           gpgme_key_t key,
    1787             :                                           gpgme_tofu_policy_t policy);
    1788             : gpgme_error_t gpgme_op_tofu_policy       (gpgme_ctx_t ctx,
    1789             :                                           gpgme_key_t key,
    1790             :                                           gpgme_tofu_policy_t policy);
    1791             : 
    1792             : 
    1793             : 
    1794             : 
    1795             : /*
    1796             :  * Key listing
    1797             :  */
    1798             : 
    1799             : /* An object to return results from a key listing operation.
    1800             :  * This structure shall be considered read-only and an application
    1801             :  * must not allocate such a structure on its own.  */
    1802             : struct _gpgme_op_keylist_result
    1803             : {
    1804             :   unsigned int truncated : 1;
    1805             : 
    1806             :   /* Internal to GPGME, do not use.  */
    1807             :   unsigned int _unused : 31;
    1808             : };
    1809             : typedef struct _gpgme_op_keylist_result *gpgme_keylist_result_t;
    1810             : 
    1811             : /* Retrieve a pointer to the result of the key listing operation.  */
    1812             : gpgme_keylist_result_t gpgme_op_keylist_result (gpgme_ctx_t ctx);
    1813             : 
    1814             : /* Start a keylist operation within CTX, searching for keys which
    1815             :    match PATTERN.  If SECRET_ONLY is true, only secret keys are
    1816             :    returned.  */
    1817             : gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern,
    1818             :                                       int secret_only);
    1819             : gpgme_error_t gpgme_op_keylist_ext_start (gpgme_ctx_t ctx,
    1820             :                                           const char *pattern[],
    1821             :                                           int secret_only, int reserved);
    1822             : 
    1823             : /* Return the next key from the keylist in R_KEY.  */
    1824             : gpgme_error_t gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key);
    1825             : 
    1826             : /* Terminate a pending keylist operation within CTX.  */
    1827             : gpgme_error_t gpgme_op_keylist_end (gpgme_ctx_t ctx);
    1828             : 
    1829             : /* Change the passphrase for KEY.  FLAGS is reserved for future use
    1830             :    and must be passed as 0.  */
    1831             : gpgme_error_t gpgme_op_passwd_start (gpgme_ctx_t ctx, gpgme_key_t key,
    1832             :                                      unsigned int flags);
    1833             : gpgme_error_t gpgme_op_passwd (gpgme_ctx_t ctx, gpgme_key_t key,
    1834             :                                unsigned int flags);
    1835             : 
    1836             : 
    1837             : 
    1838             : /*
    1839             :  * Trust items and operations.
    1840             :  */
    1841             : 
    1842             : /* An object to hold data of a trust item.
    1843             :  * This structure shall be considered read-only and an application
    1844             :  * must not allocate such a structure on its own.  */
    1845             : struct _gpgme_trust_item
    1846             : {
    1847             :   /* Internal to GPGME, do not use.  */
    1848             :   unsigned int _refs;
    1849             : 
    1850             :   /* The key ID to which the trust item belongs.  */
    1851             :   char *keyid;
    1852             : 
    1853             :   /* Internal to GPGME, do not use.  */
    1854             :   char _keyid[16 + 1];
    1855             : 
    1856             :   /* The type of the trust item, 1 refers to a key, 2 to a user ID.  */
    1857             :   int type;
    1858             : 
    1859             :   /* The trust level.  */
    1860             :   int level;
    1861             : 
    1862             :   /* The owner trust if TYPE is 1.  */
    1863             :   char *owner_trust;
    1864             : 
    1865             :   /* Internal to GPGME, do not use.  */
    1866             :   char _owner_trust[2];
    1867             : 
    1868             :   /* The calculated validity.  */
    1869             :   char *validity;
    1870             : 
    1871             :   /* Internal to GPGME, do not use.  */
    1872             :   char _validity[2];
    1873             : 
    1874             :   /* The user name if TYPE is 2.  */
    1875             :   char *name;
    1876             : };
    1877             : typedef struct _gpgme_trust_item *gpgme_trust_item_t;
    1878             : 
    1879             : /* Start a trustlist operation within CTX, searching for trust items
    1880             :    which match PATTERN.  */
    1881             : gpgme_error_t gpgme_op_trustlist_start (gpgme_ctx_t ctx,
    1882             :                                         const char *pattern, int max_level);
    1883             : 
    1884             : /* Return the next trust item from the trustlist in R_ITEM.  */
    1885             : gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx,
    1886             :                                        gpgme_trust_item_t *r_item);
    1887             : 
    1888             : /* Terminate a pending trustlist operation within CTX.  */
    1889             : gpgme_error_t gpgme_op_trustlist_end (gpgme_ctx_t ctx);
    1890             : 
    1891             : /* Acquire a reference to ITEM.  */
    1892             : void gpgme_trust_item_ref (gpgme_trust_item_t item);
    1893             : 
    1894             : /* Release a reference to ITEM.  If this was the last one the trust
    1895             :    item is destroyed.  */
    1896             : void gpgme_trust_item_unref (gpgme_trust_item_t item);
    1897             : 
    1898             : 
    1899             : 
    1900             : /*
    1901             :  * Audit log
    1902             :  */
    1903             : 
    1904             : /* Return the auditlog for the current session.  This may be called
    1905             :    after a successful or failed operation.  If no audit log is
    1906             :    available GPG_ERR_NO_DATA is returned.  */
    1907             : gpgme_error_t gpgme_op_getauditlog_start (gpgme_ctx_t ctx, gpgme_data_t output,
    1908             :                                           unsigned int flags);
    1909             : gpgme_error_t gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output,
    1910             :                                     unsigned int flags);
    1911             : 
    1912             : 
    1913             : 
    1914             : /*
    1915             :  * Spawn interface
    1916             :  */
    1917             : 
    1918             : /* Flags for the spawn operations.  */
    1919             : #define GPGME_SPAWN_DETACHED      1
    1920             : #define GPGME_SPAWN_ALLOW_SET_FG  2
    1921             : 
    1922             : 
    1923             : /* Run the command FILE with the arguments in ARGV.  Connect stdin to
    1924             :    DATAIN, stdout to DATAOUT, and STDERR to DATAERR.  If one the data
    1925             :    streams is NULL, connect to /dev/null instead.  */
    1926             : gpgme_error_t gpgme_op_spawn_start (gpgme_ctx_t ctx,
    1927             :                                     const char *file, const char *argv[],
    1928             :                                     gpgme_data_t datain,
    1929             :                                     gpgme_data_t dataout, gpgme_data_t dataerr,
    1930             :                                     unsigned int flags);
    1931             : gpgme_error_t gpgme_op_spawn (gpgme_ctx_t ctx,
    1932             :                               const char *file, const char *argv[],
    1933             :                               gpgme_data_t datain,
    1934             :                               gpgme_data_t dataout, gpgme_data_t dataerr,
    1935             :                               unsigned int flags);
    1936             : 
    1937             : 
    1938             : /*
    1939             :  * Low-level Assuan protocol access.
    1940             :  */
    1941             : typedef gpgme_error_t (*gpgme_assuan_data_cb_t)
    1942             :      (void *opaque, const void *data, size_t datalen);
    1943             : 
    1944             : typedef gpgme_error_t (*gpgme_assuan_inquire_cb_t)
    1945             :      (void *opaque, const char *name, const char *args,
    1946             :       gpgme_data_t *r_data);
    1947             : 
    1948             : typedef gpgme_error_t (*gpgme_assuan_status_cb_t)
    1949             :      (void *opaque, const char *status, const char *args);
    1950             : 
    1951             : /* Send the Assuan COMMAND and return results via the callbacks.
    1952             :    Asynchronous variant. */
    1953             : gpgme_error_t gpgme_op_assuan_transact_start (gpgme_ctx_t ctx,
    1954             :                                               const char *command,
    1955             :                                               gpgme_assuan_data_cb_t data_cb,
    1956             :                                               void *data_cb_value,
    1957             :                                               gpgme_assuan_inquire_cb_t inq_cb,
    1958             :                                               void *inq_cb_value,
    1959             :                                               gpgme_assuan_status_cb_t stat_cb,
    1960             :                                               void *stat_cb_value);
    1961             : 
    1962             : /* Send the Assuan COMMAND and return results via the callbacks.
    1963             :    Synchronous variant. */
    1964             : gpgme_error_t gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx,
    1965             :                                             const char *command,
    1966             :                                             gpgme_assuan_data_cb_t data_cb,
    1967             :                                             void *data_cb_value,
    1968             :                                             gpgme_assuan_inquire_cb_t inq_cb,
    1969             :                                             void *inq_cb_value,
    1970             :                                             gpgme_assuan_status_cb_t stat_cb,
    1971             :                                             void *stat_cb_value,
    1972             :                                             gpgme_error_t *op_err);
    1973             : 
    1974             : 
    1975             : /*
    1976             :  * Crypto container support.
    1977             :  */
    1978             : 
    1979             : /* An object to return results from a VFS mount operation.
    1980             :  * This structure shall be considered read-only and an application
    1981             :  * must not allocate such a structure on its own.  */
    1982             : struct _gpgme_op_vfs_mount_result
    1983             : {
    1984             :   char *mount_dir;
    1985             : };
    1986             : typedef struct _gpgme_op_vfs_mount_result *gpgme_vfs_mount_result_t;
    1987             : 
    1988             : gpgme_vfs_mount_result_t gpgme_op_vfs_mount_result (gpgme_ctx_t ctx);
    1989             : 
    1990             : /* The container is automatically unmounted when the context is reset
    1991             :    or destroyed.  Transmission errors are returned directly,
    1992             :    operational errors are returned in OP_ERR.  */
    1993             : gpgme_error_t gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file,
    1994             :                                   const char *mount_dir, unsigned int flags,
    1995             :                                   gpgme_error_t *op_err);
    1996             : 
    1997             : gpgme_error_t gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[],
    1998             :                                    const char *container_file,
    1999             :                                    unsigned int flags, gpgme_error_t *op_err);
    2000             : 
    2001             : 
    2002             : /*
    2003             :  * Interface to gpgconf(1).
    2004             :  */
    2005             : 
    2006             : /* The expert level at which a configuration option or group of
    2007             :    options should be displayed.  See the gpgconf(1) documentation for
    2008             :    more details.  */
    2009             : typedef enum
    2010             :   {
    2011             :     GPGME_CONF_BASIC = 0,
    2012             :     GPGME_CONF_ADVANCED = 1,
    2013             :     GPGME_CONF_EXPERT = 2,
    2014             :     GPGME_CONF_INVISIBLE = 3,
    2015             :     GPGME_CONF_INTERNAL = 4
    2016             :   }
    2017             : gpgme_conf_level_t;
    2018             : 
    2019             : 
    2020             : /* The data type of a configuration option argument.  See the gpgconf(1)
    2021             :    documentation for more details.  */
    2022             : typedef enum
    2023             :   {
    2024             :     /* Basic types.  */
    2025             :     GPGME_CONF_NONE = 0,
    2026             :     GPGME_CONF_STRING = 1,
    2027             :     GPGME_CONF_INT32 = 2,
    2028             :     GPGME_CONF_UINT32 = 3,
    2029             : 
    2030             :     /* Complex types.  */
    2031             :     GPGME_CONF_FILENAME = 32,
    2032             :     GPGME_CONF_LDAP_SERVER = 33,
    2033             :     GPGME_CONF_KEY_FPR = 34,
    2034             :     GPGME_CONF_PUB_KEY = 35,
    2035             :     GPGME_CONF_SEC_KEY = 36,
    2036             :     GPGME_CONF_ALIAS_LIST = 37
    2037             :   }
    2038             : gpgme_conf_type_t;
    2039             : 
    2040             : /* For now, compatibility.  */
    2041             : #define GPGME_CONF_PATHNAME GPGME_CONF_FILENAME
    2042             : 
    2043             : 
    2044             : /* This represents a single argument for a configuration option.
    2045             :    Which of the members of value is used depends on the ALT_TYPE.  */
    2046             : typedef struct gpgme_conf_arg
    2047             : {
    2048             :   struct gpgme_conf_arg *next;
    2049             :   /* True if the option appears without an (optional) argument.  */
    2050             :   unsigned int no_arg;
    2051             :   union
    2052             :   {
    2053             :     unsigned int count;
    2054             :     unsigned int uint32;
    2055             :     int int32;
    2056             :     char *string;
    2057             :   } value;
    2058             : } *gpgme_conf_arg_t;
    2059             : 
    2060             : 
    2061             : /* The flags of a configuration option.  See the gpgconf
    2062             :    documentation for details.  */
    2063             : #define GPGME_CONF_GROUP        (1 << 0)
    2064             : #define GPGME_CONF_OPTIONAL     (1 << 1)
    2065             : #define GPGME_CONF_LIST         (1 << 2)
    2066             : #define GPGME_CONF_RUNTIME      (1 << 3)
    2067             : #define GPGME_CONF_DEFAULT      (1 << 4)
    2068             : #define GPGME_CONF_DEFAULT_DESC (1 << 5)
    2069             : #define GPGME_CONF_NO_ARG_DESC  (1 << 6)
    2070             : #define GPGME_CONF_NO_CHANGE    (1 << 7)
    2071             : 
    2072             : 
    2073             : /* The representation of a single configuration option.  See the
    2074             :    gpg-conf documentation for details.  */
    2075             : typedef struct gpgme_conf_opt
    2076             : {
    2077             :   struct gpgme_conf_opt *next;
    2078             : 
    2079             :   /* The option name.  */
    2080             :   char *name;
    2081             : 
    2082             :   /* The flags for this option.  */
    2083             :   unsigned int flags;
    2084             : 
    2085             :   /* The level of this option.  */
    2086             :   gpgme_conf_level_t level;
    2087             : 
    2088             :   /* The localized description of this option.  */
    2089             :   char *description;
    2090             : 
    2091             :   /* The type and alternate type of this option.  */
    2092             :   gpgme_conf_type_t type;
    2093             :   gpgme_conf_type_t alt_type;
    2094             : 
    2095             :   /* The localized (short) name of the argument, if any.  */
    2096             :   char *argname;
    2097             : 
    2098             :   /* The default value.  */
    2099             :   gpgme_conf_arg_t default_value;
    2100             :   char *default_description;
    2101             : 
    2102             :   /* The default value if the option is not set.  */
    2103             :   gpgme_conf_arg_t no_arg_value;
    2104             :   char *no_arg_description;
    2105             : 
    2106             :   /* The current value if the option is set.  */
    2107             :   gpgme_conf_arg_t value;
    2108             : 
    2109             :   /* The new value, if any.  NULL means reset to default.  */
    2110             :   int change_value;
    2111             :   gpgme_conf_arg_t new_value;
    2112             : 
    2113             :   /* Free for application use.  */
    2114             :   void *user_data;
    2115             : } *gpgme_conf_opt_t;
    2116             : 
    2117             : 
    2118             : /* The representation of a component that can be configured.  See the
    2119             :    gpg-conf documentation for details.  */
    2120             : typedef struct gpgme_conf_comp
    2121             : {
    2122             :   struct gpgme_conf_comp *next;
    2123             : 
    2124             :   /* Internal to GPGME, do not use!  */
    2125             :   gpgme_conf_opt_t *_last_opt_p;
    2126             : 
    2127             :   /* The component name.  */
    2128             :   char *name;
    2129             : 
    2130             :   /* A human-readable description for the component.  */
    2131             :   char *description;
    2132             : 
    2133             :   /* The program name (an absolute path to the program).  */
    2134             :   char *program_name;
    2135             : 
    2136             :   /* A linked list of options for this component.  */
    2137             :   struct gpgme_conf_opt *options;
    2138             : } *gpgme_conf_comp_t;
    2139             : 
    2140             : 
    2141             : /* Allocate a new gpgme_conf_arg_t.  If VALUE is NULL, a "no arg
    2142             :    default" is prepared.  If type is a string type, VALUE should point
    2143             :    to the string.  Else, it should point to an unsigned or signed
    2144             :    integer respectively.  */
    2145             : gpgme_error_t gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
    2146             :                                   gpgme_conf_type_t type, const void *value);
    2147             : 
    2148             : /* This also releases all chained argument structures!  */
    2149             : void gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type);
    2150             : 
    2151             : /* Register a change for the value of OPT to ARG.  If RESET is 1 (do
    2152             :    not use any values but 0 or 1), ARG is ignored and the option is
    2153             :    not changed (reverting a previous change).  Otherwise, if ARG is
    2154             :    NULL, the option is cleared or reset to its default. The change
    2155             :    is done with gpgconf's --runtime option to immediately take effect. */
    2156             : gpgme_error_t gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset,
    2157             :                                      gpgme_conf_arg_t arg);
    2158             : 
    2159             : /* Release a set of configurations.  */
    2160             : void gpgme_conf_release (gpgme_conf_comp_t conf);
    2161             : 
    2162             : /* Retrieve the current configurations.  */
    2163             : gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p);
    2164             : 
    2165             : /* Save the configuration of component comp.  This function does not
    2166             :    follow chained components!  */
    2167             : gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp);
    2168             : 
    2169             : 
    2170             : /* Information about software versions.
    2171             :  * This structure shall be considered read-only and an application
    2172             :  * must not allocate such a structure on its own.  */
    2173             : typedef struct _gpgme_op_query_swdb_result
    2174             : {
    2175             :   /* RFU */
    2176             :   struct _gpgme_op_query_swdb_result *next;
    2177             : 
    2178             :   /* The name of the package (e.g. "gpgme", "gnupg") */
    2179             :   char *name;
    2180             : 
    2181             :   /* The version number of the installed version.  */
    2182             :   char *iversion;
    2183             : 
    2184             :   /* The time the online info was created.  */
    2185             :   unsigned long created;
    2186             : 
    2187             :   /* The time the online info was retrieved.  */
    2188             :   unsigned long retrieved;
    2189             : 
    2190             :   /* This bit is set if an error occured or some of the information
    2191             :    * in this structure may not be set.  */
    2192             :   unsigned int warning : 1;
    2193             : 
    2194             :   /* An update is available.  */
    2195             :   unsigned int update : 1;
    2196             : 
    2197             :   /* The update is important.  */
    2198             :   unsigned int urgent : 1;
    2199             : 
    2200             :   /* No information at all available.  */
    2201             :   unsigned int noinfo : 1;
    2202             : 
    2203             :   /* The package name is not known. */
    2204             :   unsigned int unknown : 1;
    2205             : 
    2206             :   /* The information here is too old.  */
    2207             :   unsigned int tooold : 1;
    2208             : 
    2209             :   /* Other error.  */
    2210             :   unsigned int error : 1;
    2211             : 
    2212             :   unsigned int _reserved : 25;
    2213             : 
    2214             :   /* The version number of the latest released version.  */
    2215             :   char *version;
    2216             : 
    2217             :   /* The release date of that version.  */
    2218             :   unsigned long reldate;
    2219             : 
    2220             : } *gpgme_query_swdb_result_t;
    2221             : 
    2222             : 
    2223             : /* Run the gpgconf --query-swdb command.  */
    2224             : gpgme_error_t gpgme_op_query_swdb (gpgme_ctx_t ctx,
    2225             :                                    const char *name, const char *iversion,
    2226             :                                    unsigned int reserved);
    2227             : 
    2228             : /* Return the result from the last query_swdb operation.  */
    2229             : gpgme_query_swdb_result_t gpgme_op_query_swdb_result (gpgme_ctx_t ctx);
    2230             : 
    2231             : 
    2232             : 
    2233             : 
    2234             : /*
    2235             :  * Various functions.
    2236             :  */
    2237             : 
    2238             : /* Set special global flags; consult the manual before use.  */
    2239             : int gpgme_set_global_flag (const char *name, const char *value);
    2240             : 
    2241             : /* Check that the library fulfills the version requirement.  Note:
    2242             :    This is here only for the case where a user takes a pointer from
    2243             :    the old version of this function.  The new version and macro for
    2244             :    run-time checks are below.  */
    2245             : const char *gpgme_check_version (const char *req_version);
    2246             : 
    2247             : /* Check that the library fulfills the version requirement and check
    2248             :    for struct layout mismatch involving bitfields.  */
    2249             : const char *gpgme_check_version_internal (const char *req_version,
    2250             :                                           size_t offset_sig_validity);
    2251             : 
    2252             : #define gpgme_check_version(req_version)                                \
    2253             :   gpgme_check_version_internal (req_version,                            \
    2254             :                                 offsetof (struct _gpgme_signature, validity))
    2255             : 
    2256             : /* Return the default values for various directories.  */
    2257             : const char *gpgme_get_dirinfo (const char *what);
    2258             : 
    2259             : /* Get the information about the configured and installed engines.  A
    2260             :    pointer to the first engine in the statically allocated linked list
    2261             :    is returned in *INFO.  If an error occurs, it is returned.  The
    2262             :    returned data is valid until the next gpgme_set_engine_info.  */
    2263             : gpgme_error_t gpgme_get_engine_info (gpgme_engine_info_t *engine_info);
    2264             : 
    2265             : /* Set the default engine info for the protocol PROTO to the file name
    2266             :    FILE_NAME and the home directory HOME_DIR.  */
    2267             : gpgme_error_t gpgme_set_engine_info (gpgme_protocol_t proto,
    2268             :                                      const char *file_name,
    2269             :                                      const char *home_dir);
    2270             : 
    2271             : /* Verify that the engine implementing PROTO is installed and
    2272             :    available.  */
    2273             : gpgme_error_t gpgme_engine_check_version (gpgme_protocol_t proto);
    2274             : 
    2275             : 
    2276             : /* Reference counting for result objects.  */
    2277             : void gpgme_result_ref (void *result);
    2278             : void gpgme_result_unref (void *result);
    2279             : 
    2280             : /* Return a public key algorithm string (e.g. "rsa2048").  Caller must
    2281             :    free using gpgme_free.  */
    2282             : char *gpgme_pubkey_algo_string (gpgme_subkey_t subkey);
    2283             : 
    2284             : /* Return a statically allocated string with the name of the public
    2285             :    key algorithm ALGO, or NULL if that name is not known.  */
    2286             : const char *gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo);
    2287             : 
    2288             : /* Return a statically allocated string with the name of the hash
    2289             :    algorithm ALGO, or NULL if that name is not known.  */
    2290             : const char *gpgme_hash_algo_name (gpgme_hash_algo_t algo);
    2291             : 
    2292             : /* Return the addr-spec from a user id.  Caller must free the result
    2293             :  * with gpgme_free. */
    2294             : char *gpgme_addrspec_from_uid (const char *uid);
    2295             : 
    2296             : 
    2297             : 
    2298             : /*
    2299             :  * Deprecated types, constants and functions.
    2300             :  */
    2301             : 
    2302             : /* The possible stati for gpgme_op_edit.  The use of that function and
    2303             :  * these status codes are deprecated in favor of gpgme_op_interact. */
    2304             : typedef enum
    2305             :   {
    2306             :     GPGME_STATUS_EOF = 0,
    2307             :     /* mkstatus processing starts here */
    2308             :     GPGME_STATUS_ENTER = 1,
    2309             :     GPGME_STATUS_LEAVE = 2,
    2310             :     GPGME_STATUS_ABORT = 3,
    2311             : 
    2312             :     GPGME_STATUS_GOODSIG = 4,
    2313             :     GPGME_STATUS_BADSIG = 5,
    2314             :     GPGME_STATUS_ERRSIG = 6,
    2315             : 
    2316             :     GPGME_STATUS_BADARMOR = 7,
    2317             : 
    2318             :     GPGME_STATUS_RSA_OR_IDEA = 8,      /* (legacy) */
    2319             :     GPGME_STATUS_KEYEXPIRED = 9,
    2320             :     GPGME_STATUS_KEYREVOKED = 10,
    2321             : 
    2322             :     GPGME_STATUS_TRUST_UNDEFINED = 11,
    2323             :     GPGME_STATUS_TRUST_NEVER = 12,
    2324             :     GPGME_STATUS_TRUST_MARGINAL = 13,
    2325             :     GPGME_STATUS_TRUST_FULLY = 14,
    2326             :     GPGME_STATUS_TRUST_ULTIMATE = 15,
    2327             : 
    2328             :     GPGME_STATUS_SHM_INFO = 16,        /* (legacy) */
    2329             :     GPGME_STATUS_SHM_GET = 17,         /* (legacy) */
    2330             :     GPGME_STATUS_SHM_GET_BOOL = 18,    /* (legacy) */
    2331             :     GPGME_STATUS_SHM_GET_HIDDEN = 19,  /* (legacy) */
    2332             : 
    2333             :     GPGME_STATUS_NEED_PASSPHRASE = 20,
    2334             :     GPGME_STATUS_VALIDSIG = 21,
    2335             :     GPGME_STATUS_SIG_ID = 22,
    2336             :     GPGME_STATUS_ENC_TO = 23,
    2337             :     GPGME_STATUS_NODATA = 24,
    2338             :     GPGME_STATUS_BAD_PASSPHRASE = 25,
    2339             :     GPGME_STATUS_NO_PUBKEY = 26,
    2340             :     GPGME_STATUS_NO_SECKEY = 27,
    2341             :     GPGME_STATUS_NEED_PASSPHRASE_SYM = 28,
    2342             :     GPGME_STATUS_DECRYPTION_FAILED = 29,
    2343             :     GPGME_STATUS_DECRYPTION_OKAY = 30,
    2344             :     GPGME_STATUS_MISSING_PASSPHRASE = 31,
    2345             :     GPGME_STATUS_GOOD_PASSPHRASE = 32,
    2346             :     GPGME_STATUS_GOODMDC = 33,
    2347             :     GPGME_STATUS_BADMDC = 34,
    2348             :     GPGME_STATUS_ERRMDC = 35,
    2349             :     GPGME_STATUS_IMPORTED = 36,
    2350             :     GPGME_STATUS_IMPORT_OK = 37,
    2351             :     GPGME_STATUS_IMPORT_PROBLEM = 38,
    2352             :     GPGME_STATUS_IMPORT_RES = 39,
    2353             :     GPGME_STATUS_FILE_START = 40,
    2354             :     GPGME_STATUS_FILE_DONE = 41,
    2355             :     GPGME_STATUS_FILE_ERROR = 42,
    2356             : 
    2357             :     GPGME_STATUS_BEGIN_DECRYPTION = 43,
    2358             :     GPGME_STATUS_END_DECRYPTION = 44,
    2359             :     GPGME_STATUS_BEGIN_ENCRYPTION = 45,
    2360             :     GPGME_STATUS_END_ENCRYPTION = 46,
    2361             : 
    2362             :     GPGME_STATUS_DELETE_PROBLEM = 47,
    2363             :     GPGME_STATUS_GET_BOOL = 48,
    2364             :     GPGME_STATUS_GET_LINE = 49,
    2365             :     GPGME_STATUS_GET_HIDDEN = 50,
    2366             :     GPGME_STATUS_GOT_IT = 51,
    2367             :     GPGME_STATUS_PROGRESS = 52,
    2368             :     GPGME_STATUS_SIG_CREATED = 53,
    2369             :     GPGME_STATUS_SESSION_KEY = 54,
    2370             :     GPGME_STATUS_NOTATION_NAME = 55,
    2371             :     GPGME_STATUS_NOTATION_DATA = 56,
    2372             :     GPGME_STATUS_POLICY_URL = 57,
    2373             :     GPGME_STATUS_BEGIN_STREAM = 58,    /* (legacy) */
    2374             :     GPGME_STATUS_END_STREAM = 59,      /* (legacy) */
    2375             :     GPGME_STATUS_KEY_CREATED = 60,
    2376             :     GPGME_STATUS_USERID_HINT = 61,
    2377             :     GPGME_STATUS_UNEXPECTED = 62,
    2378             :     GPGME_STATUS_INV_RECP = 63,
    2379             :     GPGME_STATUS_NO_RECP = 64,
    2380             :     GPGME_STATUS_ALREADY_SIGNED = 65,
    2381             :     GPGME_STATUS_SIGEXPIRED = 66,      /* (legacy) */
    2382             :     GPGME_STATUS_EXPSIG = 67,
    2383             :     GPGME_STATUS_EXPKEYSIG = 68,
    2384             :     GPGME_STATUS_TRUNCATED = 69,
    2385             :     GPGME_STATUS_ERROR = 70,
    2386             :     GPGME_STATUS_NEWSIG = 71,
    2387             :     GPGME_STATUS_REVKEYSIG = 72,
    2388             :     GPGME_STATUS_SIG_SUBPACKET = 73,
    2389             :     GPGME_STATUS_NEED_PASSPHRASE_PIN = 74,
    2390             :     GPGME_STATUS_SC_OP_FAILURE = 75,
    2391             :     GPGME_STATUS_SC_OP_SUCCESS = 76,
    2392             :     GPGME_STATUS_CARDCTRL = 77,
    2393             :     GPGME_STATUS_BACKUP_KEY_CREATED = 78,
    2394             :     GPGME_STATUS_PKA_TRUST_BAD = 79,
    2395             :     GPGME_STATUS_PKA_TRUST_GOOD = 80,
    2396             :     GPGME_STATUS_PLAINTEXT = 81,
    2397             :     GPGME_STATUS_INV_SGNR = 82,
    2398             :     GPGME_STATUS_NO_SGNR = 83,
    2399             :     GPGME_STATUS_SUCCESS = 84,
    2400             :     GPGME_STATUS_DECRYPTION_INFO = 85,
    2401             :     GPGME_STATUS_PLAINTEXT_LENGTH = 86,
    2402             :     GPGME_STATUS_MOUNTPOINT = 87,
    2403             :     GPGME_STATUS_PINENTRY_LAUNCHED = 88,
    2404             :     GPGME_STATUS_ATTRIBUTE = 89,
    2405             :     GPGME_STATUS_BEGIN_SIGNING = 90,
    2406             :     GPGME_STATUS_KEY_NOT_CREATED = 91,
    2407             :     GPGME_STATUS_INQUIRE_MAXLEN = 92,
    2408             :     GPGME_STATUS_FAILURE = 93,
    2409             :     GPGME_STATUS_KEY_CONSIDERED = 94,
    2410             :     GPGME_STATUS_TOFU_USER = 95,
    2411             :     GPGME_STATUS_TOFU_STATS = 96,
    2412             :     GPGME_STATUS_TOFU_STATS_LONG = 97,
    2413             :     GPGME_STATUS_NOTATION_FLAGS = 98
    2414             :   }
    2415             : gpgme_status_code_t;
    2416             : 
    2417             : /* The callback type used by the deprecated functions gpgme_op_edit
    2418             :  * and gpgme_op_card_edit.  */
    2419             : typedef gpgme_error_t (*gpgme_edit_cb_t) (void *opaque,
    2420             :                                           gpgme_status_code_t status,
    2421             :                                           const char *args, int fd);
    2422             : 
    2423             : /* The possible signature stati.  Deprecated, use error value in sig
    2424             :    status.  */
    2425             : typedef enum
    2426             :   {
    2427             :     GPGME_SIG_STAT_NONE  = 0,
    2428             :     GPGME_SIG_STAT_GOOD  = 1,
    2429             :     GPGME_SIG_STAT_BAD   = 2,
    2430             :     GPGME_SIG_STAT_NOKEY = 3,
    2431             :     GPGME_SIG_STAT_NOSIG = 4,
    2432             :     GPGME_SIG_STAT_ERROR = 5,
    2433             :     GPGME_SIG_STAT_DIFF  = 6,
    2434             :     GPGME_SIG_STAT_GOOD_EXP = 7,
    2435             :     GPGME_SIG_STAT_GOOD_EXPKEY = 8
    2436             :   }
    2437             : _gpgme_sig_stat_t;
    2438             : 
    2439             : /* The available key and signature attributes.  Deprecated, use the
    2440             :    individual result structures instead.  */
    2441             : typedef enum
    2442             :   {
    2443             :     GPGME_ATTR_KEYID        = 1,
    2444             :     GPGME_ATTR_FPR          = 2,
    2445             :     GPGME_ATTR_ALGO         = 3,
    2446             :     GPGME_ATTR_LEN          = 4,
    2447             :     GPGME_ATTR_CREATED      = 5,
    2448             :     GPGME_ATTR_EXPIRE       = 6,
    2449             :     GPGME_ATTR_OTRUST       = 7,
    2450             :     GPGME_ATTR_USERID       = 8,
    2451             :     GPGME_ATTR_NAME         = 9,
    2452             :     GPGME_ATTR_EMAIL        = 10,
    2453             :     GPGME_ATTR_COMMENT      = 11,
    2454             :     GPGME_ATTR_VALIDITY     = 12,
    2455             :     GPGME_ATTR_LEVEL        = 13,
    2456             :     GPGME_ATTR_TYPE         = 14,
    2457             :     GPGME_ATTR_IS_SECRET    = 15,
    2458             :     GPGME_ATTR_KEY_REVOKED  = 16,
    2459             :     GPGME_ATTR_KEY_INVALID  = 17,
    2460             :     GPGME_ATTR_UID_REVOKED  = 18,
    2461             :     GPGME_ATTR_UID_INVALID  = 19,
    2462             :     GPGME_ATTR_KEY_CAPS     = 20,
    2463             :     GPGME_ATTR_CAN_ENCRYPT  = 21,
    2464             :     GPGME_ATTR_CAN_SIGN     = 22,
    2465             :     GPGME_ATTR_CAN_CERTIFY  = 23,
    2466             :     GPGME_ATTR_KEY_EXPIRED  = 24,
    2467             :     GPGME_ATTR_KEY_DISABLED = 25,
    2468             :     GPGME_ATTR_SERIAL       = 26,
    2469             :     GPGME_ATTR_ISSUER       = 27,
    2470             :     GPGME_ATTR_CHAINID      = 28,
    2471             :     GPGME_ATTR_SIG_STATUS   = 29,
    2472             :     GPGME_ATTR_ERRTOK       = 30,
    2473             :     GPGME_ATTR_SIG_SUMMARY  = 31,
    2474             :     GPGME_ATTR_SIG_CLASS    = 32
    2475             :   }
    2476             : _gpgme_attr_t;
    2477             : 
    2478             : /* Compat.
    2479             :  * This structure shall be considered read-only and an application
    2480             :  * must not allocate such a structure on its own.  */
    2481             : struct _gpgme_op_assuan_result
    2482             : {
    2483             : };
    2484             : typedef struct _gpgme_op_assuan_result *gpgme_assuan_result_t;
    2485             : #define GpgmeIOCbs gpgme_io_cbs
    2486             : #define GpgmeDataCbs gpgme_data_cbs
    2487             : 
    2488             : #ifdef __cplusplus
    2489             : }
    2490             : #endif
    2491             : #endif /* GPGME_H */
    2492             : /*
    2493             : Local Variables:
    2494             : buffer-read-only: t
    2495             : End:
    2496             : */

Generated by: LCOV version 1.13