में एक प्रोग्राम चला रहा है मेरे पास एक प्रोग्राम है जो एक बार पैड एन्क्रिप्शन का उपयोग करके दो फाइलों को एक साथ जोड़ता है। चूंकि कीफाइल इस तरह की संवेदनशील प्रकृति का है, मैं नहीं चाहता कि कीफाइल के किसी भी निशान कंप्यूटर हार्ड ड्राइव पर दिखाई दे क्योंकि यह सुरक्षा समझौता कर सकता है।सी - रैम
सवाल है, मैं कैसे रैम में कार्यक्रम चला सकता हूँ इतनी के रूप में किसी भी निशान से बचने के लिए पर HD छोड़ दिया जा रहा? वैकल्पिक रूप से, फ्लैश ड्राइव से प्रोग्राम चलाने से फ्लैश ड्राइव में कीफाइल का निशान होता है?
नीचे कैसे keyfile कार्यक्रम में इलाज किया जाता है:
/* Check if keyfile can be opened. */
if((keyfile = fopen(argv[3], "rb"))== NULL)
{
printf("Can't open keyfile.\n");
printf("Please enter a valid filename.\n");
printf("USAGE: OTP <source file> <output file> <keyfile>\n");
perror("Error");
return(1);
}
/* Get size of keyfile */
fstat(fileno(keyfile), &keybuf);
/* Check if keyfile is the same size as, or bigger than the sourcefile */
if((keybuf.st_size) < (statbuf.st_size))
{
printf("Source file is larger than keyfile.\n");
printf("This significantly reduces cryptographic strength.\n");
printf("Do you wish to continue? (Y/N)\n");
fgets(buffer, 20, stdin);
sscanf(buffer, "%c", &ans);
if(ans == 'n' || ans == 'N')
{
return (1);
}
if(ans == 'y' || ans == 'Y')
{
printf("Proceeding with Encryption/Decryption.\n");
}
/* Encrypt/Decrypt and write to output file. */
while(count < (statbuf.st_size))
{
key=fgetc(keyfile);
data=fgetc(sourcefile);
output=(key^data);
fputc(output,destfile);
count++;
}
/* Close files. */
fclose(keyfile);
fclose(sourcefile);
fclose(destfile);
मैं जब इस googling, लेकिन यह है कि मैं क्या जरूरत होने के लिए नहीं मालूम था एक inram
समारोह में आए।
धन्यवाद! ऐसा लगता है कि मुझे वही चाहिए। आपकी धारणाएं काफी सही थीं। – youjustreadthis
हाय फिर, मैं हाल ही में एक और धागा है: http://stackoverflow.com/questions/12990214/is-this-usage-of-mlockall-correct#12990658 और एक भ्रमित जवाब है कि लग रहा था खंडन करने के लिए आप क्या है मिल गया यहाँ कहा। क्या आप संभवतः एक नज़र डालें और जवाब पर अपनी राय दे सकते हैं? @ गीफ रेडी – youjustreadthis