LCOV - code coverage report
Current view: top level - build/src - gpgme.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 2 10 20.0 %
Date: 2015-11-05 17:14:26 Functions: 1 5 20.0 %

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

Generated by: LCOV version 1.11