]> git.notmuchmail.org Git - notmuch/blob - util/crypto.h
1a90f0e00321fc73d1e93d8808ae602222b5048e
[notmuch] / util / crypto.h
1 #ifndef _CRYPTO_H
2 #define _CRYPTO_H
3
4 #include <stdbool.h>
5 #include "gmime-extra.h"
6 #include "notmuch.h"
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 typedef struct _notmuch_crypto {
13     bool verify;
14     notmuch_decryption_policy_t decrypt;
15 #if (GMIME_MAJOR_VERSION < 3)
16     GMimeCryptoContext* gpgctx;
17     GMimeCryptoContext* pkcs7ctx;
18     const char *gpgpath;
19 #endif
20 } _notmuch_crypto_t;
21
22 GMimeObject *
23 _notmuch_crypto_decrypt (bool *attempted,
24                          notmuch_decryption_policy_t decrypt,
25                          notmuch_message_t *message,
26                          GMimeCryptoContext* crypto_ctx,
27                          GMimeMultipartEncrypted *part,
28                          GMimeDecryptResult **decrypt_result,
29                          GError **err);
30
31 #if (GMIME_MAJOR_VERSION < 3)
32 notmuch_status_t
33 _notmuch_crypto_get_gmime_ctx_for_protocol (_notmuch_crypto_t *crypto,
34                                             const char *protocol,
35                                             GMimeCryptoContext **ctx);
36 #endif
37
38 void
39 _notmuch_crypto_cleanup (_notmuch_crypto_t *crypto);
40
41 #ifdef __cplusplus
42 }
43 #endif
44 #endif