68 " -in arg - input file - default stdin\n",
69 " -out arg - output file - default stdout\n",
70 " -key key - password\n",
74 int main(
int argc,
char *argv[])
76 FILE *
in=NULL,*
out=NULL;
77 char *infile=NULL,*outfile=NULL,*keystr=NULL;
88 if (strcmp(*argv,
"-in") == 0)
90 if (--argc < 1)
goto bad;
93 else if (strcmp(*argv,
"-out") == 0)
95 if (--argc < 1)
goto bad;
98 else if (strcmp(*argv,
"-key") == 0)
100 if (--argc < 1)
goto bad;
105 fprintf(stderr,
"unknown option %s\n",*argv);
116 for (pp=
usage; (*pp != NULL); pp++)
117 fprintf(stderr,
"%s",*pp);
125 in=fopen(infile,
"r");
137 out=fopen(outfile,
"w");
145 #ifdef OPENSSL_SYS_MSDOS
160 fprintf(stderr,
"bad password read\n");
172 i=fread(buf,1,BUFSIZ,in);
179 RC4(&key,(
unsigned int)i,(
unsigned char *)buf,
180 (
unsigned char *)buf);
181 i=fwrite(buf,(
unsigned int)i,1,out);