markus@openbsd.org | dad2b18 | 2015-03-03 22:35:19 +0000 | [diff] [blame] | 1 | # $OpenBSD: keygen-change.sh,v 1.5 2015/03/03 22:35:19 markus Exp $ |
Damien Miller | 8b9cde7 | 2003-01-22 17:53:16 +1100 | [diff] [blame] | 2 | # Placed in the Public Domain. |
| 3 | |
| 4 | tid="change passphrase for key" |
| 5 | |
| 6 | S1="secret1" |
| 7 | S2="2secret" |
| 8 | |
markus@openbsd.org | dad2b18 | 2015-03-03 22:35:19 +0000 | [diff] [blame] | 9 | KEYTYPES=`${SSH} -Q key-plain` |
| 10 | if ssh_version 1; then |
| 11 | KEYTYPES="${KEYTYPES} rsa1" |
| 12 | fi |
| 13 | |
| 14 | for t in $KEYTYPES; do |
Damien Miller | 8b9cde7 | 2003-01-22 17:53:16 +1100 | [diff] [blame] | 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 |
| 28 | done |