tkey 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. t=$1
  3. ktype=$2
  4. ptype=$3
  5. if ../util/shlib_wrap.sh ../apps/openssl no-$ktype; then
  6. echo skipping $ktype $ptype conversion test
  7. exit 0
  8. fi
  9. if [ $ptype = "public" ]; then
  10. cmd="../util/shlib_wrap.sh ../apps/openssl $ktype -pubin -pubout"
  11. else
  12. cmd="../util/shlib_wrap.sh ../apps/openssl $ktype"
  13. fi
  14. echo testing $ktype $ptype conversions
  15. cp $t $ktype-fff.p
  16. echo "p -> d"
  17. $cmd -in $ktype-fff.p -inform p -outform d >$ktype-f.d || exit 1
  18. echo "p -> p"
  19. $cmd -in $ktype-fff.p -inform p -outform p >$ktype-f.p || exit 1
  20. echo "d -> d"
  21. $cmd -in $ktype-f.d -inform d -outform d >$ktype-ff.d1 || exit 1
  22. echo "p -> d"
  23. $cmd -in $ktype-f.p -inform p -outform d >$ktype-ff.d3 || exit 1
  24. echo "d -> p"
  25. $cmd -in $ktype-f.d -inform d -outform p >$ktype-ff.p1 || exit 1
  26. echo "p -> p"
  27. $cmd -in $ktype-f.p -inform p -outform p >$ktype-ff.p3 || exit 1
  28. cmp $ktype-fff.p $ktype-f.p || exit 1
  29. cmp $ktype-fff.p $ktype-ff.p1 || exit 1
  30. cmp $ktype-fff.p $ktype-ff.p3 || exit 1
  31. cmp $ktype-f.p $ktype-ff.p1 || exit 1
  32. cmp $ktype-f.p $ktype-ff.p3 || exit 1
  33. /bin/rm -f $ktype-f.* $ktype-ff.* $ktype-fff.*
  34. [ $ptype = "public" ] && exit 0
  35. echo testing $ktype PKCS#8 conversions
  36. cmd="../util/shlib_wrap.sh ../apps/openssl pkey"
  37. $cmd -in $t -out $ktype-fff.p
  38. echo "p -> d"
  39. $cmd -in $ktype-fff.p -inform p -outform d >$ktype-f.d || exit 1
  40. echo "p -> p"
  41. $cmd -in $ktype-fff.p -inform p -outform p >$ktype-f.p || exit 1
  42. echo "d -> d"
  43. $cmd -in $ktype-f.d -inform d -outform d >$ktype-ff.d1 || exit 1
  44. echo "p -> d"
  45. $cmd -in $ktype-f.p -inform p -outform d >$ktype-ff.d3 || exit 1
  46. echo "d -> p"
  47. $cmd -in $ktype-f.d -inform d -outform p >$ktype-ff.p1 || exit 1
  48. echo "p -> p"
  49. $cmd -in $ktype-f.p -inform p -outform p >$ktype-ff.p3 || exit 1
  50. cmp $ktype-fff.p $ktype-f.p || exit 1
  51. cmp $ktype-fff.p $ktype-ff.p1 || exit 1
  52. cmp $ktype-fff.p $ktype-ff.p3 || exit 1
  53. cmp $ktype-f.p $ktype-ff.p1 || exit 1
  54. cmp $ktype-f.p $ktype-ff.p3 || exit 1
  55. /bin/rm -f $ktype-f.* $ktype-ff.* $ktype-fff.*