61#ifdef CRYPT_BACKEND_CLASSIC_SMIME
101 *keylist = (*keylist)->
next;
160 const int rc =
mw_get_field(
_(
"Enter S/MIME passphrase:"), buf,
214static pid_t
smime_invoke(FILE **fp_smime_in, FILE **fp_smime_out, FILE **fp_smime_err,
215 int fp_smime_infd,
int fp_smime_outfd,
int fp_smime_errfd,
216 const char *fname,
const char *sig_fname,
const char *cryptalg,
217 const char *digestalg,
const char *key,
const char *certificates,
218 const char *intermediates,
const struct Expando *exp)
237 fp_smime_err, fp_smime_infd, fp_smime_outfd,
257 for (p = buf; p; p = pend)
262 if ((pend = strchr(p,
' ')) || (pend = strchr(p,
'\t')) || (pend = strchr(p,
'\n')))
335 char buf[1024] = { 0 };
338 struct SmimeKey **results_end = &results;
344 only_public_key ?
NONULL(c_smime_certificates) :
NONULL(c_smime_keys));
355 while (fgets(buf,
sizeof(buf), fp))
363 results_end = &key->
next;
386 for (
struct SmimeKey *result = results; result; result = result->
next)
409 bool only_public_key,
bool oppenc_mode)
417 struct SmimeKey **matches_end = &matches;
419 struct SmimeKey *trusted_match = NULL;
420 struct SmimeKey *valid_match = NULL;
422 bool multi_trusted_matches =
false;
425 for (result = results; result; result = result->
next)
427 if (abilities && !(result->
flags & abilities))
435 *matches_end = match;
436 matches_end = &match->
next;
438 if (match->
trust ==
't')
442 multi_trusted_matches =
true;
444 trusted_match = match;
446 else if ((match->
trust ==
'u') || (match->
trust ==
'v'))
457 if (oppenc_mode || !isatty(STDIN_FILENO))
459 const bool c_crypt_opportunistic_encrypt_strong_keys =
463 else if (valid_match && !c_crypt_opportunistic_encrypt_strong_keys)
468 else if (trusted_match && !multi_trusted_matches)
498 struct SmimeKey **matches_end = &matches;
503 for (result = results; result; result = result->
next)
505 if (abilities && !(result->
flags & abilities))
514 *matches_end = match;
515 matches_end = &match->
next;
580 const char *k = NULL;
587 buf_printf(prompt,
_(
"Enter keyID for %s: "), mailbox);
596 k = key ? key->
hash :
NONULL(c_smime_default_key);
619 if (c_smime_decrypt_use_default_key && c_smime_default_key)
625 NONULL(c_smime_certificates), c_smime_default_key);
660 char *keylist = NULL;
661 size_t keylist_size = 0;
662 size_t keylist_used = 0;
668 if (!key && !oppenc_mode && isatty(STDIN_FILENO))
686 sprintf(keylist + keylist_used,
"%s%s", keylist_used ?
" " :
"", keyid);
706 bool copy,
char ***buffer,
int *num)
708 char email[256] = { 0 };
728 const struct Expando *c_smime_get_cert_email_command =
730 pid =
smime_invoke(NULL, NULL, NULL, -1, fileno(fp_out), fileno(fp_err), certificate,
731 NULL, NULL, NULL, NULL, NULL, NULL, c_smime_get_cert_email_command);
734 mutt_message(
_(
"Error: unable to create OpenSSL subprocess"));
747 while ((fgets(email,
sizeof(email), fp_out)))
750 if (len && (email[len - 1] ==
'\n'))
751 email[len - 1] =
'\0';
755 rc = (rc < 0) ? 0 : rc;
775 if (copy && buffer && num)
782 while ((fgets(email,
sizeof(email), fp_out)))
785 if (len && (email[len - 1] ==
'\n'))
786 email[len - 1] =
'\0';
812 FILE *fp_cert = NULL;
838 pid =
smime_invoke(NULL, NULL, NULL, -1, fileno(fp_out), fileno(fp_err), infile,
839 NULL, NULL, NULL, NULL, NULL, NULL, c_smime_pk7out_command);
852 empty = (fgetc(fp_out) == EOF);
872 pid =
smime_invoke(NULL, NULL, NULL, -1, fileno(fp_cert), fileno(fp_err),
873 buf_string(pk7out), NULL, NULL, NULL, NULL, NULL, NULL,
874 c_smime_get_cert_command);
890 empty = (fgetc(fp_cert) == EOF);
926 struct Buffer *certfile = NULL;
949 const struct Expando *c_smime_get_signer_cert_command =
951 pid =
smime_invoke(NULL, NULL, NULL, -1, -1, fileno(fp_err), infile, NULL, NULL, NULL,
952 NULL,
buf_string(certfile), NULL, c_smime_get_signer_cert_command);
965 empty = (fgetc(fp_out) == EOF);
993 char *certfile = NULL;
994 struct Buffer *buf = NULL;
1013 if (c_smime_ask_cert_label)
1029 const struct Expando *c_smime_import_cert_command =
1031 FILE *fp_smime_in = NULL;
1032 pid_t pid =
smime_invoke(&fp_smime_in, NULL, NULL, -1, fileno(fp_out),
1033 fileno(fp_err), certfile, NULL, NULL, NULL, NULL,
1034 NULL, NULL, c_smime_import_cert_command);
1037 mutt_message(
_(
"Error: unable to create OpenSSL subprocess"));
1041 fputc(
'\n', fp_smime_in);
1069 const char *mbox = NULL;
1070 const char *certfile = NULL;
1153 FILE **fp_smime_err,
int fp_smime_infd,
1154 int fp_smime_outfd,
int fp_smime_errfd,
1155 const char *fname,
const char *uids)
1159 return smime_invoke(fp_smime_in, fp_smime_out, fp_smime_err, fp_smime_infd,
1160 fp_smime_outfd, fp_smime_errfd, fname, NULL, c_smime_encrypt_with,
1161 NULL, NULL, uids, NULL, c_smime_encrypt_command);
1180 FILE **fp_smime_err,
int fp_smime_infd,
int fp_smime_outfd,
1181 int fp_smime_errfd,
const char *fname)
1186 return smime_invoke(fp_smime_in, fp_smime_out, fp_smime_err, fp_smime_infd,
1187 fp_smime_outfd, fp_smime_errfd, fname, NULL, NULL,
1198 char buf[1024] = { 0 };
1200 char *cert_end = NULL;
1201 FILE *fp_smime_in = NULL;
1202 FILE *fp_smime_err = NULL;
1203 FILE *fp_out = NULL;
1204 FILE *fp_tmp = NULL;
1205 struct Body *b_enc = NULL;
1238 for (
char *cert_start = certlist; cert_start; cert_start = cert_end)
1240 cert_end = strchr(cert_start,
' ');
1247 snprintf(certfile + off,
sizeof(certfile) - off,
"%s%s/%s",
1248 (off != 0) ?
" " :
"",
NONULL(c_smime_certificates), cert_start);
1256 fputc(
'\n', fp_tmp);
1261 fileno(fp_smime_err),
buf_string(smime_infile), certfile);
1275 empty = (fgetc(fp_out) == EOF);
1278 fflush(fp_smime_err);
1279 rewind(fp_smime_err);
1280 while (fgets(buf,
sizeof(buf) - 1, fp_smime_err))
1311 b_enc->
parts = NULL;
1349 char *micalg = NULL;
1368 struct Body *b_sign = NULL;
1369 struct Body *rc = NULL;
1370 char buf[1024] = { 0 };
1371 struct Buffer *filetosign = NULL;
1372 struct Buffer *signedfile = NULL;
1373 FILE *fp_smime_in = NULL;
1374 FILE *fp_smime_out = NULL;
1375 FILE *fp_smime_err = NULL;
1376 FILE *fp_sign = NULL;
1380 const char *intermediates = NULL;
1384 const char *signas = c_smime_sign_as ? c_smime_sign_as : c_smime_default_key;
1385 if (!signas || (*signas ==
'\0'))
1387 mutt_error(
_(
"Can't sign: No key specified. Use Sign As."));
1413 fputc(
'\n', fp_sign);
1424 intermediates = signas;
1426 intermediates = signas_key->
issuer;
1429 NONULL(c_smime_certificates), intermediates);
1434 fileno(fp_smime_out), -1,
buf_string(filetosign));
1442 fputc(
'\n', fp_smime_in);
1449 fflush(fp_smime_err);
1450 rewind(fp_smime_err);
1451 while (fgets(buf,
sizeof(buf) - 1, fp_smime_err))
1458 fflush(fp_smime_out);
1459 rewind(fp_smime_out);
1460 empty = (fgetc(fp_smime_out) == EOF);
1542 FILE **fp_smime_err,
int fp_smime_infd,
1543 int fp_smime_outfd,
int fp_smime_errfd,
1544 const char *fname,
const char *sig_fname,
int opaque)
1546 const struct Expando *c_smime_verify_opaque_command =
1549 return smime_invoke(fp_smime_in, fp_smime_out, fp_smime_err, fp_smime_infd, fp_smime_outfd,
1550 fp_smime_errfd, fname, sig_fname, NULL, NULL, NULL, NULL, NULL,
1551 (opaque ? c_smime_verify_opaque_command : c_smime_verify_command));
1570 FILE **fp_smime_err,
int fp_smime_infd,
int fp_smime_outfd,
1571 int fp_smime_errfd,
const char *fname)
1575 return smime_invoke(fp_smime_in, fp_smime_out, fp_smime_err, fp_smime_infd,
1576 fp_smime_outfd, fp_smime_errfd, fname, NULL, NULL, NULL,
1579 c_smime_decrypt_command);
1588 FILE *fp_smime_out = NULL;
1589 FILE *fp_smime_err = NULL;
1593 LOFF_T tmpoffset = 0;
1594 size_t tmplength = 0;
1595 int orig_type = b->
type;
1616 const char *save_prefix = state->
prefix;
1631 state->
prefix = save_prefix;
1633 b->
type = orig_type;
1648 fflush(fp_smime_out);
1660 fflush(fp_smime_err);
1661 rewind(fp_smime_err);
1671 fflush(fp_smime_err);
1672 rewind(fp_smime_err);
1705 FILE *fp_smime_out = NULL;
1706 FILE *fp_smime_in = NULL;
1707 FILE *fp_smime_err = NULL;
1708 FILE *fp_tmp = NULL;
1709 FILE *fp_out = NULL;
1710 struct Body *p = NULL;
1752 fileno(fp_smime_err),
buf_string(tmpfname))) == -1))
1763 fileno(fp_smime_out), fileno(fp_smime_err), NULL,
1779 fputc(
'\n', fp_smime_in);
1789 fflush(fp_smime_err);
1790 rewind(fp_smime_err);
1792 const int c = fgetc(fp_smime_err);
1795 ungetc(c, fp_smime_err);
1812 fflush(fp_smime_out);
1813 rewind(fp_smime_out);
1818 if (fgetc(fp_smime_out) == EOF)
1823 rewind(fp_smime_out);
1828 fp_out = fp_out_file;
1839 char buf[8192] = { 0 };
1840 while (fgets(buf,
sizeof(buf) - 1, fp_smime_out))
1843 if ((len > 1) && (buf[len - 2] ==
'\r'))
1845 buf[len - 2] =
'\n';
1846 buf[len - 1] =
'\0';
1879 FILE *fp_tmp_buffer = state->
fp_in;
1880 state->
fp_in = fp_out;
1882 state->
fp_in = fp_tmp_buffer;
1918 rewind(fp_smime_err);
1945 struct State state = { 0 };
1946 LOFF_T tmpoffset = b->
offset;
1947 size_t tmplength = b->
length;
1975 state.
fp_in = fp_tmp;
1989 (*b_dec)->goodsig = b->
goodsig;
1990 (*b_dec)->badsig = b->
badsig;
2028 const char *prompt = NULL;
2029 const char *letters = NULL;
2030 const char *choices = NULL;
2045 prompt =
_(
"S/MIME (s)ign, encrypt (w)ith, sign (a)s, (c)lear, or (o)ppenc mode off?");
2047 letters =
_(
"swaco");
2050 else if (c_crypt_opportunistic_encrypt)
2055 prompt =
_(
"S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, (c)lear, or (o)ppenc mode?");
2057 letters =
_(
"eswabco");
2058 choices =
"eswabcO";
2064 prompt =
_(
"S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, or (c)lear?");
2066 letters =
_(
"eswabc");
2073 switch (choices[choice - 1])
2132 switch (
mw_multi_choice(
_(
"Choose algorithm family: (1) DES, (2) RC2, (3) AES, or (c)lear?"),
2153 switch (choice =
mw_multi_choice(
_(
"(1) RC2-40, (2) RC2-64, (3) RC2-128?"),
2206 }
while (choice == -1);
void mutt_addr_free(struct Address **ptr)
Free a single Address.
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
bool mutt_addr_is_user(const struct Address *addr)
Does the address belong to the user.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
Convenience wrapper for the config headers.
#define CSR_RESULT(x)
Extract the result code from CSR_* flags.
#define CSR_SUCCESS
Action completed successfully.
int mutt_copy_message(FILE *fp_out, struct Email *e, struct Message *msg, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen)
Copy a message from a Mailbox.
@ MUTT_CM_DECODE_SMIME
Used for decoding S/MIME messages.
@ MUTT_CM_NONE
No flags are set.
#define MUTT_CM_DECODE_CRYPT
Combination flag for decoding any kind of cryptography (PGP or S/MIME)
@ CH_WEED
Weed the headers?
@ CH_MIME
Ignore MIME fields.
@ CH_NONE
No flags are set.
@ CH_NONEWLINE
Don't output terminating newline after the header.
Convenience wrapper for the core headers.
void crypt_opportunistic_encrypt(struct Email *e)
Can all recipients be determined.
SecurityFlags mutt_is_multipart_signed(struct Body *b)
Is a message signed?
SecurityFlags mutt_is_application_smime(struct Body *b)
Does the message use S/MIME?
void crypt_current_time(struct State *state, const char *app_name)
Print the current time.
void crypt_convert_to_7bit(struct Body *b)
Convert an email to 7bit encoding.
Signing/encryption multiplexor.
void crypt_smime_void_passphrase(void)
Wrapper for CryptModuleSpecs::void_passphrase()
Wrapper around crypto functions.
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
void mutt_endwin(void)
Shutdown curses.
@ MUTT_COMP_UNBUFFERED
Ignore macro buffer.
@ MUTT_COMP_PASS
Password mode (no echo)
@ MUTT_COMP_NONE
No flags are set.
void mutt_body_free(struct Body **ptr)
Free a Body.
struct Body * mutt_body_new(void)
Create a new Body.
Structs that make up an email.
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
struct Body * mutt_read_mime_header(FILE *fp, bool digest)
Parse a MIME header.
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
int expando_render(const struct Expando *exp, const struct ExpandoRenderCallback *erc, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando + data into a string.
const struct ExpandoRenderCallback SmimeCommandRenderCallbacks[]
Callbacks for Smime Command Expandos.
Ncrypt Smime Expando definitions.
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
Copy the contents of one file into another.
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, ReadLineFlags flags)
Read a line from a file.
int mutt_file_copy_bytes(FILE *fp_in, FILE *fp_out, size_t size)
Copy some content from one file to another.
long mutt_file_get_size_fp(FILE *fp)
Get the size of a file.
bool mutt_file_seek(FILE *fp, LOFF_T offset, int whence)
Wrapper for fseeko with error handling.
void mutt_file_unlink(const char *s)
Delete a file, carefully.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
@ MUTT_RL_NONE
No flags are set.
int smime_class_application_handler(struct Body *b, struct State *state)
Manage the MIME type "application/pgp" or "application/smime" - Implements CryptModuleSpecs::applicat...
int smime_class_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec)
Decrypt an encrypted MIME part - Implements CryptModuleSpecs::decrypt_mime() -.
char * smime_class_find_keys(const struct AddressList *al, bool oppenc_mode)
Find the keyids of the recipients of a message - Implements CryptModuleSpecs::find_keys() -.
struct Body * smime_class_sign_message(struct Body *b, const struct AddressList *from)
Cryptographically sign the Body of a message - Implements CryptModuleSpecs::sign_message() -.
struct Body * smime_class_build_smime_entity(struct Body *b, char *certlist)
Encrypt the email body to all recipients - Implements CryptModuleSpecs::smime_build_smime_entity() -.
void smime_class_getkeys(struct Envelope *env)
Get the S/MIME keys required to encrypt this email - Implements CryptModuleSpecs::smime_getkeys() -.
void smime_class_invoke_import(const char *infile, const char *mailbox)
Add a certificate and update index file (externally) - Implements CryptModuleSpecs::smime_invoke_impo...
int smime_class_verify_sender(struct Email *e, struct Message *msg)
Does the sender match the certificate?
bool smime_class_valid_passphrase(void)
Ensure we have a valid passphrase - Implements CryptModuleSpecs::valid_passphrase() -.
int smime_class_verify_one(struct Body *b, struct State *state, const char *tempfile)
Check a signed MIME part against a signature - Implements CryptModuleSpecs::verify_one() -.
void smime_class_void_passphrase(void)
Forget the cached passphrase - Implements CryptModuleSpecs::void_passphrase() -.
struct SmimeKey * dlg_smime(struct SmimeKey *keys, const char *query)
Get the user to select a key -.
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
int mw_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question -.
int mutt_protected_headers_handler(struct Body *b_email, struct State *state)
Handler for protected headers - Implements handler_t -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
Convenience wrapper for the gui headers.
int mutt_body_handler(struct Body *b, struct State *state)
Handler for the Body of an email.
void mutt_decode_attachment(const struct Body *b, struct State *state)
Decode an email's attachment.
Read/write command history from/to a file.
@ HC_OTHER
Miscellaneous strings.
@ LL_DEBUG2
Log at debug level 2.
#define FREE(x)
Free memory and set the pointer to NULL.
#define MUTT_MEM_CALLOC(n, type)
#define MUTT_MEM_REALLOC(pptr, n, type)
@ ENC_BASE64
Base-64 encoded text.
@ TYPE_MULTIPART
Type: 'multipart/*'.
@ TYPE_APPLICATION
Type: 'application/*'.
@ DISP_ATTACH
Content is attached.
@ DISP_INLINE
Content is inline.
@ MODULE_ID_NCRYPT
ModuleNcrypt, Ncrypt
void mutt_generate_boundary(struct ParameterList *pl)
Create a unique boundary id for a MIME part.
time_t mutt_date_add_timeout(time_t now, time_t timeout)
Safely add a timeout to a given time_t value.
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
pid_t filter_create_fd(const char *cmd, FILE **fp_in, FILE **fp_out, FILE **fp_err, int fdin, int fdout, int fderr, char **envlist)
Run a command on a pipe (optionally connect stdin/stdout)
Convenience wrapper for the library headers.
void state_attach_puts(struct State *state, const char *t)
Write a string to the state.
@ STATE_DISPLAY
Output is displayed to the user.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * mutt_str_dup(const char *str)
Copy a string, safely.
int mutt_str_asprintf(char **strp, const char *fmt,...)
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
const char * mutt_istr_find(const char *haystack, const char *needle)
Find first occurrence of string (ignoring case)
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
Many unsorted constants and some structs.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
API for encryption/signing of emails.
@ SEC_OPPENCRYPT
Opportunistic encrypt mode.
@ SEC_SIGNOPAQUE
Email has an opaque signature (encrypted)
@ SEC_SIGN
Email is signed.
@ SEC_ENCRYPT
Email is encrypted.
#define SMIME_SIGN
Email is S/MIME signed.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
@ KEYFLAG_CANSIGN
Key is suitable for signing.
@ KEYFLAG_CANENCRYPT
Key is suitable for encryption.
Ncrypt private Module data.
Shared constants/structs that are private to libconn.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
void mutt_param_set(struct ParameterList *pl, const char *attribute, const char *value)
Set a Parameter.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
#define TAILQ_FOREACH(var, head, field)
#define TAILQ_FIRST(head)
#define TAILQ_EMPTY(head)
@ MUTT_FORMAT_NONE
No flags are set.
int mutt_write_mime_body(struct Body *b, FILE *fp, struct ConfigSubset *sub)
Write a MIME part.
Convenience wrapper for the send headers.
struct Address * mutt_default_from(struct ConfigSubset *sub)
Get a default 'from' Address.
static struct SmimeKey * smime_get_key_by_hash(const char *hash, bool only_public_key)
Find a key by its hash.
static pid_t smime_invoke_sign(FILE **fp_smime_in, FILE **fp_smime_out, FILE **fp_smime_err, int fp_smime_infd, int fp_smime_outfd, int fp_smime_errfd, const char *fname)
Use SMIME to sign a file.
static void getkeys(const char *mailbox)
Get the keys for a mailbox.
static struct SmimeKey * smime_copy_key(struct SmimeKey *key)
Copy an SMIME key.
static struct SmimeKey * smime_get_key_by_str(const char *str, KeyFlags abilities, bool only_public_key)
Find an SMIME key by string.
void smime_init(void)
Initialise smime globals.
void smime_cleanup(struct NcryptModuleData *mod_data)
Clean up smime globals.
static pid_t smime_invoke_verify(FILE **fp_smime_in, FILE **fp_smime_out, FILE **fp_smime_err, int fp_smime_infd, int fp_smime_outfd, int fp_smime_errfd, const char *fname, const char *sig_fname, int opaque)
Use SMIME to verify a file.
static char * smime_extract_signer_certificate(const char *infile)
Extract the signer's certificate.
static struct Body * smime_handle_entity(struct Body *b, struct State *state, FILE *fp_out_file)
Handle type application/pkcs7-mime.
static struct SmimeKey * smime_parse_key(char *buf)
Parse an SMIME key block.
static pid_t smime_invoke_decrypt(FILE **fp_smime_in, FILE **fp_smime_out, FILE **fp_smime_err, int fp_smime_infd, int fp_smime_outfd, int fp_smime_errfd, const char *fname)
Use SMIME to decrypt a file.
static struct SmimeKey * smime_get_candidates(const char *search, bool only_public_key)
Find keys matching a string.
static char * smime_extract_certificate(const char *infile)
Extract an SMIME certificate from a file.
static int smime_handle_cert_email(const char *certificate, const char *mailbox, bool copy, char ***buffer, int *num)
Process an email containing certificates.
static struct SmimeKey * smime_get_key_by_addr(const char *mailbox, KeyFlags abilities, bool only_public_key, bool oppenc_mode)
Find an SIME key by address.
static pid_t smime_invoke(FILE **fp_smime_in, FILE **fp_smime_out, FILE **fp_smime_err, int fp_smime_infd, int fp_smime_outfd, int fp_smime_errfd, const char *fname, const char *sig_fname, const char *cryptalg, const char *digestalg, const char *key, const char *certificates, const char *intermediates, const struct Expando *exp)
Run an SMIME command.
static pid_t smime_invoke_encrypt(FILE **fp_smime_in, FILE **fp_smime_out, FILE **fp_smime_err, int fp_smime_infd, int fp_smime_outfd, int fp_smime_errfd, const char *fname, const char *uids)
Use SMIME to encrypt a file.
static void smime_key_free(struct SmimeKey **keylist)
Free a list of SMIME keys.
static char * openssl_md_to_smime_micalg(const char *md)
Change the algorithm names.
static void smime_command(struct Buffer *buf, struct SmimeCommandContext *cctx, const struct Expando *exp)
Format an SMIME command string.
static struct SmimeKey * smime_ask_for_key(const char *prompt, KeyFlags abilities, bool only_public_key)
Ask the user to select a key.
struct Buffer * mailbox
Mailbox and host address.
char * d_filename
filename to be used for the content-disposition header If NULL, filename is used instead.
struct Body * parts
parts of a multipart or message/rfc822
LOFF_T offset
offset where the actual data begins
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
bool badsig
Bad cryptographic signature (needed to check encrypted s/mime-signatures)
struct Envelope * mime_headers
Memory hole protected headers.
LOFF_T length
length (in bytes) of attachment
struct ParameterList parameter
Parameters of the content-type.
bool use_disp
Content-Disposition uses filename= ?
unsigned int disposition
content-disposition, ContentDisposition
struct Body * next
next attachment in the list
char * subtype
content-type subtype
unsigned int encoding
content-transfer-encoding, ContentEncoding
bool goodsig
Good cryptographic signature.
unsigned int type
content-type primary type, ContentType
char * filename
When sending a message, this is the file to which this structure refers.
String manipulation buffer.
size_t dsize
Length of data.
char * data
Pointer to data.
The envelope/body of an email.
struct Envelope * env
Envelope information.
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
struct AddressList to
Email's 'To' list.
struct AddressList cc
Email's 'Cc' list.
struct AddressList sender
Email's sender.
struct AddressList from
Email's 'From' list.
A local copy of an email.
Ncrypt private Module data.
struct Buffer smime_cert_to_use
S/MIME certificate to use.
char smime_pass[256]
Cached S/MIME Passphrase.
time_t smime_exp_time
Unix time when smime_pass expires.
struct Buffer smime_intermediate_to_use
S/MIME intermediate certificate to use.
struct Buffer smime_key_to_use
S/MIME key to use.
Container for Accounts, Notifications.
char ** env
Private copy of the environment variables.
struct ConfigSubset * sub
Inherited config items.
const char * intermediates
i
const char * certificates
c
struct SmimeKey * next
Linked list.
char * email
Email address.
char trust
i=Invalid r=revoked e=expired u=unverified v=verified t=trusted
Keep track when processing files.
StateFlags flags
Flags, e.g. STATE_DISPLAY.
FILE * fp_out
File to write to.
FILE * fp_in
File to read from.
const char * prefix
String to add to the beginning of each output line.
int cs_subset_str_string_set(const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err)
Set a config item by string.
#define mutt_file_mkstemp()