treq 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/sh
  2. cmd='../util/shlib_wrap.sh ../apps/openssl req -config ../apps/openssl.cnf'
  3. if [ "$1"x != "x" ]; then
  4. t=$1
  5. else
  6. t=testreq.pem
  7. fi
  8. if $cmd -in $t -inform p -noout -text 2>&1 | fgrep -i 'Unknown Public Key'; then
  9. echo "skipping req conversion test for $t"
  10. exit 0
  11. fi
  12. echo testing req conversions
  13. cp $t fff.p
  14. echo "p -> d"
  15. $cmd -in fff.p -inform p -outform d >f.d
  16. if [ $? != 0 ]; then exit 1; fi
  17. #echo "p -> t"
  18. #$cmd -in fff.p -inform p -outform t >f.t
  19. #if [ $? != 0 ]; then exit 1; fi
  20. echo "p -> p"
  21. $cmd -in fff.p -inform p -outform p >f.p
  22. if [ $? != 0 ]; then exit 1; fi
  23. echo "d -> d"
  24. $cmd -verify -in f.d -inform d -outform d >ff.d1
  25. if [ $? != 0 ]; then exit 1; fi
  26. #echo "t -> d"
  27. #$cmd -in f.t -inform t -outform d >ff.d2
  28. #if [ $? != 0 ]; then exit 1; fi
  29. echo "p -> d"
  30. $cmd -verify -in f.p -inform p -outform d >ff.d3
  31. if [ $? != 0 ]; then exit 1; fi
  32. #echo "d -> t"
  33. #$cmd -in f.d -inform d -outform t >ff.t1
  34. #if [ $? != 0 ]; then exit 1; fi
  35. #echo "t -> t"
  36. #$cmd -in f.t -inform t -outform t >ff.t2
  37. #if [ $? != 0 ]; then exit 1; fi
  38. #echo "p -> t"
  39. #$cmd -in f.p -inform p -outform t >ff.t3
  40. #if [ $? != 0 ]; then exit 1; fi
  41. echo "d -> p"
  42. $cmd -in f.d -inform d -outform p >ff.p1
  43. if [ $? != 0 ]; then exit 1; fi
  44. #echo "t -> p"
  45. #$cmd -in f.t -inform t -outform p >ff.p2
  46. #if [ $? != 0 ]; then exit 1; fi
  47. echo "p -> p"
  48. $cmd -in f.p -inform p -outform p >ff.p3
  49. if [ $? != 0 ]; then exit 1; fi
  50. cmp fff.p f.p
  51. if [ $? != 0 ]; then exit 1; fi
  52. cmp fff.p ff.p1
  53. if [ $? != 0 ]; then exit 1; fi
  54. #cmp fff.p ff.p2
  55. #if [ $? != 0 ]; then exit 1; fi
  56. cmp fff.p ff.p3
  57. if [ $? != 0 ]; then exit 1; fi
  58. #cmp f.t ff.t1
  59. #if [ $? != 0 ]; then exit 1; fi
  60. #cmp f.t ff.t2
  61. #if [ $? != 0 ]; then exit 1; fi
  62. #cmp f.t ff.t3
  63. #if [ $? != 0 ]; then exit 1; fi
  64. cmp f.p ff.p1
  65. if [ $? != 0 ]; then exit 1; fi
  66. #cmp f.p ff.p2
  67. #if [ $? != 0 ]; then exit 1; fi
  68. cmp f.p ff.p3
  69. if [ $? != 0 ]; then exit 1; fi
  70. /bin/rm -f f.* ff.* fff.*
  71. exit 0