ssh-com-keygen.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # $OpenBSD: ssh-com-keygen.sh,v 1.4 2004/02/24 17:06:52 markus Exp $
  2. # Placed in the Public Domain.
  3. tid="ssh.com key import"
  4. #TEST_COMBASE=/path/to/ssh/com/binaries
  5. if [ "X${TEST_COMBASE}" = "X" ]; then
  6. fatal '$TEST_COMBASE is not set'
  7. fi
  8. VERSIONS="
  9. 2.0.10
  10. 2.0.12
  11. 2.0.13
  12. 2.1.0
  13. 2.2.0
  14. 2.3.0
  15. 2.3.1
  16. 2.4.0
  17. 3.0.0
  18. 3.1.0
  19. 3.2.0
  20. 3.2.2
  21. 3.2.3
  22. 3.2.5
  23. 3.2.9
  24. 3.2.9.1
  25. 3.3.0"
  26. COMPRV=${OBJ}/comkey
  27. COMPUB=${COMPRV}.pub
  28. OPENSSHPRV=${OBJ}/opensshkey
  29. OPENSSHPUB=${OPENSSHPRV}.pub
  30. # go for it
  31. for v in ${VERSIONS}; do
  32. keygen=${TEST_COMBASE}/${v}/ssh-keygen2
  33. if [ ! -x ${keygen} ]; then
  34. continue
  35. fi
  36. types="dss"
  37. case $v in
  38. 2.3.1 | 3.*)
  39. types="$types rsa"
  40. ;;
  41. esac
  42. for t in $types; do
  43. verbose "ssh-keygen $v/$t"
  44. rm -f $COMPRV $COMPUB $OPENSSHPRV $OPENSSHPUB
  45. ${keygen} -q -P -t $t ${COMPRV} > /dev/null 2>&1
  46. if [ $? -ne 0 ]; then
  47. fail "${keygen} -t $t failed"
  48. continue
  49. fi
  50. ${SSHKEYGEN} -if ${COMPUB} > ${OPENSSHPUB}
  51. if [ $? -ne 0 ]; then
  52. fail "import public key ($v/$t) failed"
  53. continue
  54. fi
  55. ${SSHKEYGEN} -if ${COMPRV} > ${OPENSSHPRV}
  56. if [ $? -ne 0 ]; then
  57. fail "import private key ($v/$t) failed"
  58. continue
  59. fi
  60. chmod 600 ${OPENSSHPRV}
  61. ${SSHKEYGEN} -yf ${OPENSSHPRV} |
  62. diff - ${OPENSSHPUB}
  63. if [ $? -ne 0 ]; then
  64. fail "public keys ($v/$t) differ"
  65. fi
  66. done
  67. done
  68. rm -f $COMPRV $COMPUB $OPENSSHPRV $OPENSSHPUB