NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
module.c File Reference

Definition of the Ncrypt Module. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "config/lib.h"
#include "core/lib.h"
+ Include dependency graph for module.c:

Go to the source code of this file.

Functions

static bool ncrypt_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 

Variables

struct ConfigDef NcryptVars []
 Config definitions for the encryption library.
 
struct ConfigDef NcryptVarsGpgme []
 GPGME Config definitions for the encryption library.
 
struct ConfigDef NcryptVarsPgp []
 PGP Config definitions for the encryption library.
 
struct ConfigDef NcryptVarsSmime []
 SMIME Config definitions for the encryption library.
 
const struct Module ModuleNcrypt
 Module for the Ncrypt library.
 

Detailed Description

Definition of the Ncrypt Module.

Authors
  • Richard Russon

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/.

Definition in file module.c.

Function Documentation

◆ ncrypt_config_define_variables()

static bool ncrypt_config_define_variables ( struct NeoMutt * n,
struct ConfigSet * cs )
static

Define the Config Variables - Implements Module::config_define_variables()

Definition at line 43 of file module.c.

44{
45 bool rc = true;
46
48
49#if defined(CRYPT_BACKEND_GPGME)
51#endif
52
53#if defined(CRYPT_BACKEND_CLASSIC_PGP)
55#endif
56
57#if defined(CRYPT_BACKEND_CLASSIC_SMIME)
59#endif
60
61 return rc;
62}
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
struct ConfigDef NcryptVarsPgp[]
PGP Config definitions for the encryption library.
Definition config.c:301
struct ConfigDef NcryptVarsSmime[]
SMIME Config definitions for the encryption library.
Definition config.c:371
struct ConfigDef NcryptVars[]
Config definitions for the encryption library.
Definition config.c:110
struct ConfigDef NcryptVarsGpgme[]
GPGME Config definitions for the encryption library.
Definition config.c:222
+ Here is the call graph for this function:

Variable Documentation

◆ NcryptVars

struct ConfigDef NcryptVars[]
extern

Config definitions for the encryption library.

Definition at line 110 of file config.c.

