update copyright year
[claws.git] / src / plugins / pgpcore / sgpgme.h
1 /*
2  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2021 the Claws Mail team
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  * 
18  */
19
20 #ifndef SGPGME_H
21 #define SGPGME_H 1
22
23 #include <gpgme.h>
24
25 #include "privacy.h"
26
27 #define GPGERR_BUFSIZE 128
28
29 typedef struct _DetachedSigTaskData
30 {
31         gpgme_protocol_t protocol;
32         gchar *boundary;
33         gchar *text_filename;
34         gchar *sig_filename;
35         guint sig_offset;
36         guint sig_length;
37         EncodingType sig_encoding;
38         gchar *(*get_canonical_content)(FILE *, const gchar *);
39 } DetachedSigTaskData;
40
41 void sgpgme_init(void);
42 void sgpgme_done(void);
43
44 void cm_free_detached_sig_task_data(gpointer data);
45
46 void cm_check_detached_sig(GTask *task,
47         gpointer source_object,
48         gpointer _task_data,
49         GCancellable *cancellable);
50
51 gint cm_check_detached_sig_async(MimeInfo *mimeinfo,
52         GCancellable *cancellable,
53         GAsyncReadyCallback callback,
54         gpointer user_data,
55         gpgme_protocol_t protocol,
56         gchar *(*get_canonical_content)(FILE *, const gchar *));
57
58 gpgme_verify_result_t sgpgme_verify_signature   (gpgme_ctx_t ctx,
59                                          gpgme_data_t sig,
60                                          gpgme_data_t plain,
61                                          gpgme_data_t dummy);
62 SignatureStatus sgpgme_sigstat_gpgme_to_privacy
63                                         (gpgme_ctx_t ctx,
64                                          gpgme_verify_result_t status);
65 gchar *sgpgme_sigstat_info_short        (gpgme_ctx_t ctx,
66                                          gpgme_verify_result_t status);
67 gchar *sgpgme_sigstat_info_full         (gpgme_ctx_t ctx,
68                                          gpgme_verify_result_t status);
69 gpgme_data_t sgpgme_data_from_mimeinfo  (MimeInfo *mimeinfo);
70 gpgme_data_t sgpgme_decrypt_verify      (gpgme_data_t cipher, 
71                                          gpgme_verify_result_t *status,
72                                          gpgme_ctx_t ctx);
73 gchar *sgpgme_get_encrypt_data          (GSList *recp_names,
74                                          gpgme_protocol_t proto);
75 gboolean sgpgme_setup_signers(gpgme_ctx_t ctx, PrefsAccount *account,
76                               const gchar *from_addr);
77 void sgpgme_check_create_key(void);
78 gboolean sgpgme_has_secret_key(void);
79 void sgpgme_create_secret_key(PrefsAccount *account, gboolean ask_create);
80 void *sgpgme_data_release_and_get_mem(gpgme_data_t data, size_t *len);
81
82 gpgme_error_t cm_gpgme_data_rewind(gpgme_data_t dh);
83 gchar *get_gpg_executable_name();
84
85 #endif /* SGPGME_H */