blob: 29b02d94617f7956e357c28c5979597dec3c6828 [file] [log] [blame]
Darren Tucker437a5f02004-02-29 20:33:51 +11001# $OpenBSD: ssh-com-keygen.sh,v 1.4 2004/02/24 17:06:52 markus Exp $
Damien Miller38cd4352002-05-01 13:17:33 +10002# Placed in the Public Domain.
3
4tid="ssh.com key import"
5
6#TEST_COMBASE=/path/to/ssh/com/binaries
7if [ "X${TEST_COMBASE}" = "X" ]; then
8 fatal '$TEST_COMBASE is not set'
9fi
10
11VERSIONS="
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 Miller8b9cde72003-01-22 17:53:16 +110021 3.1.0
22 3.2.0
Darren Tuckeree5f83d2003-06-18 22:36:48 +100023 3.2.2
24 3.2.3
Darren Tucker437a5f02004-02-29 20:33:51 +110025 3.2.5
26 3.2.9
27 3.2.9.1
Damien Miller8b9cde72003-01-22 17:53:16 +110028 3.3.0"
Damien Miller38cd4352002-05-01 13:17:33 +100029
30COMPRV=${OBJ}/comkey
31COMPUB=${COMPRV}.pub
32OPENSSHPRV=${OBJ}/opensshkey
33OPENSSHPUB=${OPENSSHPRV}.pub
34
35# go for it
36for 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
72done
73
74rm -f $COMPRV $COMPUB $OPENSSHPRV $OPENSSHPUB