LCOV - code coverage report
Current view: top level - build/lang/python - gpgme.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2016-09-12 13:07:23 Functions: 0 0 -

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

Generated by: LCOV version 1.11