Browse Source

Added pgp_key_get_primary_userid, returning pointer to C string

master
Edouard Tisserant 7 years ago
parent
commit
e2fa5a2189
2 changed files with 11 additions and 0 deletions
  1. +10
    -0
      dist/src/lib/keyring.c
  2. +1
    -0
      dist/src/lib/keyring.h

+ 10
- 0
dist/src/lib/keyring.c View File

@ -522,6 +522,16 @@ const int32_t pgp_key_get_uid0(const pgp_key_t *key)
res;
}
const uint8_t *pgp_key_get_primary_userid(const pgp_key_t *key)
{
const int32_t uid0 = pgp_key_get_uid0(key);
if( uid0 >= 0 && key->uids && key->uidc > uid0)
{
return key->uids[uid0];
}
return NULL;
}
unsigned key_bit_len(const pgp_pubkey_t *key)
{
switch (key->alg) {


+ 1
- 0
dist/src/lib/keyring.h View File

@ -202,6 +202,7 @@ pgp_subpacket_t * pgp_copy_packet(pgp_subpacket_t *, const pgp_subpacket_t *);
uint8_t * pgp_copy_userid(uint8_t **dst, const uint8_t *src);
const int32_t pgp_key_get_uid0(const pgp_key_t *keydata);
const uint8_t *pgp_key_get_primary_userid(const pgp_key_t *key);
const pgp_pubkey_t * pgp_key_get_sigkey(const pgp_key_t *key);
const pgp_seckey_t * pgp_key_get_certkey(const pgp_key_t *key);


Loading…
Cancel
Save