diff options
Diffstat (limited to 'tests/testenc.sh')
-rwxr-xr-x | tests/testenc.sh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/testenc.sh b/tests/testenc.sh new file mode 100755 index 0000000..51af0ab --- /dev/null +++ b/tests/testenc.sh | |||
@@ -0,0 +1,66 @@ | |||
1 | #!/bin/sh | ||
2 | # $OpenBSD: testenc.sh,v 1.1 2014/08/26 17:50:07 jsing Exp $ | ||
3 | |||
4 | test=p | ||
5 | cmd=../apps/openssl | ||
6 | |||
7 | cat openssl.cnf >$test; | ||
8 | |||
9 | echo cat | ||
10 | $cmd enc < $test > $test.cipher | ||
11 | $cmd enc < $test.cipher >$test.clear | ||
12 | cmp $test $test.clear | ||
13 | if [ $? != 0 ] | ||
14 | then | ||
15 | exit 1 | ||
16 | else | ||
17 | /bin/rm $test.cipher $test.clear | ||
18 | fi | ||
19 | echo base64 | ||
20 | $cmd enc -a -e < $test > $test.cipher | ||
21 | $cmd enc -a -d < $test.cipher >$test.clear | ||
22 | cmp $test $test.clear | ||
23 | if [ $? != 0 ] | ||
24 | then | ||
25 | exit 1 | ||
26 | else | ||
27 | /bin/rm $test.cipher $test.clear | ||
28 | fi | ||
29 | |||
30 | for i in \ | ||
31 | aes-128-cbc aes-128-cfb aes-128-cfb1 aes-128-cfb8 \ | ||
32 | aes-128-ecb aes-128-ofb aes-192-cbc aes-192-cfb \ | ||
33 | aes-192-cfb1 aes-192-cfb8 aes-192-ecb aes-192-ofb \ | ||
34 | aes-256-cbc aes-256-cfb aes-256-cfb1 aes-256-cfb8 \ | ||
35 | aes-256-ecb aes-256-ofb \ | ||
36 | bf-cbc bf-cfb bf-ecb bf-ofb \ | ||
37 | cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb \ | ||
38 | des-cbc des-cfb des-cfb8 des-ecb des-ede \ | ||
39 | des-ede-cbc des-ede-cfb des-ede-ofb des-ede3 \ | ||
40 | des-ede3-cbc des-ede3-cfb des-ede3-ofb des-ofb desx-cbc \ | ||
41 | rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb \ | ||
42 | rc4 rc4-40 | ||
43 | do | ||
44 | echo $i | ||
45 | $cmd $i -e -k test < $test > $test.$i.cipher | ||
46 | $cmd $i -d -k test < $test.$i.cipher >$test.$i.clear | ||
47 | cmp $test $test.$i.clear | ||
48 | if [ $? != 0 ] | ||
49 | then | ||
50 | exit 1 | ||
51 | else | ||
52 | /bin/rm $test.$i.cipher $test.$i.clear | ||
53 | fi | ||
54 | |||
55 | echo $i base64 | ||
56 | $cmd $i -a -e -k test < $test > $test.$i.cipher | ||
57 | $cmd $i -a -d -k test < $test.$i.cipher >$test.$i.clear | ||
58 | cmp $test $test.$i.clear | ||
59 | if [ $? != 0 ] | ||
60 | then | ||
61 | exit 1 | ||
62 | else | ||
63 | /bin/rm $test.$i.cipher $test.$i.clear | ||
64 | fi | ||
65 | done | ||
66 | rm -f $test | ||