blob: e56185050ddfe54417c313f2161b1ba20442290f [file] [log] [blame]
markus@openbsd.orgdad2b182015-03-03 22:35:19 +00001# $OpenBSD: keygen-change.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
Damien Miller8b9cde72003-01-22 17:53:16 +11002# Placed in the Public Domain.
3
4tid="change passphrase for key"
5
6S1="secret1"
7S2="2secret"
8
markus@openbsd.orgdad2b182015-03-03 22:35:19 +00009KEYTYPES=`${SSH} -Q key-plain`
10if ssh_version 1; then
11 KEYTYPES="${KEYTYPES} rsa1"
12fi
13
14for t in $KEYTYPES; do
Damien Miller8b9cde72003-01-22 17:53:16 +110015 # 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