PGP key management routines. More...
#include "config.h"#include <stdbool.h>#include <stdint.h>#include <stdio.h>#include <string.h>#include <sys/stat.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 "pgpkey.h"#include "lib.h"#include "editor/lib.h"#include "history/lib.h"#include "send/lib.h"#include "crypt.h"#include "globals.h"#include "gnupgparse.h"#include "module_data.h"#include "mutt_logging.h"#include "pgpinvoke.h"#include "pgp.h"#include "pgplib.h"
Include dependency graph for pgpkey.c:Go to the source code of this file.
Data Structures | |
| struct | PgpCache |
| List of cached PGP keys. More... | |
Macros | |
| #define | PGP_KV_MATCH (PGP_KV_ADDR | PGP_KV_STRING) |
Typedefs | |
| typedef uint8_t | PgpKeyValidFlags |
Enumerations | |
| enum | PgpKeyValidFlag { PGP_KV_NONE = 0 , PGP_KV_VALID = 1U << 0 , PGP_KV_ADDR = 1U << 1 , PGP_KV_STRING = 1U << 2 , PGP_KV_STRONGID = 1U << 3 } |
| Flags for valid Pgp Key fields. More... | |
Functions | |
| struct PgpKeyInfo * | pgp_principal_key (struct PgpKeyInfo *key) |
| Get the main (parent) PGP key. | |
| bool | pgp_key_is_valid (struct PgpKeyInfo *k) |
| Is a PGP key valid? | |
| bool | pgp_keys_are_valid (struct PgpKeyInfo *keys) |
| Are all these PGP keys valid? | |
| bool | pgp_id_is_strong (struct PgpUid *uid) |
| Is a PGP key strong? | |
| bool | pgp_id_is_valid (struct PgpUid *uid) |
| Is a PGP key valid. | |
| static PgpKeyValidFlags | pgp_id_matches_addr (struct Address *addr, struct Address *u_addr, struct PgpUid *uid) |
| Does the key ID match the address. | |
| struct PgpKeyInfo * | pgp_ask_for_key (char *tag, const char *whatfor, KeyFlags abilities, enum PgpRing keyring) |
| Ask the user for a PGP key. | |
| struct Body * | pgp_class_make_key_attachment (void) |
| Generate a public key attachment - Implements CryptModuleSpecs::pgp_make_key_attachment() -. | |
| static void | pgp_add_string_to_hints (const char *str, struct ListHead *hints) |
| Split a string and add the parts to a List. | |
| static struct PgpKeyInfo ** | pgp_get_lastp (struct PgpKeyInfo *p) |
| Get the last PGP key in a list. | |
| struct PgpKeyInfo * | pgp_getkeybyaddr (struct Address *a, KeyFlags abilities, enum PgpRing keyring, bool oppenc_mode) |
| Find a PGP key by address. | |
| struct PgpKeyInfo * | pgp_getkeybystr (const char *cp, KeyFlags abilities, enum PgpRing keyring) |
| Find a PGP key by string. | |
| void | pgp_id_defaults_cleanup (struct PgpCache **pgp_id_defaults) |
| Free the PGP IdDefaults cache. | |
PGP key management routines.
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 pgpkey.c.
| #define PGP_KV_MATCH (PGP_KV_ADDR | PGP_KV_STRING) |
| typedef uint8_t PgpKeyValidFlags |
| enum PgpKeyValidFlag |
Flags for valid Pgp Key fields.
| Enumerator | |
|---|---|
| PGP_KV_NONE | No flags are set. |
| PGP_KV_VALID | PGP Key ID is valid. |
| PGP_KV_ADDR | PGP Key address is valid. |
| PGP_KV_STRING | PGP Key name string is valid. |
| PGP_KV_STRONGID | PGP Key is strong. |
Definition at line 76 of file pgpkey.c.
| struct PgpKeyInfo * pgp_principal_key | ( | struct PgpKeyInfo * | key | ) |
| bool pgp_key_is_valid | ( | struct PgpKeyInfo * | k | ) |
Is a PGP key valid?
| k | Key to examine |
| true | Key is valid |
Definition at line 107 of file pgpkey.c.
Here is the call graph for this function:
Here is the caller graph for this function:| bool pgp_keys_are_valid | ( | struct PgpKeyInfo * | keys | ) |
Are all these PGP keys valid?
| keys | Set of keys to examine |
| true | All keys are valid |
Definition at line 123 of file pgpkey.c.
Here is the call graph for this function:
Here is the caller graph for this function:| bool pgp_id_is_strong | ( | struct PgpUid * | uid | ) |
| bool pgp_id_is_valid | ( | struct PgpUid * | uid | ) |
|
static |
Does the key ID match the address.
| addr | First email address |
| u_addr | Second email address |
| uid | UID of PGP key |
| num | Flags, e.g. PGP_KV_VALID |
Definition at line 169 of file pgpkey.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct PgpKeyInfo * pgp_ask_for_key | ( | char * | tag, |
| const char * | whatfor, | ||
| KeyFlags | abilities, | ||
| enum PgpRing | keyring ) |
Ask the user for a PGP key.
| tag | Prompt for the user |
| whatfor | Use for key, e.g. "signing" |
| abilities | Abilities to match, see KeyFlags |
| keyring | PGP keyring to use |
| ptr | Selected PGP key |
Definition at line 202 of file pgpkey.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
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.
Definition at line 345 of file pgpkey.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
| struct PgpKeyInfo * pgp_getkeybyaddr | ( | struct Address * | a, |
| KeyFlags | abilities, | ||
| enum PgpRing | keyring, | ||
| bool | oppenc_mode ) |
Find a PGP key by address.
| a | Email address to match |
| abilities | Abilities to match, see KeyFlags |
| keyring | PGP keyring to use |
| oppenc_mode | If true, use opportunistic encryption |
| ptr | Matching PGP key |
Definition at line 382 of file pgpkey.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct PgpKeyInfo * pgp_getkeybystr | ( | const char * | cp, |
| KeyFlags | abilities, | ||
| enum PgpRing | keyring ) |
Find a PGP key by string.
| cp | String to match, can be empty but cannot be NULL |
| abilities | Abilities to match, see KeyFlags |
| keyring | PGP keyring to use |
| ptr | Matching PGP key |
Definition at line 523 of file pgpkey.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void pgp_id_defaults_cleanup | ( | struct PgpCache ** | pgp_id_defaults | ) |