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

Generated by: LCOV version 1.11