1 # $OpenBSD: keytype.sh,v 1.3 2013/12/06 13:52:46 markus Exp $
2 # Placed in the Public Domain.
4 tid="login with different key types"
6 TIME=`which time 2>/dev/null`
7 if test ! -x "$TIME"; then
11 cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
12 cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak
14 # Traditional and builtin key types.
15 ktypes="dsa-1024 rsa-2048 rsa-3072 ed25519-512"
16 # Types not present in all OpenSSL versions.
17 for i in `$SSH -Q key`; do
19 ecdsa-sha2-nistp256) ktypes="$ktypes ecdsa-256" ;;
20 ecdsa-sha2-nistp384) ktypes="$ktypes ecdsa-384" ;;
21 ecdsa-sha2-nistp521) ktypes="$ktypes ecdsa-521" ;;
27 bits=`echo ${kt} | awk -F- '{print $2}'`
28 type=`echo ${kt} | awk -F- '{print $1}'`
29 printf "keygen $type, $bits bits:\t"
30 ${TIME} ${SSHKEYGEN} -b $bits -q -N '' -t $type -f $OBJ/key.$kt ||\
31 fail "ssh-keygen for type $type, $bits bits failed"
39 trace "ssh connect, userkey $ut, hostkey $ht"
41 grep -v HostKey $OBJ/sshd_proxy_bak
42 echo HostKey $OBJ/key.$ht
45 grep -v IdentityFile $OBJ/ssh_proxy_bak
46 echo IdentityFile $OBJ/key.$ut
49 printf 'localhost-with-alias,127.0.0.1,::1 '
52 cat $OBJ/key.$ut.pub > $OBJ/authorized_keys_$USER
54 printf "userkey $ut, hostkey ${ht}:\t"
55 ${TIME} ${SSH} -F $OBJ/ssh_proxy 999.999.999.999 true
57 fail "ssh userkey $ut, hostkey $ht failed"