110 {
111 // clang-format off
112 { "crypt_confirm_hook", DT_BOOL, true, 0, NULL,
113 "Prompt the user to confirm keys before use"
114 },
115 { "crypt_opportunistic_encrypt", DT_BOOL, false, 0, NULL,
116 "Enable encryption when the recipient's key is available"
117 },
118 { "crypt_opportunistic_encrypt_strong_keys", DT_BOOL, false, 0, NULL,
119 "Enable encryption only when strong a key is available"
120 },
121 { "crypt_protected_headers_read", DT_BOOL, true, 0, NULL,
122 "Display protected headers (Memory Hole) in the pager"
123 },
124 { "crypt_protected_headers_subject", DT_STRING, IP "...", 0, NULL,
125 "Use this as the subject for encrypted emails"
126 },
127 { "crypt_protected_headers_weed", DT_BOOL, false, 0, NULL,
128 "Controls whether NeoMutt will weed protected header fields"
129 },
130 { "crypt_protected_headers_write", DT_BOOL, true, 0, NULL,
131 "Generate protected header (Memory Hole) for signed and encrypted emails"
132 },
133 { "crypt_encryption_info", DT_BOOL, true, 0, NULL,
134 "Add an informative block with details about the encryption"
135 },
136 { "crypt_timestamp", DT_BOOL, true, 0, NULL,
137 "Add a timestamp to PGP or SMIME output to prevent spoofing"
138 },
139 { "envelope_from_address", DT_ADDRESS, 0, 0, NULL,
140 "Manually set the sender for outgoing messages"
141 },
142 { "pgp_auto_inline", DT_BOOL, false, 0, NULL,
143 "Use old-style inline PGP messages (not recommended)"
144 },
145 { "pgp_default_key", DT_STRING, 0, 0, NULL,
146 "Default key to use for PGP operations"
147 },
148 { "pgp_entry_format", DT_EXPANDO|D_NOT_EMPTY, IP "%4n %t%f %4l/0x%k %-4a %2c %u", IP &PgpEntryFormatDef, NULL,
149 "printf-like format string for the PGP key selection menu"
150 },
151 { "pgp_ignore_subkeys", DT_BOOL, true, 0, NULL,
152 "Only use the principal PGP key"
153 },
154 { "pgp_long_ids", DT_BOOL, true, 0, NULL,
155 "Display long PGP key IDs to the user"
156 },
157 { "pgp_mime_auto", DT_QUAD, MUTT_ASKYES, 0, NULL,
158 "Prompt the user to use MIME if inline PGP fails"
159 },
160 { "pgp_retainable_sigs", DT_BOOL, false, 0, NULL,
161 "Create nested multipart/signed or encrypted messages"
162 },
163 { "pgp_self_encrypt", DT_BOOL, true, 0, NULL,
164 "Encrypted messages will also be encrypted to $pgp_default_key too"
165 },
166 { "pgp_show_unusable", DT_BOOL, true, 0, NULL,
167 "Show non-usable keys in the key selection"
168 },
169 { "pgp_sign_as", DT_STRING, 0, 0, NULL,
170 "Use this alternative key for signing messages"
171 },
172 { "pgp_key_sort", DT_SORT|D_SORT_REVERSE, KEY_SORT_ADDRESS, IP KeySortMethods, NULL,
173 "Sort order for PGP keys"
174 },
175 { "pgp_strict_enc", DT_BOOL, true, 0, NULL,
176 "Encode PGP signed messages with quoted-printable (don't unset)"
177 },
178 { "smime_default_key", DT_STRING, 0, 0, NULL,
179 "Default key for SMIME operations"
180 },
181 { "smime_encrypt_with", DT_STRING, IP "aes256", 0, NULL,
182 "Algorithm for encryption"
183 },
184 { "smime_self_encrypt", DT_BOOL, true, 0, NULL,
185 "Encrypted messages will also be encrypt to $smime_default_key too"
186 },
187 { "smime_sign_as", DT_STRING, 0, 0, NULL,
188 "Use this alternative key for signing messages"
189 },
190 { "smime_is_default", DT_BOOL, false, 0, NULL,
191 "Use SMIME rather than PGP by default"
192 },
193 { "pgp_auto_decode", DT_BOOL, false, 0, NULL,
194 "Automatically decrypt PGP messages"
195 },
196 { "crypt_verify_sig", DT_QUAD, MUTT_YES, 0, NULL,
197 "Verify PGP or SMIME signatures"
198 },
199 { "crypt_protected_headers_save", DT_BOOL, false, 0, NULL,
200 "Save the cleartext Subject with the headers"
201 },
202
203 { "crypt_confirmhook", DT_SYNONYM, IP "crypt_confirm_hook", IP "2021-02-11" },
204 { "pgp_autoinline", DT_SYNONYM, IP "pgp_auto_inline", IP "2021-02-11" },
205 { "pgp_create_traditional", DT_SYNONYM, IP "pgp_auto_inline", IP "2004-04-12" },
206 { "pgp_self_encrypt_as", DT_SYNONYM, IP "pgp_default_key", IP "2018-01-11" },
207 { "pgp_sort_keys", DT_SYNONYM, IP "pgp_key_sort", IP "2024-11-20" },
208 { "pgp_verify_sig", DT_SYNONYM, IP "crypt_verify_sig", IP "2002-01-24" },
209 { "smime_self_encrypt_as", DT_SYNONYM, IP "smime_default_key", IP "2018-01-11" },
210
211 { "pgp_encrypt_self", D_INTERNAL_DEPRECATED|DT_QUAD, 0, IP "2019-09-09" },
212 { "smime_encrypt_self", D_INTERNAL_DEPRECATED|DT_QUAD, 0, IP "2019-09-09" },
213
214 { NULL },
215 // clang-format on
216};
#define IP
Definition set.h:54
static const struct ExpandoDefinition PgpEntryFormatDef[]
Expando definitions.
Definition config.c:81
static const struct Mapping KeySortMethods[]
Sort methods for encryption keys.
Definition config.c:47
@ KEY_SORT_ADDRESS
Sort by address.
Definition sort.h:34
@ MUTT_ASKYES
Ask the user, defaulting to 'Yes'.
Definition quad.h:41
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition quad.h:39
#define D_INTERNAL_DEPRECATED
Config item shouldn't be used any more.
Definition types.h:88
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
Definition types.h:40
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_STRING
a string
Definition types.h:44
@ DT_SORT
sorting methods
Definition types.h:43
@ DT_ADDRESS
e-mail address
Definition types.h:31
@ DT_EXPANDO
an expando
Definition types.h:34
#define D_SORT_REVERSE
Sort flag for -reverse prefix.
Definition types.h:120
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition types.h:80

