Add and rename pinentry OPTION's.
[pwmd.git] / src / agent.h
blob5959c8fe8fcb8f7f98bf23c122cdcec78a2405db
1 /*
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 Ben Kibbey <bjk@luxsci.net>
5 This file is part of pwmd.
7 Pwmd is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
12 Pwmd is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef AGENT_H
21 #define AGENT_H
23 #include "pinentry.h"
25 struct inquire_data_s
27 struct crypto_s *crypto;
28 char *line;
29 size_t len;
30 int preset;
33 struct agent_s
35 assuan_context_t ctx;
36 assuan_context_t client_ctx;
37 membuf_t data;
38 gpg_error_t (*inquire_cb) (void *data, const char *line);
39 void *inquire_data;
40 void *inquire_data2;
41 void *inquire_data3;
42 struct pinentry_option_s pinentry_opts;
43 int restart;
44 size_t inquire_maxlen;
47 void cleanup_agent (struct agent_s *agent);
48 gpg_error_t send_to_agent (struct agent_s *agent, char **result, size_t * len,
49 const char *fmt, ...);
50 gpg_error_t agent_init (struct agent_s **);
51 gpg_error_t encrypt_data_file (assuan_context_t ctx, struct crypto_s *crypto,
52 gcry_sexp_t pubkey, gcry_sexp_t sigpkey,
53 const char *filename, const void *xml,
54 size_t len);
56 gpg_error_t generate_key (struct crypto_s *, char *, int, int);
57 gpg_error_t set_agent_option (struct agent_s *agent, const char *name,
58 const char *value);
59 gpg_error_t set_agent_passphrase (struct crypto_s *crypto, const char *key,
60 size_t len);
61 gpg_error_t set_pinentry_mode (struct agent_s *agent, const char *mode);
62 gpg_error_t get_pubkey (struct crypto_s *crypto, const char *hexgrip,
63 gcry_sexp_t * result);
64 gpg_error_t get_pubkey_bin (struct crypto_s *crypto,
65 const unsigned char *grip, gcry_sexp_t * result);
66 gpg_error_t agent_set_pinentry_options (struct agent_s *agent);
67 gpg_error_t agent_export_common (struct crypto_s *crypto, const char *keygrip,
68 const char *sign_keygrip, int no_passphrase,
69 const void *data, size_t datalen,
70 const char *outfile, const char *keyparams,
71 const char *keyfile);
72 char *default_key_params (struct crypto_s *crypto);
73 gpg_error_t agent_loopback_cb (void *user, const char *keyword);
74 gpg_error_t agent_passwd (struct crypto_s *crypto);
75 gpg_error_t kill_scd (struct agent_s *);
76 gpg_error_t agent_extract_key (struct crypto_s *crypto, unsigned char **result,
77 size_t * result_len);
78 gpg_error_t agent_verify (gcry_sexp_t pkey, gcry_sexp_t sig_sexp,
79 const void *data, size_t len);
80 gpg_error_t send_agent_common_options (struct agent_s *agent);
82 #endif