-
Notifications
You must be signed in to change notification settings - Fork 263
/
geanypg.h
89 lines (75 loc) · 2.75 KB
/
geanypg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* geanypg.h
*
* Copyright 2011 Hans Alves <alves.h88@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef GEANYPG_H
#define GEANYPG_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <locale.h>
#ifdef HAVE_CONFIG_H
#include "config.h" /* for the gettext domain */
#endif
#include <geanyplugin.h>
#include <Scintilla.h>
#include <gpgme.h>
#define SIZE 32
enum
{
READ = 0,
WRITE = 1
};
typedef struct
{
gpgme_ctx_t ctx;
gpgme_key_t * key_array;
unsigned long nkeys;
gpgme_key_t * skey_array;
unsigned long nskeys;
} encrypt_data;
extern GeanyPlugin *geany_plugin;
extern GeanyData *geany_data;
/* auxiliary functions (helper_functions.c) */
void geanypg_init_ed(encrypt_data * ed);
int geanypg_get_keys(encrypt_data * ed);
int geanypg_get_secret_keys(encrypt_data * ed);
void geanypg_release_keys(encrypt_data * ed);
void geanypg_load_buffer(gpgme_data_t * buffer);
void geanypg_write_file(FILE * file);
/* some more auxiliary functions (verify_aux.c) */
void geanypg_handle_signatures(encrypt_data * ed, int need_error);
void geanypg_check_sig(encrypt_data * ed, gpgme_signature_t sig);
const char * geanypg_validity(gpgme_validity_t validity);
/* dialogs */
int geanypg_encrypt_selection_dialog(encrypt_data * ed, gpgme_key_t ** selected, int * sign);
int geanypg_sign_selection_dialog(encrypt_data * ed);
gpgme_error_t geanypg_show_err_msg(gpgme_error_t err);
/* callback functions */
void geanypg_encrypt_cb(GtkMenuItem * menuitem, gpointer user_data);
void geanypg_sign_cb(GtkMenuItem * menuitem, gpointer user_data);
void geanypg_decrypt_cb(GtkMenuItem * menuitem, gpointer user_data);
void geanypg_verify_cb(GtkMenuItem * menuitem, gpointer user_data);
/* pinentry callback */
gpgme_error_t geanypg_passphrase_cb(void *hook,
const char *uid_hint,
const char *passphrase_info,
int prev_was_bad ,
int fd);
#endif