◆ NcryptVarsGpgme

struct ConfigDef NcryptVarsGpgme[]
extern

GPGME Config definitions for the encryption library.

Definition at line 222 of file config.c.

222 {
223 // clang-format off
224 { "crypt_use_gpgme", DT_BOOL|D_ON_STARTUP, true, 0, NULL,
225 "Use GPGME crypto backend"
226 },
227 { "crypt_use_pka", DT_BOOL, false, 0, NULL,
228 "Use GPGME to use PKA (lookup PGP keys using DNS)"
229 },
230 { NULL },
231 // clang-format on
232};
#define D_ON_STARTUP
May only be set at startup.
Definition types.h:79

◆ NcryptVarsPgp

struct ConfigDef NcryptVarsPgp[]
extern

PGP Config definitions for the encryption library.

Definition at line 301 of file config.c.

301 {
302 // clang-format off
303 { "pgp_check_exit", DT_BOOL, true, 0, NULL,
304 "Check the exit code of PGP subprocess"
305 },
306 { "pgp_check_gpg_decrypt_status_fd", DT_BOOL, true, 0, NULL,
307 "File descriptor used for status info"
308 },
309 { "pgp_clear_sign_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
310 "(pgp) External command to inline-sign a message"
311 },
312 { "pgp_decode_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
313 "(pgp) External command to decode a PGP attachment"
314 },
315 { "pgp_decrypt_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
316 "(pgp) External command to decrypt a PGP message"
317 },
318 { "pgp_decryption_okay", DT_REGEX, 0, 0, NULL,
319 "Text indicating a successful decryption"
320 },
321 { "pgp_encrypt_only_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
322 "(pgp) External command to encrypt, but not sign a message"
323 },
324 { "pgp_encrypt_sign_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
325 "(pgp) External command to encrypt and sign a message"
326 },
327 { "pgp_export_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
328 "(pgp) External command to export a public key from the user's keyring"
329 },
330 { "pgp_get_keys_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
331 "(pgp) External command to download a key for an email address"
332 },
333 { "pgp_good_sign", DT_REGEX, 0, 0, NULL,
334 "Text indicating a good signature"
335 },
336 { "pgp_import_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
337 "(pgp) External command to import a key into the user's keyring"
338 },
339 { "pgp_list_pubring_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
340 "(pgp) External command to list the public keys in a user's keyring"
341 },
342 { "pgp_list_secring_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
343 "(pgp) External command to list the private keys in a user's keyring"
344 },
345 { "pgp_sign_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
346 "(pgp) External command to create a detached PGP signature"
347 },
348 { "pgp_timeout", DT_LONG|D_INTEGER_NOT_NEGATIVE, 300, 0, NULL,
349 "Time in seconds to cache a passphrase"
350 },
351 { "pgp_use_gpg_agent", DT_BOOL, true, 0, NULL,
352 "Use a PGP agent for caching passwords"
353 },
354 { "pgp_verify_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
355 "(pgp) External command to verify PGP signatures"
356 },
357 { "pgp_verify_key_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &PgpCommandFormatDef, NULL,
358 "(pgp) External command to verify key information"
359 },
360 { "pgp_clearsign_command", DT_SYNONYM, IP "pgp_clear_sign_command", IP "2021-02-11" },
361 { "pgp_getkeys_command", DT_SYNONYM, IP "pgp_get_keys_command", IP "2021-02-11" },
362 { NULL },
363 // clang-format on
364};
static const struct ExpandoDefinition PgpCommandFormatDef[]
Expando definitions.
Definition config.c:254
#define D_STRING_COMMAND
A command.
Definition types.h:99
@ DT_LONG
a number (long)
Definition types.h:35
@ DT_REGEX
regular expressions
Definition types.h:41
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.
Definition types.h:101

