summaryrefslogtreecommitdiff
path: root/regress/keygen-change.sh
blob: dd1bfda80e6ae58ca4341a4df8817e986a0ac480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#	$OpenBSD: keygen-change.sh,v 1.8 2019/11/26 23:43:10 djm Exp $
#	Placed in the Public Domain.

tid="change passphrase for key"

S1="secret1"
S2="2secret"

KEYTYPES=`${SSH} -Q key-plain | maybe_filter_sk`

for t in $KEYTYPES; do
	trace "generating $t key"
	rm -f $OBJ/$t-key
	${SSHKEYGEN} -q -N ${S1} -t $t -f $OBJ/$t-key
	if [ $? -eq 0 ]; then
		${SSHKEYGEN} -p -P ${S1} -N ${S2} -f $OBJ/$t-key > /dev/null
		if [ $? -ne 0 ]; then
			fail "ssh-keygen -p failed for $t-key"
		fi
	else
		fail "ssh-keygen for $t-key failed"
	fi
	rm -f $OBJ/$t-key $OBJ/$t-key.pub
done