xref: /freebsd/crypto/openssh/regress/keygen-change.sh (revision 59d43d11fe3e3f490ad5fce4d0349e9eeaf8d765)
1#	$OpenBSD: keygen-change.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
2#	Placed in the Public Domain.
3
4tid="change passphrase for key"
5
6S1="secret1"
7S2="2secret"
8
9KEYTYPES=`${SSH} -Q key-plain`
10if ssh_version 1; then
11	KEYTYPES="${KEYTYPES} rsa1"
12fi
13
14for t in $KEYTYPES; do
15	# generate user key for agent
16	trace "generating $t key"
17	rm -f $OBJ/$t-key
18	${SSHKEYGEN} -q -N ${S1} -t $t -f $OBJ/$t-key
19	if [ $? -eq 0 ]; then
20		${SSHKEYGEN} -p -P ${S1} -N ${S2} -f $OBJ/$t-key > /dev/null
21		if [ $? -ne 0 ]; then
22			fail "ssh-keygen -p failed for $t-key"
23		fi
24	else
25		fail "ssh-keygen for $t-key failed"
26	fi
27	rm -f $OBJ/$t-key $OBJ/$t-key.pub
28done
29