2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015,
4 Ben Kibbey <bjk@luxsci.net>
6 This file is part of pwmd.
8 Pwmd is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
13 Pwmd is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
25 #include <gpg-error.h>
26 #include <sys/types.h>
33 #elif defined (HAVE_INTTYPES_H)
39 #define CRYPTO_FLAG_NEWFILE 0x0001
40 #define CRYPTO_FLAG_KEYFILE 0x0002 // --passphrase-file with --import
41 #define CRYPTO_FLAG_SYMMETRIC 0x0004
42 #define CRYPTO_FLAG_PASSWD 0x0008
43 #define CRYPTO_FLAG_PASSWD_NEW 0x0010
44 #define CRYPTO_FLAG_PASSWD_SIGN 0x0020
48 char **pubkey
; /* SAVE --keyid */
49 char *sigkey
; /* SAVE --sign-keyid */
50 char *userid
; /* SAVE genkey parameters */
51 gpgme_key_t
*mainkey
; /* GENKEY --subkey-of */
59 assuan_context_t client_ctx
;
61 unsigned char *plaintext
;
62 size_t plaintext_size
;
66 char *filename
; /* the currently opened data file */
68 gpg_error_t progress_rc
;
69 time_t status_timeout
;
74 gpgme_error_t
crypto_init (struct crypto_s
**, void *, const char *, int,
75 char *passphrase_file
);
76 gpgme_error_t
crypto_init_ctx (struct crypto_s
*, int, char *passphrase_file
);
77 gpgme_error_t
crypto_genkey (struct client_s
*, struct crypto_s
*);
78 gpgme_error_t
crypto_encrypt (struct client_s
*, struct crypto_s
*);
79 gpgme_error_t
crypto_decrypt (struct client_s
*, struct crypto_s
*);
80 gpgme_error_t
crypto_passwd (struct client_s
*, struct crypto_s
*);
81 void crypto_free (struct crypto_s
*);
82 void crypto_free_save (struct save_s
*);
83 void crypto_free_non_keys (struct crypto_s
*);
84 gpgme_error_t
crypto_data_to_buf (const gpgme_data_t
, unsigned char **,
86 gpg_error_t
crypto_write_file (struct crypto_s
*, unsigned char **crc
,
88 gpgme_error_t
crypto_list_keys (struct crypto_s
*, char **, int secret
,
90 char *crypto_key_info (const gpgme_key_t
);
91 void crypto_free_key_list (gpgme_key_t
*);
92 gpg_error_t
crypto_try_decrypt (struct client_s
*, int);
93 void crypto_set_keepalive ();
94 gpg_error_t
crypto_is_symmetric (const char *filename
);
95 gpg_error_t
crypto_keyid_to_16b (char **keys
);
96 gpg_error_t
crypto_keyid_to_16b_once (char *key
);
97 gpg_error_t
crypto_delete_key (struct client_s
*client
, struct crypto_s
*,
98 const gpgme_key_t
, int secret
);