NeoMutt  2024-11-14-151-g38259e
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
expando_pgp.c File Reference

Ncrypt Expando definitions. More...

#include <stdbool.h>
#include <stdio.h>
#include "private.h"
#include "mutt/lib.h"
#include "core/lib.h"
#include "expando_pgp.h"
#include "lib.h"
#include "expando/lib.h"
#include "pgp.h"
#include "pgpkey.h"
#include "pgplib.h"
+ Include dependency graph for expando_pgp.c:

Go to the source code of this file.

Functions

static char pgp_flags (KeyFlags flags)
 Turn PGP key flags into a string.
 
static void pgp_entry_ignore (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Field not supported - Implements get_string_t -.
 
static long pgp_entry_number_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 PGP: Index number - Implements get_number_t -.
 
static void pgp_entry_trust (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Trust/validity - Implements get_string_t -.
 
static void pgp_entry_user_id (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: User id - Implements get_string_t -.
 
static char * pgp_key_abilities (KeyFlags flags)
 Turn PGP key abilities into a string.
 
static void pgp_key_algorithm (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Key Algorithm - Implements get_string_t -.
 
static void pgp_key_capabilities (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Key Capabilities - Implements get_string_t -.
 
static void pgp_key_date (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Date of the key - Implements get_string_t -.
 
static long pgp_key_date_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 PGP: Date of the key - Implements get_number_t -.
 
static void pgp_key_flags (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Key Flags - Implements get_string_t -.
 
static void pgp_key_id (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Key id - Implements get_string_t -.
 
static long pgp_key_length_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 PGP: Key length - Implements get_number_t -.
 
static void pgp_pkey_algorithm (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Principal Key Algorithm - Implements get_string_t -.
 
static void pgp_pkey_capabilities (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Principal Key Capabilities - Implements get_string_t -.
 
static void pgp_pkey_flags (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Principal Key Flags - Implements get_string_t -.
 
static void pgp_pkey_id (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 PGP: Principal Key id - Implements get_string_t -.
 
static long pgp_pkey_length_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 PGP: Principal Key length - Implements get_number_t -.
 

Variables

static const char TrustFlags [] = "?- +"
 Characters used to show the trust level for PGP keys.
 
const struct ExpandoRenderCallback PgpEntryRenderCallbacks []
 PgpEntryRenderCallbacks- Callbacks for PGP Key Expandos.
 

Detailed Description

Ncrypt Expando definitions.

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 expando_pgp.c.

Function Documentation

◆ pgp_flags()

static char pgp_flags ( KeyFlags  flags)
static

Turn PGP key flags into a string.

Parameters
flagsFlags, see KeyFlags
Return values
charFlag character

Definition at line 49 of file expando_pgp.c.

50{
51 if (flags & KEYFLAG_REVOKED)
52 return 'R';
53 if (flags & KEYFLAG_EXPIRED)
54 return 'X';
55 if (flags & KEYFLAG_DISABLED)
56 return 'd';
57 if (flags & KEYFLAG_CRITICAL)
58 return 'c';
59
60 return ' ';
61}
#define KEYFLAG_EXPIRED
Key is expired.
Definition: lib.h:137
#define KEYFLAG_CRITICAL
Key is marked critical.
Definition: lib.h:141
#define KEYFLAG_DISABLED
Key is marked disabled.
Definition: lib.h:139
#define KEYFLAG_REVOKED
Key is revoked.
Definition: lib.h:138
+ Here is the caller graph for this function:

◆ pgp_key_abilities()

static char * pgp_key_abilities ( KeyFlags  flags)
static

Turn PGP key abilities into a string.

Parameters
flagsFlags, see KeyFlags
Return values
ptrAbilities string
Note
This returns a pointer to a static buffer

Definition at line 112 of file expando_pgp.c.

113{
114 static char buf[3];
115
116 if (!(flags & KEYFLAG_CANENCRYPT))
117 buf[0] = '-';
118 else if (flags & KEYFLAG_PREFER_SIGNING)
119 buf[0] = '.';
120 else
121 buf[0] = 'e';
122
123 if (!(flags & KEYFLAG_CANSIGN))
124 buf[1] = '-';
125 else if (flags & KEYFLAG_PREFER_ENCRYPTION)
126 buf[1] = '.';
127 else
128 buf[1] = 's';
129
130 buf[2] = '\0';
131
132 return buf;
133}
#define KEYFLAG_CANENCRYPT
Key is suitable for encryption.
Definition: lib.h:134
#define KEYFLAG_PREFER_SIGNING
Key's owner prefers signing.
Definition: lib.h:143
#define KEYFLAG_PREFER_ENCRYPTION
Key's owner prefers encryption.
Definition: lib.h:142
#define KEYFLAG_CANSIGN
Key is suitable for signing.
Definition: lib.h:133
+ Here is the caller graph for this function:

Variable Documentation

◆ TrustFlags

const char TrustFlags[] = "?- +"
static

Characters used to show the trust level for PGP keys.

Definition at line 42 of file expando_pgp.c.

◆ PgpEntryRenderCallbacks

const struct ExpandoRenderCallback PgpEntryRenderCallbacks[]
Initial value:
= {
{ -1, -1, NULL, NULL },
}
@ ED_PGP
Pgp ED_PGP_ ExpandoDataPgp.
Definition: domain.h:51
@ ED_PGP_KEY
Pgp_Key ED_PGK_ ExpandoDataPgpKey.
Definition: domain.h:53
static long pgp_key_length_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
PGP: Key length - Implements get_number_t -.
Definition: expando_pgp.c:241
static long pgp_entry_number_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
PGP: Index number - Implements get_number_t -.
Definition: expando_pgp.c:74
static long pgp_key_date_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
PGP: Date of the key - Implements get_number_t -.
Definition: expando_pgp.c:200
static long pgp_pkey_length_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
PGP: Principal Key length - Implements get_number_t -.
Definition: expando_pgp.c:316
static void pgp_entry_ignore(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Field not supported - Implements get_string_t -.
Definition: expando_pgp.c:66
static void pgp_key_capabilities(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Key Capabilities - Implements get_string_t -.
Definition: expando_pgp.c:152
static void pgp_pkey_algorithm(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Principal Key Algorithm - Implements get_string_t -.
Definition: expando_pgp.c:253
static void pgp_key_flags(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Key Flags - Implements get_string_t -.
Definition: expando_pgp.c:212
static void pgp_pkey_flags(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Principal Key Flags - Implements get_string_t -.
Definition: expando_pgp.c:285
static void pgp_key_id(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Key id - Implements get_string_t -.
Definition: expando_pgp.c:227
static void pgp_pkey_capabilities(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Principal Key Capabilities - Implements get_string_t -.
Definition: expando_pgp.c:268
static void pgp_key_algorithm(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Key Algorithm - Implements get_string_t -.
Definition: expando_pgp.c:138
static void pgp_entry_user_id(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: User id - Implements get_string_t -.
Definition: expando_pgp.c:95
static void pgp_key_date(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Date of the key - Implements get_string_t -.
Definition: expando_pgp.c:168
static void pgp_pkey_id(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Principal Key id - Implements get_string_t -.
Definition: expando_pgp.c:301
static void pgp_entry_trust(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP: Trust/validity - Implements get_string_t -.
Definition: expando_pgp.c:83
@ ED_PGP_NUMBER
PgpEntry.num.
Definition: private.h:51
@ ED_PGP_USER_ID
PgpUid.addr.
Definition: private.h:53
@ ED_PGP_TRUST
PgpUid, TrustFlags.
Definition: private.h:52
@ ED_PGK_KEY_CAPABILITIES
PgpKeyInfo.flags, pgp_key_abilities()
Definition: pgplib.h:71
@ ED_PGK_KEY_FINGERPRINT
PgpKeyInfo.fingerprint.
Definition: pgplib.h:72
@ ED_PGK_PKEY_LENGTH
pgp_principal_key(), PgpKeyInfo.keylen
Definition: pgplib.h:81
@ ED_PGK_PKEY_ALGORITHM
pgp_principal_key(), PgpKeyInfo.algorithm
Definition: pgplib.h:76
@ ED_PGK_DATE
PgpKeyInfo.gen_time.
Definition: pgplib.h:69
@ ED_PGK_PKEY_FINGERPRINT
pgp_principal_key(), PgpKeyInfo.fingerprint
Definition: pgplib.h:78
@ ED_PGK_KEY_ID
PgpKeyInfo, pgp_this_keyid()
Definition: pgplib.h:74
@ ED_PGK_PROTOCOL
PgpKeyInfo.
Definition: pgplib.h:82
@ ED_PGK_PKEY_CAPABILITIES
pgp_principal_key(), PgpKeyInfo.flags, pgp_key_abilities()
Definition: pgplib.h:77
@ ED_PGK_KEY_FLAGS
PgpKeyInfo.kflags, pgp_flags()
Definition: pgplib.h:73
@ ED_PGK_PKEY_ID
pgp_principal_key(), PgpKeyInfo, pgp_this_keyid()
Definition: pgplib.h:80
@ ED_PGK_KEY_ALGORITHM
PgpKeyInfo.algorithm.
Definition: pgplib.h:70
@ ED_PGK_KEY_LENGTH
PgpKeyInfo.keylen.
Definition: pgplib.h:75
@ ED_PGK_PKEY_FLAGS
pgp_principal_key(), PgpKeyInfo.kflags, pgp_flags()
Definition: pgplib.h:79

PgpEntryRenderCallbacks- Callbacks for PGP Key Expandos.

See also
PgpEntryFormatDef, ExpandoDataGlobal, ExpandoDataPgp, ExpandoDataPgpKey

Definition at line 331 of file expando_pgp.c.