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