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

Generated by: LCOV version 1.13