Signing/encryption multiplexor. More...
#include "config.h"
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "alias/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "crypt.h"
#include "lib.h"
#include "attach/lib.h"
#include "question/lib.h"
#include "send/lib.h"
#include "copy.h"
#include "cryptglue.h"
#include "globals.h"
#include "handler.h"
#include "mx.h"
#include "autocrypt/lib.h"
Go to the source code of this file.
Functions | |
void | crypt_current_time (struct State *state, const char *app_name) |
Print the current time. | |
void | crypt_forget_passphrase (void) |
Forget a passphrase and display a message. | |
bool | crypt_valid_passphrase (SecurityFlags flags) |
Check that we have a usable passphrase, ask if not. | |
int | mutt_protect (struct Email *e, char *keylist, bool postpone) |
Encrypt and/or sign a message. | |
SecurityFlags | mutt_is_multipart_signed (struct Body *b) |
Is a message signed? | |
SecurityFlags | mutt_is_multipart_encrypted (struct Body *b) |
Does the message have encrypted parts? | |
int | mutt_is_valid_multipart_pgp_encrypted (struct Body *b) |
Is this a valid multi-part encrypted message? | |
SecurityFlags | mutt_is_malformed_multipart_pgp_encrypted (struct Body *b) |
Check for malformed layout. | |
SecurityFlags | mutt_is_application_pgp (const struct Body *b) |
Does the message use PGP? | |
SecurityFlags | mutt_is_application_smime (struct Body *b) |
Does the message use S/MIME? | |
SecurityFlags | crypt_query (struct Body *b) |
Check out the type of encryption used. | |
int | crypt_write_signed (struct Body *b, struct State *state, const char *tempfile) |
Write the message body/part. | |
void | crypt_convert_to_7bit (struct Body *b) |
Convert an email to 7bit encoding. | |
void | crypt_extract_keys_from_messages (struct Mailbox *m, struct EmailArray *ea) |
Extract keys from a message. | |
int | crypt_get_keys (struct Email *e, char **keylist, bool oppenc_mode) |
Check we have all the keys we need. | |
void | crypt_opportunistic_encrypt (struct Email *e) |
Can all recipients be determined. | |
static void | crypt_fetch_signatures (struct Body ***b_sigs, struct Body *b, int *n) |
Create an array of an emails parts. | |
bool | mutt_should_hide_protected_subject (struct Email *e) |
Should NeoMutt hide the protected subject? | |
int | mutt_protected_headers_handler (struct Body *b_email, struct State *state) |
Handler for protected headers - Implements handler_t -. | |
int | mutt_signed_handler (struct Body *b_email, struct State *state) |
Handler for "multipart/signed" - Implements handler_t -. | |
const char * | crypt_get_fingerprint_or_id (const char *p, const char **pphint, const char **ppl, const char **pps) |
Get the fingerprint or long key ID. | |
bool | crypt_is_numerical_keyid (const char *s) |
Is this a numerical keyid. | |
Signing/encryption multiplexor.
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 crypt.c.
void crypt_current_time | ( | struct State * | state, |
const char * | app_name | ||
) |
Print the current time.
state | State to use |
app_name | App name, e.g. "PGP" |
print the current time to avoid spoofing of the signature output
Definition at line 65 of file crypt.c.
void crypt_forget_passphrase | ( | void | ) |
Forget a passphrase and display a message.
Definition at line 90 of file crypt.c.
bool crypt_valid_passphrase | ( | SecurityFlags | flags | ) |
Check that we have a usable passphrase, ask if not.
flags | Flags, see SecurityFlags |
true | Success |
false | Failed |
Definition at line 132 of file crypt.c.
int mutt_protect | ( | struct Email * | e, |
char * | keylist, | ||
bool | postpone | ||
) |
Encrypt and/or sign a message.
e | |
keylist | List of keys to encrypt to (space-separated) |
postpone | When true, signing is automatically disabled |
0 | Success |
-1 | Error |
Definition at line 157 of file crypt.c.
SecurityFlags mutt_is_multipart_signed | ( | struct Body * | b | ) |
Is a message signed?
b | Body of email |
num | Message is signed, see SecurityFlags |
0 | Message is not signed (SEC_NO_FLAGS) |
Definition at line 408 of file crypt.c.
SecurityFlags mutt_is_multipart_encrypted | ( | struct Body * | b | ) |
Does the message have encrypted parts?
b | Body of email |
num | Message has got encrypted parts, see SecurityFlags |
0 | Message hasn't got encrypted parts (SEC_NO_FLAGS) |
Definition at line 443 of file crypt.c.
int mutt_is_valid_multipart_pgp_encrypted | ( | struct Body * | b | ) |
Is this a valid multi-part encrypted message?
b | Body of email |
>0 | Message is valid, with encrypted parts, e.g. PGP_ENCRYPT |
0 | Message hasn't got encrypted parts |
Definition at line 467 of file crypt.c.
SecurityFlags mutt_is_malformed_multipart_pgp_encrypted | ( | struct Body * | b | ) |
Check for malformed layout.
b | Body of email |
num | Success, see SecurityFlags |
0 | Error, (SEC_NO_FLAGS) |
This checks for the malformed layout caused by MS Exchange in some cases:
Definition at line 504 of file crypt.c.
SecurityFlags mutt_is_application_pgp | ( | const struct Body * | b | ) |
Does the message use PGP?
b | Body of email |
>0 | Message uses PGP, e.g. PGP_ENCRYPT |
0 | Message doesn't use PGP, (SEC_NO_FLAGS) |
Definition at line 548 of file crypt.c.
SecurityFlags mutt_is_application_smime | ( | struct Body * | b | ) |
Does the message use S/MIME?
b | Body of email |
>0 | Message uses S/MIME, e.g. SMIME_ENCRYPT |
0 | Message doesn't use S/MIME, (SEC_NO_FLAGS) |
Definition at line 609 of file crypt.c.
SecurityFlags crypt_query | ( | struct Body * | b | ) |
Check out the type of encryption used.
b | Body of email |
num | Flags, see SecurityFlags |
0 | Error (SEC_NO_FLAGS) |
Set the cached status values if there are any.
Definition at line 687 of file crypt.c.
Write the message body/part.
0 | Success |
-1 | Error |
Body/part A described by state state to the given TEMPFILE.
Definition at line 759 of file crypt.c.
void crypt_convert_to_7bit | ( | struct Body * | b | ) |
Convert an email to 7bit encoding.
b | Body of email to convert |
Definition at line 809 of file crypt.c.
void crypt_extract_keys_from_messages | ( | struct Mailbox * | m, |
struct EmailArray * | ea | ||
) |
Extract keys from a message.
m | Mailbox |
ea | Array of Emails to process |
The extracted keys will be added to the user's keyring.
Definition at line 858 of file crypt.c.
int crypt_get_keys | ( | struct Email * | e, |
char ** | keylist, | ||
bool | oppenc_mode | ||
) |
Check we have all the keys we need.
[in] | e | Email with addresses to match |
[out] | keylist | Keys needed |
[in] | oppenc_mode | If true, use opportunistic encryption |
0 | Success |
-1 | Error |
Do a quick check to make sure that we can find all of the encryption keys if the user has requested this service. Return the list of keys in KEYLIST. If oppenc_mode is true, only keys that can be determined without prompting will be used.
Definition at line 961 of file crypt.c.
void crypt_opportunistic_encrypt | ( | struct Email * | e | ) |
Can all recipients be determined.
e |
Check if all recipients keys can be automatically determined. Enable encryption if they can, otherwise disable encryption.
Definition at line 1045 of file crypt.c.
Create an array of an emails parts.
Definition at line 1074 of file crypt.c.
bool mutt_should_hide_protected_subject | ( | struct Email * | e | ) |
Should NeoMutt hide the protected subject?
e | Email to test |
true | The subject should be protected |
Definition at line 1100 of file crypt.c.
const char * crypt_get_fingerprint_or_id | ( | const char * | p, |
const char ** | pphint, | ||
const char ** | ppl, | ||
const char ** | pps | ||
) |
Get the fingerprint or long key ID.
[in] | p | String to examine |
[out] | pphint | Start of string to be passed to pgp_add_string_to_hints() or crypt_add_string_to_hints() |
[out] | ppl | Start of long key ID if detected, else NULL |
[out] | pps | Start of short key ID if detected, else NULL |
ptr | Copy of fingerprint, if any, stripped of all spaces. Must be FREE'd by caller |
NULL | Otherwise |
Obtain pointers to fingerprint or short or long key ID, if any.
Upon return, at most one of return, *ppl and *pps pointers is non-NULL, indicating the longest fingerprint or ID found, if any.
Definition at line 1385 of file crypt.c.
bool crypt_is_numerical_keyid | ( | const char * | s | ) |
Is this a numerical keyid.
s | Key to test |
true | Keyid is numeric |
Check if a crypt-hook value is a key id.
Definition at line 1474 of file crypt.c.