◆ NcryptVarsSmime

struct ConfigDef NcryptVarsSmime[]
extern

SMIME Config definitions for the encryption library.

Definition at line 371 of file config.c.

371 {
372 // clang-format off
373 { "smime_ask_cert_label", DT_BOOL, true, 0, NULL,
374 "Prompt the user for a label for SMIME certificates"
375 },
376 { "smime_ca_location", DT_PATH|D_PATH_FILE, 0, 0, NULL,
377 "File containing trusted certificates"
378 },
379 { "smime_certificates", DT_PATH|D_PATH_DIR, 0, 0, NULL,
380 "File containing user's public certificates"
381 },
382 { "smime_decrypt_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &SmimeCommandFormatDef, NULL,
383 "(smime) External command to decrypt an SMIME message"
384 },
385 { "smime_decrypt_use_default_key", DT_BOOL, true, 0, NULL,
386 "Use the default key for decryption"
387 },
388 { "smime_encrypt_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &SmimeCommandFormatDef, NULL,
389 "(smime) External command to encrypt a message"
390 },
391 { "smime_get_cert_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &SmimeCommandFormatDef, NULL,
392 "(smime) External command to extract a certificate from a message"
393 },
394 { "smime_get_cert_email_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &SmimeCommandFormatDef, NULL,
395 "(smime) External command to get a certificate for an email"
396 },
397 { "smime_get_signer_cert_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &SmimeCommandFormatDef, NULL,
398 "(smime) External command to extract a certificate from an email"
399 },
400 { "smime_import_cert_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &SmimeCommandFormatDef, NULL,
401 "(smime) External command to import a certificate"
402 },
403 { "smime_keys", DT_PATH|D_PATH_DIR, 0, 0, NULL,
404 "File containing user's private certificates"
405 },
406 { "smime_pk7out_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &SmimeCommandFormatDef, NULL,
407 "(smime) External command to extract a public certificate"
408 },
409 { "smime_sign_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &SmimeCommandFormatDef, NULL,
410 "(smime) External command to sign a message"
411 },
412 { "smime_sign_digest_alg", DT_STRING, IP "sha256", 0, NULL,
413 "Digest algorithm"
414 },
415 { "smime_timeout", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 300, 0, NULL,
416 "Time in seconds to cache a passphrase"
417 },
418 { "smime_verify_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &SmimeCommandFormatDef, NULL,
419 "(smime) External command to verify a signed message"
420 },
421 { "smime_verify_opaque_command", DT_EXPANDO|D_STRING_COMMAND, 0, IP &SmimeCommandFormatDef, NULL,
422 "(smime) External command to verify a signature"
423 },
424 { NULL },
425 // clang-format on
426};
static const struct ExpandoDefinition SmimeCommandFormatDef[]
Expando definitions.
Definition config.c:282
#define D_PATH_DIR
Path is a directory.
Definition types.h:103
#define D_PATH_FILE
Path is a file.
Definition types.h:104
@ DT_NUMBER
a number
Definition types.h:38
@ DT_PATH
a path to a file/directory
Definition types.h:39

◆ ModuleNcrypt

const struct Module ModuleNcrypt
Initial value:
= {
"ncrypt",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}
@ MODULE_ID_NCRYPT
ModuleNcrypt, Ncrypt
Definition module_api.h:80
static bool ncrypt_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:43

Module for the Ncrypt library.

Definition at line 67 of file module.c.

67 {
69 "ncrypt",
70 NULL, // init
71 NULL, // config_define_types
73 NULL, // commands_register
74 NULL, // gui_init
75 NULL, // gui_cleanup
76 NULL, // cleanup
77};