The purpose of the Lead is mainly to provide informations about the file such as the extension, RPM version, name of the package, destination OS, ...It is a C structure:
struct rpmlead {
unsigned char magic[4];
unsigned char major, minor;
short type;
short archnum;
char name[66];
short osnum;
short signature_type;
char reserved[16];
};
The Signature part contains several signatures to check the integrity and authenticity of the package. They are represented as Header data structures, containing the PGP key and a hash MD5 of it.
The Header contains metadata of the package. It is represented as a Header data structure, the same used by the signatures library. We won't go deeper into the structure format, since it is quite complicated but the reader interested should read carefully the header lib/rpmlib.h in the rpm sources.