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

Generated by: LCOV version 1.11