00001 #ifndef __ENCRYPTOR_H
00002 #define __ENCRYPTOR_H
00003
00004 #include <stdio.h>
00005 #include"aes.h"
00006 #include "util.h"
00007 #include<stdlib.h>
00008
00009
00010 #define MAX_STREAM_SIZE 1024*256
00011 class encryptor{
00012
00013 aes_context ctx;
00014 unsigned char stream_block[MAX_STREAM_SIZE][16];
00015 unsigned char nonce_counter[16];
00016 int send_offset;
00017 int receive_offset;
00018
00019 public:
00020 encryptor() ;
00021 encryptor(int &key_len) ;
00022 ~encryptor();
00023
00024 int set_key(unsigned char key_str[], int key_len) ;
00025
00026 int precompute_keys() ;
00027 int print_stream() ;
00028 int crypt(unsigned char *io, int len, int send) ;
00029 int crypt_ctr( aes_context *ctx, unsigned char nonce_counter[16], unsigned char stream_block[16]);
00030 };
00031
00032 #endif