-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_ec03.sh
57 lines (43 loc) · 1.93 KB
/
test_ec03.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
# This test basic functionality of encryption decryption and whether two files
# after encryption and then decryption are same or not.
# IV will be set to page_number + inode number of encryption file and by
# default cipher name is set to aes if not mentioned.
# This run user program (xcepnc_nocheck) with NO checks in user program
# infile_ec : input file
# encryptfile_ec : file after decryption
# decryptfile_ec : file after decryption
echo dummy test > infile_ec
echo "" >> results_ec
echo "" >> log_ec
echo test_ec03.sh: >> results_ec
echo test_ec03.sh: >> log_ec
echo ./xcpenc_nocheck -e -p password infile_ec encryptfile_ec >> results_ec
echo ./xcpenc_nocheck -e -p password infile_ec encryptfile_ec >> log_ec
./xcpenc_nocheck -e -p "password" infile_ec encryptfile_ec >> log_ec
retval=$?
if test $retval != 0 ; then
echo encryption: xcpenc_nocheck failed with error: $retval >> results_ec
else
echo encryption: xcpenc_nocheck program succeeded >> results_ec
fi
echo "" >> results_ec
echo "" >> log_ec
echo ./xcpenc_nocheck -d -p password encryptfile_ec decryptfile_ec >> results_ec
echo ./xcpenc_nocheck -d -p password encryptfile_ec decryptfile_ec >> log_ec
./xcpenc_nocheck -d -p "password" encryptfile_ec decryptfile_ec >> log_ec
retval=$?
if test $retval != 0 ; then
echo decryption: xcpenc_nocheck failed with error: $retval >> results_ec
else
echo decryption: xcpenc_nocheck program succeeded >> results_ec
fi
echo "" >> results_ec
# now verify that the two files are the same before encryption and after decryption
if cmp infile_ec decryptfile_ec ; then
echo "contents of infile_ec and decryptfile_ec are same" >> results_ec
else
echo "contents of infile_ec and decryptfile_ec DIFFER" >> results_ec
fi
echo "------------------------------------------------------------------------------" >> results_ec
echo "------------------------------------------------------------------------------" >> log_ec