des_encrypt() -- SSLeay 0.9.0b -- January 1999

NAME

des_enc_read, des_enc_write -- read and write DES-encrypted data

SYNOPSIS

#include "des.h"

int des_enc_read(fd,buf,len,ks,iv)
int fd, len;
char *buf;
des_key_schedule ks;
des_cblock *iv;

int des_enc_write(fd,buf,len,ks,iv)
int fd, len;
char *buf;
des_key_schedule ks;
des_cblock *iv;

DESCRIPTION

All of the encryption functions take what is called a des_key_schedule as an argument. A des_key_schedule is an expanded form of the des key. A des_key is 8 bytes of odd parity, the type used to hold the key is a des_cblock. A des_cblock is an array of 8 bytes, often in this library description I will refer to input bytes when the function specifies des_cblock's as input or output, this just means that the variable should be a multiple of 8 bytes.

des_rw_mode This flag holds either DES_CBC_MODE or DES_PCBC_MODE (default). This specifies the function to use in the enc_read() and enc_write() functions.

des_enc_read() will write to a file descriptor the encrypted data from buf. This data will be preceded by a 4 byte 'byte count' and will be padded out to 8 bytes. The encryption is either CBC of PCBC depending on the value of des_rw_mode. If it is DES_PCBC_MODE, pcbc is used, if DES_CBC_MODE, cbc is used. The default is to use DES_PCBC_MODE.

des_enc_write() reads stuff written by des_enc_read() and decrypts it. I have used these routines quite a lot but I don't believe they are suitable for non-blocking io. If you are after a full authentication/encryption over networks, have a look at SSL instead.