Correct a potential bug.
[openssl.git] / test / trsa
1 #!/bin/sh
2
3 PATH=../apps:$PATH
4 export PATH
5
6 if ../apps/openssl list-standard-commands | grep '^rsa$' >/dev/null; then
7   echo openssl rsa command available
8 else
9   echo openssl rsa command not available, skipping test
10   exit 0
11 fi
12
13 cmd='../apps/openssl rsa'
14
15 if [ "$1"x != "x" ]; then
16         t=$1
17 else
18         t=testrsa.pem
19 fi
20
21 echo testing rsa conversions
22 cp $t fff.p
23
24 echo "p -> d"
25 $cmd -in fff.p -inform p -outform d >f.d
26 if [ $? != 0 ]; then exit 1; fi
27 #echo "p -> t"
28 #$cmd -in fff.p -inform p -outform t >f.t
29 #if [ $? != 0 ]; then exit 1; fi
30 echo "p -> p"
31 $cmd -in fff.p -inform p -outform p >f.p
32 if [ $? != 0 ]; then exit 1; fi
33
34 echo "d -> d"
35 $cmd -in f.d -inform d -outform d >ff.d1
36 if [ $? != 0 ]; then exit 1; fi
37 #echo "t -> d"
38 #$cmd -in f.t -inform t -outform d >ff.d2
39 #if [ $? != 0 ]; then exit 1; fi
40 echo "p -> d"
41 $cmd -in f.p -inform p -outform d >ff.d3
42 if [ $? != 0 ]; then exit 1; fi
43
44 #echo "d -> t"
45 #$cmd -in f.d -inform d -outform t >ff.t1
46 #if [ $? != 0 ]; then exit 1; fi
47 #echo "t -> t"
48 #$cmd -in f.t -inform t -outform t >ff.t2
49 #if [ $? != 0 ]; then exit 1; fi
50 #echo "p -> t"
51 #$cmd -in f.p -inform p -outform t >ff.t3
52 #if [ $? != 0 ]; then exit 1; fi
53
54 echo "d -> p"
55 $cmd -in f.d -inform d -outform p >ff.p1
56 if [ $? != 0 ]; then exit 1; fi
57 #echo "t -> p"
58 #$cmd -in f.t -inform t -outform p >ff.p2
59 #if [ $? != 0 ]; then exit 1; fi
60 echo "p -> p"
61 $cmd -in f.p -inform p -outform p >ff.p3
62 if [ $? != 0 ]; then exit 1; fi
63
64 cmp fff.p f.p
65 if [ $? != 0 ]; then exit 1; fi
66 cmp fff.p ff.p1
67 if [ $? != 0 ]; then exit 1; fi
68 #cmp fff.p ff.p2
69 #if [ $? != 0 ]; then exit 1; fi
70 cmp fff.p ff.p3
71 if [ $? != 0 ]; then exit 1; fi
72
73 #cmp f.t ff.t1
74 #if [ $? != 0 ]; then exit 1; fi
75 #cmp f.t ff.t2
76 #if [ $? != 0 ]; then exit 1; fi
77 #cmp f.t ff.t3
78 #if [ $? != 0 ]; then exit 1; fi
79
80 cmp f.p ff.p1
81 if [ $? != 0 ]; then exit 1; fi
82 #cmp f.p ff.p2
83 #if [ $? != 0 ]; then exit 1; fi
84 cmp f.p ff.p3
85 if [ $? != 0 ]; then exit 1; fi
86
87 /bin/rm -f f.* ff.* fff.*
88 exit 0