summaryrefslogtreecommitdiffstats
path: root/regress/ssh2putty.sh
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-03-12 14:17:00 +0100
committerDamien Miller <djm@mindrot.org>2008-03-12 14:17:00 +0100
commitaf78493bba42cd4351eded064fb63b81fa2867a9 (patch)
tree0eca81431c4b72d3cc1a6f3119a95ad7ffa82fa8 /regress/ssh2putty.sh
parent - djm@cvs.openbsd.org 2007/12/12 05:04:03 (diff)
downloadopenssh-af78493bba42cd4351eded064fb63b81fa2867a9.tar.xz
openssh-af78493bba42cd4351eded064fb63b81fa2867a9.zip
- djm@cvs.openbsd.org 2007/12/21 04:13:53
[regress/Makefile regress/test-exec.sh regress/putty-ciphers.sh] [regress/putty-kex.sh regress/putty-transfer.sh regress/ssh2putty.sh] basic (crypto, kex and transfer) interop regression tests against putty To run these, install putty and run "make interop-tests" from the build directory - the tests aren't run by default yet.
Diffstat (limited to 'regress/ssh2putty.sh')
-rwxr-xr-xregress/ssh2putty.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/regress/ssh2putty.sh b/regress/ssh2putty.sh
new file mode 100755
index 000000000..82dd44787
--- /dev/null
+++ b/regress/ssh2putty.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+if test "x$1" = "x" -o "x$2" = "x" -o "x$3" = "x" ; then
+ echo "Usage: ssh2putty hostname port ssh-private-key"
+ exit 1
+fi
+
+HOST=$1
+PORT=$2
+KEYFILE=$3
+
+# XXX - support DSA keys too
+if ! grep -q "BEGIN RSA PRIVATE KEY" $KEYFILE ; then
+ echo "Unsupported private key format"
+ exit 1
+fi
+
+public_exponent=`
+ openssl rsa -noout -text -in $KEYFILE | grep ^publicExponent |
+ sed 's/.*(//;s/).*//'
+`
+test $? -ne 0 && exit 1
+
+modulus=`
+ openssl rsa -noout -modulus -in $KEYFILE | grep ^Modulus= |
+ sed 's/^Modulus=/0x/' | tr A-Z a-z
+`
+test $? -ne 0 && exit 1
+
+echo "rsa2@$PORT:$HOST $public_exponent,$modulus"
+