testenc 1016 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/sh
  2. testsrc=testenc
  3. test=./p
  4. cmd="../util/shlib_wrap.sh ../apps/openssl"
  5. cat $testsrc >$test;
  6. echo cat
  7. $cmd enc < $test > $test.cipher
  8. $cmd enc < $test.cipher >$test.clear
  9. cmp $test $test.clear
  10. if [ $? != 0 ]
  11. then
  12. exit 1
  13. else
  14. /bin/rm $test.cipher $test.clear
  15. fi
  16. echo base64
  17. $cmd enc -a -e < $test > $test.cipher
  18. $cmd enc -a -d < $test.cipher >$test.clear
  19. cmp $test $test.clear
  20. if [ $? != 0 ]
  21. then
  22. exit 1
  23. else
  24. /bin/rm $test.cipher $test.clear
  25. fi
  26. for i in `$cmd list-cipher-commands`
  27. do
  28. echo $i
  29. $cmd $i -bufsize 113 -e -k test < $test > $test.$i.cipher
  30. $cmd $i -bufsize 157 -d -k test < $test.$i.cipher >$test.$i.clear
  31. cmp $test $test.$i.clear
  32. if [ $? != 0 ]
  33. then
  34. exit 1
  35. else
  36. /bin/rm $test.$i.cipher $test.$i.clear
  37. fi
  38. echo $i base64
  39. $cmd $i -bufsize 113 -a -e -k test < $test > $test.$i.cipher
  40. $cmd $i -bufsize 157 -a -d -k test < $test.$i.cipher >$test.$i.clear
  41. cmp $test $test.$i.clear
  42. if [ $? != 0 ]
  43. then
  44. exit 1
  45. else
  46. /bin/rm $test.$i.cipher $test.$i.clear
  47. fi
  48. done
  49. rm -f $test