SIGNATURE(3)

NAME
signature - routines to manipulate signatures

SYNOPSIS
#include <pgplib.h>
int
signature2buf(PGPsig_t *sig, u_char **buf);
int
buf2signature(u_char *buf, int len, PGPsig_t *sig);
void
free_signature(PGPsig_t *sig);
int
make_sig(u_char *buf, int len, u_char class, PGPseckey_t *key, PGPsig_t *sig);
int
sign_buffer(u_char *buf, int len, PGPseckey_t *key, PGPsig_t *sig);
int
verify_sig(u_char *data, int len, PGPsig_t *sig, PGPpubkey_t);
*key"
int
verify_keysig(PGPpubkey_t *pubkey, PGPuserid_t *uid, PGPsig_t *sig, PGPpubkey_t *signkey);
.

DESCRIPTION
These routines manipulate signatures (regardless of type). signature2buf() and buf2signature() operate on a package compatible with RFC1991. The size of the buffer returned by the former can be found with get_packetlen(). free_signature() only frees the internal state (and not the space occupied by the structure itself).

Informally, the routines make_sig() and sign_buffer() will "sign" the data in buf.

More presicely, a hash will be created of len bytes of data from buf together with class and some other information (see RFC1991 for details). This hash is then encrypted with the key key and the resulting data (the signature) stored in sig. The secret components of the key must be decrypted. sign_buffer() will call make_sig() with class set to 0x00 (document signature, binary image; again see RFC1991 for details).

The routine verify_sig() will create a hash of len bytes of data from data, encrypt the hash with the public key key and compare the result with the signature in sig. verify_keysig() will verify a special case of buffer, namely a key-userid binding. The string representing a user-id stored in uid is concatenated to the public key pubkey. A signature is generated with the key signkey and teh result is compared to the sigature stored in sig. .

RETURN VALUES
Upon success 0 is returned. If an error occurs, -1 is returned. buf2signature() will return 1 if there is a syntax error in the input. verify_signature() will return 1 if the signature can-not be verified. .

SEE ALSO
decrypt_seckey(PGPlib) free(3) get_packetlen(PGPlib) malloc(3) PGPlib(3) .

BUGS
Regarding verify_signature(), an interesting question is: What if the digests are identical but the checksums are different? Since I don't know the answer, I don't known what to do if this turns out to be the case so it is ignored (suggestions are most welcome). .

STANDARDS
All p[ackets are in accordance with RFC1991. Encryption is performed according to RFC1425 with the ASN string as described in RFC1423. .

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