SSLeay demo
We have installed the ssl libraries on scott (and it was remarkably easy), and I hope to have them
on the stooges before long. The stuff you need to build programs is all
under /usr/local/ssl, although a lot of documentation is still in one of my directories,
/faculty/rossa/datasec/SSLeay-0.8.1 but I intend to move it soon.
Here is a short demonstration using the crypto library to demonstrate IDEA.
Script started on Wed Sep 03 08:36:16 1997
sh-2.00$ cat idea1.c
#include <stdio.h>
#include "/usr/local/ssl/include/idea.h"
void main(){
unsigned char key[] = {0x01, 0x12, 0x23, 0x34,
0x45, 0x56, 0x67, 0x78,
0x89, 0x9a, 0xab, 0xbc,
0xcd, 0xde, 0xef, 0xf0};
IDEA_KEY_SCHEDULE encs, decs;
unsigned char input[] = {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11};
unsigned char output[8];
unsigned char testdec[8];
int i;
idea_set_encrypt_key(key, &encs);
idea_set_decrypt_key(&encs, &decs);
idea_ecb_encrypt(input, output, &encs);
idea_ecb_encrypt(output, testdec, &decs);
printf("Idea input block: ");
for(i = 0; i < 8; i++)
{
printf("%x",input[i]);
}
printf("\noutput block: ");
for(i = 0; i < 8; i++)
{
printf("%x", output[i]);
}
printf("\n");
printf("Decrypted as: ");
for(i=0; i < 8; i++)
{
printf("%x", testdec[i]);
}
printf("\n");
}
sh-2.00$ cc idea1.c /usr/local/ssl/lib/libcrypto.a
sh-2.00$ a.out
Idea input block: 1111111111111111
output block: 93d94f16b9258f
Decrypted as: 1111111111111111
sh-2.00$ exit
exit
script done on Wed Sep 03 08:36:48 1997