aboutsummaryrefslogtreecommitdiff
path: root/tests/testenc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testenc.sh')
-rwxr-xr-xtests/testenc.sh66
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
4test=p
5cmd=../apps/openssl
6
7cat openssl.cnf >$test;
8
9echo cat
10$cmd enc < $test > $test.cipher
11$cmd enc < $test.cipher >$test.clear
12cmp $test $test.clear
13if [ $? != 0 ]
14then
15 exit 1
16else
17 /bin/rm $test.cipher $test.clear
18fi
19echo base64
20$cmd enc -a -e < $test > $test.cipher
21$cmd enc -a -d < $test.cipher >$test.clear
22cmp $test $test.clear
23if [ $? != 0 ]
24then
25 exit 1
26else
27 /bin/rm $test.cipher $test.clear
28fi
29
30for 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
43do
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
65done
66rm -f $test