GET_PUBKEY_REC(3)

NAME
get_pubkey_rec - get and store a public key with signatures

SYNOPSIS
#include <pgplib.h>
int
get_pubkey_rec(PGPKEYID keyid, int *len, u_char **buf);
int
store_pubkey_rec(PGPKEYID keyid, repl_t replace, u_char *buf, int len);

DESCRIPTION
The key with the identifier keyid is fetched (or stored) from (in) the database together with all associated signatures and user identifications. When fetched, the result is placed in allocated memory and buf is set to point to it. The length of this memory is returned in len; the caller must free it when it is no longer used. The buffer will contain standard PGP packets, with the public key first. These packages can be used to provide a public key directly. When storing, the buffer buf must point to a memory region, len bytes long, containing PGP packets. The first packet must be a public key, followed by associated signatures and user identifications. If the key is already present, the outcome depends on the value of replace which might be either REPLACE or INSERT with the obvious meanings.

RETURN VALUES
If no error occured, 0 is returned in both cases. When fetching, 1 is returned if the key was not found. When storing, if the key was present and INSERT was specified, 1 is returned. Upon the encounter of an error, -1 is returned in both cases.

SEE ALSO
free(3) keydb_init(PGPlib) malloc(3) store_pubkey_record(PGPlib)

STANDARDS
The packet in buf will, in the case of fetching, be compatible with RFC1991.

HISTORY
Written by Tage Stabell-Kulų. First appeared in PGPlib 0.1