00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 #ifndef __DATA_BLOCK_ENCRYPTOR_H 00011 #define __DATA_BLOCK_ENCRYPTOR_H 00012 00013 #include "Rijndael.h" 00014 #include "RakMemoryOverride.h" 00015 class RakNetRandom; 00016 00018 class DataBlockEncryptor 00019 { 00020 00021 public: 00022 00023 // Constructor 00024 DataBlockEncryptor(); 00025 00026 // Destructor 00027 ~DataBlockEncryptor(); 00028 00030 bool IsKeySet( void ) const; 00031 00034 void SetKey( const unsigned char key[ 16 ] ); 00035 00037 void UnsetKey( void ); 00038 00046 void Encrypt( unsigned char *input, unsigned int inputLength, unsigned char *output, unsigned int *outputLength, RakNetRandom *rnr ); 00047 00056 bool Decrypt( unsigned char *input, unsigned int inputLength, unsigned char *output, unsigned int *outputLength ); 00057 00058 protected: 00059 00060 keyInstance keyEncrypt; 00061 keyInstance keyDecrypt; 00062 cipherInstance cipherInst; 00063 bool keySet; 00064 }; 00065 00066 #endif