KEYDB_INIT(3)

NAME
keydb_init - initialize a database of public keys

SYNOPSIS
#include <pgplib.h>
int
keydb_init(char *name, openmode_t mode);

DESCRIPTION
The string name is used to construct five filenames: name.hash name.key name.string name.revstring and name.keyid, each of which will be used to hold a database. The contents of these databases are as follows:

name.hash
    This database holds hashes of the keys with sigantures in order to rapid verify whether a key record has changed.

name.key
    This database contains the public keys which can be accessed through the other databases. The data indexed by the key is a set of PGP packets containing first the public key, then UserID packets and certificates.

name.keyid
    PGP prints only 32 bit of the real KeyID's when it presents keys. This database is used to quickly find the real KeyID from a short one.

name.revstring
    Indexed by the UserID is the KeyID held as data. This database is used to find the KeyID(s) matching a string which in it self is not a full UserID.

name.string
    Every userid associated with a public key is stored in this database. That is, indexed by the KeyID is a set of UserID's.

The parameter mode can be set to one of the following:

READER
    The database is opened

WRITER
    The database is opened for writing

NEWD
    A new database is created, regardless of whether one existed.

The semantics of these modes is given by the underlying database.

RETURN VALUES
If the databases could be opened (in the desired mode), 0 is returned. If not, -1 is returned.

SEE ALSO
dbopen(3) access(2) keydb_end(PGPlib) store_pubkey(PGPlib) store_pubkey_rec(PGPlib) store_uid(PGPlib)

HISTORY
Written by Tage Stabell-Kulø and Thomas Roessler. First appeared in PGPlib 0.1

BUGS
The number of possible errors are far greater than the number of return codes we want this function to have. It is left to the user to figure out why things went wrong.