DEC_DECRYPT_BUFFER(3)

NAME
dec_decrypt_buffer - decrypt a buffer with a secret key

SYNOPSIS
#include <pgplib.h>
int
sec_decrypt_packet(PGPseckey_t *key, u_char *PKE_packet, int pke_l, u_char *conv_packet, int conv_l, u_char **outbuf, int *outlen);

DESCRIPTION
The buffer pointed to by conv_packet (which is conv_l bytes long) is assumed to hold a conventionally encrypted buffer. The DEK containing the IDEA key, encrypted with a public key, is pointed to by PKE_packet (and it is pke_l bytes long). The secret key needed to decrypt the packet holding the DEK is pointed to by key. PKE_packet is decrypted with key. If the key is the correct one, conv_packet is decrypted with the IDEA key fond inside the DEK. If the (IDEA) key is correct, the resulting packet is placed in a buffer pointed to by outbuf. This buffer i s outlen bytes long. This buffer must be released.

RETURN VALUES
If everything goes well, 0 is returned. If an invalid packet is supplied, 1 is returned. If either the secret key or the IDEA key is incorrect, 2 is returned. If somne other error occurs, -1 is returned.

SEE ALSO
compress_buffer(PGPlib) pub_encrypt_buffer(PGPlib) malloc(3)

HISTORY
Written by Thomas Roessler <roessler@guug.de>. First appeared in PGPlib 0.3.