Wrapper for PGP/SMIME calls to GPGME. More...
#include "config.h"
#include <errno.h>
#include <gpg-error.h>
#include <gpgme.h>
#include <langinfo.h>
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "private.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_gpgme.h"
#include "lib.h"
#include "attach/lib.h"
#include "editor/lib.h"
#include "history/lib.h"
#include "question/lib.h"
#include "send/lib.h"
#include "crypt.h"
#include "globals.h"
#include "gpgme_functions.h"
#include "handler.h"
#include "hook.h"
#include "mutt_logging.h"
#include "autocrypt/lib.h"
Go to the source code of this file.
Data Structures | |
struct | CryptCache |
Internal cache for GPGME. More... | |
Macros | |
#define | CRYPT_KV_VALID (1 << 0) |
#define | CRYPT_KV_ADDR (1 << 1) |
#define | CRYPT_KV_STRING (1 << 2) |
#define | CRYPT_KV_STRONGID (1 << 3) |
#define | CRYPT_KV_MATCH (CRYPT_KV_ADDR | CRYPT_KV_STRING) |
#define | PKA_NOTATION_NAME "pka-address@gnupg.org" |
#define | _LINE_COMPARE(_x, _y) line_compare(_x, sizeof(_x) - 1, _y) |
#define | MESSAGE(_y) _LINE_COMPARE("MESSAGE-----", _y) |
#define | SIGNED_MESSAGE(_y) _LINE_COMPARE("SIGNED MESSAGE-----", _y) |
#define | PUBLIC_KEY_BLOCK(_y) _LINE_COMPARE("PUBLIC KEY BLOCK-----", _y) |
#define | BEGIN_PGP_SIGNATURE(_y) _LINE_COMPARE("-----BEGIN PGP SIGNATURE-----", _y) |
Functions | |
static bool | is_pka_notation (gpgme_sig_notation_t notation) |
Is this the standard pka email address. | |
static void | redraw_if_needed (gpgme_ctx_t ctx) |
Accommodate for a redraw if needed. | |
const char * | crypt_keyid (struct CryptKeyInfo *k) |
Find the ID for the key. | |
static const char * | crypt_long_keyid (struct CryptKeyInfo *k) |
Find the Long ID for the key. | |
static const char * | crypt_short_keyid (struct CryptKeyInfo *k) |
Get the short keyID for a key. | |
static const char * | crypt_fpr (struct CryptKeyInfo *k) |
Get the hexstring fingerprint from a key. | |
const char * | crypt_fpr_or_lkeyid (struct CryptKeyInfo *k) |
Find the fingerprint of a key. | |
struct CryptKeyInfo * | crypt_copy_key (struct CryptKeyInfo *key) |
Return a copy of KEY. | |
static void | crypt_key_free (struct CryptKeyInfo **keylist) |
Release all the keys in a list. | |
bool | crypt_id_is_strong (struct CryptKeyInfo *key) |
Is the key strong. | |
int | crypt_id_is_valid (struct CryptKeyInfo *key) |
Is key ID valid. | |
static int | crypt_id_matches_addr (struct Address *addr, struct Address *u_addr, struct CryptKeyInfo *key) |
Does the key ID match the address. | |
gpgme_ctx_t | create_gpgme_context (bool for_smime) |
Create a new GPGME context. | |
static gpgme_data_t | create_gpgme_data (void) |
Create a new GPGME data object. | |
static gpgme_data_t | body_to_data_object (struct Body *b, bool convert) |
Create GPGME object from the mail body. | |
static gpgme_data_t | file_to_data_object (FILE *fp, long offset, size_t length) |
Create GPGME data object from file. | |
static int | data_object_to_stream (gpgme_data_t data, FILE *fp) |
Write a GPGME data object to a file. | |
static char * | data_object_to_tempfile (gpgme_data_t data, FILE **fp_ret) |
Copy a data object to a temporary file. | |
static void | create_recipient_string (const char *keylist, struct Buffer *recpstring, int use_smime) |
Create a string of recipients. | |
static bool | set_signer_from_address (gpgme_ctx_t ctx, const char *address, bool for_smime) |
Try to set the context's signer from the address. | |
static int | set_signer (gpgme_ctx_t ctx, const struct AddressList *al, bool for_smime) |
Make sure that the correct signer is set. | |
static gpgme_error_t | set_pka_sig_notation (gpgme_ctx_t ctx) |
Set the signature notation. | |
static char * | encrypt_gpgme_object (gpgme_data_t plaintext, char *keylist, bool use_smime, bool combined_signed, const struct AddressList *from) |
Encrypt the GPGPME data object. | |
static int | get_micalg (gpgme_ctx_t ctx, int use_smime, char *buf, size_t buflen) |
Find the "micalg" parameter from the last GPGME operation. | |
static void | print_time (time_t t, struct State *state) |
Print the date/time according to the locale. | |
static struct Body * | sign_message (struct Body *b, const struct AddressList *from, bool use_smime) |
Sign a message. | |
struct Body * | pgp_gpgme_sign_message (struct Body *b, const struct AddressList *from) |
Cryptographically sign the Body of a message - Implements CryptModuleSpecs::sign_message() -. | |
struct Body * | smime_gpgme_sign_message (struct Body *b, const struct AddressList *from) |
Cryptographically sign the Body of a message - Implements CryptModuleSpecs::sign_message() -. | |
struct Body * | pgp_gpgme_encrypt_message (struct Body *b, char *keylist, bool sign, const struct AddressList *from) |
PGP encrypt an email - Implements CryptModuleSpecs::pgp_encrypt_message() -. | |
struct Body * | smime_gpgme_build_smime_entity (struct Body *b, char *keylist) |
Encrypt the email body to all recipients - Implements CryptModuleSpecs::smime_build_smime_entity() -. | |
static int | show_sig_summary (unsigned long sum, gpgme_ctx_t ctx, gpgme_key_t key, int idx, struct State *state, gpgme_signature_t sig) |
Show a signature summary. | |
static void | show_fingerprint (gpgme_key_t key, struct State *state) |
Write a key's fingerprint. | |
static void | show_one_sig_validity (gpgme_ctx_t ctx, int idx, struct State *state) |
Show the validity of a key used for one signature. | |
static void | print_smime_keyinfo (const char *msg, gpgme_signature_t sig, gpgme_key_t key, struct State *state) |
Print key info about an SMIME key. | |
static void | show_one_recipient (struct State *state, gpgme_recipient_t r) |
Show information about one encryption recipient. | |
static void | show_encryption_info (struct State *state, gpgme_decrypt_result_t result) |
Show encryption information. | |
static int | show_one_sig_status (gpgme_ctx_t ctx, int idx, struct State *state) |
Show information about one signature. | |
static int | verify_one (struct Body *b, struct State *state, const char *tempfile, bool is_smime) |
Do the actual verification step. | |
int | pgp_gpgme_verify_one (struct Body *b, struct State *state, const char *tempfile) |
Check a signed MIME part against a signature - Implements CryptModuleSpecs::verify_one() -. | |
int | smime_gpgme_verify_one (struct Body *b, struct State *state, const char *tempfile) |
Check a signed MIME part against a signature - Implements CryptModuleSpecs::verify_one() -. | |
static struct Body * | decrypt_part (struct Body *b, struct State *state, FILE *fp_out, bool is_smime, int *r_is_signed) |
Decrypt a PGP or SMIME message. | |
int | pgp_gpgme_decrypt_mime (FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec) |
Decrypt an encrypted MIME part - Implements CryptModuleSpecs::decrypt_mime() -. | |
int | smime_gpgme_decrypt_mime (FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec) |
Decrypt an encrypted MIME part - Implements CryptModuleSpecs::decrypt_mime() -. | |
static int | pgp_gpgme_extract_keys (gpgme_data_t keydata, FILE **fp) |
Write PGP keys to a file. | |
static int | line_compare (const char *a, size_t n, const char *b) |
Compare two strings ignore line endings. | |
static int | pgp_check_traditional_one_body (FILE *fp, struct Body *b) |
Check one inline PGP body part. | |
bool | pgp_gpgme_check_traditional (FILE *fp, struct Body *b, bool just_one) |
Look for inline (non-MIME) PGP content - Implements CryptModuleSpecs::pgp_check_traditional() -. | |
void | pgp_gpgme_invoke_import (const char *fname) |
Import a key from a message into the user's public key ring - Implements CryptModuleSpecs::pgp_invoke_import() -. | |
static void | copy_clearsigned (gpgme_data_t data, struct State *state, char *charset) |
Copy a clearsigned message. | |
int | pgp_gpgme_application_handler (struct Body *b, struct State *state) |
Manage the MIME type "application/pgp" or "application/smime" - Implements CryptModuleSpecs::application_handler() -. | |
int | pgp_gpgme_encrypted_handler (struct Body *b, struct State *state) |
Manage a PGP or S/MIME encrypted MIME part - Implements CryptModuleSpecs::encrypted_handler() -. | |
int | smime_gpgme_application_handler (struct Body *b, struct State *state) |
Manage the MIME type "application/pgp" or "application/smime" - Implements CryptModuleSpecs::application_handler() -. | |
unsigned int | key_check_cap (gpgme_key_t key, enum KeyCap cap) |
Check the capabilities of a key. | |
static char * | list_to_pattern (struct ListHead *list) |
Convert STailQ to GPGME-compatible pattern. | |
static struct CryptKeyInfo * | get_candidates (struct ListHead *hints, SecurityFlags app, int secret) |
Get a list of keys which are candidates for the selection. | |
static void | crypt_add_string_to_hints (const char *str, struct ListHead *hints) |
Split a string and add the parts to a List. | |
static struct CryptKeyInfo * | crypt_getkeybyaddr (struct Address *a, KeyFlags abilities, unsigned int app, bool *forced_valid, bool oppenc_mode) |
Find a key by email address. | |
static struct CryptKeyInfo * | crypt_getkeybystr (const char *p, KeyFlags abilities, unsigned int app, bool *forced_valid) |
Find a key by string. | |
static struct CryptKeyInfo * | crypt_ask_for_key (const char *tag, const char *whatfor, KeyFlags abilities, unsigned int app, bool *forced_valid) |
Ask the user for a key. | |
static char * | find_keys (const struct AddressList *addrlist, unsigned int app, bool oppenc_mode) |
Find keys of the recipients of the message. | |
char * | pgp_gpgme_find_keys (const struct AddressList *addrlist, bool oppenc_mode) |
Find the keyids of the recipients of a message - Implements CryptModuleSpecs::find_keys() -. | |
char * | smime_gpgme_find_keys (const struct AddressList *addrlist, bool oppenc_mode) |
Find the keyids of the recipients of a message - Implements CryptModuleSpecs::find_keys() -. | |
int | mutt_gpgme_select_secret_key (struct Buffer *keyid) |
Select a private Autocrypt key for a new account. | |
struct Body * | pgp_gpgme_make_key_attachment (void) |
Generate a public key attachment - Implements CryptModuleSpecs::pgp_make_key_attachment() -. | |
static void | init_common (void) |
Initialise code common to PGP and SMIME parts of GPGME. | |
static void | init_pgp (void) |
Initialise the PGP crypto backend. | |
static void | init_smime (void) |
Initialise the SMIME crypto backend. | |
void | pgp_gpgme_init (void) |
Initialise the crypto module - Implements CryptModuleSpecs::init() -. | |
void | smime_gpgme_init (void) |
Initialise the crypto module - Implements CryptModuleSpecs::init() -. | |
static SecurityFlags | gpgme_send_menu (struct Email *e, bool is_smime) |
Show the user the encryption/signing menu. | |
SecurityFlags | pgp_gpgme_send_menu (struct Email *e) |
Ask the user whether to sign and/or encrypt the email - Implements CryptModuleSpecs::send_menu() -. | |
SecurityFlags | smime_gpgme_send_menu (struct Email *e) |
Ask the user whether to sign and/or encrypt the email - Implements CryptModuleSpecs::send_menu() -. | |
static bool | verify_sender (struct Email *e) |
Verify the sender of a message. | |
int | smime_gpgme_verify_sender (struct Email *e, struct Message *msg) |
Does the sender match the certificate? - Implements CryptModuleSpecs::smime_verify_sender() -. | |
void | pgp_gpgme_set_sender (const char *sender) |
Set the sender of the email - Implements CryptModuleSpecs::set_sender() -. | |
const char * | mutt_gpgme_print_version (void) |
Get version of GPGME. | |
Variables | |
static struct CryptCache * | IdDefaults = NULL |
Cache of GPGME keys. | |
static gpgme_key_t | SignatureKey = NULL |
PGP Key to sign with. | |
static char * | CurrentSender = NULL |
Email address of the sender. | |
Wrapper for PGP/SMIME calls to GPGME.
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_gpgme.c.
#define CRYPT_KV_VALID (1 << 0) |
Definition at line 74 of file crypt_gpgme.c.
#define CRYPT_KV_ADDR (1 << 1) |
Definition at line 75 of file crypt_gpgme.c.
#define CRYPT_KV_STRING (1 << 2) |
Definition at line 76 of file crypt_gpgme.c.
#define CRYPT_KV_STRONGID (1 << 3) |
Definition at line 77 of file crypt_gpgme.c.
#define CRYPT_KV_MATCH (CRYPT_KV_ADDR | CRYPT_KV_STRING) |
Definition at line 78 of file crypt_gpgme.c.
#define PKA_NOTATION_NAME "pka-address@gnupg.org" |
Definition at line 98 of file crypt_gpgme.c.
#define _LINE_COMPARE | ( | _x, | |
_y | |||
) | line_compare(_x, sizeof(_x) - 1, _y) |
Definition at line 100 of file crypt_gpgme.c.
#define MESSAGE | ( | _y | ) | _LINE_COMPARE("MESSAGE-----", _y) |
Definition at line 101 of file crypt_gpgme.c.
#define SIGNED_MESSAGE | ( | _y | ) | _LINE_COMPARE("SIGNED MESSAGE-----", _y) |
Definition at line 102 of file crypt_gpgme.c.
#define PUBLIC_KEY_BLOCK | ( | _y | ) | _LINE_COMPARE("PUBLIC KEY BLOCK-----", _y) |
Definition at line 103 of file crypt_gpgme.c.
#define BEGIN_PGP_SIGNATURE | ( | _y | ) | _LINE_COMPARE("-----BEGIN PGP SIGNATURE-----", _y) |
Definition at line 104 of file crypt_gpgme.c.
|
static |
Is this the standard pka email address.
notation | GPGME notation |
true | It is the standard pka email address |
Definition at line 112 of file crypt_gpgme.c.
|
static |
Accommodate for a redraw if needed.
ctx | GPGME handle |
Definition at line 121 of file crypt_gpgme.c.
const char * crypt_keyid | ( | struct CryptKeyInfo * | k | ) |
Find the ID for the key.
k | Key to use |
ptr | ID string for the key |
Return the keyID for the key K. Note that this string is valid as long as K is valid
Definition at line 138 of file crypt_gpgme.c.
|
static |
Find the Long ID for the key.
k | Key to use |
ptr | Long ID string for the key |
Return the long keyID for the key K.
Definition at line 163 of file crypt_gpgme.c.
|
static |
Get the short keyID for a key.
k | Key to use |
ptr | Short key string |
Definition at line 180 of file crypt_gpgme.c.
|
static |
Get the hexstring fingerprint from a key.
k | Key to use |
ptr | Hexstring fingerprint |
Definition at line 199 of file crypt_gpgme.c.
const char * crypt_fpr_or_lkeyid | ( | struct CryptKeyInfo * | k | ) |
Find the fingerprint of a key.
k | Key to examine |
ptr | Fingerprint if available, otherwise the long keyid |
Definition at line 214 of file crypt_gpgme.c.
struct CryptKeyInfo * crypt_copy_key | ( | struct CryptKeyInfo * | key | ) |
Return a copy of KEY.
key | Key to copy |
ptr | Copy of key |
Definition at line 234 of file crypt_gpgme.c.
|
static |
Release all the keys in a list.
[out] | keylist | List of keys |
Definition at line 253 of file crypt_gpgme.c.
bool crypt_id_is_strong | ( | struct CryptKeyInfo * | key | ) |
Is the key strong.
key | Key to test |
true | Validity of key is sufficient |
Definition at line 275 of file crypt_gpgme.c.
int crypt_id_is_valid | ( | struct CryptKeyInfo * | key | ) |
Is key ID valid.
key | Key to test |
true | Key is valid |
When the key is not marked as unusable
Definition at line 310 of file crypt_gpgme.c.
|
static |
Does the key ID match the address.
addr | First email address |
u_addr | Second email address |
key | Key to use |
num | Flags, e.g. CRYPT_KV_VALID |
Return a bit vector describing how well the addresses ADDR and U_ADDR match and whether KEY is valid.
Definition at line 328 of file crypt_gpgme.c.
gpgme_ctx_t create_gpgme_context | ( | bool | for_smime | ) |
Create a new GPGME context.
for_smime | If true, protocol of the context is set to CMS |
ptr | New GPGME context |
Definition at line 361 of file crypt_gpgme.c.
|
static |
Create a new GPGME data object.
ptr | GPGPE data object |
This is a wrapper to die on error.
Definition at line 400 of file crypt_gpgme.c.
|
static |
Create GPGME object from the mail body.
b | Body to use |
convert | If true, lines are converted to CR-LF if required |
ptr | Newly created GPGME data object |
Definition at line 419 of file crypt_gpgme.c.
|
static |
Create GPGME data object from file.
fp | File to read from |
offset | Offset to start reading from |
length | Length of data to read |
ptr | Newly created GPGME data object |
Definition at line 493 of file crypt_gpgme.c.
|
static |
Write a GPGME data object to a file.
data | GPGME data object |
fp | File to write to |
0 | Success |
-1 | Error |
Definition at line 514 of file crypt_gpgme.c.
|
static |
Copy a data object to a temporary file.
[in] | data | GPGME data object |
[out] | fp_ret | Temporary file |
ptr | Name of temporary file |
If fp_ret is passed in, the file will be rewound, left open, and returned via that parameter.
Definition at line 563 of file crypt_gpgme.c.
|
static |
Create a string of recipients.
keylist | Keys, space-separated |
recpstring | Buffer to store the recipients |
use_smime | Use SMIME |
Definition at line 622 of file crypt_gpgme.c.
|
static |
Try to set the context's signer from the address.
ctx | GPGME handle |
address | Address to try to set as a signer |
for_smime | Use S/MIME |
Definition at line 658 of file crypt_gpgme.c.
|
static |
Make sure that the correct signer is set.
ctx | GPGME handle |
al | From AddressList |
for_smime | Use S/MIME |
0 | Success |
-1 | Error |
Definition at line 717 of file crypt_gpgme.c.
|
static |
Set the signature notation.
ctx | GPGME context |
num | GPGME error code, e.g. GPG_ERR_NO_ERROR |
Definition at line 761 of file crypt_gpgme.c.
|
static |
Encrypt the GPGPME data object.
plaintext | GPGME data object with plain text message |
keylist | List of keys to encrypt to |
use_smime | If true, use SMIME |
combined_signed | If true, sign and encrypt the message (PGP only) |
from | The From header line |
ptr | Name of temporary file containing encrypted text |
Definition at line 781 of file crypt_gpgme.c.
|
static |
Find the "micalg" parameter from the last GPGME operation.
ctx | GPGME handle |
use_smime | If set, use SMIME instead of PGP |
buf | Buffer for the result |
buflen | Length of buffer |
0 | Success |
-1 | Error |
Find the "Message Integrity Check algorithm" from the last GPGME operation. It is expected that this operation was a sign operation.
Definition at line 853 of file crypt_gpgme.c.
|
static |
Print the date/time according to the locale.
t | Timestamp |
state | State to write to |
Definition at line 891 of file crypt_gpgme.c.
|
static |
Sign a message.
b | Message to sign |
from | The From header line |
use_smime | If set, use SMIME instead of PGP |
ptr | new Body |
NULL | error |
Definition at line 906 of file crypt_gpgme.c.
|
static |
Show a signature summary.
sum | Flags, e.g. GPGME_SIGSUM_KEY_REVOKED |
ctx | GPGME handle |
key | Set of keys |
idx | Index into key set |
state | State to use |
sig | GPGME signature |
0 | Success |
1 | There is a severe warning |
Display the common attributes of the signature summary SUM.
Definition at line 1133 of file crypt_gpgme.c.
|
static |
Write a key's fingerprint.
key | GPGME key |
state | State to write to |
Definition at line 1257 of file crypt_gpgme.c.
|
static |
Show the validity of a key used for one signature.
ctx | GPGME handle |
idx | Index of signature to check |
state | State to use |
Definition at line 1312 of file crypt_gpgme.c.
|
static |
Print key info about an SMIME key.
msg | Prefix message to write |
sig | GPGME signature |
key | GPGME key |
state | State to write to |
Definition at line 1351 of file crypt_gpgme.c.
|
static |
Show information about one encryption recipient.
state | State to write to |
r | Encryption recipient |
Definition at line 1417 of file crypt_gpgme.c.
|
static |
Show encryption information.
state | State to write to |
result | Decryption result |
Definition at line 1433 of file crypt_gpgme.c.
|
static |
Show information about one signature.
ctx | GPGME handle of a successful verification |
idx | Index |
state | State to use |
0 | Normal procession |
1 | A bad signature |
2 | A signature with a warning |
-1 | No more signature |
The index should start at 0 and increment for each call/signature.
Definition at line 1458 of file crypt_gpgme.c.
|
static |
Do the actual verification step.
b | Body part containing signature |
state | State to read from |
tempfile | Temporary file to read |
is_smime | Is the key S/MIME? |
0 | Success |
1 | Bad signature |
2 | Warnings |
-1 | Error |
With is_smime set to true we assume S/MIME.
Definition at line 1581 of file crypt_gpgme.c.
|
static |
Decrypt a PGP or SMIME message.
[in] | b | Body of message |
[in] | state | State to use |
[in] | fp_out | File to write to |
[in] | is_smime | True if an SMIME message |
[out] | r_is_signed | Flag, R_IS_SIGNED (PGP only) |
ptr | Newly allocated Body |
For PGP returns a flag in R_IS_SIGNED to indicate whether this is a combined encrypted and signed message, for S/MIME it returns true when it is not a encrypted but a signed message.
Definition at line 1732 of file crypt_gpgme.c.
|
static |
Write PGP keys to a file.
[in] | keydata | GPGME key data |
[out] | fp | Temporary file created with key info |
0 | Success |
-1 | Error |
Definition at line 2112 of file crypt_gpgme.c.
|
static |
Compare two strings ignore line endings.
a | String a |
n | Maximum length to compare |
b | String b |
0 | Strings match |
-1 | Strings differ |
Check that b is a complete line containing a followed by either LF or CRLF.
Definition at line 2195 of file crypt_gpgme.c.
|
static |
Check one inline PGP body part.
fp | File to read from |
b | Body of the email |
true | Success |
false | Error |
Definition at line 2213 of file crypt_gpgme.c.
|
static |
Copy a clearsigned message.
data | GPGME data object |
state | State to use |
charset | Charset of message |
strip the signature and PGP's dash-escaping.
XXX charset handling: We assume that it is safe to do character set decoding first, dash decoding second here, while we do it the other way around in the main handler.
(Note that we aren't worse than Outlook & Cie in this, and also note that we can successfully handle anything produced by any existing versions of neomutt.)
Definition at line 2414 of file crypt_gpgme.c.
unsigned int key_check_cap | ( | gpgme_key_t | key, |
enum KeyCap | cap | ||
) |
Check the capabilities of a key.
key | GPGME key |
cap | Flags, e.g. KEY_CAP_CAN_ENCRYPT |
>0 | Key has the capabilities |
Definition at line 2948 of file crypt_gpgme.c.
|
static |
Convert STailQ to GPGME-compatible pattern.
list | List of strings to convert |
ptr | GPGME-compatible pattern |
We need to convert spaces in an item into a '+' and '' into "%25".
Definition at line 3004 of file crypt_gpgme.c.
|
static |
Get a list of keys which are candidates for the selection.
hints | List of strings to match |
app | Application type, e.g. APPLICATION_PGP |
secret | If true, only match secret keys |
ptr | Key List |
NULL | Error |
Select by looking at the HINTS list.
Definition at line 3071 of file crypt_gpgme.c.
|
static |
Split a string and add the parts to a List.
[in] | str | String to parse |
[out] | hints | List of string parts |
The string str is split by whitespace and punctuation and the parts added to hints. This list is later used to match addresses.
Definition at line 3224 of file crypt_gpgme.c.
|
static |
Find a key by email address.
[in] | a | Address to match |
[in] | abilities | Abilities to match, see KeyFlags |
[in] | app | Application type, e.g. APPLICATION_PGP |
[out] | forced_valid | Set to true if user overrode key's validity |
[in] | oppenc_mode | If true, use opportunistic encryption |
ptr | Matching key |
Definition at line 3248 of file crypt_gpgme.c.
|
static |
Find a key by string.
[in] | p | String to match |
[in] | abilities | Abilities to match, see KeyFlags |
[in] | app | Application type, e.g. APPLICATION_PGP |
[out] | forced_valid | Set to true if user overrode key's validity |
ptr | Matching key |
Definition at line 3382 of file crypt_gpgme.c.
|
static |
Ask the user for a key.
[in] | tag | Prompt to display |
[in] | whatfor | Label to use (OPTIONAL) |
[in] | abilities | Flags, see KeyFlags |
[in] | app | Application type, e.g. APPLICATION_PGP |
[out] | forced_valid | Set to true if user overrode key's validity |
ptr | Copy of the selected key |
If whatfor is not null use it as default and store it under that label as the next default.
Definition at line 3465 of file crypt_gpgme.c.
|
static |
Find keys of the recipients of the message.
addrlist | Address List |
app | Application type, e.g. APPLICATION_PGP |
oppenc_mode | If true, use opportunistic encryption |
ptr | Space-separated string of keys |
NULL | At least one of the keys can't be found |
If oppenc_mode is true, only keys that can be determined without prompting will be used.
Definition at line 3534 of file crypt_gpgme.c.
int mutt_gpgme_select_secret_key | ( | struct Buffer * | keyid | ) |
Select a private Autocrypt key for a new account.
keyid | Autocrypt Key id |
0 | Success |
-1 | Error |
Unfortunately, the internal ncrypt/crypt_gpgme.c functions use CryptKeyInfo, and so aren't exportable.
This function queries all private keys, provides the crypt_select_keys() menu, and returns the selected key fingerprint in keyid.
Definition at line 3685 of file crypt_gpgme.c.
|
static |
Initialise code common to PGP and SMIME parts of GPGME.
Definition at line 3824 of file crypt_gpgme.c.
|
static |
Initialise the PGP crypto backend.
Definition at line 3843 of file crypt_gpgme.c.
|
static |
Initialise the SMIME crypto backend.
Definition at line 3854 of file crypt_gpgme.c.
|
static |
Show the user the encryption/signing menu.
e | |
is_smime | True if an SMIME message |
num | Flags, e.g. APPLICATION_SMIME | SEC_ENCRYPT |
Definition at line 3886 of file crypt_gpgme.c.
|
static |
Verify the sender of a message.
e |
true | Sender is verified |
Definition at line 4065 of file crypt_gpgme.c.
const char * mutt_gpgme_print_version | ( | void | ) |
Get version of GPGME.
ptr | GPGME version string |
Definition at line 4163 of file crypt_gpgme.c.
|
static |
Cache of GPGME keys.
Definition at line 92 of file crypt_gpgme.c.
|
static |
PGP Key to sign with.
Definition at line 94 of file crypt_gpgme.c.
|
static |
Email address of the sender.
Definition at line 96 of file crypt_gpgme.c.