summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-02-24 17:33:30 +1100
committerDamien Miller <djm@mindrot.org>2010-02-24 17:33:30 +1100
commit8eff8e8f59de5807e1db73bdfd86a0780595f01c (patch)
treeac8367aeb1c6aac467073f851faa65ff715ce973
parentcfa42d2fd2077cce168b81c77f63776bd87a68b3 (diff)
- dtucker@cvs.openbsd.org 2009/11/09 04:20:04
[regress/Makefile keygen-convert.sh] add regression test for ssh-keygen pubkey conversions
-rw-r--r--regress/keygen-convert.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/regress/keygen-convert.sh b/regress/keygen-convert.sh
new file mode 100644
index 000000000..ad0e9c637
--- /dev/null
+++ b/regress/keygen-convert.sh
@@ -0,0 +1,33 @@
1# $OpenBSD: keygen-convert.sh,v 1.1 2009/11/09 04:20:04 dtucker Exp $
2# Placed in the Public Domain.
3
4tid="convert keys"
5
6for t in rsa dsa; do
7 # generate user key for agent
8 trace "generating $t key"
9 rm -f $OBJ/$t-key
10 ${SSHKEYGEN} -q -N "" -t $t -f $OBJ/$t-key
11
12 trace "export $t private to rfc4716 public"
13 ${SSHKEYGEN} -q -e -f $OBJ/$t-key >$OBJ/$t-key-rfc || \
14 fail "export $t private to rfc4716 public"
15
16 trace "export $t public to rfc4716 public"
17 ${SSHKEYGEN} -q -e -f $OBJ/$t-key.pub >$OBJ/$t-key-rfc.pub || \
18 fail "$t public to rfc4716 public"
19
20 cmp $OBJ/$t-key-rfc $OBJ/$t-key-rfc.pub || \
21 fail "$t rfc4716 exports differ between public and private"
22
23 trace "import $t rfc4716 public"
24 ${SSHKEYGEN} -q -i -f $OBJ/$t-key-rfc >$OBJ/$t-rfc-imported || \
25 fail "$t import rfc4716 public"
26
27 cut -f1,2 -d " " $OBJ/$t-key.pub >$OBJ/$t-key-nocomment.pub
28 cmp $OBJ/$t-key-nocomment.pub $OBJ/$t-rfc-imported || \
29 fail "$t imported differs from original"
30
31 rm -f $OBJ/$t-key $OBJ/$t-key.pub $OBJ/$t-key-rfc $OBJ/$t-key-rfc.pub \
32 $OBJ/$t-rfc-imported $OBJ/$t-key-nocomment.pub
33done