1204861Sdes# $OpenBSD: keygen-convert.sh,v 1.1 2009/11/09 04:20:04 dtucker Exp $ 2204861Sdes# Placed in the Public Domain. 3204861Sdes 4204861Sdestid="convert keys" 5204861Sdes 6204861Sdesfor t in rsa dsa; do 7204861Sdes # generate user key for agent 8204861Sdes trace "generating $t key" 9204861Sdes rm -f $OBJ/$t-key 10204861Sdes ${SSHKEYGEN} -q -N "" -t $t -f $OBJ/$t-key 11204861Sdes 12204861Sdes trace "export $t private to rfc4716 public" 13204861Sdes ${SSHKEYGEN} -q -e -f $OBJ/$t-key >$OBJ/$t-key-rfc || \ 14204861Sdes fail "export $t private to rfc4716 public" 15204861Sdes 16204861Sdes trace "export $t public to rfc4716 public" 17204861Sdes ${SSHKEYGEN} -q -e -f $OBJ/$t-key.pub >$OBJ/$t-key-rfc.pub || \ 18204861Sdes fail "$t public to rfc4716 public" 19204861Sdes 20204861Sdes cmp $OBJ/$t-key-rfc $OBJ/$t-key-rfc.pub || \ 21204861Sdes fail "$t rfc4716 exports differ between public and private" 22204861Sdes 23204861Sdes trace "import $t rfc4716 public" 24204861Sdes ${SSHKEYGEN} -q -i -f $OBJ/$t-key-rfc >$OBJ/$t-rfc-imported || \ 25204861Sdes fail "$t import rfc4716 public" 26204861Sdes 27204861Sdes cut -f1,2 -d " " $OBJ/$t-key.pub >$OBJ/$t-key-nocomment.pub 28204861Sdes cmp $OBJ/$t-key-nocomment.pub $OBJ/$t-rfc-imported || \ 29204861Sdes fail "$t imported differs from original" 30204861Sdes 31204861Sdes rm -f $OBJ/$t-key $OBJ/$t-key.pub $OBJ/$t-key-rfc $OBJ/$t-key-rfc.pub \ 32204861Sdes $OBJ/$t-rfc-imported $OBJ/$t-key-nocomment.pub 33204861Sdesdone 34