/*
http://ardoino.altervista.org/crypto-security/articles/openssl_all
*/
//-------------------misc.c----------------------------------------------
void help(char *name)
{
printf("UniSFED [Simple File Encrypter/Decrypter] v%s\n",\
VERSION);
printf("Coded by Paolo Ardoino <ardoino.gnu@disi.unige.it>\n");
printf("Usage:\n");
printf("%s -h\t:displays this help\n",name);
printf("%s -fh <file_to_hash>\t:performs the MD5 hash of \
file_to_hash.\n",name);
printf("%s -fc <file1_to_cmp> <file2_to_cmp>\t:compares the \
MD5 hash of the two files.\n",name);
printf("%s -e <-des|-bf|-rsa> <file_to_crypt> \
<file_output> [rsa_pub.pem]]\t:encrypts file_to_crypt with \
choosen cipher.\n",name);
printf("%s -d <-des|-bf|-rsa> <file_to_decrypt> \
<file_output> [rsa_sec.pem]\t:decrypts file_to_decrypt with choosen cipher.\n",name);
printf("%s -grsa <numbits> <secfile> <pubfile>\t:generates a \
RSA key pair.\n", name);
printf(" -des: des block cipher.\n");
printf(" -bf: blowfish block cipher.\n");
printf("Ex: %s -e -bf passwords.txt crypto_pass.txt\n",name);
printf("Ex: %s -d -bf crypto_pass.txt pass_file.txt\n",name);
printf("Ex: %s -fc file1 file2\n",name);
printf("\nPlease report bugs to <ardoino.gnu@disi.unige.it>\n");
return;
}
/*
* fexists() checks for the existence of a given file.
* return 0 if the file doesn't exist and 1 if it exists.
*/
int fexists(char *file)
{
FILE *fp;
if ((fp = fopen(file,"r")) == NULL) {
return 0;
} else {
fclose(fp);
return 1;
}
}
//-------------------end misc.c------------------------------------------