/**
* 系统:linux
* 库 : openssl(版本0.9.8k-7ubuntu8.6,)
* 步骤:令flag = 1,调用getMacAddr;再分别令flag等于2和3
* 命令:
* flag = 1时,
* gcc maic.c getMacAddr.c (获取 MAC 地址)
* ./a.out
* flag = 2
* gcc maic.c evp.c -lcrypto
* ./a.out service.info service.key 1 (加密)
* ./a.out service.key file.info 0 (解密)
* flag = 3
* gcc maic.c anaFile.c
* ./a.out
*
* 注意:编译除flag为2外的case时,最好将flag 2 注释掉
*/
#include <stdio.h>
#include "evp.h"
#include "getMacAddr.h"
#include "anaFile.h"
int main(int argc,char **argv)
{
FILE * fin;
FILE * fout;
time_t tTmp;
struct tm tmstrTmp;
memset(&tmstrTmp,0,sizeof(struct tm));
tTmp=time(NULL);
localtime_r(&tTmp,&tmstrTmp);
printf("\t当前时间: %d-%d-%d %d:%d:%d\n",tmstrTmp.tm_year+1900,tmstrTmp.tm_mon+1,tmstrTmp.tm_mday,\
tmstrTmp.tm_hour,tmstrTmp.tm_min,tmstrTmp.tm_sec);
int flag = 3;
switch(flag)
{
case 1 :
getMacAddr();
break;
case 2 :
/*if( 4!=argc )
{
printf( "\tusage :\t./evp <fileinput> <fileoutput> <int>\n" );
return -1;
}
fin = fopen(argv[1], "a+");
fout = fopen(argv[2], "a+");
do_crypt(fin, fout, atoi(argv[3])); // atoi(argv[3]) = 1 时,则加密
fclose(fin);
fclose(fout);*/
break;
case 3 :
//anaFile();
break;
default:
break;
}
return 0;
}