int EncryptFile(char *KeyBuffer, char *FileName)
#include <windows.h>
#include <stdio.h>
#include "aes.h"
{int Code;
// attach DLL
Code = aesAttach(0, 0);
if(Code<0)
{printf("ERROR %d: Cannot attach\n", Code);
return FALSE;
}
printf("Will encrypt file in ECB mode\n");
Code = aesInitAES((char *)KeyBuffer, NULL, AES_ECB_MODE, AES_ENCRYPT, NULL);
if(Code<0)
{printf("aesInitAES fails\n");
PrintError(Code);
return FALSE;
}
printf("Encrypt file...\n");
Code = aesEncryptFile(NULL, KeyBuffer, FileName);
if(Code<0)
{printf("aesEncryptFile fails\n");
PrintError(Code);
return FALSE;
}
printf("%d bytes encrypted\n", Code);
return Code;
}
HOME PAGE
MARSHALLSOFT is a trademark of MarshallSoft Computing, Inc.