Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

28

10. Implementation of proxy-based security protocols in c or c++ with features like


Confidentiality, Integrity and Authentication.
Program:

#include <stdio.h>

int main(){
FIL E *fp1, *fp2;char a;
fp 1= fopen("test.txt", "r");if (fp1 ==
NULL)
{ puts ("cannot open test. txt file");exit(1);
}
fp2 = fopen ("test1, txt", "w");if (fp2 ==
NULL){
puts ("Not able to test1 txt file");fclose (fp1);
exit (1);
a= fget (fp1);
fprintf (fp2, “%c", a+3);
while (a! = EOF){
a= fgetc (fp₁);
fprintf (fp2,”%c", a+3);
printf("test.txt is successfully encrypted and stored to test1. txt");printf ("n/test.txt
can be forwarded to destination");
fclose (fp1); fclose
(fp2);return 0;
}

test.txt
Deepika
Deepika

Output: -
test. txt is sucessfully encrypted and stored to test1.txttest1.txt can be
forwarded to destination.
test 1. Txt
29

19hhslnd

Confidentiality at Receiver side: #include


<stdio.h>
int main() { FILE *fp1;
*fp2;
char a ;
fp1 = fopen ("test1.txt", "r"); if (fp1 =
NULL){
puts ("cannot open test.txt file");exit (1)
}
fp2= fopen("test 2. txt", "w");
if (fp2 == NULL) {
puts ("Not able to test text file");fclose (fp1);
exit (1);
}
a = fgetc (fp1);
fprintf (fp2, "%c", a-3);while (a!=
EOF)
a = fgetc (fp1);
fprintf(fp2,”%c”,a-3);
return 0;
Output: -
test1.txt is Successfully decrypted and stored in test2.txt User can read
test2. txt file

You might also like