1 /* engine-backend.h - A crypto backend for the engine interface.
2 Copyright (C) 2002, 2003, 2004, 2009 g10 Code GmbH
4 This file is part of GPGME.
6 GPGME is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of
9 the License, or (at your option) any later version.
11 GPGME is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef ENGINE_BACKEND_H
21 #define ENGINE_BACKEND_H
27 /* Static functions. */
29 /* Return the default file name for the binary of this engine. */
30 const char *(*get_file_name) (void);
32 /* Return the default home dir for the binary of this engine. If
33 this function pointer is not set, the standard default home dir
34 of the engine is used. */
35 const char *(*get_home_dir) (void);
37 /* Returns a malloced string containing the version of the engine
38 with the given binary file name (or the default if FILE_NAME is
40 char *(*get_version) (const char *file_name);
42 /* Returns a statically allocated string containing the required
44 const char *(*get_req_version) (void);
46 gpgme_error_t (*new) (void **r_engine,
47 const char *file_name, const char *home_dir);
49 /* Member functions. */
50 void (*release) (void *engine);
51 gpgme_error_t (*reset) (void *engine);
52 void (*set_status_handler) (void *engine, engine_status_handler_t fnc,
54 gpgme_error_t (*set_command_handler) (void *engine,
55 engine_command_handler_t fnc,
56 void *fnc_value, gpgme_data_t data);
57 gpgme_error_t (*set_colon_line_handler) (void *engine,
58 engine_colon_line_handler_t fnc,
60 gpgme_error_t (*set_locale) (void *engine, int category, const char *value);
61 gpgme_error_t (*set_protocol) (void *engine, gpgme_protocol_t protocol);
62 gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph,
64 gpgme_error_t (*decrypt_verify) (void *engine, gpgme_data_t ciph,
66 gpgme_error_t (*delete) (void *engine, gpgme_key_t key, int allow_secret);
67 gpgme_error_t (*edit) (void *engine, int type, gpgme_key_t key,
68 gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */);
69 gpgme_error_t (*encrypt) (void *engine, gpgme_key_t recp[],
70 gpgme_encrypt_flags_t flags,
71 gpgme_data_t plain, gpgme_data_t ciph,
73 gpgme_error_t (*encrypt_sign) (void *engine, gpgme_key_t recp[],
74 gpgme_encrypt_flags_t flags,
75 gpgme_data_t plain, gpgme_data_t ciph,
76 int use_armor, gpgme_ctx_t ctx /* FIXME */);
77 gpgme_error_t (*export) (void *engine, const char *pattern,
78 gpgme_export_mode_t mode, gpgme_data_t keydata,
80 gpgme_error_t (*export_ext) (void *engine, const char *pattern[],
81 gpgme_export_mode_t mode, gpgme_data_t keydata,
83 gpgme_error_t (*genkey) (void *engine, gpgme_data_t help_data, int use_armor,
84 gpgme_data_t pubkey, gpgme_data_t seckey);
85 gpgme_error_t (*import) (void *engine, gpgme_data_t keydata,
86 gpgme_key_t *keyarray);
87 gpgme_error_t (*keylist) (void *engine, const char *pattern,
88 int secret_only, gpgme_keylist_mode_t mode);
89 gpgme_error_t (*keylist_ext) (void *engine, const char *pattern[],
90 int secret_only, int reserved,
91 gpgme_keylist_mode_t mode);
92 gpgme_error_t (*sign) (void *engine, gpgme_data_t in, gpgme_data_t out,
93 gpgme_sig_mode_t mode, int use_armor,
94 int use_textmode, int include_certs,
95 gpgme_ctx_t ctx /* FIXME */);
96 gpgme_error_t (*trustlist) (void *engine, const char *pattern);
97 gpgme_error_t (*verify) (void *engine, gpgme_data_t sig,
98 gpgme_data_t signed_text, gpgme_data_t plaintext);
99 gpgme_error_t (*getauditlog) (void *engine, gpgme_data_t output,
101 gpgme_error_t (*opassuan_transact) (void *engine,
103 gpgme_assuan_data_cb_t data_cb,
105 gpgme_assuan_inquire_cb_t inq_cb,
107 gpgme_assuan_status_cb_t status_cb,
108 void *status_cb_value);
110 gpgme_error_t (*conf_load) (void *engine, gpgme_conf_comp_t *conf_p);
111 gpgme_error_t (*conf_save) (void *engine, gpgme_conf_comp_t conf);
113 void (*set_io_cbs) (void *engine, gpgme_io_cbs_t io_cbs);
114 void (*io_event) (void *engine, gpgme_event_io_t type, void *type_data);
116 /* Cancel the whole engine session. */
117 gpgme_error_t (*cancel) (void *engine);
119 /* Cancel only the current operation, not the whole session. */
120 gpgme_error_t (*cancel_op) (void *engine);
122 /* Change the passphrase for KEY. */
123 gpgme_error_t (*passwd) (void *engine, gpgme_key_t key, unsigned int flags);
127 extern struct engine_ops _gpgme_engine_ops_gpg; /* OpenPGP. */
129 extern struct engine_ops _gpgme_engine_ops_gpgsm; /* CMS. */
131 #ifdef ENABLE_GPGCONF
132 extern struct engine_ops _gpgme_engine_ops_gpgconf; /* gpg-conf. */
135 extern struct engine_ops _gpgme_engine_ops_assuan; /* Low-level Assuan. */
138 extern struct engine_ops _gpgme_engine_ops_g13; /* Crypto VFS. */
140 #ifdef ENABLE_UISERVER
141 extern struct engine_ops _gpgme_engine_ops_uiserver;
144 #endif /* ENGINE_BACKEND_H */