diff options
author | Alistair Delva <adelva@google.com> | 2021-10-27 15:04:29 -0700 |
---|---|---|
committer | Alistair Delva <adelva@google.com> | 2021-10-27 15:06:42 -0700 |
commit | aa1e1baec4e1cdc49d0ee7aec83d07e30adaf19f (patch) | |
tree | 6a4709841e622abaad951691e859a4ef59044903 /regress/keygen-convert.sh | |
parent | 393ead3e4a22c473a4d316e47f9bbda36f638188 (diff) | |
parent | bf944e3794eff5413f2df1ef37cddf96918c6bde (diff) | |
download | openssh-aa1e1baec4e1cdc49d0ee7aec83d07e30adaf19f.tar.gz |
Merge commit 'bf944e3794eff5413f2df1ef37cddf96918c6bde' into HEAD
Corresponds to 8.8p1 release.
Bug: 195664829
Test: lunch aosp_cf_arm64_phone-userdebug && mmma external/openssh
Test: lunch aosp_cf_x86_64_phone-userdebug && mmma external/openssh
Link: https://github.com/openssh/openssh-portable/releases/tag/V_8_8_P1
Change-Id: I96cca0f86a2ea006a47d7f0595e1f958ec35dbe6
Diffstat (limited to 'regress/keygen-convert.sh')
-rw-r--r-- | regress/keygen-convert.sh | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/regress/keygen-convert.sh b/regress/keygen-convert.sh index fce110ea1..95656581c 100644 --- a/regress/keygen-convert.sh +++ b/regress/keygen-convert.sh @@ -1,40 +1,54 @@ -# $OpenBSD: keygen-convert.sh,v 1.2 2019/07/23 07:55:29 dtucker Exp $ +# $OpenBSD: keygen-convert.sh,v 1.6 2021/07/24 02:57:28 dtucker Exp $ # Placed in the Public Domain. tid="convert keys" -types="" -for i in ${SSH_KEYTYPES}; do - case "$i" in - ssh-dss) types="$types dsa" ;; - ssh-rsa) types="$types rsa" ;; - esac -done +cat > $OBJ/askpass <<EOD +#!/bin/sh +echo hunter2 +EOD +chmod u+x $OBJ/askpass + +if ${SSHKEYGEN} -? 2>&1 | grep "ssh-keygen -e" >/dev/null; then + test_import_export=1 +fi -for t in $types; do +for t in ${SSH_KEYTYPES}; do # generate user key for agent trace "generating $t key" rm -f $OBJ/$t-key ${SSHKEYGEN} -q -N "" -t $t -f $OBJ/$t-key - trace "export $t private to rfc4716 public" - ${SSHKEYGEN} -q -e -f $OBJ/$t-key >$OBJ/$t-key-rfc || \ - fail "export $t private to rfc4716 public" + if test "x$test_import_export" = "x1"; then + trace "export $t private to rfc4716 public" + ${SSHKEYGEN} -q -e -f $OBJ/$t-key >$OBJ/$t-key-rfc || \ + fail "export $t private to rfc4716 public" + + trace "export $t public to rfc4716 public" + ${SSHKEYGEN} -q -e -f $OBJ/$t-key.pub >$OBJ/$t-key-rfc.pub || \ + fail "$t public to rfc4716 public" + + cmp $OBJ/$t-key-rfc $OBJ/$t-key-rfc.pub || \ + fail "$t rfc4716 exports differ between public and private" - trace "export $t public to rfc4716 public" - ${SSHKEYGEN} -q -e -f $OBJ/$t-key.pub >$OBJ/$t-key-rfc.pub || \ - fail "$t public to rfc4716 public" + trace "import $t rfc4716 public" + ${SSHKEYGEN} -q -i -f $OBJ/$t-key-rfc >$OBJ/$t-rfc-imported || \ + fail "$t import rfc4716 public" - cmp $OBJ/$t-key-rfc $OBJ/$t-key-rfc.pub || \ - fail "$t rfc4716 exports differ between public and private" + cut -f1,2 -d " " $OBJ/$t-key.pub >$OBJ/$t-key-nocomment.pub + cmp $OBJ/$t-key-nocomment.pub $OBJ/$t-rfc-imported || \ + fail "$t imported differs from original" + fi - trace "import $t rfc4716 public" - ${SSHKEYGEN} -q -i -f $OBJ/$t-key-rfc >$OBJ/$t-rfc-imported || \ - fail "$t import rfc4716 public" + trace "set passphrase $t" + ${SSHKEYGEN} -q -p -P '' -N 'hunter2' -f $OBJ/$t-key >/dev/null || \ + fail "$t set passphrase failed" - cut -f1,2 -d " " $OBJ/$t-key.pub >$OBJ/$t-key-nocomment.pub - cmp $OBJ/$t-key-nocomment.pub $OBJ/$t-rfc-imported || \ - fail "$t imported differs from original" + trace "export $t to public with passphrase" + SSH_ASKPASS=$OBJ/askpass SSH_ASKPASS_REQUIRE=force \ + ${SSHKEYGEN} -y -f $OBJ/$t-key >$OBJ/$t-key-nocomment.pub + cmp $OBJ/$t-key.pub $OBJ/$t-key-nocomment.pub || \ + fail "$t exported pubkey differs from generated" rm -f $OBJ/$t-key $OBJ/$t-key.pub $OBJ/$t-key-rfc $OBJ/$t-key-rfc.pub \ $OBJ/$t-rfc-imported $OBJ/$t-key-nocomment.pub |