File: crypt_mod_pgp_gpgme.c

package info (click to toggle)
neomutt 20250510%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 23,372 kB
  • sloc: ansic: 171,730; sh: 5,357; perl: 1,121; tcl: 1,065; python: 443; makefile: 48
file content (88 lines) | stat: -rw-r--r-- 2,426 bytes parent folder | download | duplicates (3)
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
/**
 * @file
 * Wrappers for calls to GPGME PGP
 *
 * @authors
 * Copyright (C) 2017-2024 Richard Russon <rich@flatcap.org>
 *
 * @copyright
 * 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, see <http://www.gnu.org/licenses/>.
 */

/**
 * @page crypt_crypt_mod_pgp_gpgme Wrappers for calls to GPGME PGP
 *
 * Wrappers for calls to GPGME PGP
 */

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include "lib.h"
#include "crypt_gpgme.h"
#include "crypt_mod.h"

/**
 * pgp_gpgme_void_passphrase - Forget the cached passphrase - Implements CryptModuleSpecs::void_passphrase() - @ingroup crypto_void_passphrase
 *
 * This is handled by gpg-agent.
 */
static void pgp_gpgme_void_passphrase(void)
{
}

/**
 * pgp_gpgme_valid_passphrase - Ensure we have a valid passphrase - Implements CryptModuleSpecs::valid_passphrase() - @ingroup crypto_valid_passphrase
 *
 * This is handled by gpg-agent.
 */
static bool pgp_gpgme_valid_passphrase(void)
{
  return true;
}

/**
 * CryptModPgpGpgme - GPGME PGP - Implements ::CryptModuleSpecs - @ingroup crypto_api
 */
const struct CryptModuleSpecs CryptModPgpGpgme = {
  // clang-format off
  APPLICATION_PGP,

  pgp_gpgme_init,
  NULL, /* cleanup */
  pgp_gpgme_void_passphrase,
  pgp_gpgme_valid_passphrase,
  pgp_gpgme_decrypt_mime,
  pgp_gpgme_application_handler,
  pgp_gpgme_encrypted_handler,
  pgp_gpgme_find_keys,
  pgp_gpgme_sign_message,
  pgp_gpgme_verify_one,
  pgp_gpgme_send_menu,
  pgp_gpgme_set_sender,

  pgp_gpgme_encrypt_message,
  pgp_gpgme_make_key_attachment,
  pgp_gpgme_check_traditional,
  NULL, /* pgp_traditional_encryptsign */
  NULL, /* pgp_invoke_getkeys */
  pgp_gpgme_invoke_import,
  NULL, /* pgp_extract_key_from_attachment */

  NULL, /* smime_getkeys */
  NULL, /* smime_verify_sender */
  NULL, /* smime_build_smime_entity */
  NULL, /* smime_invoke_import */
  // clang-format on
};