diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,29 @@
+Copyright (c) <2009>, <Maurício C. Antunes>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the author nor the names of contributors
+    may be used to endorse or promote products derived from this
+    software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/bindings-gpgme.cabal b/bindings-gpgme.cabal
new file mode 100644
--- /dev/null
+++ b/bindings-gpgme.cabal
@@ -0,0 +1,30 @@
+cabal-version: >= 1.2.3
+name: bindings-gpgme
+homepage: http://bitbucket.org/mauricio/bindings-gpgme
+synopsis:
+  Low level bindings to gpgme.
+version: 0.1
+license: BSD3
+license-file: LICENSE
+maintainer: Maurício C. Antunes <mauricio.antunes@gmail.com>
+author: Maurício C. Antunes
+build-type: Simple
+category: FFI
+stability: Misses C dependencies.
+bug-reports: http://bitbucket.org/mauricio/bindings-gpgme/issues
+extra-source-files:
+  include/gpgme.h
+  include/gpg-error.h
+library
+  hs-source-dirs: src
+  extensions:
+    ForeignFunctionInterface
+  build-depends:
+    base >= 3 && < 5,
+    bindings-DSL >= 1.0 && < 1.1
+  exposed-modules:
+    Bindings.Gpgme
+  c-sources:
+    src/inlines.c
+  include-dirs:
+    include
diff --git a/include/gpg-error.h b/include/gpg-error.h
new file mode 100644
--- /dev/null
+++ b/include/gpg-error.h
@@ -0,0 +1,651 @@
+/* Output of mkheader.awk.  DO NOT EDIT.  */
+
+/* gpg-error.h - Public interface to libgpg-error.
+   Copyright (C) 2003, 2004 g10 Code GmbH
+
+   This file is part of libgpg-error.
+ 
+   libgpg-error is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public License
+   as published by the Free Software Foundation; either version 2.1 of
+   the License, or (at your option) any later version.
+ 
+   libgpg-error is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+ 
+   You should have received a copy of the GNU Lesser General Public
+   License along with libgpg-error; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
+
+#ifndef GPG_ERROR_H
+#define GPG_ERROR_H	1
+
+#include <stddef.h>
+
+#ifdef __GNUC__
+#define GPG_ERR_INLINE __inline__
+#elif __STDC_VERSION__ >= 199901L
+#define GPG_ERR_INLINE inline
+#else
+#ifndef GPG_ERR_INLINE
+#define GPG_ERR_INLINE
+#endif 
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* just to make Emacs auto-indent happy */
+}
+#endif
+#endif /* __cplusplus */
+
+/* The GnuPG project consists of many components.  Error codes are
+   exchanged between all components.  The common error codes and their
+   user-presentable descriptions are kept into a shared library to
+   allow adding new error codes and components without recompiling any
+   of the other components.  The interface will not change in a
+   backward incompatible way.
+
+   An error code together with an error source build up an error
+   value.  As the error value is been passed from one component to
+   another, it preserver the information about the source and nature
+   of the error.
+
+   A component of the GnuPG project can define the following macro to
+   tune the behaviour of the library:
+
+   GPG_ERR_SOURCE_DEFAULT: Define to an error source of type
+   gpg_err_source_t to make that source the default for gpg_error().
+   Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default.  */
+
+
+/* The error source type gpg_err_source_t.
+
+   Where as the Poo out of a welle small
+   Taketh his firste springing and his sours.
+					--Chaucer.  */
+
+/* Only use free slots, never change or reorder the existing
+   entries.  */
+typedef enum
+  {
+    GPG_ERR_SOURCE_UNKNOWN = 0,
+    GPG_ERR_SOURCE_GCRYPT = 1,
+    GPG_ERR_SOURCE_GPG = 2,
+    GPG_ERR_SOURCE_GPGSM = 3,
+    GPG_ERR_SOURCE_GPGAGENT = 4,
+    GPG_ERR_SOURCE_PINENTRY = 5,
+    GPG_ERR_SOURCE_SCD = 6,
+    GPG_ERR_SOURCE_GPGME = 7,
+    GPG_ERR_SOURCE_KEYBOX = 8,
+    GPG_ERR_SOURCE_KSBA = 9,
+    GPG_ERR_SOURCE_DIRMNGR = 10,
+    GPG_ERR_SOURCE_GSTI = 11,
+    GPG_ERR_SOURCE_GPA = 12,
+    GPG_ERR_SOURCE_KLEO = 13,
+    GPG_ERR_SOURCE_ANY = 31,
+    GPG_ERR_SOURCE_USER_1 = 32,
+    GPG_ERR_SOURCE_USER_2 = 33,
+    GPG_ERR_SOURCE_USER_3 = 34,
+    GPG_ERR_SOURCE_USER_4 = 35,
+
+    /* This is one more than the largest allowed entry.  */
+    GPG_ERR_SOURCE_DIM = 256
+  } gpg_err_source_t;
+
+
+/* The error code type gpg_err_code_t.  */
+
+/* Only use free slots, never change or reorder the existing
+   entries.  */
+typedef enum
+  {
+    GPG_ERR_NO_ERROR = 0,
+    GPG_ERR_GENERAL = 1,
+    GPG_ERR_UNKNOWN_PACKET = 2,
+    GPG_ERR_UNKNOWN_VERSION = 3,
+    GPG_ERR_PUBKEY_ALGO = 4,
+    GPG_ERR_DIGEST_ALGO = 5,
+    GPG_ERR_BAD_PUBKEY = 6,
+    GPG_ERR_BAD_SECKEY = 7,
+    GPG_ERR_BAD_SIGNATURE = 8,
+    GPG_ERR_NO_PUBKEY = 9,
+    GPG_ERR_CHECKSUM = 10,
+    GPG_ERR_BAD_PASSPHRASE = 11,
+    GPG_ERR_CIPHER_ALGO = 12,
+    GPG_ERR_KEYRING_OPEN = 13,
+    GPG_ERR_INV_PACKET = 14,
+    GPG_ERR_INV_ARMOR = 15,
+    GPG_ERR_NO_USER_ID = 16,
+    GPG_ERR_NO_SECKEY = 17,
+    GPG_ERR_WRONG_SECKEY = 18,
+    GPG_ERR_BAD_KEY = 19,
+    GPG_ERR_COMPR_ALGO = 20,
+    GPG_ERR_NO_PRIME = 21,
+    GPG_ERR_NO_ENCODING_METHOD = 22,
+    GPG_ERR_NO_ENCRYPTION_SCHEME = 23,
+    GPG_ERR_NO_SIGNATURE_SCHEME = 24,
+    GPG_ERR_INV_ATTR = 25,
+    GPG_ERR_NO_VALUE = 26,
+    GPG_ERR_NOT_FOUND = 27,
+    GPG_ERR_VALUE_NOT_FOUND = 28,
+    GPG_ERR_SYNTAX = 29,
+    GPG_ERR_BAD_MPI = 30,
+    GPG_ERR_INV_PASSPHRASE = 31,
+    GPG_ERR_SIG_CLASS = 32,
+    GPG_ERR_RESOURCE_LIMIT = 33,
+    GPG_ERR_INV_KEYRING = 34,
+    GPG_ERR_TRUSTDB = 35,
+    GPG_ERR_BAD_CERT = 36,
+    GPG_ERR_INV_USER_ID = 37,
+    GPG_ERR_UNEXPECTED = 38,
+    GPG_ERR_TIME_CONFLICT = 39,
+    GPG_ERR_KEYSERVER = 40,
+    GPG_ERR_WRONG_PUBKEY_ALGO = 41,
+    GPG_ERR_TRIBUTE_TO_D_A = 42,
+    GPG_ERR_WEAK_KEY = 43,
+    GPG_ERR_INV_KEYLEN = 44,
+    GPG_ERR_INV_ARG = 45,
+    GPG_ERR_BAD_URI = 46,
+    GPG_ERR_INV_URI = 47,
+    GPG_ERR_NETWORK = 48,
+    GPG_ERR_UNKNOWN_HOST = 49,
+    GPG_ERR_SELFTEST_FAILED = 50,
+    GPG_ERR_NOT_ENCRYPTED = 51,
+    GPG_ERR_NOT_PROCESSED = 52,
+    GPG_ERR_UNUSABLE_PUBKEY = 53,
+    GPG_ERR_UNUSABLE_SECKEY = 54,
+    GPG_ERR_INV_VALUE = 55,
+    GPG_ERR_BAD_CERT_CHAIN = 56,
+    GPG_ERR_MISSING_CERT = 57,
+    GPG_ERR_NO_DATA = 58,
+    GPG_ERR_BUG = 59,
+    GPG_ERR_NOT_SUPPORTED = 60,
+    GPG_ERR_INV_OP = 61,
+    GPG_ERR_TIMEOUT = 62,
+    GPG_ERR_INTERNAL = 63,
+    GPG_ERR_EOF_GCRYPT = 64,
+    GPG_ERR_INV_OBJ = 65,
+    GPG_ERR_TOO_SHORT = 66,
+    GPG_ERR_TOO_LARGE = 67,
+    GPG_ERR_NO_OBJ = 68,
+    GPG_ERR_NOT_IMPLEMENTED = 69,
+    GPG_ERR_CONFLICT = 70,
+    GPG_ERR_INV_CIPHER_MODE = 71,
+    GPG_ERR_INV_FLAG = 72,
+    GPG_ERR_INV_HANDLE = 73,
+    GPG_ERR_TRUNCATED = 74,
+    GPG_ERR_INCOMPLETE_LINE = 75,
+    GPG_ERR_INV_RESPONSE = 76,
+    GPG_ERR_NO_AGENT = 77,
+    GPG_ERR_AGENT = 78,
+    GPG_ERR_INV_DATA = 79,
+    GPG_ERR_ASSUAN_SERVER_FAULT = 80,
+    GPG_ERR_ASSUAN = 81,
+    GPG_ERR_INV_SESSION_KEY = 82,
+    GPG_ERR_INV_SEXP = 83,
+    GPG_ERR_UNSUPPORTED_ALGORITHM = 84,
+    GPG_ERR_NO_PIN_ENTRY = 85,
+    GPG_ERR_PIN_ENTRY = 86,
+    GPG_ERR_BAD_PIN = 87,
+    GPG_ERR_INV_NAME = 88,
+    GPG_ERR_BAD_DATA = 89,
+    GPG_ERR_INV_PARAMETER = 90,
+    GPG_ERR_WRONG_CARD = 91,
+    GPG_ERR_NO_DIRMNGR = 92,
+    GPG_ERR_DIRMNGR = 93,
+    GPG_ERR_CERT_REVOKED = 94,
+    GPG_ERR_NO_CRL_KNOWN = 95,
+    GPG_ERR_CRL_TOO_OLD = 96,
+    GPG_ERR_LINE_TOO_LONG = 97,
+    GPG_ERR_NOT_TRUSTED = 98,
+    GPG_ERR_CANCELED = 99,
+    GPG_ERR_BAD_CA_CERT = 100,
+    GPG_ERR_CERT_EXPIRED = 101,
+    GPG_ERR_CERT_TOO_YOUNG = 102,
+    GPG_ERR_UNSUPPORTED_CERT = 103,
+    GPG_ERR_UNKNOWN_SEXP = 104,
+    GPG_ERR_UNSUPPORTED_PROTECTION = 105,
+    GPG_ERR_CORRUPTED_PROTECTION = 106,
+    GPG_ERR_AMBIGUOUS_NAME = 107,
+    GPG_ERR_CARD = 108,
+    GPG_ERR_CARD_RESET = 109,
+    GPG_ERR_CARD_REMOVED = 110,
+    GPG_ERR_INV_CARD = 111,
+    GPG_ERR_CARD_NOT_PRESENT = 112,
+    GPG_ERR_NO_PKCS15_APP = 113,
+    GPG_ERR_NOT_CONFIRMED = 114,
+    GPG_ERR_CONFIGURATION = 115,
+    GPG_ERR_NO_POLICY_MATCH = 116,
+    GPG_ERR_INV_INDEX = 117,
+    GPG_ERR_INV_ID = 118,
+    GPG_ERR_NO_SCDAEMON = 119,
+    GPG_ERR_SCDAEMON = 120,
+    GPG_ERR_UNSUPPORTED_PROTOCOL = 121,
+    GPG_ERR_BAD_PIN_METHOD = 122,
+    GPG_ERR_CARD_NOT_INITIALIZED = 123,
+    GPG_ERR_UNSUPPORTED_OPERATION = 124,
+    GPG_ERR_WRONG_KEY_USAGE = 125,
+    GPG_ERR_NOTHING_FOUND = 126,
+    GPG_ERR_WRONG_BLOB_TYPE = 127,
+    GPG_ERR_MISSING_VALUE = 128,
+    GPG_ERR_HARDWARE = 129,
+    GPG_ERR_PIN_BLOCKED = 130,
+    GPG_ERR_USE_CONDITIONS = 131,
+    GPG_ERR_PIN_NOT_SYNCED = 132,
+    GPG_ERR_INV_CRL = 133,
+    GPG_ERR_BAD_BER = 134,
+    GPG_ERR_INV_BER = 135,
+    GPG_ERR_ELEMENT_NOT_FOUND = 136,
+    GPG_ERR_IDENTIFIER_NOT_FOUND = 137,
+    GPG_ERR_INV_TAG = 138,
+    GPG_ERR_INV_LENGTH = 139,
+    GPG_ERR_INV_KEYINFO = 140,
+    GPG_ERR_UNEXPECTED_TAG = 141,
+    GPG_ERR_NOT_DER_ENCODED = 142,
+    GPG_ERR_NO_CMS_OBJ = 143,
+    GPG_ERR_INV_CMS_OBJ = 144,
+    GPG_ERR_UNKNOWN_CMS_OBJ = 145,
+    GPG_ERR_UNSUPPORTED_CMS_OBJ = 146,
+    GPG_ERR_UNSUPPORTED_ENCODING = 147,
+    GPG_ERR_UNSUPPORTED_CMS_VERSION = 148,
+    GPG_ERR_UNKNOWN_ALGORITHM = 149,
+    GPG_ERR_INV_ENGINE = 150,
+    GPG_ERR_PUBKEY_NOT_TRUSTED = 151,
+    GPG_ERR_DECRYPT_FAILED = 152,
+    GPG_ERR_KEY_EXPIRED = 153,
+    GPG_ERR_SIG_EXPIRED = 154,
+    GPG_ERR_ENCODING_PROBLEM = 155,
+    GPG_ERR_INV_STATE = 156,
+    GPG_ERR_DUP_VALUE = 157,
+    GPG_ERR_MISSING_ACTION = 158,
+    GPG_ERR_MODULE_NOT_FOUND = 159,
+    GPG_ERR_INV_OID_STRING = 160,
+    GPG_ERR_INV_TIME = 161,
+    GPG_ERR_INV_CRL_OBJ = 162,
+    GPG_ERR_UNSUPPORTED_CRL_VERSION = 163,
+    GPG_ERR_INV_CERT_OBJ = 164,
+    GPG_ERR_UNKNOWN_NAME = 165,
+    GPG_ERR_LOCALE_PROBLEM = 166,
+    GPG_ERR_NOT_LOCKED = 167,
+    GPG_ERR_PROTOCOL_VIOLATION = 168,
+    GPG_ERR_INV_MAC = 169,
+    GPG_ERR_INV_REQUEST = 170,
+    GPG_ERR_UNKNOWN_EXTN = 171,
+    GPG_ERR_UNKNOWN_CRIT_EXTN = 172,
+    GPG_ERR_LOCKED = 173,
+    GPG_ERR_UNKNOWN_OPTION = 174,
+    GPG_ERR_UNKNOWN_COMMAND = 175,
+    GPG_ERR_UNFINISHED = 199,
+    GPG_ERR_BUFFER_TOO_SHORT = 200,
+    GPG_ERR_SEXP_INV_LEN_SPEC = 201,
+    GPG_ERR_SEXP_STRING_TOO_LONG = 202,
+    GPG_ERR_SEXP_UNMATCHED_PAREN = 203,
+    GPG_ERR_SEXP_NOT_CANONICAL = 204,
+    GPG_ERR_SEXP_BAD_CHARACTER = 205,
+    GPG_ERR_SEXP_BAD_QUOTATION = 206,
+    GPG_ERR_SEXP_ZERO_PREFIX = 207,
+    GPG_ERR_SEXP_NESTED_DH = 208,
+    GPG_ERR_SEXP_UNMATCHED_DH = 209,
+    GPG_ERR_SEXP_UNEXPECTED_PUNC = 210,
+    GPG_ERR_SEXP_BAD_HEX_CHAR = 211,
+    GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212,
+    GPG_ERR_SEXP_BAD_OCT_CHAR = 213,
+    GPG_ERR_ASS_GENERAL = 257,
+    GPG_ERR_ASS_ACCEPT_FAILED = 258,
+    GPG_ERR_ASS_CONNECT_FAILED = 259,
+    GPG_ERR_ASS_INV_RESPONSE = 260,
+    GPG_ERR_ASS_INV_VALUE = 261,
+    GPG_ERR_ASS_INCOMPLETE_LINE = 262,
+    GPG_ERR_ASS_LINE_TOO_LONG = 263,
+    GPG_ERR_ASS_NESTED_COMMANDS = 264,
+    GPG_ERR_ASS_NO_DATA_CB = 265,
+    GPG_ERR_ASS_NO_INQUIRE_CB = 266,
+    GPG_ERR_ASS_NOT_A_SERVER = 267,
+    GPG_ERR_ASS_NOT_A_CLIENT = 268,
+    GPG_ERR_ASS_SERVER_START = 269,
+    GPG_ERR_ASS_READ_ERROR = 270,
+    GPG_ERR_ASS_WRITE_ERROR = 271,
+    GPG_ERR_ASS_TOO_MUCH_DATA = 273,
+    GPG_ERR_ASS_UNEXPECTED_CMD = 274,
+    GPG_ERR_ASS_UNKNOWN_CMD = 275,
+    GPG_ERR_ASS_SYNTAX = 276,
+    GPG_ERR_ASS_CANCELED = 277,
+    GPG_ERR_ASS_NO_INPUT = 278,
+    GPG_ERR_ASS_NO_OUTPUT = 279,
+    GPG_ERR_ASS_PARAMETER = 280,
+    GPG_ERR_ASS_UNKNOWN_INQUIRE = 281,
+    GPG_ERR_USER_1 = 1024,
+    GPG_ERR_USER_2 = 1025,
+    GPG_ERR_USER_3 = 1026,
+    GPG_ERR_USER_4 = 1027,
+    GPG_ERR_USER_5 = 1028,
+    GPG_ERR_USER_6 = 1029,
+    GPG_ERR_USER_7 = 1030,
+    GPG_ERR_USER_8 = 1031,
+    GPG_ERR_USER_9 = 1032,
+    GPG_ERR_USER_10 = 1033,
+    GPG_ERR_USER_11 = 1034,
+    GPG_ERR_USER_12 = 1035,
+    GPG_ERR_USER_13 = 1036,
+    GPG_ERR_USER_14 = 1037,
+    GPG_ERR_USER_15 = 1038,
+    GPG_ERR_USER_16 = 1039,
+    GPG_ERR_MISSING_ERRNO = 16381,
+    GPG_ERR_UNKNOWN_ERRNO = 16382,
+    GPG_ERR_EOF = 16383,
+
+    /* The following error codes are used to map system errors.  */
+#define GPG_ERR_SYSTEM_ERROR	(1 << 15)
+    GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,
+    GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1,
+    GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2,
+    GPG_ERR_EADDRNOTAVAIL = GPG_ERR_SYSTEM_ERROR | 3,
+    GPG_ERR_EADV = GPG_ERR_SYSTEM_ERROR | 4,
+    GPG_ERR_EAFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 5,
+    GPG_ERR_EAGAIN = GPG_ERR_SYSTEM_ERROR | 6,
+    GPG_ERR_EALREADY = GPG_ERR_SYSTEM_ERROR | 7,
+    GPG_ERR_EAUTH = GPG_ERR_SYSTEM_ERROR | 8,
+    GPG_ERR_EBACKGROUND = GPG_ERR_SYSTEM_ERROR | 9,
+    GPG_ERR_EBADE = GPG_ERR_SYSTEM_ERROR | 10,
+    GPG_ERR_EBADF = GPG_ERR_SYSTEM_ERROR | 11,
+    GPG_ERR_EBADFD = GPG_ERR_SYSTEM_ERROR | 12,
+    GPG_ERR_EBADMSG = GPG_ERR_SYSTEM_ERROR | 13,
+    GPG_ERR_EBADR = GPG_ERR_SYSTEM_ERROR | 14,
+    GPG_ERR_EBADRPC = GPG_ERR_SYSTEM_ERROR | 15,
+    GPG_ERR_EBADRQC = GPG_ERR_SYSTEM_ERROR | 16,
+    GPG_ERR_EBADSLT = GPG_ERR_SYSTEM_ERROR | 17,
+    GPG_ERR_EBFONT = GPG_ERR_SYSTEM_ERROR | 18,
+    GPG_ERR_EBUSY = GPG_ERR_SYSTEM_ERROR | 19,
+    GPG_ERR_ECANCELED = GPG_ERR_SYSTEM_ERROR | 20,
+    GPG_ERR_ECHILD = GPG_ERR_SYSTEM_ERROR | 21,
+    GPG_ERR_ECHRNG = GPG_ERR_SYSTEM_ERROR | 22,
+    GPG_ERR_ECOMM = GPG_ERR_SYSTEM_ERROR | 23,
+    GPG_ERR_ECONNABORTED = GPG_ERR_SYSTEM_ERROR | 24,
+    GPG_ERR_ECONNREFUSED = GPG_ERR_SYSTEM_ERROR | 25,
+    GPG_ERR_ECONNRESET = GPG_ERR_SYSTEM_ERROR | 26,
+    GPG_ERR_ED = GPG_ERR_SYSTEM_ERROR | 27,
+    GPG_ERR_EDEADLK = GPG_ERR_SYSTEM_ERROR | 28,
+    GPG_ERR_EDEADLOCK = GPG_ERR_SYSTEM_ERROR | 29,
+    GPG_ERR_EDESTADDRREQ = GPG_ERR_SYSTEM_ERROR | 30,
+    GPG_ERR_EDIED = GPG_ERR_SYSTEM_ERROR | 31,
+    GPG_ERR_EDOM = GPG_ERR_SYSTEM_ERROR | 32,
+    GPG_ERR_EDOTDOT = GPG_ERR_SYSTEM_ERROR | 33,
+    GPG_ERR_EDQUOT = GPG_ERR_SYSTEM_ERROR | 34,
+    GPG_ERR_EEXIST = GPG_ERR_SYSTEM_ERROR | 35,
+    GPG_ERR_EFAULT = GPG_ERR_SYSTEM_ERROR | 36,
+    GPG_ERR_EFBIG = GPG_ERR_SYSTEM_ERROR | 37,
+    GPG_ERR_EFTYPE = GPG_ERR_SYSTEM_ERROR | 38,
+    GPG_ERR_EGRATUITOUS = GPG_ERR_SYSTEM_ERROR | 39,
+    GPG_ERR_EGREGIOUS = GPG_ERR_SYSTEM_ERROR | 40,
+    GPG_ERR_EHOSTDOWN = GPG_ERR_SYSTEM_ERROR | 41,
+    GPG_ERR_EHOSTUNREACH = GPG_ERR_SYSTEM_ERROR | 42,
+    GPG_ERR_EIDRM = GPG_ERR_SYSTEM_ERROR | 43,
+    GPG_ERR_EIEIO = GPG_ERR_SYSTEM_ERROR | 44,
+    GPG_ERR_EILSEQ = GPG_ERR_SYSTEM_ERROR | 45,
+    GPG_ERR_EINPROGRESS = GPG_ERR_SYSTEM_ERROR | 46,
+    GPG_ERR_EINTR = GPG_ERR_SYSTEM_ERROR | 47,
+    GPG_ERR_EINVAL = GPG_ERR_SYSTEM_ERROR | 48,
+    GPG_ERR_EIO = GPG_ERR_SYSTEM_ERROR | 49,
+    GPG_ERR_EISCONN = GPG_ERR_SYSTEM_ERROR | 50,
+    GPG_ERR_EISDIR = GPG_ERR_SYSTEM_ERROR | 51,
+    GPG_ERR_EISNAM = GPG_ERR_SYSTEM_ERROR | 52,
+    GPG_ERR_EL2HLT = GPG_ERR_SYSTEM_ERROR | 53,
+    GPG_ERR_EL2NSYNC = GPG_ERR_SYSTEM_ERROR | 54,
+    GPG_ERR_EL3HLT = GPG_ERR_SYSTEM_ERROR | 55,
+    GPG_ERR_EL3RST = GPG_ERR_SYSTEM_ERROR | 56,
+    GPG_ERR_ELIBACC = GPG_ERR_SYSTEM_ERROR | 57,
+    GPG_ERR_ELIBBAD = GPG_ERR_SYSTEM_ERROR | 58,
+    GPG_ERR_ELIBEXEC = GPG_ERR_SYSTEM_ERROR | 59,
+    GPG_ERR_ELIBMAX = GPG_ERR_SYSTEM_ERROR | 60,
+    GPG_ERR_ELIBSCN = GPG_ERR_SYSTEM_ERROR | 61,
+    GPG_ERR_ELNRNG = GPG_ERR_SYSTEM_ERROR | 62,
+    GPG_ERR_ELOOP = GPG_ERR_SYSTEM_ERROR | 63,
+    GPG_ERR_EMEDIUMTYPE = GPG_ERR_SYSTEM_ERROR | 64,
+    GPG_ERR_EMFILE = GPG_ERR_SYSTEM_ERROR | 65,
+    GPG_ERR_EMLINK = GPG_ERR_SYSTEM_ERROR | 66,
+    GPG_ERR_EMSGSIZE = GPG_ERR_SYSTEM_ERROR | 67,
+    GPG_ERR_EMULTIHOP = GPG_ERR_SYSTEM_ERROR | 68,
+    GPG_ERR_ENAMETOOLONG = GPG_ERR_SYSTEM_ERROR | 69,
+    GPG_ERR_ENAVAIL = GPG_ERR_SYSTEM_ERROR | 70,
+    GPG_ERR_ENEEDAUTH = GPG_ERR_SYSTEM_ERROR | 71,
+    GPG_ERR_ENETDOWN = GPG_ERR_SYSTEM_ERROR | 72,
+    GPG_ERR_ENETRESET = GPG_ERR_SYSTEM_ERROR | 73,
+    GPG_ERR_ENETUNREACH = GPG_ERR_SYSTEM_ERROR | 74,
+    GPG_ERR_ENFILE = GPG_ERR_SYSTEM_ERROR | 75,
+    GPG_ERR_ENOANO = GPG_ERR_SYSTEM_ERROR | 76,
+    GPG_ERR_ENOBUFS = GPG_ERR_SYSTEM_ERROR | 77,
+    GPG_ERR_ENOCSI = GPG_ERR_SYSTEM_ERROR | 78,
+    GPG_ERR_ENODATA = GPG_ERR_SYSTEM_ERROR | 79,
+    GPG_ERR_ENODEV = GPG_ERR_SYSTEM_ERROR | 80,
+    GPG_ERR_ENOENT = GPG_ERR_SYSTEM_ERROR | 81,
+    GPG_ERR_ENOEXEC = GPG_ERR_SYSTEM_ERROR | 82,
+    GPG_ERR_ENOLCK = GPG_ERR_SYSTEM_ERROR | 83,
+    GPG_ERR_ENOLINK = GPG_ERR_SYSTEM_ERROR | 84,
+    GPG_ERR_ENOMEDIUM = GPG_ERR_SYSTEM_ERROR | 85,
+    GPG_ERR_ENOMEM = GPG_ERR_SYSTEM_ERROR | 86,
+    GPG_ERR_ENOMSG = GPG_ERR_SYSTEM_ERROR | 87,
+    GPG_ERR_ENONET = GPG_ERR_SYSTEM_ERROR | 88,
+    GPG_ERR_ENOPKG = GPG_ERR_SYSTEM_ERROR | 89,
+    GPG_ERR_ENOPROTOOPT = GPG_ERR_SYSTEM_ERROR | 90,
+    GPG_ERR_ENOSPC = GPG_ERR_SYSTEM_ERROR | 91,
+    GPG_ERR_ENOSR = GPG_ERR_SYSTEM_ERROR | 92,
+    GPG_ERR_ENOSTR = GPG_ERR_SYSTEM_ERROR | 93,
+    GPG_ERR_ENOSYS = GPG_ERR_SYSTEM_ERROR | 94,
+    GPG_ERR_ENOTBLK = GPG_ERR_SYSTEM_ERROR | 95,
+    GPG_ERR_ENOTCONN = GPG_ERR_SYSTEM_ERROR | 96,
+    GPG_ERR_ENOTDIR = GPG_ERR_SYSTEM_ERROR | 97,
+    GPG_ERR_ENOTEMPTY = GPG_ERR_SYSTEM_ERROR | 98,
+    GPG_ERR_ENOTNAM = GPG_ERR_SYSTEM_ERROR | 99,
+    GPG_ERR_ENOTSOCK = GPG_ERR_SYSTEM_ERROR | 100,
+    GPG_ERR_ENOTSUP = GPG_ERR_SYSTEM_ERROR | 101,
+    GPG_ERR_ENOTTY = GPG_ERR_SYSTEM_ERROR | 102,
+    GPG_ERR_ENOTUNIQ = GPG_ERR_SYSTEM_ERROR | 103,
+    GPG_ERR_ENXIO = GPG_ERR_SYSTEM_ERROR | 104,
+    GPG_ERR_EOPNOTSUPP = GPG_ERR_SYSTEM_ERROR | 105,
+    GPG_ERR_EOVERFLOW = GPG_ERR_SYSTEM_ERROR | 106,
+    GPG_ERR_EPERM = GPG_ERR_SYSTEM_ERROR | 107,
+    GPG_ERR_EPFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 108,
+    GPG_ERR_EPIPE = GPG_ERR_SYSTEM_ERROR | 109,
+    GPG_ERR_EPROCLIM = GPG_ERR_SYSTEM_ERROR | 110,
+    GPG_ERR_EPROCUNAVAIL = GPG_ERR_SYSTEM_ERROR | 111,
+    GPG_ERR_EPROGMISMATCH = GPG_ERR_SYSTEM_ERROR | 112,
+    GPG_ERR_EPROGUNAVAIL = GPG_ERR_SYSTEM_ERROR | 113,
+    GPG_ERR_EPROTO = GPG_ERR_SYSTEM_ERROR | 114,
+    GPG_ERR_EPROTONOSUPPORT = GPG_ERR_SYSTEM_ERROR | 115,
+    GPG_ERR_EPROTOTYPE = GPG_ERR_SYSTEM_ERROR | 116,
+    GPG_ERR_ERANGE = GPG_ERR_SYSTEM_ERROR | 117,
+    GPG_ERR_EREMCHG = GPG_ERR_SYSTEM_ERROR | 118,
+    GPG_ERR_EREMOTE = GPG_ERR_SYSTEM_ERROR | 119,
+    GPG_ERR_EREMOTEIO = GPG_ERR_SYSTEM_ERROR | 120,
+    GPG_ERR_ERESTART = GPG_ERR_SYSTEM_ERROR | 121,
+    GPG_ERR_EROFS = GPG_ERR_SYSTEM_ERROR | 122,
+    GPG_ERR_ERPCMISMATCH = GPG_ERR_SYSTEM_ERROR | 123,
+    GPG_ERR_ESHUTDOWN = GPG_ERR_SYSTEM_ERROR | 124,
+    GPG_ERR_ESOCKTNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 125,
+    GPG_ERR_ESPIPE = GPG_ERR_SYSTEM_ERROR | 126,
+    GPG_ERR_ESRCH = GPG_ERR_SYSTEM_ERROR | 127,
+    GPG_ERR_ESRMNT = GPG_ERR_SYSTEM_ERROR | 128,
+    GPG_ERR_ESTALE = GPG_ERR_SYSTEM_ERROR | 129,
+    GPG_ERR_ESTRPIPE = GPG_ERR_SYSTEM_ERROR | 130,
+    GPG_ERR_ETIME = GPG_ERR_SYSTEM_ERROR | 131,
+    GPG_ERR_ETIMEDOUT = GPG_ERR_SYSTEM_ERROR | 132,
+    GPG_ERR_ETOOMANYREFS = GPG_ERR_SYSTEM_ERROR | 133,
+    GPG_ERR_ETXTBSY = GPG_ERR_SYSTEM_ERROR | 134,
+    GPG_ERR_EUCLEAN = GPG_ERR_SYSTEM_ERROR | 135,
+    GPG_ERR_EUNATCH = GPG_ERR_SYSTEM_ERROR | 136,
+    GPG_ERR_EUSERS = GPG_ERR_SYSTEM_ERROR | 137,
+    GPG_ERR_EWOULDBLOCK = GPG_ERR_SYSTEM_ERROR | 138,
+    GPG_ERR_EXDEV = GPG_ERR_SYSTEM_ERROR | 139,
+    GPG_ERR_EXFULL = GPG_ERR_SYSTEM_ERROR | 140,
+
+    /* This is one more than the largest allowed entry.  */
+    GPG_ERR_CODE_DIM = 65536
+  } gpg_err_code_t;
+
+
+/* The error value type gpg_error_t.  */
+
+/* We would really like to use bit-fields in a struct, but using
+   structs as return values can cause binary compatibility issues, in
+   particular if you want to do it effeciently (also see
+   -freg-struct-return option to GCC).  */
+typedef unsigned int gpg_error_t;
+
+/* We use the lowest 16 bits of gpg_error_t for error codes.  The 16th
+   bit indicates system errors.  */
+#define GPG_ERR_CODE_MASK	(GPG_ERR_CODE_DIM - 1)
+
+/* Bits 17 to 24 are reserved.  */
+
+/* We use the upper 8 bits of gpg_error_t for error sources.  */
+#define GPG_ERR_SOURCE_MASK	(GPG_ERR_SOURCE_DIM - 1)
+#define GPG_ERR_SOURCE_SHIFT	24
+
+
+/* GCC feature test.  */
+#undef _GPG_ERR_HAVE_CONSTRUCTOR
+#if __GNUC__
+#define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \
+                            + __GNUC_MINOR__ * 100 \
+                            + __GNUC_PATCHLEVEL__)
+
+#if _GPG_ERR_GCC_VERSION > 30100
+#define _GPG_ERR_CONSTRUCTOR	__attribute__ ((__constructor__))
+#define _GPG_ERR_HAVE_CONSTRUCTOR
+#endif
+#endif
+
+#ifndef _GPG_ERR_CONSTRUCTOR
+#define _GPG_ERR_CONSTRUCTOR
+#endif
+
+
+/* Initialization function.  */
+
+/* Initialize the library.  This function should be run early.  */
+gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;
+
+/* If this is defined, the library is already initialized by the
+   constructor and does not need to be initialized explicitely.  */
+#undef GPG_ERR_INITIALIZED
+#ifdef _GPG_ERR_HAVE_CONSTRUCTOR
+#define GPG_ERR_INITIALIZED	1
+#endif
+
+
+/* Constructor and accessor functions.  */
+
+/* Construct an error value from an error code and source.  Within a
+   subsystem, use gpg_error.  */
+static GPG_ERR_INLINE gpg_error_t
+gpg_err_make (gpg_err_source_t source, gpg_err_code_t code)
+{
+  return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR
+    : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT)
+       | (code & GPG_ERR_CODE_MASK));
+}
+
+
+/* The user should define GPG_ERR_SOURCE_DEFAULT before including this
+   file to specify a default source for gpg_error.  */
+#ifndef GPG_ERR_SOURCE_DEFAULT
+#define GPG_ERR_SOURCE_DEFAULT	GPG_ERR_SOURCE_UNKNOWN
+#endif
+
+static GPG_ERR_INLINE gpg_error_t
+gpg_error (gpg_err_code_t code)
+{
+  return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code);
+}
+
+
+/* Retrieve the error code from an error value.  */
+static GPG_ERR_INLINE gpg_err_code_t
+gpg_err_code (gpg_error_t err)
+{
+  return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK);
+}
+
+
+/* Retrieve the error source from an error value.  */
+static GPG_ERR_INLINE gpg_err_source_t
+gpg_err_source (gpg_error_t err)
+{
+  return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT)
+			     & GPG_ERR_SOURCE_MASK);
+}
+
+
+/* String functions.  */
+
+/* Return a pointer to a string containing a description of the error
+   code in the error value ERR.  This function is not thread-safe.  */
+const char *gpg_strerror (gpg_error_t err);
+
+/* Return the error string for ERR in the user-supplied buffer BUF of
+   size BUFLEN.  This function is, in contrast to gpg_strerror,
+   thread-safe if a thread-safe strerror_r() function is provided by
+   the system.  If the function succeeds, 0 is returned and BUF
+   contains the string describing the error.  If the buffer was not
+   large enough, ERANGE is returned and BUF contains as much of the
+   beginning of the error string as fits into the buffer.  */
+int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen);
+
+/* Return a pointer to a string containing a description of the error
+   source in the error value ERR.  */
+const char *gpg_strsource (gpg_error_t err);
+
+
+/* Mapping of system errors (errno).  */
+
+/* Retrieve the error code for the system error ERR.  This returns
+   GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
+   this). */
+gpg_err_code_t gpg_err_code_from_errno (int err);
+
+
+/* Retrieve the system error for the error code CODE.  This returns 0
+   if CODE is not a system error code.  */
+int gpg_err_code_to_errno (gpg_err_code_t code);
+
+
+/* Retrieve the error code directly from the ERRNO variable.  This
+   returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped
+   (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
+gpg_err_code_t gpg_err_code_from_syserror (void);
+
+
+
+
+/* Self-documenting convenience functions.  */
+
+static GPG_ERR_INLINE gpg_error_t
+gpg_err_make_from_errno (gpg_err_source_t source, int err)
+{
+  return gpg_err_make (source, gpg_err_code_from_errno (err));
+}
+
+
+static GPG_ERR_INLINE gpg_error_t
+gpg_error_from_errno (int err)
+{
+  return gpg_error (gpg_err_code_from_errno (err));
+}
+
+static GPG_ERR_INLINE gpg_error_t
+gpg_error_from_syserror (void)
+{
+  return gpg_error (gpg_err_code_from_syserror ());
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif	/* GPG_ERROR_H */
diff --git a/include/gpgme.h b/include/gpgme.h
new file mode 100644
--- /dev/null
+++ b/include/gpgme.h
@@ -0,0 +1,1893 @@
+/* gpgme.h - Public interface to GnuPG Made Easy.                   -*- c -*-
+   Copyright (C) 2000 Werner Koch (dd9jn)
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH
+
+   This file is part of GPGME.
+ 
+   GPGME is free software; you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of
+   the License, or (at your option) any later version.
+   
+   GPGME is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+   
+   You should have received a copy of the GNU Lesser General Public
+   License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ 
+   File: src/gpgme.h.  Generated from gpgme.h.in by configure.  */
+
+#ifndef GPGME_H
+#define GPGME_H
+
+#ifdef __GNUC__
+#define _GPGME_INLINE __inline__
+#elif __STDC_VERSION__ >= 199901L
+#define _GPGME_INLINE inline
+#else
+#define _GPGME_INLINE
+#endif
+
+/* Include stdio.h for the FILE type definition.  */
+#include <stdio.h>
+
+#ifdef _MSC_VER
+  typedef long off_t;
+  typedef long ssize_t;
+#else
+# include <sys/types.h>
+#endif
+
+#include <gpg-error.h>
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* just to make Emacs auto-indent happy */
+}
+#endif
+#endif /* __cplusplus */
+
+
+
+/* Check for compiler features.  */
+#if __GNUC__
+#define _GPGME_GCC_VERSION (__GNUC__ * 10000 \
+                            + __GNUC_MINOR__ * 100 \
+                            + __GNUC_PATCHLEVEL__)
+
+#if _GPGME_GCC_VERSION > 30100
+#define _GPGME_DEPRECATED	__attribute__ ((__deprecated__))
+#endif
+#endif
+
+#ifndef _GPGME_DEPRECATED
+#define _GPGME_DEPRECATED
+#endif
+
+
+/* The version of this header should match the one of the library.  Do
+   not use this symbol in your application, use gpgme_check_version
+   instead.  The purpose of this macro is to let autoconf (using the
+   AM_PATH_GPGME macro) check that this header matches the installed
+   library.  */
+#define GPGME_VERSION "1.1.8"
+
+
+
+/* Some opaque data types used by GPGME.  */
+
+/* The context holds some global state and configration options, as
+   well as the results of a crypto operation.  */
+struct gpgme_context;
+typedef struct gpgme_context *gpgme_ctx_t;
+
+/* The data object is used by GPGME to exchange arbitrary data.  */
+struct gpgme_data;
+typedef struct gpgme_data *gpgme_data_t;
+
+
+/* Wrappers for the libgpg-error library.  */
+
+typedef gpg_error_t gpgme_error_t;
+typedef gpg_err_code_t gpgme_err_code_t;
+typedef gpg_err_source_t gpgme_err_source_t;
+
+
+static _GPGME_INLINE gpgme_error_t
+gpgme_err_make (gpgme_err_source_t source, gpgme_err_code_t code)
+{
+  return gpg_err_make (source, code);
+}
+
+
+/* The user can define GPGME_ERR_SOURCE_DEFAULT before including this
+   file to specify a default source for gpgme_error.  */
+#ifndef GPGME_ERR_SOURCE_DEFAULT
+#define GPGME_ERR_SOURCE_DEFAULT  GPG_ERR_SOURCE_USER_1
+#endif
+
+static _GPGME_INLINE gpgme_error_t
+gpgme_error (gpgme_err_code_t code)
+{
+  return gpgme_err_make (GPGME_ERR_SOURCE_DEFAULT, code);
+}
+
+
+static _GPGME_INLINE gpgme_err_code_t
+gpgme_err_code (gpgme_error_t err)
+{
+  return gpg_err_code (err);
+}
+
+
+static _GPGME_INLINE gpgme_err_source_t
+gpgme_err_source (gpgme_error_t err)
+{
+  return gpg_err_source (err);
+}
+
+
+/* Return a pointer to a string containing a description of the error
+   code in the error value ERR.  This function is not thread safe.  */
+const char *gpgme_strerror (gpgme_error_t err);
+
+/* Return the error string for ERR in the user-supplied buffer BUF of
+   size BUFLEN.  This function is, in contrast to gpg_strerror,
+   thread-safe if a thread-safe strerror_r() function is provided by
+   the system.  If the function succeeds, 0 is returned and BUF
+   contains the string describing the error.  If the buffer was not
+   large enough, ERANGE is returned and BUF contains as much of the
+   beginning of the error string as fits into the buffer.  */
+int gpgme_strerror_r (gpg_error_t err, char *buf, size_t buflen);
+
+
+/* Return a pointer to a string containing a description of the error
+   source in the error value ERR.  */
+const char *gpgme_strsource (gpgme_error_t err);
+
+
+/* Retrieve the error code for the system error ERR.  This returns
+   GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
+   this).  */
+gpgme_err_code_t gpgme_err_code_from_errno (int err);
+
+
+/* Retrieve the system error for the error code CODE.  This returns 0
+   if CODE is not a system error code.  */
+int gpgme_err_code_to_errno (gpgme_err_code_t code);
+
+  
+/* Return an error value with the error source SOURCE and the system
+   error ERR.  */
+gpgme_error_t gpgme_err_make_from_errno (gpgme_err_source_t source, int err);
+
+
+/* Return an error value with the system error ERR.  */
+gpgme_err_code_t gpgme_error_from_errno (int err);
+
+
+/* The possible encoding mode of gpgme_data_t objects.  */
+typedef enum
+  {
+    GPGME_DATA_ENCODING_NONE   = 0,	/* Not specified.  */
+    GPGME_DATA_ENCODING_BINARY = 1,
+    GPGME_DATA_ENCODING_BASE64 = 2,
+    GPGME_DATA_ENCODING_ARMOR  = 3	/* Either PEM or OpenPGP Armor.  */
+  }
+gpgme_data_encoding_t;
+
+
+/* Public key algorithms from libgcrypt.  */
+typedef enum
+  {
+    GPGME_PK_RSA   = 1,
+    GPGME_PK_RSA_E = 2,
+    GPGME_PK_RSA_S = 3,
+    GPGME_PK_ELG_E = 16,
+    GPGME_PK_DSA   = 17,
+    GPGME_PK_ELG   = 20
+  }
+gpgme_pubkey_algo_t;
+
+
+/* Hash algorithms from libgcrypt.  */
+typedef enum
+  {
+    GPGME_MD_NONE          = 0,  
+    GPGME_MD_MD5           = 1,
+    GPGME_MD_SHA1          = 2,
+    GPGME_MD_RMD160        = 3,
+    GPGME_MD_MD2           = 5,
+    GPGME_MD_TIGER         = 6,   /* TIGER/192. */
+    GPGME_MD_HAVAL         = 7,   /* HAVAL, 5 pass, 160 bit. */
+    GPGME_MD_SHA256        = 8,
+    GPGME_MD_SHA384        = 9,
+    GPGME_MD_SHA512        = 10,
+    GPGME_MD_MD4           = 301,
+    GPGME_MD_CRC32	   = 302,
+    GPGME_MD_CRC32_RFC1510 = 303,
+    GPGME_MD_CRC24_RFC2440 = 304
+  }
+gpgme_hash_algo_t;
+
+
+/* The possible signature stati.  Deprecated, use error value in sig
+   status.  */
+typedef enum
+  {
+    GPGME_SIG_STAT_NONE  = 0,
+    GPGME_SIG_STAT_GOOD  = 1,
+    GPGME_SIG_STAT_BAD   = 2,
+    GPGME_SIG_STAT_NOKEY = 3,
+    GPGME_SIG_STAT_NOSIG = 4,
+    GPGME_SIG_STAT_ERROR = 5,
+    GPGME_SIG_STAT_DIFF  = 6,
+    GPGME_SIG_STAT_GOOD_EXP = 7,
+    GPGME_SIG_STAT_GOOD_EXPKEY = 8
+  }
+_gpgme_sig_stat_t;
+typedef _gpgme_sig_stat_t gpgme_sig_stat_t _GPGME_DEPRECATED;
+
+
+/* The available signature modes.  */
+typedef enum
+  {
+    GPGME_SIG_MODE_NORMAL = 0,
+    GPGME_SIG_MODE_DETACH = 1,
+    GPGME_SIG_MODE_CLEAR  = 2
+  }
+gpgme_sig_mode_t;
+
+
+/* The available key and signature attributes.  Deprecated, use the
+   individual result structures instead.  */
+typedef enum
+  {
+    GPGME_ATTR_KEYID        = 1,
+    GPGME_ATTR_FPR          = 2,
+    GPGME_ATTR_ALGO         = 3,
+    GPGME_ATTR_LEN          = 4,
+    GPGME_ATTR_CREATED      = 5,
+    GPGME_ATTR_EXPIRE       = 6,
+    GPGME_ATTR_OTRUST       = 7,
+    GPGME_ATTR_USERID       = 8,
+    GPGME_ATTR_NAME         = 9,
+    GPGME_ATTR_EMAIL        = 10,
+    GPGME_ATTR_COMMENT      = 11,
+    GPGME_ATTR_VALIDITY     = 12,
+    GPGME_ATTR_LEVEL        = 13,
+    GPGME_ATTR_TYPE         = 14,
+    GPGME_ATTR_IS_SECRET    = 15,
+    GPGME_ATTR_KEY_REVOKED  = 16,
+    GPGME_ATTR_KEY_INVALID  = 17,
+    GPGME_ATTR_UID_REVOKED  = 18,
+    GPGME_ATTR_UID_INVALID  = 19,
+    GPGME_ATTR_KEY_CAPS     = 20,
+    GPGME_ATTR_CAN_ENCRYPT  = 21,
+    GPGME_ATTR_CAN_SIGN     = 22,
+    GPGME_ATTR_CAN_CERTIFY  = 23,
+    GPGME_ATTR_KEY_EXPIRED  = 24,
+    GPGME_ATTR_KEY_DISABLED = 25,
+    GPGME_ATTR_SERIAL       = 26,
+    GPGME_ATTR_ISSUER       = 27,
+    GPGME_ATTR_CHAINID      = 28,
+    GPGME_ATTR_SIG_STATUS   = 29,
+    GPGME_ATTR_ERRTOK       = 30,
+    GPGME_ATTR_SIG_SUMMARY  = 31,
+    GPGME_ATTR_SIG_CLASS    = 32
+  }
+_gpgme_attr_t;
+typedef _gpgme_attr_t gpgme_attr_t _GPGME_DEPRECATED;
+
+
+/* The available validities for a trust item or key.  */
+typedef enum
+  {
+    GPGME_VALIDITY_UNKNOWN   = 0,
+    GPGME_VALIDITY_UNDEFINED = 1,
+    GPGME_VALIDITY_NEVER     = 2,
+    GPGME_VALIDITY_MARGINAL  = 3,
+    GPGME_VALIDITY_FULL      = 4,
+    GPGME_VALIDITY_ULTIMATE  = 5
+  }
+gpgme_validity_t;
+
+
+/* The available protocols.  */
+typedef enum
+  {
+    GPGME_PROTOCOL_OpenPGP = 0,  /* The default mode.  */
+    GPGME_PROTOCOL_CMS     = 1,
+    GPGME_PROTOCOL_GPGCONF = 2,  /* Special code for gpgconf.  */
+    GPGME_PROTOCOL_UNKNOWN = 255
+  }
+gpgme_protocol_t;
+
+
+/* The available keylist mode flags.  */
+#define GPGME_KEYLIST_MODE_LOCAL		1
+#define GPGME_KEYLIST_MODE_EXTERN		2
+#define GPGME_KEYLIST_MODE_SIGS			4
+#define GPGME_KEYLIST_MODE_SIG_NOTATIONS	8
+#define GPGME_KEYLIST_MODE_VALIDATE		256
+
+typedef unsigned int gpgme_keylist_mode_t;
+
+
+/* Flags for the audit log functions.  */
+#define GPGME_AUDITLOG_HTML      1 
+#define GPGME_AUDITLOG_WITH_HELP 128
+
+
+/* Signature notations.  */
+
+/* The available signature notation flags.  */
+#define GPGME_SIG_NOTATION_HUMAN_READABLE	1
+#define GPGME_SIG_NOTATION_CRITICAL		2
+
+typedef unsigned int gpgme_sig_notation_flags_t;
+
+struct _gpgme_sig_notation
+{
+  struct _gpgme_sig_notation *next;
+
+  /* If NAME is a null pointer, then VALUE contains a policy URL
+     rather than a notation.  */
+  char *name;
+
+  /* The value of the notation data.  */
+  char *value;
+
+  /* The length of the name of the notation data.  */
+  int name_len;
+
+  /* The length of the value of the notation data.  */
+  int value_len;
+
+  /* The accumulated flags.  */
+  gpgme_sig_notation_flags_t flags;
+
+  /* Notation data is human-readable.  */
+  unsigned int human_readable : 1;
+
+  /* Notation data is critical.  */
+  unsigned int critical : 1;
+
+  /* Internal to GPGME, do not use.  */
+  int _unused : 30;
+};
+typedef struct _gpgme_sig_notation *gpgme_sig_notation_t;
+
+
+/* The possible stati for the edit operation.  */
+typedef enum
+  {
+    GPGME_STATUS_EOF,
+    /* mkstatus processing starts here */
+    GPGME_STATUS_ENTER,
+    GPGME_STATUS_LEAVE,
+    GPGME_STATUS_ABORT,
+
+    GPGME_STATUS_GOODSIG,
+    GPGME_STATUS_BADSIG,
+    GPGME_STATUS_ERRSIG,
+
+    GPGME_STATUS_BADARMOR,
+
+    GPGME_STATUS_RSA_OR_IDEA,
+    GPGME_STATUS_KEYEXPIRED,
+    GPGME_STATUS_KEYREVOKED,
+
+    GPGME_STATUS_TRUST_UNDEFINED,
+    GPGME_STATUS_TRUST_NEVER,
+    GPGME_STATUS_TRUST_MARGINAL,
+    GPGME_STATUS_TRUST_FULLY,
+    GPGME_STATUS_TRUST_ULTIMATE,
+
+    GPGME_STATUS_SHM_INFO,
+    GPGME_STATUS_SHM_GET,
+    GPGME_STATUS_SHM_GET_BOOL,
+    GPGME_STATUS_SHM_GET_HIDDEN,
+
+    GPGME_STATUS_NEED_PASSPHRASE,
+    GPGME_STATUS_VALIDSIG,
+    GPGME_STATUS_SIG_ID,
+    GPGME_STATUS_ENC_TO,
+    GPGME_STATUS_NODATA,
+    GPGME_STATUS_BAD_PASSPHRASE,
+    GPGME_STATUS_NO_PUBKEY,
+    GPGME_STATUS_NO_SECKEY,
+    GPGME_STATUS_NEED_PASSPHRASE_SYM,
+    GPGME_STATUS_DECRYPTION_FAILED,
+    GPGME_STATUS_DECRYPTION_OKAY,
+    GPGME_STATUS_MISSING_PASSPHRASE,
+    GPGME_STATUS_GOOD_PASSPHRASE,
+    GPGME_STATUS_GOODMDC,
+    GPGME_STATUS_BADMDC,
+    GPGME_STATUS_ERRMDC,
+    GPGME_STATUS_IMPORTED,
+    GPGME_STATUS_IMPORT_OK,
+    GPGME_STATUS_IMPORT_PROBLEM,
+    GPGME_STATUS_IMPORT_RES,
+    GPGME_STATUS_FILE_START,
+    GPGME_STATUS_FILE_DONE,
+    GPGME_STATUS_FILE_ERROR,
+
+    GPGME_STATUS_BEGIN_DECRYPTION,
+    GPGME_STATUS_END_DECRYPTION,
+    GPGME_STATUS_BEGIN_ENCRYPTION,
+    GPGME_STATUS_END_ENCRYPTION,
+
+    GPGME_STATUS_DELETE_PROBLEM,
+    GPGME_STATUS_GET_BOOL,
+    GPGME_STATUS_GET_LINE,
+    GPGME_STATUS_GET_HIDDEN,
+    GPGME_STATUS_GOT_IT,
+    GPGME_STATUS_PROGRESS,
+    GPGME_STATUS_SIG_CREATED,
+    GPGME_STATUS_SESSION_KEY,
+    GPGME_STATUS_NOTATION_NAME,
+    GPGME_STATUS_NOTATION_DATA,
+    GPGME_STATUS_POLICY_URL,
+    GPGME_STATUS_BEGIN_STREAM,
+    GPGME_STATUS_END_STREAM,
+    GPGME_STATUS_KEY_CREATED,
+    GPGME_STATUS_USERID_HINT,
+    GPGME_STATUS_UNEXPECTED,
+    GPGME_STATUS_INV_RECP,
+    GPGME_STATUS_NO_RECP,
+    GPGME_STATUS_ALREADY_SIGNED,
+    GPGME_STATUS_SIGEXPIRED,
+    GPGME_STATUS_EXPSIG,
+    GPGME_STATUS_EXPKEYSIG,
+    GPGME_STATUS_TRUNCATED,
+    GPGME_STATUS_ERROR,
+    GPGME_STATUS_NEWSIG,
+    GPGME_STATUS_REVKEYSIG,
+    GPGME_STATUS_SIG_SUBPACKET,
+    GPGME_STATUS_NEED_PASSPHRASE_PIN,
+    GPGME_STATUS_SC_OP_FAILURE,
+    GPGME_STATUS_SC_OP_SUCCESS,
+    GPGME_STATUS_CARDCTRL,
+    GPGME_STATUS_BACKUP_KEY_CREATED,
+    GPGME_STATUS_PKA_TRUST_BAD,
+    GPGME_STATUS_PKA_TRUST_GOOD,
+
+    GPGME_STATUS_PLAINTEXT
+  }
+gpgme_status_code_t;
+
+
+/* The engine information structure.  */
+struct _gpgme_engine_info
+{
+  struct _gpgme_engine_info *next;
+
+  /* The protocol ID.  */
+  gpgme_protocol_t protocol;
+
+  /* The file name of the engine binary.  */
+  char *file_name;
+  
+  /* The version string of the installed engine.  */
+  char *version;
+
+  /* The minimum version required for GPGME.  */
+  const char *req_version;
+
+  /* The home directory used, or NULL if default.  */
+  char *home_dir;
+};
+typedef struct _gpgme_engine_info *gpgme_engine_info_t;
+
+
+/* A subkey from a key.  */
+struct _gpgme_subkey
+{
+  struct _gpgme_subkey *next;
+
+  /* True if subkey is revoked.  */
+  unsigned int revoked : 1;
+
+  /* True if subkey is expired.  */
+  unsigned int expired : 1;
+
+  /* True if subkey is disabled.  */
+  unsigned int disabled : 1;
+
+  /* True if subkey is invalid.  */
+  unsigned int invalid : 1;
+
+  /* True if subkey can be used for encryption.  */
+  unsigned int can_encrypt : 1;
+
+  /* True if subkey can be used for signing.  */
+  unsigned int can_sign : 1;
+
+  /* True if subkey can be used for certification.  */
+  unsigned int can_certify : 1;
+
+  /* True if subkey is secret.  */
+  unsigned int secret : 1;
+
+  /* True if subkey can be used for authentication.  */
+  unsigned int can_authenticate : 1;
+
+  /* True if subkey is qualified for signatures according to German law.  */
+  unsigned int is_qualified : 1;
+
+  /* Internal to GPGME, do not use.  */
+  unsigned int _unused : 22;
+  
+  /* Public key algorithm supported by this subkey.  */
+  gpgme_pubkey_algo_t pubkey_algo;
+
+  /* Length of the subkey.  */
+  unsigned int length;
+
+  /* The key ID of the subkey.  */
+  char *keyid;
+
+  /* Internal to GPGME, do not use.  */
+  char _keyid[16 + 1];
+
+  /* The fingerprint of the subkey in hex digit form.  */
+  char *fpr;
+
+  /* The creation timestamp, -1 if invalid, 0 if not available.  */
+  long int timestamp;
+
+  /* The expiration timestamp, 0 if the subkey does not expire.  */
+  long int expires;
+};
+typedef struct _gpgme_subkey *gpgme_subkey_t;
+
+
+/* A signature on a user ID.  */
+struct _gpgme_key_sig
+{
+  struct _gpgme_key_sig *next;
+
+  /* True if the signature is a revocation signature.  */
+  unsigned int revoked : 1;
+
+  /* True if the signature is expired.  */
+  unsigned int expired : 1;
+
+  /* True if the signature is invalid.  */
+  unsigned int invalid : 1;
+
+  /* True if the signature should be exported.  */
+  unsigned int exportable : 1;
+
+  /* Internal to GPGME, do not use.  */
+  unsigned int _unused : 28;
+
+  /* The public key algorithm used to create the signature.  */
+  gpgme_pubkey_algo_t pubkey_algo;
+
+  /* The key ID of key used to create the signature.  */
+  char *keyid;
+
+  /* Internal to GPGME, do not use.  */
+  char _keyid[16 + 1];
+
+  /* The creation timestamp, -1 if invalid, 0 if not available.  */
+  long int timestamp;
+
+  /* The expiration timestamp, 0 if the subkey does not expire.  */
+  long int expires;
+
+  /* Same as in gpgme_signature_t.  */
+  gpgme_error_t status;
+
+#ifdef __cplusplus
+  unsigned int _obsolete_class _GPGME_DEPRECATED;
+#else
+  /* Must be set to SIG_CLASS below.  */
+  unsigned int class _GPGME_DEPRECATED;
+#endif
+
+  /* The user ID string.  */
+  char *uid;
+
+  /* The name part of the user ID.  */
+  char *name;
+
+  /* The email part of the user ID.  */
+  char *email;
+
+  /* The comment part of the user ID.  */
+  char *comment;
+
+  /* Crypto backend specific signature class.  */
+  unsigned int sig_class;
+
+  /* Notation data and policy URLs.  */
+  gpgme_sig_notation_t notations;
+
+  /* Internal to GPGME, do not use.  */
+  gpgme_sig_notation_t _last_notation;
+};
+typedef struct _gpgme_key_sig *gpgme_key_sig_t;
+
+
+/* An user ID from a key.  */
+struct _gpgme_user_id
+{
+  struct _gpgme_user_id *next;
+
+  /* True if the user ID is revoked.  */
+  unsigned int revoked : 1;
+
+  /* True if the user ID is invalid.  */
+  unsigned int invalid : 1;
+
+  /* Internal to GPGME, do not use.  */
+  unsigned int _unused : 30;
+
+  /* The validity of the user ID.  */
+  gpgme_validity_t validity; 
+
+  /* The user ID string.  */
+  char *uid;
+
+  /* The name part of the user ID.  */
+  char *name;
+
+  /* The email part of the user ID.  */
+  char *email;
+
+  /* The comment part of the user ID.  */
+  char *comment;
+
+  /* The signatures of the user ID.  */
+  gpgme_key_sig_t signatures;
+
+  /* Internal to GPGME, do not use.  */
+  gpgme_key_sig_t _last_keysig;
+};
+typedef struct _gpgme_user_id *gpgme_user_id_t;
+
+
+/* A key from the keyring.  */
+struct _gpgme_key
+{
+  /* Internal to GPGME, do not use.  */
+  unsigned int _refs;
+
+  /* True if key is revoked.  */
+  unsigned int revoked : 1;
+
+  /* True if key is expired.  */
+  unsigned int expired : 1;
+
+  /* True if key is disabled.  */
+  unsigned int disabled : 1;
+
+  /* True if key is invalid.  */
+  unsigned int invalid : 1;
+
+  /* True if key can be used for encryption.  */
+  unsigned int can_encrypt : 1;
+
+  /* True if key can be used for signing.  */
+  unsigned int can_sign : 1;
+
+  /* True if key can be used for certification.  */
+  unsigned int can_certify : 1;
+
+  /* True if key is secret.  */
+  unsigned int secret : 1;
+
+  /* True if key can be used for authentication.  */
+  unsigned int can_authenticate : 1;
+
+  /* True if subkey is qualified for signatures according to German law.  */
+  unsigned int is_qualified : 1;
+
+  /* Internal to GPGME, do not use.  */
+  unsigned int _unused : 22;
+
+  /* This is the protocol supported by this key.  */
+  gpgme_protocol_t protocol;
+
+  /* If protocol is GPGME_PROTOCOL_CMS, this string contains the
+     issuer serial.  */
+  char *issuer_serial;
+
+  /* If protocol is GPGME_PROTOCOL_CMS, this string contains the
+     issuer name.  */
+  char *issuer_name;
+
+  /* If protocol is GPGME_PROTOCOL_CMS, this string contains the chain
+     ID.  */
+  char *chain_id;
+
+  /* If protocol is GPGME_PROTOCOL_OpenPGP, this field contains the
+     owner trust.  */
+  gpgme_validity_t owner_trust;
+
+  /* The subkeys of the key.  */
+  gpgme_subkey_t subkeys;
+
+  /* The user IDs of the key.  */
+  gpgme_user_id_t uids;
+
+  /* Internal to GPGME, do not use.  */
+  gpgme_subkey_t _last_subkey;
+
+  /* Internal to GPGME, do not use.  */
+  gpgme_user_id_t _last_uid;
+
+  /* The keylist mode that was active when listing the key.  */
+  gpgme_keylist_mode_t keylist_mode;
+};
+typedef struct _gpgme_key *gpgme_key_t;
+
+
+
+/* Types for callback functions.  */
+
+/* Request a passphrase from the user.  */
+typedef gpgme_error_t (*gpgme_passphrase_cb_t) (void *hook,
+						const char *uid_hint,
+						const char *passphrase_info,
+						int prev_was_bad, int fd);
+
+/* Inform the user about progress made.  */
+typedef void (*gpgme_progress_cb_t) (void *opaque, const char *what,
+				     int type, int current, int total);
+
+/* Interact with the user about an edit operation.  */
+typedef gpgme_error_t (*gpgme_edit_cb_t) (void *opaque,
+					  gpgme_status_code_t status,
+					  const char *args, int fd);
+
+
+/* Context management functions.  */
+
+/* Create a new context and return it in CTX.  */
+gpgme_error_t gpgme_new (gpgme_ctx_t *ctx);
+
+/* Release the context CTX.  */
+void gpgme_release (gpgme_ctx_t ctx);
+
+/* Set the protocol to be used by CTX to PROTO.  */
+gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t proto);
+
+/* Get the protocol used with CTX */
+gpgme_protocol_t gpgme_get_protocol (gpgme_ctx_t ctx);
+
+/* Get the string describing protocol PROTO, or NULL if invalid.  */
+const char *gpgme_get_protocol_name (gpgme_protocol_t proto);
+
+/* If YES is non-zero, enable armor mode in CTX, disable it otherwise.  */
+void gpgme_set_armor (gpgme_ctx_t ctx, int yes);
+
+/* Return non-zero if armor mode is set in CTX.  */
+int gpgme_get_armor (gpgme_ctx_t ctx);
+
+/* If YES is non-zero, enable text mode in CTX, disable it otherwise.  */
+void gpgme_set_textmode (gpgme_ctx_t ctx, int yes);
+
+/* Return non-zero if text mode is set in CTX.  */
+int gpgme_get_textmode (gpgme_ctx_t ctx);
+
+/* Use whatever the default of the backend crypto engine is.  */
+#define GPGME_INCLUDE_CERTS_DEFAULT	-256
+
+/* Include up to NR_OF_CERTS certificates in an S/MIME message.  */
+void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs);
+
+/* Return the number of certs to include in an S/MIME message.  */
+int gpgme_get_include_certs (gpgme_ctx_t ctx);
+
+/* Set keylist mode in CTX to MODE.  */
+gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t ctx,
+				      gpgme_keylist_mode_t mode);
+
+/* Get keylist mode in CTX.  */
+gpgme_keylist_mode_t gpgme_get_keylist_mode (gpgme_ctx_t ctx);
+
+/* Set the passphrase callback function in CTX to CB.  HOOK_VALUE is
+   passed as first argument to the passphrase callback function.  */
+void gpgme_set_passphrase_cb (gpgme_ctx_t ctx,
+                              gpgme_passphrase_cb_t cb, void *hook_value);
+
+/* Get the current passphrase callback function in *CB and the current
+   hook value in *HOOK_VALUE.  */
+void gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *cb,
+			      void **hook_value);
+
+/* Set the progress callback function in CTX to CB.  HOOK_VALUE is
+   passed as first argument to the progress callback function.  */
+void gpgme_set_progress_cb (gpgme_ctx_t c, gpgme_progress_cb_t cb,
+			    void *hook_value);
+
+/* Get the current progress callback function in *CB and the current
+   hook value in *HOOK_VALUE.  */
+void gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *cb,
+			    void **hook_value);
+
+/* This function sets the locale for the context CTX, or the default
+   locale if CTX is a null pointer.  */
+gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category,
+				const char *value);
+
+/* Get the information about the configured engines.  A pointer to the
+   first engine in the statically allocated linked list is returned.
+   The returned data is valid until the next gpgme_ctx_set_engine_info.  */
+gpgme_engine_info_t gpgme_ctx_get_engine_info (gpgme_ctx_t ctx);
+
+/* Set the engine info for the context CTX, protocol PROTO, to the
+   file name FILE_NAME and the home directory HOME_DIR.  */
+gpgme_error_t gpgme_ctx_set_engine_info (gpgme_ctx_t ctx,
+					 gpgme_protocol_t proto,
+					 const char *file_name,
+					 const char *home_dir);
+
+
+/* Return a statically allocated string with the name of the public
+   key algorithm ALGO, or NULL if that name is not known.  */
+const char *gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo);
+
+/* Return a statically allocated string with the name of the hash
+   algorithm ALGO, or NULL if that name is not known.  */
+const char *gpgme_hash_algo_name (gpgme_hash_algo_t algo);
+
+
+/* Delete all signers from CTX.  */
+void gpgme_signers_clear (gpgme_ctx_t ctx);
+
+/* Add KEY to list of signers in CTX.  */
+gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key);
+
+/* Return the SEQth signer's key in CTX.  */
+gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq);
+
+/* Retrieve the signature status of signature IDX in CTX after a
+   successful verify operation in R_STAT (if non-null).  The creation
+   time stamp of the signature is returned in R_CREATED (if non-null).
+   The function returns a string containing the fingerprint.
+   Deprecated, use verify result directly.  */
+const char *gpgme_get_sig_status (gpgme_ctx_t ctx, int idx,
+                                  _gpgme_sig_stat_t *r_stat,
+				  time_t *r_created) _GPGME_DEPRECATED;
+
+/* Retrieve certain attributes of a signature.  IDX is the index
+   number of the signature after a successful verify operation.  WHAT
+   is an attribute where GPGME_ATTR_EXPIRE is probably the most useful
+   one.  WHATIDX is to be passed as 0 for most attributes . */
+unsigned long gpgme_get_sig_ulong_attr (gpgme_ctx_t c, int idx,
+                                        _gpgme_attr_t what, int whatidx)
+     _GPGME_DEPRECATED;
+const char *gpgme_get_sig_string_attr (gpgme_ctx_t c, int idx,
+				       _gpgme_attr_t what, int whatidx)
+     _GPGME_DEPRECATED;
+
+
+/* Get the key used to create signature IDX in CTX and return it in
+   R_KEY.  */
+gpgme_error_t gpgme_get_sig_key (gpgme_ctx_t ctx, int idx, gpgme_key_t *r_key)
+     _GPGME_DEPRECATED;
+
+
+/* Clear all notation data from the context.  */
+void gpgme_sig_notation_clear (gpgme_ctx_t ctx);
+
+/* Add the human-readable notation data with name NAME and value VALUE
+   to the context CTX, using the flags FLAGS.  If NAME is NULL, then
+   VALUE should be a policy URL.  The flag
+   GPGME_SIG_NOTATION_HUMAN_READABLE is forced to be true for notation
+   data, and false for policy URLs.  */
+gpgme_error_t gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name,
+				      const char *value,
+				      gpgme_sig_notation_flags_t flags);
+
+/* Get the sig notations for this context.  */
+gpgme_sig_notation_t gpgme_sig_notation_get (gpgme_ctx_t ctx);
+
+
+/* Run control.  */
+
+/* The type of an I/O callback function.  */
+typedef gpgme_error_t (*gpgme_io_cb_t) (void *data, int fd);
+
+/* The type of a function that can register FNC as the I/O callback
+   function for the file descriptor FD with direction dir (0: for writing,
+   1: for reading).  FNC_DATA should be passed as DATA to FNC.  The
+   function should return a TAG suitable for the corresponding
+   gpgme_remove_io_cb_t, and an error value.  */
+typedef gpgme_error_t (*gpgme_register_io_cb_t) (void *data, int fd, int dir,
+						 gpgme_io_cb_t fnc,
+						 void *fnc_data, void **tag);
+
+/* The type of a function that can remove a previously registered I/O
+   callback function given TAG as returned by the register
+   function.  */
+typedef void (*gpgme_remove_io_cb_t) (void *tag);
+
+typedef enum
+  {
+    GPGME_EVENT_START,
+    GPGME_EVENT_DONE,
+    GPGME_EVENT_NEXT_KEY,
+    GPGME_EVENT_NEXT_TRUSTITEM
+  }
+gpgme_event_io_t;
+
+/* The type of a function that is called when a context finished an
+   operation.  */
+typedef void (*gpgme_event_io_cb_t) (void *data, gpgme_event_io_t type,
+				     void *type_data);
+
+struct gpgme_io_cbs
+{
+  gpgme_register_io_cb_t add;
+  void *add_priv;
+  gpgme_remove_io_cb_t remove;
+  gpgme_event_io_cb_t event;
+  void *event_priv;
+};
+typedef struct gpgme_io_cbs *gpgme_io_cbs_t;
+
+/* Set the I/O callback functions in CTX to IO_CBS.  */
+void gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
+
+/* Get the current I/O callback functions.  */
+void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
+
+/* Process the pending operation and, if HANG is non-zero, wait for
+   the pending operation to finish.  */
+gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang);
+
+
+/* Functions to handle data objects.  */
+
+/* Read up to SIZE bytes into buffer BUFFER from the data object with
+   the handle HANDLE.  Return the number of characters read, 0 on EOF
+   and -1 on error.  If an error occurs, errno is set.  */
+typedef ssize_t (*gpgme_data_read_cb_t) (void *handle, void *buffer,
+					 size_t size);
+
+/* Write up to SIZE bytes from buffer BUFFER to the data object with
+   the handle HANDLE.  Return the number of characters written, or -1
+   on error.  If an error occurs, errno is set.  */
+typedef ssize_t (*gpgme_data_write_cb_t) (void *handle, const void *buffer,
+					  size_t size);
+
+/* Set the current position from where the next read or write starts
+   in the data object with the handle HANDLE to OFFSET, relativ to
+   WHENCE.  */
+typedef off_t (*gpgme_data_seek_cb_t) (void *handle, off_t offset, int whence);
+
+/* Close the data object with the handle DL.  */
+typedef void (*gpgme_data_release_cb_t) (void *handle);
+
+struct gpgme_data_cbs
+{
+  gpgme_data_read_cb_t read;
+  gpgme_data_write_cb_t write;
+  gpgme_data_seek_cb_t seek;
+  gpgme_data_release_cb_t release;
+};
+typedef struct gpgme_data_cbs *gpgme_data_cbs_t;
+
+/* Read up to SIZE bytes into buffer BUFFER from the data object with
+   the handle DH.  Return the number of characters read, 0 on EOF and
+   -1 on error.  If an error occurs, errno is set.  */
+ssize_t gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size);
+
+/* Write up to SIZE bytes from buffer BUFFER to the data object with
+   the handle DH.  Return the number of characters written, or -1 on
+   error.  If an error occurs, errno is set.  */
+ssize_t gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size);
+
+/* Set the current position from where the next read or write starts
+   in the data object with the handle DH to OFFSET, relativ to
+   WHENCE.  */
+off_t gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence);
+
+/* Create a new data buffer and return it in R_DH.  */
+gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh);
+
+/* Destroy the data buffer DH.  */
+void gpgme_data_release (gpgme_data_t dh);
+
+/* Create a new data buffer filled with SIZE bytes starting from
+   BUFFER.  If COPY is zero, copying is delayed until necessary, and
+   the data is taken from the original location when needed.  */
+gpgme_error_t gpgme_data_new_from_mem (gpgme_data_t *r_dh,
+				       const char *buffer, size_t size,
+				       int copy);
+
+/* Destroy the data buffer DH and return a pointer to its content.
+   The memory has be to released with gpgme_free() by the user.  It's
+   size is returned in R_LEN.  */
+char *gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len);
+
+/* Release the memory returned by gpgme_data_release_and_get_mem().  */
+void gpgme_free (void *buffer);
+
+gpgme_error_t gpgme_data_new_from_cbs (gpgme_data_t *dh,
+				       gpgme_data_cbs_t cbs,
+				       void *handle);
+
+gpgme_error_t gpgme_data_new_from_fd (gpgme_data_t *dh, int fd);
+
+gpgme_error_t gpgme_data_new_from_stream (gpgme_data_t *dh, FILE *stream);
+
+/* Return the encoding attribute of the data buffer DH */
+gpgme_data_encoding_t gpgme_data_get_encoding (gpgme_data_t dh);
+
+/* Set the encoding attribute of data buffer DH to ENC */
+gpgme_error_t gpgme_data_set_encoding (gpgme_data_t dh,
+				       gpgme_data_encoding_t enc);
+
+/* Get the file name associated with the data object with handle DH, or
+   NULL if there is none.  */
+char *gpgme_data_get_file_name (gpgme_data_t dh);
+
+/* Set the file name associated with the data object with handle DH to
+   FILE_NAME.  */
+gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh,
+					const char *file_name);
+
+
+/* Create a new data buffer which retrieves the data from the callback
+   function READ_CB.  Deprecated, please use gpgme_data_new_from_cbs
+   instead.  */
+gpgme_error_t gpgme_data_new_with_read_cb (gpgme_data_t *r_dh,
+					   int (*read_cb) (void*,char *,
+							   size_t,size_t*),
+					   void *read_cb_value)
+     _GPGME_DEPRECATED;
+
+/* Create a new data buffer filled with the content of file FNAME.
+   COPY must be non-zero.  For delayed read, please use
+   gpgme_data_new_from_fd or gpgme_data_new_from stream instead.  */
+gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh,
+					const char *fname,
+					int copy);
+
+/* Create a new data buffer filled with LENGTH bytes starting from
+   OFFSET within the file FNAME or stream FP (exactly one must be
+   non-zero).  */
+gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh,
+					    const char *fname, FILE *fp,
+					    off_t offset, size_t length);
+
+/* Reset the read pointer in DH.  Deprecated, please use
+   gpgme_data_seek instead.  */
+gpgme_error_t gpgme_data_rewind (gpgme_data_t dh) _GPGME_DEPRECATED;
+
+
+/* Key and trust functions.  */
+
+/* Get the key with the fingerprint FPR from the crypto backend.  If
+   SECRET is true, get the secret key.  */
+gpgme_error_t gpgme_get_key (gpgme_ctx_t ctx, const char *fpr,
+			     gpgme_key_t *r_key, int secret);
+
+/* Acquire a reference to KEY.  */
+void gpgme_key_ref (gpgme_key_t key);
+
+/* Release a reference to KEY.  If this was the last one the key is
+   destroyed.  */
+void gpgme_key_unref (gpgme_key_t key);
+void gpgme_key_release (gpgme_key_t key);
+
+/* Return the value of the attribute WHAT of KEY, which has to be
+   representable by a string.  IDX specifies the sub key or user ID
+   for attributes related to sub keys or user IDs.  Deprecated, use
+   key structure directly instead. */
+const char *gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what,
+				       const void *reserved, int idx)
+     _GPGME_DEPRECATED;
+
+/* Return the value of the attribute WHAT of KEY, which has to be
+   representable by an unsigned integer.  IDX specifies the sub key or
+   user ID for attributes related to sub keys or user IDs.
+   Deprecated, use key structure directly instead.  */
+unsigned long gpgme_key_get_ulong_attr (gpgme_key_t key, _gpgme_attr_t what,
+					const void *reserved, int idx)
+     _GPGME_DEPRECATED;
+
+/* Return the value of the attribute WHAT of a signature on user ID
+   UID_IDX in KEY, which has to be representable by a string.  IDX
+   specifies the signature.  Deprecated, use key structure directly
+   instead.  */
+const char *gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx,
+					   _gpgme_attr_t what,
+					   const void *reserved, int idx)
+     _GPGME_DEPRECATED;
+
+/* Return the value of the attribute WHAT of a signature on user ID
+   UID_IDX in KEY, which has to be representable by an unsigned
+   integer string.  IDX specifies the signature.  Deprecated, use key
+   structure directly instead.  */
+unsigned long gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx,
+					    _gpgme_attr_t what,
+					    const void *reserved, int idx)
+     _GPGME_DEPRECATED;
+
+
+/* Crypto Operations.  */
+
+/* Cancel a pending asynchronous operation.  */
+gpgme_error_t gpgme_cancel (gpgme_ctx_t ctx);
+
+/* Cancel a pending operation asynchronously.  */
+gpgme_error_t gpgme_cancel_async (gpgme_ctx_t ctx);
+
+
+struct _gpgme_invalid_key
+{
+  struct _gpgme_invalid_key *next;
+  char *fpr;
+  gpgme_error_t reason;
+};
+typedef struct _gpgme_invalid_key *gpgme_invalid_key_t;
+
+
+/* Encryption.  */
+struct _gpgme_op_encrypt_result
+{
+  /* The list of invalid recipients.  */
+  gpgme_invalid_key_t invalid_recipients;
+};
+typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t;
+
+/* Retrieve a pointer to the result of the encrypt operation.  */
+gpgme_encrypt_result_t gpgme_op_encrypt_result (gpgme_ctx_t ctx);
+
+/* The valid encryption flags.  */
+typedef enum
+  {
+    GPGME_ENCRYPT_ALWAYS_TRUST = 1
+  }
+gpgme_encrypt_flags_t;
+
+/* Encrypt plaintext PLAIN within CTX for the recipients RECP and
+   store the resulting ciphertext in CIPHER.  */
+gpgme_error_t gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
+				      gpgme_encrypt_flags_t flags,
+				      gpgme_data_t plain, gpgme_data_t cipher);
+gpgme_error_t gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[],
+				gpgme_encrypt_flags_t flags,
+				gpgme_data_t plain, gpgme_data_t cipher);
+
+/* Encrypt plaintext PLAIN within CTX for the recipients RECP and
+   store the resulting ciphertext in CIPHER.  Also sign the ciphertext
+   with the signers in CTX.  */
+gpgme_error_t gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx,
+					   gpgme_key_t recp[],
+					   gpgme_encrypt_flags_t flags,
+					   gpgme_data_t plain,
+					   gpgme_data_t cipher);
+gpgme_error_t gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[],
+				     gpgme_encrypt_flags_t flags,
+				     gpgme_data_t plain, gpgme_data_t cipher);
+
+
+/* Decryption.  */
+
+struct _gpgme_recipient
+{
+  struct _gpgme_recipient *next;
+
+  /* The key ID of key for which the text was encrypted.  */
+  char *keyid;
+
+  /* Internal to GPGME, do not use.  */
+  char _keyid[16 + 1];
+
+  /* The public key algorithm of the recipient key.  */
+  gpgme_pubkey_algo_t pubkey_algo;
+
+  /* The status of the recipient.  */
+  gpgme_error_t status;
+};
+typedef struct _gpgme_recipient *gpgme_recipient_t;
+
+struct _gpgme_op_decrypt_result
+{
+  char *unsupported_algorithm;
+
+  /* Key should not have been used for encryption.  */
+  unsigned int wrong_key_usage : 1;
+
+  /* Internal to GPGME, do not use.  */
+  int _unused : 31;
+
+  gpgme_recipient_t recipients;
+
+  /* The original file name of the plaintext message, if
+     available.  */
+  char *file_name;
+};
+typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t;
+
+/* Retrieve a pointer to the result of the decrypt operation.  */
+gpgme_decrypt_result_t gpgme_op_decrypt_result (gpgme_ctx_t ctx);
+
+/* Decrypt ciphertext CIPHER within CTX and store the resulting
+   plaintext in PLAIN.  */
+gpgme_error_t gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
+				      gpgme_data_t plain);
+gpgme_error_t gpgme_op_decrypt (gpgme_ctx_t ctx,
+				gpgme_data_t cipher, gpgme_data_t plain);
+
+/* Decrypt ciphertext CIPHER and make a signature verification within
+   CTX and store the resulting plaintext in PLAIN.  */
+gpgme_error_t gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx,
+					     gpgme_data_t cipher,
+					     gpgme_data_t plain);
+gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher,
+				       gpgme_data_t plain);
+
+
+/* Signing.  */
+struct _gpgme_new_signature
+{
+  struct _gpgme_new_signature *next;
+
+  /* The type of the signature.  */
+  gpgme_sig_mode_t type;
+
+  /* The public key algorithm used to create the signature.  */
+  gpgme_pubkey_algo_t pubkey_algo;
+
+  /* The hash algorithm used to create the signature.  */
+  gpgme_hash_algo_t hash_algo;
+
+  /* Internal to GPGME, do not use.  Must be set to the same value as
+     CLASS below.  */
+  unsigned long _obsolete_class;
+
+  /* Signature creation time.  */
+  long int timestamp;
+
+  /* The fingerprint of the signature.  */
+  char *fpr;
+
+#ifdef __cplusplus
+  unsigned int _obsolete_class_2;
+#else
+  /* Must be set to SIG_CLASS below.  */
+  unsigned int class _GPGME_DEPRECATED;
+#endif
+
+  /* Crypto backend specific signature class.  */
+  unsigned int sig_class;
+};
+typedef struct _gpgme_new_signature *gpgme_new_signature_t;
+
+struct _gpgme_op_sign_result
+{
+  /* The list of invalid signers.  */
+  gpgme_invalid_key_t invalid_signers;
+  gpgme_new_signature_t signatures;
+};
+typedef struct _gpgme_op_sign_result *gpgme_sign_result_t;
+
+/* Retrieve a pointer to the result of the signing operation.  */
+gpgme_sign_result_t gpgme_op_sign_result (gpgme_ctx_t ctx);
+
+/* Sign the plaintext PLAIN and store the signature in SIG.  */
+gpgme_error_t gpgme_op_sign_start (gpgme_ctx_t ctx,
+				   gpgme_data_t plain, gpgme_data_t sig,
+				   gpgme_sig_mode_t mode);
+gpgme_error_t gpgme_op_sign (gpgme_ctx_t ctx,
+			     gpgme_data_t plain, gpgme_data_t sig,
+			     gpgme_sig_mode_t mode);
+
+
+/* Verify.  */
+
+/* Flags used for the SUMMARY field in a gpgme_signature_t.  */
+typedef enum
+  {
+    GPGME_SIGSUM_VALID       = 0x0001,  /* The signature is fully valid.  */
+    GPGME_SIGSUM_GREEN       = 0x0002,  /* The signature is good.  */
+    GPGME_SIGSUM_RED         = 0x0004,  /* The signature is bad.  */
+    GPGME_SIGSUM_KEY_REVOKED = 0x0010,  /* One key has been revoked.  */
+    GPGME_SIGSUM_KEY_EXPIRED = 0x0020,  /* One key has expired.  */
+    GPGME_SIGSUM_SIG_EXPIRED = 0x0040,  /* The signature has expired.  */
+    GPGME_SIGSUM_KEY_MISSING = 0x0080,  /* Can't verify: key missing.  */
+    GPGME_SIGSUM_CRL_MISSING = 0x0100,  /* CRL not available.  */
+    GPGME_SIGSUM_CRL_TOO_OLD = 0x0200,  /* Available CRL is too old.  */
+    GPGME_SIGSUM_BAD_POLICY  = 0x0400,  /* A policy was not met.  */
+    GPGME_SIGSUM_SYS_ERROR   = 0x0800   /* A system error occured.  */
+  }
+gpgme_sigsum_t;
+
+struct _gpgme_signature
+{
+  struct _gpgme_signature *next;
+
+  /* A summary of the signature status.  */
+  gpgme_sigsum_t summary;
+
+  /* The fingerprint or key ID of the signature.  */
+  char *fpr;
+
+  /* The status of the signature.  */
+  gpgme_error_t status;
+
+  /* Notation data and policy URLs.  */
+  gpgme_sig_notation_t notations;
+
+  /* Signature creation time.  */
+  unsigned long timestamp;
+
+  /* Signature exipration time or 0.  */
+  unsigned long exp_timestamp;
+
+  /* Key should not have been used for signing.  */
+  unsigned int wrong_key_usage : 1;
+
+  /* PKA status: 0 = not available, 1 = bad, 2 = okay, 3 = RFU. */
+  unsigned int pka_trust : 2;
+
+  /* Validity has been verified using the chain model. */
+  unsigned int chain_model : 1;
+
+  /* Internal to GPGME, do not use.  */
+  int _unused : 28;
+
+  gpgme_validity_t validity;
+  gpgme_error_t validity_reason;
+
+  /* The public key algorithm used to create the signature.  */
+  gpgme_pubkey_algo_t pubkey_algo;
+
+  /* The hash algorithm used to create the signature.  */
+  gpgme_hash_algo_t hash_algo;
+
+  /* The mailbox from the PKA information or NULL. */
+  char *pka_address;
+};
+typedef struct _gpgme_signature *gpgme_signature_t;
+
+struct _gpgme_op_verify_result
+{
+  gpgme_signature_t signatures;
+
+  /* The original file name of the plaintext message, if
+     available.  */
+  char *file_name;
+};
+typedef struct _gpgme_op_verify_result *gpgme_verify_result_t;
+
+/* Retrieve a pointer to the result of the verify operation.  */
+gpgme_verify_result_t gpgme_op_verify_result (gpgme_ctx_t ctx);
+
+/* Verify within CTX that SIG is a valid signature for TEXT.  */
+gpgme_error_t gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig,
+				     gpgme_data_t signed_text,
+				     gpgme_data_t plaintext);
+gpgme_error_t gpgme_op_verify (gpgme_ctx_t ctx, gpgme_data_t sig,
+			       gpgme_data_t signed_text,
+			       gpgme_data_t plaintext);
+
+
+/* Import.  */
+
+/* The key was new.  */
+#define GPGME_IMPORT_NEW	1
+
+/* The key contained new user IDs.  */
+#define GPGME_IMPORT_UID	2
+
+/* The key contained new signatures.  */
+#define GPGME_IMPORT_SIG	4
+
+/* The key contained new sub keys.  */
+#define GPGME_IMPORT_SUBKEY	8
+
+/* The key contained a secret key.  */
+#define GPGME_IMPORT_SECRET	16
+
+
+struct _gpgme_import_status
+{
+  struct _gpgme_import_status *next;
+
+  /* Fingerprint.  */
+  char *fpr;
+
+  /* If a problem occured, the reason why the key could not be
+     imported.  Otherwise GPGME_No_Error.  */
+  gpgme_error_t result;
+
+  /* The result of the import, the GPGME_IMPORT_* values bit-wise
+     ORed.  0 means the key was already known and no new components
+     have been added.  */
+  unsigned int status;
+};
+typedef struct _gpgme_import_status *gpgme_import_status_t;
+
+/* Import.  */
+struct _gpgme_op_import_result
+{
+  /* Number of considered keys.  */
+  int considered;
+
+  /* Keys without user ID.  */
+  int no_user_id;
+
+  /* Imported keys.  */
+  int imported;
+
+  /* Imported RSA keys.  */
+  int imported_rsa;
+
+  /* Unchanged keys.  */
+  int unchanged;
+
+  /* Number of new user ids.  */
+  int new_user_ids;
+
+  /* Number of new sub keys.  */
+  int new_sub_keys;
+
+  /* Number of new signatures.  */
+  int new_signatures;
+
+  /* Number of new revocations.  */
+  int new_revocations;
+
+  /* Number of secret keys read.  */
+  int secret_read;
+
+  /* Number of secret keys imported.  */
+  int secret_imported;
+
+  /* Number of secret keys unchanged.  */
+  int secret_unchanged;
+
+  /* Number of new keys skipped.  */
+  int skipped_new_keys;
+
+  /* Number of keys not imported.  */
+  int not_imported;
+
+  /* List of keys for which an import was attempted.  */
+  gpgme_import_status_t imports;
+};
+typedef struct _gpgme_op_import_result *gpgme_import_result_t;
+
+/* Retrieve a pointer to the result of the import operation.  */
+gpgme_import_result_t gpgme_op_import_result (gpgme_ctx_t ctx);
+
+/* Import the key in KEYDATA into the keyring.  */
+gpgme_error_t gpgme_op_import_start (gpgme_ctx_t ctx, gpgme_data_t keydata);
+gpgme_error_t gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata);
+gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata,
+				   int *nr) _GPGME_DEPRECATED;
+
+
+/* Export the keys found by PATTERN into KEYDATA.  */
+gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern,
+				     unsigned int reserved,
+				     gpgme_data_t keydata);
+gpgme_error_t gpgme_op_export (gpgme_ctx_t ctx, const char *pattern,
+			       unsigned int reserved, gpgme_data_t keydata);
+
+gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx,
+					 const char *pattern[],
+					 unsigned int reserved,
+					 gpgme_data_t keydata);
+gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[],
+				   unsigned int reserved,
+				   gpgme_data_t keydata);
+
+
+/* Key generation.  */
+struct _gpgme_op_genkey_result
+{
+  /* A primary key was generated.  */
+  unsigned int primary : 1;
+
+  /* A sub key was generated.  */
+  unsigned int sub : 1;
+
+  /* Internal to GPGME, do not use.  */
+  unsigned int _unused : 30;
+
+  /* The fingerprint of the generated key.  */
+  char *fpr;
+};
+typedef struct _gpgme_op_genkey_result *gpgme_genkey_result_t;
+
+/* Generate a new keypair and add it to the keyring.  PUBKEY and
+   SECKEY should be null for now.  PARMS specifies what keys should be
+   generated.  */
+gpgme_error_t gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms,
+				     gpgme_data_t pubkey, gpgme_data_t seckey);
+gpgme_error_t gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms,
+			       gpgme_data_t pubkey, gpgme_data_t seckey);
+
+/* Retrieve a pointer to the result of the genkey operation.  */
+gpgme_genkey_result_t gpgme_op_genkey_result (gpgme_ctx_t ctx);
+
+
+/* Delete KEY from the keyring.  If ALLOW_SECRET is non-zero, secret
+   keys are also deleted.  */
+gpgme_error_t gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key,
+				     int allow_secret);
+gpgme_error_t gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key,
+			       int allow_secret);
+
+
+/* Edit the key KEY.  Send status and command requests to FNC and
+   output of edit commands to OUT.  */
+gpgme_error_t gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
+				   gpgme_edit_cb_t fnc, void *fnc_value,
+				   gpgme_data_t out);
+gpgme_error_t gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key,
+			     gpgme_edit_cb_t fnc, void *fnc_value,
+			     gpgme_data_t out);
+
+/* Edit the card for the key KEY.  Send status and command requests to
+   FNC and output of edit commands to OUT.  */
+gpgme_error_t gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
+					gpgme_edit_cb_t fnc, void *fnc_value,
+					gpgme_data_t out);
+gpgme_error_t gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key,
+				  gpgme_edit_cb_t fnc, void *fnc_value,
+				  gpgme_data_t out);
+
+
+/* Key management functions.  */
+struct _gpgme_op_keylist_result
+{
+  unsigned int truncated : 1;
+
+  /* Internal to GPGME, do not use.  */
+  unsigned int _unused : 31;
+};
+typedef struct _gpgme_op_keylist_result *gpgme_keylist_result_t;
+
+/* Retrieve a pointer to the result of the key listing operation.  */
+gpgme_keylist_result_t gpgme_op_keylist_result (gpgme_ctx_t ctx);
+
+/* Start a keylist operation within CTX, searching for keys which
+   match PATTERN.  If SECRET_ONLY is true, only secret keys are
+   returned.  */
+gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern,
+				      int secret_only);
+gpgme_error_t gpgme_op_keylist_ext_start (gpgme_ctx_t ctx,
+					  const char *pattern[],
+					  int secret_only, int reserved);
+
+/* Return the next key from the keylist in R_KEY.  */
+gpgme_error_t gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key);
+
+/* Terminate a pending keylist operation within CTX.  */
+gpgme_error_t gpgme_op_keylist_end (gpgme_ctx_t ctx);
+
+
+/* Trust items and operations.  */
+
+struct _gpgme_trust_item
+{
+  /* Internal to GPGME, do not use.  */
+  unsigned int _refs;
+
+  /* The key ID to which the trust item belongs.  */
+  char *keyid;
+
+  /* Internal to GPGME, do not use.  */
+  char _keyid[16 + 1];
+
+  /* The type of the trust item, 1 refers to a key, 2 to a user ID.  */
+  int type;
+
+  /* The trust level.  */
+  int level;
+
+  /* The owner trust if TYPE is 1.  */
+  char *owner_trust;
+
+  /* Internal to GPGME, do not use.  */
+  char _owner_trust[2];
+
+  /* The calculated validity.  */
+  char *validity;
+ 
+  /* Internal to GPGME, do not use.  */
+  char _validity[2];
+
+  /* The user name if TYPE is 2.  */
+  char *name;
+};
+typedef struct _gpgme_trust_item *gpgme_trust_item_t;
+
+/* Start a trustlist operation within CTX, searching for trust items
+   which match PATTERN.  */
+gpgme_error_t gpgme_op_trustlist_start (gpgme_ctx_t ctx,
+					const char *pattern, int max_level);
+
+/* Return the next trust item from the trustlist in R_ITEM.  */
+gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx,
+				       gpgme_trust_item_t *r_item);
+
+/* Terminate a pending trustlist operation within CTX.  */
+gpgme_error_t gpgme_op_trustlist_end (gpgme_ctx_t ctx);
+
+/* Acquire a reference to ITEM.  */
+void gpgme_trust_item_ref (gpgme_trust_item_t item);
+
+/* Release a reference to ITEM.  If this was the last one the trust
+   item is destroyed.  */
+void gpgme_trust_item_unref (gpgme_trust_item_t item);
+
+/* Release the trust item ITEM.  Deprecated, use
+   gpgme_trust_item_unref.  */
+void gpgme_trust_item_release (gpgme_trust_item_t item) _GPGME_DEPRECATED;
+
+/* Return the value of the attribute WHAT of ITEM, which has to be
+   representable by a string.  Deprecated, use trust item structure
+   directly.  */
+const char *gpgme_trust_item_get_string_attr (gpgme_trust_item_t item,
+					      _gpgme_attr_t what,
+					      const void *reserved, int idx)
+     _GPGME_DEPRECATED;
+
+/* Return the value of the attribute WHAT of KEY, which has to be
+   representable by an integer.  IDX specifies a running index if the
+   attribute appears more than once in the key.  Deprecated, use trust
+   item structure directly.  */
+int gpgme_trust_item_get_int_attr (gpgme_trust_item_t item, _gpgme_attr_t what,
+				   const void *reserved, int idx)
+     _GPGME_DEPRECATED;
+
+
+/* Return the auditlog for the current session.  This may be called
+   after a successful or failed operation.  If no audit log is
+   available GPG_ERR_NO_DATA is returned.  */
+gpgme_error_t gpgme_op_getauditlog_start (gpgme_ctx_t ctx, gpgme_data_t output,
+                                          unsigned int flags);
+gpgme_error_t gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, 
+                                    unsigned int flags);
+
+
+/* Interface to gpgconf(1).  */
+
+/* The expert level at which a configuration option or group of
+   options should be displayed.  See the gpgconf(1) documentation for
+   more details.  */
+typedef enum
+  {
+    GPGME_CONF_BASIC = 0,
+    GPGME_CONF_ADVANCED = 1,
+    GPGME_CONF_EXPERT = 2,
+    GPGME_CONF_INVISIBLE = 3,
+    GPGME_CONF_INTERNAL = 4
+  }
+gpgme_conf_level_t;
+
+
+/* The data type of a configuration option argument.  See the gpgconf(1)
+   documentation for more details.  */
+typedef enum
+  {
+    /* Basic types.  */
+    GPGME_CONF_NONE = 0,
+    GPGME_CONF_STRING = 1,
+    GPGME_CONF_INT32 = 2,
+    GPGME_CONF_UINT32 = 3,
+
+    /* Complex types.  */
+    GPGME_CONF_FILENAME = 32,
+    GPGME_CONF_LDAP_SERVER = 33,
+    GPGME_CONF_KEY_FPR = 34,
+    GPGME_CONF_PUB_KEY = 35,
+    GPGME_CONF_SEC_KEY = 36,
+    GPGME_CONF_ALIAS_LIST = 37
+  }
+gpgme_conf_type_t;
+/* Macro for backward compatibility (even though it was undocumented
+   and marked as experimental in 1.1.6 - will be removed after 1.1.7): */
+#define GPGME_CONF_PATHNAME GPGME_CONF_FILENAME
+
+
+/* This represents a single argument for a configuration option.
+   Which of the members of value is used depends on the ALT_TYPE.  */
+typedef struct gpgme_conf_arg
+{
+  struct gpgme_conf_arg *next;
+  /* True if the option appears without an (optional) argument.  */
+  unsigned int no_arg;
+  union
+  {
+    unsigned int count;
+    unsigned int uint32;
+    int int32;
+    char *string;
+  } value;
+} *gpgme_conf_arg_t;
+
+
+/* The flags of a configuration option.  See the gpg-conf
+   documentation for details.  */
+#define GPGME_CONF_GROUP	(1 << 0)
+#define GPGME_CONF_OPTIONAL	(1 << 1)
+#define GPGME_CONF_LIST		(1 << 2)
+#define GPGME_CONF_RUNTIME	(1 << 3)
+#define GPGME_CONF_DEFAULT	(1 << 4)
+#define GPGME_CONF_DEFAULT_DESC	(1 << 5)
+#define GPGME_CONF_NO_ARG_DESC	(1 << 6)
+#define GPGME_CONF_NO_CHANGE	(1 << 7)
+
+
+/* The representation of a single configuration option.  See the
+   gpg-conf documentation for details.  */
+typedef struct gpgme_conf_opt
+{
+  struct gpgme_conf_opt *next;
+  
+  /* The option name.  */
+  char *name;
+
+  /* The flags for this option.  */
+  unsigned int flags;
+
+  /* The level of this option.  */
+  gpgme_conf_level_t level;
+
+  /* The localized description of this option.  */
+  char *description;
+
+  /* The type and alternate type of this option.  */
+  gpgme_conf_type_t type;
+  gpgme_conf_type_t alt_type;
+
+  /* The localized (short) name of the argument, if any.  */
+  char *argname;
+
+  /* The default value.  */
+  gpgme_conf_arg_t default_value;
+  char *default_description;
+  
+  /* The default value if the option is not set.  */
+  gpgme_conf_arg_t no_arg_value;
+  char *no_arg_description;
+
+  /* The current value if the option is set.  */
+  gpgme_conf_arg_t value;
+
+  /* The new value, if any.  NULL means reset to default.  */
+  int change_value;
+  gpgme_conf_arg_t new_value;
+
+  /* Free for application use.  */
+  void *user_data;
+} *gpgme_conf_opt_t;
+
+
+/* The representation of a component that can be configured.  See the
+   gpg-conf documentation for details.  */
+typedef struct gpgme_conf_comp
+{
+  struct gpgme_conf_comp *next;
+
+  /* Internal to GPGME, do not use!  */
+  gpgme_conf_opt_t *_last_opt_p;
+
+  /* The component name.  */
+  char *name;
+
+  /* A human-readable description for the component.  */
+  char *description;
+
+  /* The program name (an absolute path to the program).  */
+  char *program_name;  
+
+  /* A linked list of options for this component.  */
+  struct gpgme_conf_opt *options;
+} *gpgme_conf_comp_t;
+
+
+/* Allocate a new gpgme_conf_arg_t.  If VALUE is NULL, a "no arg
+   default" is prepared.  If type is a string type, VALUE should point
+   to the string.  Else, it should point to an unsigned or signed
+   integer respectively.  */
+gpgme_error_t gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
+				  gpgme_conf_type_t type, void *value);
+
+/* This also releases all chained argument structures!  */
+void gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type);
+
+/* Register a change for the value of OPT to ARG.  If RESET is 1 (do
+   not use any values but 0 or 1), ARG is ignored and the option is
+   not changed (reverting a previous change).  Otherwise, if ARG is
+   NULL, the option is cleared or reset to its default.  */
+gpgme_error_t gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset,
+				     gpgme_conf_arg_t arg);
+
+/* Release a set of configurations.  */
+void gpgme_conf_release (gpgme_conf_comp_t conf);
+ 
+/* Retrieve the current configurations.  */
+gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p);
+
+/* Save the configuration of component comp.  This function does not
+   follow chained components!  */
+gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp);
+
+
+/* Various functions.  */
+
+/* Check that the library fulfills the version requirement.  */
+const char *gpgme_check_version (const char *req_version);
+
+/* Get the information about the configured and installed engines.  A
+   pointer to the first engine in the statically allocated linked list
+   is returned in *INFO.  If an error occurs, it is returned.  The
+   returned data is valid until the next gpgme_set_engine_info.  */
+gpgme_error_t gpgme_get_engine_info (gpgme_engine_info_t *engine_info);
+
+/* Set the default engine info for the protocol PROTO to the file name
+   FILE_NAME and the home directory HOME_DIR.  */
+gpgme_error_t gpgme_set_engine_info (gpgme_protocol_t proto,
+				     const char *file_name,
+				     const char *home_dir);
+
+
+/* Engine support functions.  */
+
+/* Verify that the engine implementing PROTO is installed and
+   available.  */
+gpgme_error_t gpgme_engine_check_version (gpgme_protocol_t proto);
+
+
+/* Deprecated types.  */
+typedef gpgme_ctx_t GpgmeCtx _GPGME_DEPRECATED;
+typedef gpgme_data_t GpgmeData _GPGME_DEPRECATED;
+typedef gpgme_error_t GpgmeError _GPGME_DEPRECATED;
+typedef gpgme_data_encoding_t GpgmeDataEncoding _GPGME_DEPRECATED;
+typedef gpgme_pubkey_algo_t GpgmePubKeyAlgo _GPGME_DEPRECATED;
+typedef gpgme_hash_algo_t GpgmeHashAlgo _GPGME_DEPRECATED;
+typedef gpgme_sig_stat_t GpgmeSigStat _GPGME_DEPRECATED;
+typedef gpgme_sig_mode_t GpgmeSigMode _GPGME_DEPRECATED;
+typedef gpgme_attr_t GpgmeAttr _GPGME_DEPRECATED;
+typedef gpgme_validity_t GpgmeValidity _GPGME_DEPRECATED;
+typedef gpgme_protocol_t GpgmeProtocol _GPGME_DEPRECATED;
+typedef gpgme_engine_info_t GpgmeEngineInfo _GPGME_DEPRECATED;
+typedef gpgme_subkey_t GpgmeSubkey _GPGME_DEPRECATED;
+typedef gpgme_key_sig_t GpgmeKeySig _GPGME_DEPRECATED;
+typedef gpgme_user_id_t GpgmeUserID _GPGME_DEPRECATED;
+typedef gpgme_key_t GpgmeKey _GPGME_DEPRECATED;
+typedef gpgme_passphrase_cb_t GpgmePassphraseCb _GPGME_DEPRECATED;
+typedef gpgme_progress_cb_t GpgmeProgressCb _GPGME_DEPRECATED;
+typedef gpgme_io_cb_t GpgmeIOCb _GPGME_DEPRECATED;
+typedef gpgme_register_io_cb_t GpgmeRegisterIOCb _GPGME_DEPRECATED;
+typedef gpgme_remove_io_cb_t GpgmeRemoveIOCb _GPGME_DEPRECATED;
+typedef gpgme_event_io_t GpgmeEventIO _GPGME_DEPRECATED;
+typedef gpgme_event_io_cb_t GpgmeEventIOCb _GPGME_DEPRECATED;
+#define GpgmeIOCbs gpgme_io_cbs
+typedef gpgme_data_read_cb_t GpgmeDataReadCb _GPGME_DEPRECATED;
+typedef gpgme_data_write_cb_t GpgmeDataWriteCb _GPGME_DEPRECATED;
+typedef gpgme_data_seek_cb_t GpgmeDataSeekCb _GPGME_DEPRECATED;
+typedef gpgme_data_release_cb_t GpgmeDataReleaseCb _GPGME_DEPRECATED;
+#define GpgmeDataCbs gpgme_data_cbs
+typedef gpgme_encrypt_result_t GpgmeEncryptResult _GPGME_DEPRECATED;
+typedef gpgme_sig_notation_t GpgmeSigNotation _GPGME_DEPRECATED;
+typedef	gpgme_signature_t GpgmeSignature _GPGME_DEPRECATED;
+typedef gpgme_verify_result_t GpgmeVerifyResult _GPGME_DEPRECATED;
+typedef gpgme_import_status_t GpgmeImportStatus _GPGME_DEPRECATED;
+typedef gpgme_import_result_t GpgmeImportResult _GPGME_DEPRECATED;
+typedef gpgme_genkey_result_t GpgmeGenKeyResult _GPGME_DEPRECATED;
+typedef	gpgme_trust_item_t GpgmeTrustItem _GPGME_DEPRECATED;
+typedef gpgme_status_code_t GpgmeStatusCode _GPGME_DEPRECATED;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* GPGME_H */
diff --git a/src/Bindings/Gpgme.hsc b/src/Bindings/Gpgme.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Gpgme.hsc
@@ -0,0 +1,465 @@
+#include <bindings.dsl.h>
+#include <gpgme.h>
+
+-- | <http://www.gnupg.org/gpgme.html>
+
+module Bindings.Gpgme where
+#strict_import
+
+#integral_t off_t
+#integral_t ssize_t
+
+#integral_t gpgme_ctx_t
+#integral_t gpgme_data_t
+#integral_t gpg_error_t
+#integral_t gpgme_error_t
+#integral_t gpg_err_code_t
+#integral_t gpgme_err_code_t
+#integral_t gpg_err_source_t
+#integral_t gpgme_err_source_t
+
+#cinline gpgme_err_make , <gpgme_err_source_t> -> <gpgme_err_code_t> -> IO <gpgme_error_t>
+#cinline gpgme_error , <gpgme_err_code_t> -> IO <gpgme_error_t>
+#cinline gpgme_err_code , <gpgme_error_t> -> IO <gpgme_err_code_t>
+#cinline gpgme_err_source , <gpgme_error_t> -> IO <gpgme_err_source_t>
+
+#ccall gpgme_strerror , <gpgme_error_t> -> IO CString
+#ccall gpgme_strerror_r , <gpg_error_t> -> CString -> CSize -> IO CInt
+#ccall gpgme_strsource , <gpgme_error_t> -> IO CString
+#ccall gpgme_err_code_from_errno , CInt -> IO <gpgme_err_code_t>
+#ccall gpgme_err_code_to_errno , <gpgme_err_code_t> -> IO CInt
+#ccall gpgme_err_make_from_errno , <gpgme_err_source_t> -> CInt -> IO <gpgme_error_t>
+#ccall gpgme_error_from_errno , CInt -> IO <gpgme_err_code_t>
+
+#integral_t gpgme_data_encoding_t
+#num GPGME_DATA_ENCODING_NONE
+#num GPGME_DATA_ENCODING_BINARY
+#num GPGME_DATA_ENCODING_BASE64
+#num GPGME_DATA_ENCODING_ARMOR
+
+#integral_t gpgme_pubkey_algo_t
+#num GPGME_PK_RSA
+#num GPGME_PK_RSA_E
+#num GPGME_PK_RSA_S
+#num GPGME_PK_ELG_E
+#num GPGME_PK_DSA
+#num GPGME_PK_ELG
+
+#integral_t gpgme_hash_algo_t
+#num GPGME_MD_NONE
+#num GPGME_MD_MD5
+#num GPGME_MD_SHA1
+#num GPGME_MD_RMD160
+#num GPGME_MD_MD2
+#num GPGME_MD_TIGER
+#num GPGME_MD_HAVAL
+#num GPGME_MD_SHA256
+#num GPGME_MD_SHA384
+#num GPGME_MD_SHA512
+#num GPGME_MD_MD4
+#num GPGME_MD_CRC32
+#num GPGME_MD_CRC32_RFC1510
+#num GPGME_MD_CRC24_RFC2440
+
+#integral_t gpgme_sig_mode_t
+#num GPGME_SIG_MODE_NORMAL
+#num GPGME_SIG_MODE_DETACH
+#num GPGME_SIG_MODE_CLEAR
+
+#integral_t gpgme_validity_t
+#num GPGME_VALIDITY_UNKNOWN
+#num GPGME_VALIDITY_UNDEFINED
+#num GPGME_VALIDITY_NEVER
+#num GPGME_VALIDITY_MARGINAL
+#num GPGME_VALIDITY_FULL
+#num GPGME_VALIDITY_ULTIMATE
+
+#integral_t gpgme_protocol_t
+#num GPGME_PROTOCOL_OpenPGP
+#num GPGME_PROTOCOL_CMS
+#num GPGME_PROTOCOL_GPGCONF
+#num GPGME_PROTOCOL_UNKNOWN
+
+#integral_t gpgme_keylist_mode_t
+#num GPGME_KEYLIST_MODE_LOCAL
+#num GPGME_KEYLIST_MODE_EXTERN
+#num GPGME_KEYLIST_MODE_SIGS
+#num GPGME_KEYLIST_MODE_SIG_NOTATIONS
+#num GPGME_KEYLIST_MODE_VALIDATE
+#num GPGME_AUDITLOG_HTML
+#num GPGME_AUDITLOG_WITH_HELP
+
+#integral_t gpgme_sig_notation_flags_t
+#num GPGME_SIG_NOTATION_HUMAN_READABLE
+#num GPGME_SIG_NOTATION_CRITICAL
+
+#integral_t gpgme_sig_notation_t
+
+#integral_t gpgme_status_code_t
+#num GPGME_STATUS_EOF
+#num GPGME_STATUS_ENTER
+#num GPGME_STATUS_LEAVE
+#num GPGME_STATUS_ABORT
+#num GPGME_STATUS_GOODSIG
+#num GPGME_STATUS_BADSIG
+#num GPGME_STATUS_ERRSIG
+#num GPGME_STATUS_BADARMOR
+#num GPGME_STATUS_RSA_OR_IDEA
+#num GPGME_STATUS_KEYEXPIRED
+#num GPGME_STATUS_KEYREVOKED
+#num GPGME_STATUS_TRUST_UNDEFINED
+#num GPGME_STATUS_TRUST_NEVER
+#num GPGME_STATUS_TRUST_MARGINAL
+#num GPGME_STATUS_TRUST_FULLY
+#num GPGME_STATUS_TRUST_ULTIMATE
+#num GPGME_STATUS_SHM_INFO
+#num GPGME_STATUS_SHM_GET
+#num GPGME_STATUS_SHM_GET_BOOL
+#num GPGME_STATUS_SHM_GET_HIDDEN
+#num GPGME_STATUS_NEED_PASSPHRASE
+#num GPGME_STATUS_VALIDSIG
+#num GPGME_STATUS_SIG_ID
+#num GPGME_STATUS_ENC_TO
+#num GPGME_STATUS_NODATA
+#num GPGME_STATUS_BAD_PASSPHRASE
+#num GPGME_STATUS_NO_PUBKEY
+#num GPGME_STATUS_NO_SECKEY
+#num GPGME_STATUS_NEED_PASSPHRASE_SYM
+#num GPGME_STATUS_DECRYPTION_FAILED
+#num GPGME_STATUS_DECRYPTION_OKAY
+#num GPGME_STATUS_MISSING_PASSPHRASE
+#num GPGME_STATUS_GOOD_PASSPHRASE
+#num GPGME_STATUS_GOODMDC
+#num GPGME_STATUS_BADMDC
+#num GPGME_STATUS_ERRMDC
+#num GPGME_STATUS_IMPORTED
+#num GPGME_STATUS_IMPORT_OK
+#num GPGME_STATUS_IMPORT_PROBLEM
+#num GPGME_STATUS_IMPORT_RES
+#num GPGME_STATUS_FILE_START
+#num GPGME_STATUS_FILE_DONE
+#num GPGME_STATUS_FILE_ERROR
+#num GPGME_STATUS_BEGIN_DECRYPTION
+#num GPGME_STATUS_END_DECRYPTION
+#num GPGME_STATUS_BEGIN_ENCRYPTION
+#num GPGME_STATUS_END_ENCRYPTION
+#num GPGME_STATUS_DELETE_PROBLEM
+#num GPGME_STATUS_GET_BOOL
+#num GPGME_STATUS_GET_LINE
+#num GPGME_STATUS_GET_HIDDEN
+#num GPGME_STATUS_GOT_IT
+#num GPGME_STATUS_PROGRESS
+#num GPGME_STATUS_SIG_CREATED
+#num GPGME_STATUS_SESSION_KEY
+#num GPGME_STATUS_NOTATION_NAME
+#num GPGME_STATUS_NOTATION_DATA
+#num GPGME_STATUS_POLICY_URL
+#num GPGME_STATUS_BEGIN_STREAM
+#num GPGME_STATUS_END_STREAM
+#num GPGME_STATUS_KEY_CREATED
+#num GPGME_STATUS_USERID_HINT
+#num GPGME_STATUS_UNEXPECTED
+#num GPGME_STATUS_INV_RECP
+#num GPGME_STATUS_NO_RECP
+#num GPGME_STATUS_ALREADY_SIGNED
+#num GPGME_STATUS_SIGEXPIRED
+#num GPGME_STATUS_EXPSIG
+#num GPGME_STATUS_EXPKEYSIG
+#num GPGME_STATUS_TRUNCATED
+#num GPGME_STATUS_ERROR
+#num GPGME_STATUS_NEWSIG
+#num GPGME_STATUS_REVKEYSIG
+#num GPGME_STATUS_SIG_SUBPACKET
+#num GPGME_STATUS_NEED_PASSPHRASE_PIN
+#num GPGME_STATUS_SC_OP_FAILURE
+#num GPGME_STATUS_SC_OP_SUCCESS
+#num GPGME_STATUS_CARDCTRL
+#num GPGME_STATUS_BACKUP_KEY_CREATED
+#num GPGME_STATUS_PKA_TRUST_BAD
+#num GPGME_STATUS_PKA_TRUST_GOOD
+#num GPGME_STATUS_PLAINTEXT
+
+#integral_t gpgme_engine_info_t
+#integral_t gpgme_subkey_t
+#integral_t gpgme_key_sig_t
+#integral_t gpgme_user_id_t
+#integral_t gpgme_key_t
+
+#callback gpgme_passphrase_cb_t , Ptr () -> CString -> CString -> CInt -> CInt -> IO <gpgme_error_t>
+#callback gpgme_progress_cb_t , Ptr () -> CString -> CInt -> CInt -> CInt -> IO ()
+#callback gpgme_edit_cb_t , Ptr () -> <gpgme_status_code_t> -> CString -> CInt -> IO <gpgme_error_t>
+
+#ccall gpgme_new , Ptr <gpgme_ctx_t> -> IO <gpgme_error_t>
+#ccall gpgme_release , <gpgme_ctx_t> -> IO ()
+#ccall gpgme_set_protocol , <gpgme_ctx_t> -> <gpgme_protocol_t> -> IO <gpgme_error_t>
+#ccall gpgme_get_protocol , <gpgme_ctx_t> -> IO <gpgme_protocol_t>
+#ccall gpgme_get_protocol_name , <gpgme_protocol_t> -> IO CString
+#ccall gpgme_set_armor , <gpgme_ctx_t> -> CInt -> IO ()
+#ccall gpgme_get_armor , <gpgme_ctx_t> -> IO CInt
+#ccall gpgme_set_textmode , <gpgme_ctx_t> -> CInt -> IO ()
+#ccall gpgme_get_textmode , <gpgme_ctx_t> -> IO CInt
+
+#num GPGME_INCLUDE_CERTS_DEFAULT
+
+#ccall gpgme_set_include_certs , <gpgme_ctx_t> -> CInt -> IO ()
+#ccall gpgme_get_include_certs , <gpgme_ctx_t> -> IO CInt
+#ccall gpgme_set_keylist_mode , <gpgme_ctx_t> -> <gpgme_keylist_mode_t> -> IO <gpgme_error_t>
+#ccall gpgme_get_keylist_mode , <gpgme_ctx_t> -> IO <gpgme_keylist_mode_t>
+#ccall gpgme_set_passphrase_cb , <gpgme_ctx_t> -> <gpgme_passphrase_cb_t> -> Ptr () -> IO ()
+#ccall gpgme_get_passphrase_cb , <gpgme_ctx_t> -> Ptr <gpgme_passphrase_cb_t> -> Ptr (Ptr ()) -> IO ()
+#ccall gpgme_set_progress_cb , <gpgme_ctx_t> -> <gpgme_progress_cb_t> -> Ptr () -> IO ()
+#ccall gpgme_get_progress_cb , <gpgme_ctx_t> -> Ptr <gpgme_progress_cb_t> -> Ptr (Ptr ()) -> IO ()
+#ccall gpgme_set_locale , <gpgme_ctx_t> -> CInt -> CString -> IO <gpgme_error_t>
+#ccall gpgme_ctx_get_engine_info , <gpgme_ctx_t> -> IO <gpgme_engine_info_t>
+#ccall gpgme_ctx_set_engine_info , <gpgme_ctx_t> -> <gpgme_protocol_t> -> CString -> CString -> IO <gpgme_error_t>
+#ccall gpgme_pubkey_algo_name , <gpgme_pubkey_algo_t> -> IO CString
+#ccall gpgme_hash_algo_name , <gpgme_hash_algo_t> -> IO CString
+#ccall gpgme_signers_clear , <gpgme_ctx_t> -> IO ()
+#ccall gpgme_signers_add , <gpgme_ctx_t> -> <gpgme_key_t> -> IO <gpgme_error_t>
+#ccall gpgme_signers_enum , <gpgme_ctx_t> -> CInt -> IO <gpgme_key_t>
+#ccall gpgme_sig_notation_clear , <gpgme_ctx_t> -> IO ()
+#ccall gpgme_sig_notation_add , <gpgme_ctx_t> -> CString -> CString -> <gpgme_sig_notation_flags_t> -> IO <gpgme_error_t>
+#ccall gpgme_sig_notation_get , <gpgme_ctx_t> -> IO <gpgme_sig_notation_t>
+
+#callback gpgme_io_cb_t , Ptr () -> CInt -> IO <gpgme_error_t>
+#callback gpgme_register_io_cb_t , Ptr () -> CInt -> CInt -> <gpgme_io_cb_t> -> Ptr () -> Ptr (Ptr ()) -> IO <gpgme_error_t>
+#callback gpgme_remove_io_cb_t , Ptr () -> IO ()
+
+#integral_t gpgme_event_io_t
+#num GPGME_EVENT_START
+#num GPGME_EVENT_DONE
+#num GPGME_EVENT_NEXT_KEY
+#num GPGME_EVENT_NEXT_TRUSTITEM
+
+#callback gpgme_event_io_cb_t , Ptr () -> <gpgme_event_io_t> -> Ptr () -> IO ()
+
+#starttype struct gpgme_io_cbs
+#field add , <gpgme_register_io_cb_t>
+#field add_priv , Ptr ()
+#field remove , <gpgme_remove_io_cb_t>
+#field event , <gpgme_event_io_cb_t>
+#field event_priv , Ptr ()
+#stoptype
+
+#synonym_t gpgme_io_cbs_t , Ptr <gpgme_io_cbs>
+
+#ccall gpgme_set_io_cbs , <gpgme_ctx_t> -> <gpgme_io_cbs_t> -> IO ()
+#ccall gpgme_get_io_cbs , <gpgme_ctx_t> -> <gpgme_io_cbs_t> -> IO ()
+#ccall gpgme_wait , <gpgme_ctx_t> -> Ptr <gpgme_error_t> -> CInt -> IO <gpgme_ctx_t>
+
+#callback gpgme_data_read_cb_t , Ptr () -> Ptr () -> CSize -> IO <ssize_t>
+#callback gpgme_data_write_cb_t , Ptr () -> Ptr () -> CSize -> IO <ssize_t>
+#callback gpgme_data_seek_cb_t , Ptr () -> <off_t> -> CInt -> IO <off_t>
+#callback gpgme_data_release_cb_t , Ptr () -> IO ()
+
+#starttype struct gpgme_data_cbs
+#field read , <gpgme_data_read_cb_t>
+#field write , <gpgme_data_write_cb_t>
+#field seek , <gpgme_data_seek_cb_t>
+#field release , <gpgme_data_release_cb_t>
+#stoptype
+
+#synonym_t gpgme_data_cbs_t , Ptr <gpgme_data_cbs>
+
+#ccall gpgme_data_read , <gpgme_data_t> -> Ptr () -> CSize -> IO <ssize_t>
+#ccall gpgme_data_write , <gpgme_data_t> -> Ptr () -> CSize -> IO <ssize_t>
+#ccall gpgme_data_seek , <gpgme_data_t> -> <off_t> -> CInt -> IO <off_t>
+#ccall gpgme_data_new , Ptr <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_data_release , <gpgme_data_t> -> IO ()
+#ccall gpgme_data_new_from_mem , Ptr <gpgme_data_t> -> CString -> CSize -> CInt -> IO <gpgme_error_t>
+#ccall gpgme_data_release_and_get_mem , <gpgme_data_t> -> Ptr CSize -> IO CString
+#ccall gpgme_free , Ptr () -> IO ()
+#ccall gpgme_data_new_from_cbs , Ptr <gpgme_data_t> -> <gpgme_data_cbs_t> -> Ptr () -> IO <gpgme_error_t>
+#ccall gpgme_data_new_from_fd , Ptr <gpgme_data_t> -> CInt -> IO <gpgme_error_t>
+#ccall gpgme_data_new_from_stream , Ptr <gpgme_data_t> -> Ptr CFile -> IO <gpgme_error_t>
+#ccall gpgme_data_get_encoding , <gpgme_data_t> -> IO <gpgme_data_encoding_t>
+#ccall gpgme_data_set_encoding , <gpgme_data_t> -> <gpgme_data_encoding_t> -> IO <gpgme_error_t>
+#ccall gpgme_data_get_file_name , <gpgme_data_t> -> IO CString
+#ccall gpgme_data_set_file_name , <gpgme_data_t> -> CString -> IO <gpgme_error_t>
+#ccall gpgme_data_new_from_file , Ptr <gpgme_data_t> -> CString -> CInt -> IO <gpgme_error_t>
+#ccall gpgme_data_new_from_filepart , Ptr <gpgme_data_t> -> CString -> Ptr CFile -> <off_t> -> CSize -> IO <gpgme_error_t>
+#ccall gpgme_get_key , <gpgme_ctx_t> -> CString -> Ptr <gpgme_key_t> -> CInt -> IO <gpgme_error_t>
+#ccall gpgme_key_ref , <gpgme_key_t> -> IO ()
+#ccall gpgme_key_unref , <gpgme_key_t> -> IO ()
+#ccall gpgme_key_release , <gpgme_key_t> -> IO ()
+#ccall gpgme_cancel , <gpgme_ctx_t> -> IO <gpgme_error_t>
+#ccall gpgme_cancel_async , <gpgme_ctx_t> -> IO <gpgme_error_t>
+
+#integral_t gpgme_invalid_key_t
+
+#integral_t gpgme_encrypt_result_t
+
+#ccall gpgme_op_encrypt_result , <gpgme_ctx_t> -> IO <gpgme_encrypt_result_t>
+
+#integral_t gpgme_encrypt_flags_t
+#num GPGME_ENCRYPT_ALWAYS_TRUST
+
+#ccall gpgme_op_encrypt_start , <gpgme_ctx_t> -> Ptr <gpgme_key_t> -> <gpgme_encrypt_flags_t> -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_encrypt , <gpgme_ctx_t> -> Ptr <gpgme_key_t> -> <gpgme_encrypt_flags_t> -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_encrypt_sign_start , <gpgme_ctx_t> -> Ptr <gpgme_key_t> -> <gpgme_encrypt_flags_t> -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_encrypt_sign , <gpgme_ctx_t> -> Ptr <gpgme_key_t> -> <gpgme_encrypt_flags_t> -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+
+#integral_t gpgme_recipient_t
+#integral_t gpgme_decrypt_result_t
+
+#ccall gpgme_op_decrypt_result , <gpgme_ctx_t> -> IO <gpgme_decrypt_result_t>
+#ccall gpgme_op_decrypt_start , <gpgme_ctx_t> -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_decrypt , <gpgme_ctx_t> -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_decrypt_verify_start , <gpgme_ctx_t> -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_decrypt_verify , <gpgme_ctx_t> -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+
+#integral_t gpgme_new_signature_t
+#integral_t gpgme_sign_result_t
+
+#ccall gpgme_op_sign_result , <gpgme_ctx_t> -> IO <gpgme_sign_result_t>
+#ccall gpgme_op_sign_start , <gpgme_ctx_t> -> <gpgme_data_t> -> <gpgme_data_t> -> <gpgme_sig_mode_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_sign , <gpgme_ctx_t> -> <gpgme_data_t> -> <gpgme_data_t> -> <gpgme_sig_mode_t> -> IO <gpgme_error_t>
+
+#integral_t gpgme_sigsum_t
+#num GPGME_SIGSUM_VALID
+#num GPGME_SIGSUM_GREEN
+#num GPGME_SIGSUM_RED
+#num GPGME_SIGSUM_KEY_REVOKED
+#num GPGME_SIGSUM_KEY_EXPIRED
+#num GPGME_SIGSUM_SIG_EXPIRED
+#num GPGME_SIGSUM_KEY_MISSING
+#num GPGME_SIGSUM_CRL_MISSING
+#num GPGME_SIGSUM_CRL_TOO_OLD
+#num GPGME_SIGSUM_BAD_POLICY
+#num GPGME_SIGSUM_SYS_ERROR
+
+#integral_t gpgme_signature_t
+#integral_t  gpgme_verify_result_t
+
+#ccall gpgme_op_verify_result , <gpgme_ctx_t> -> IO <gpgme_verify_result_t>
+#ccall gpgme_op_verify_start , <gpgme_ctx_t> -> <gpgme_data_t> -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_verify , <gpgme_ctx_t> -> <gpgme_data_t> -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+
+#num GPGME_IMPORT_NEW
+#num GPGME_IMPORT_UID
+#num GPGME_IMPORT_SIG
+#num GPGME_IMPORT_SUBKEY
+#num GPGME_IMPORT_SECRET
+
+#integral_t gpgme_import_status_t
+#integral_t gpgme_import_result_t
+
+#ccall gpgme_op_import_result , <gpgme_ctx_t> -> IO <gpgme_import_result_t>
+#ccall gpgme_op_import_start , <gpgme_ctx_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_import , <gpgme_ctx_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_export_start , <gpgme_ctx_t> -> CString -> CUInt -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_export , <gpgme_ctx_t> -> CString -> CUInt -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_export_ext_start , <gpgme_ctx_t> -> Ptr CString -> CUInt -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_export_ext , <gpgme_ctx_t> -> Ptr CString -> CUInt -> <gpgme_data_t> -> IO <gpgme_error_t>
+
+#integral_t gpgme_genkey_result_t
+
+#ccall gpgme_op_genkey_start , <gpgme_ctx_t> -> CString -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_genkey , <gpgme_ctx_t> -> CString -> <gpgme_data_t> -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_genkey_result , <gpgme_ctx_t> -> IO <gpgme_genkey_result_t>
+#ccall gpgme_op_delete_start , <gpgme_ctx_t> -> <gpgme_key_t> -> CInt -> IO <gpgme_error_t>
+#ccall gpgme_op_delete , <gpgme_ctx_t> -> <gpgme_key_t> -> CInt -> IO <gpgme_error_t>
+#ccall gpgme_op_edit_start , <gpgme_ctx_t> -> <gpgme_key_t> -> <gpgme_edit_cb_t> -> Ptr () -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_edit , <gpgme_ctx_t> -> <gpgme_key_t> -> <gpgme_edit_cb_t> -> Ptr () -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_card_edit_start , <gpgme_ctx_t> -> <gpgme_key_t> -> <gpgme_edit_cb_t> -> Ptr () -> <gpgme_data_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_card_edit , <gpgme_ctx_t> -> <gpgme_key_t> -> <gpgme_edit_cb_t> -> Ptr () -> <gpgme_data_t> -> IO <gpgme_error_t>
+
+#integral_t  gpgme_keylist_result_t
+
+#ccall gpgme_op_keylist_result , <gpgme_ctx_t> -> IO <gpgme_keylist_result_t>
+#ccall gpgme_op_keylist_start , <gpgme_ctx_t> -> CString -> CInt -> IO <gpgme_error_t>
+#ccall gpgme_op_keylist_ext_start , <gpgme_ctx_t> -> Ptr CString -> CInt -> CInt -> IO <gpgme_error_t>
+#ccall gpgme_op_keylist_next , <gpgme_ctx_t> -> Ptr <gpgme_key_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_keylist_end , <gpgme_ctx_t> -> IO <gpgme_error_t>
+
+#integral_t gpgme_trust_item_t
+
+#ccall gpgme_op_trustlist_start , <gpgme_ctx_t> -> CString -> CInt -> IO <gpgme_error_t>
+#ccall gpgme_op_trustlist_next , <gpgme_ctx_t> -> Ptr <gpgme_trust_item_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_trustlist_end , <gpgme_ctx_t> -> IO <gpgme_error_t>
+#ccall gpgme_trust_item_ref , <gpgme_trust_item_t> -> IO ()
+#ccall gpgme_trust_item_unref , <gpgme_trust_item_t> -> IO ()
+#ccall gpgme_op_getauditlog_start , <gpgme_ctx_t> -> <gpgme_data_t> -> CUInt -> IO <gpgme_error_t>
+#ccall gpgme_op_getauditlog , <gpgme_ctx_t> -> <gpgme_data_t> -> CUInt -> IO <gpgme_error_t>
+
+#integral_t gpgme_conf_level_t
+#num GPGME_CONF_BASIC
+#num GPGME_CONF_ADVANCED
+#num GPGME_CONF_EXPERT
+#num GPGME_CONF_INVISIBLE
+#num GPGME_CONF_INTERNAL
+
+#integral_t gpgme_conf_type_t
+#num GPGME_CONF_NONE
+#num GPGME_CONF_STRING
+#num GPGME_CONF_INT32
+#num GPGME_CONF_UINT32
+#num GPGME_CONF_FILENAME
+#num GPGME_CONF_LDAP_SERVER
+#num GPGME_CONF_KEY_FPR
+#num GPGME_CONF_PUB_KEY
+#num GPGME_CONF_SEC_KEY
+#num GPGME_CONF_ALIAS_LIST
+
+#starttype struct gpgme_conf_arg
+#field next , Ptr <gpgme_conf_arg>
+#field no_arg , CUInt
+#field value.count , CUInt
+#field value.uint32 , CUInt
+#field value.int32 , CInt
+#field value.string , CString
+#stoptype
+
+#synonym_t gpgme_conf_arg_t , Ptr <gpgme_conf_arg>
+
+#num GPGME_CONF_GROUP
+#num GPGME_CONF_OPTIONAL
+#num GPGME_CONF_LIST
+#num GPGME_CONF_RUNTIME
+#num GPGME_CONF_DEFAULT
+#num GPGME_CONF_DEFAULT_DESC
+#num GPGME_CONF_NO_ARG_DESC
+#num GPGME_CONF_NO_CHANGE
+
+#starttype struct gpgme_conf_opt
+#field next , Ptr <gpgme_conf_opt>
+#field name , CString
+#field flags , CUInt
+#field level , <gpgme_conf_level_t>
+#field description , CString
+#field type , <gpgme_conf_type_t>
+#field alt_type , <gpgme_conf_type_t>
+#field argname , CString
+#field default_value , <gpgme_conf_arg_t>
+#field default_description , CString
+#field no_arg_value , <gpgme_conf_arg_t>
+#field no_arg_description , CString
+#field value , <gpgme_conf_arg_t>
+#field change_value , CInt
+#field new_value , <gpgme_conf_arg_t>
+#field user_data , Ptr ()
+#stoptype
+
+#synonym_t gpgme_conf_opt_t , Ptr <gpgme_conf_opt>
+
+#starttype struct gpgme_conf_comp
+#field next , Ptr <gpgme_conf_comp>
+#field name , CString
+#field description , CString
+#field program_name , CString
+#field options , Ptr <gpgme_conf_opt>
+#stoptype
+
+#synonym_t gpgme_conf_comp_t , Ptr <gpgme_conf_comp>
+
+#ccall gpgme_conf_arg_new , Ptr <gpgme_conf_arg_t> -> <gpgme_conf_type_t> -> Ptr () -> IO <gpgme_error_t>
+#ccall gpgme_conf_arg_release , <gpgme_conf_arg_t> -> <gpgme_conf_type_t> -> IO ()
+#ccall gpgme_conf_opt_change , <gpgme_conf_opt_t> -> CInt -> <gpgme_conf_arg_t> -> IO <gpgme_error_t>
+#ccall gpgme_conf_release , <gpgme_conf_comp_t> -> IO ()
+#ccall gpgme_op_conf_load , <gpgme_ctx_t> -> Ptr <gpgme_conf_comp_t> -> IO <gpgme_error_t>
+#ccall gpgme_op_conf_save , <gpgme_ctx_t> -> <gpgme_conf_comp_t> -> IO <gpgme_error_t>
+#ccall gpgme_check_version , CString -> IO CString
+#ccall gpgme_get_engine_info , Ptr <gpgme_engine_info_t> -> IO <gpgme_error_t>
+#ccall gpgme_set_engine_info , <gpgme_protocol_t> -> CString -> CString -> IO <gpgme_error_t>
+#ccall gpgme_engine_check_version , <gpgme_protocol_t> -> IO <gpgme_error_t>
+
diff --git a/src/inlines.c b/src/inlines.c
new file mode 100644
--- /dev/null
+++ b/src/inlines.c
@@ -0,0 +1,2 @@
+#include <bindings.cmacros.h>
+#include <gpgme.h>
