summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/regress/ssh2putty.sh
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2013-09-21 22:24:10 +0000
committerdes <des@FreeBSD.org>2013-09-21 22:24:10 +0000
commitb32fed86db62816ab222f56c1f859a444ac8648b (patch)
treefb81eca65d09d841e542cd6af66ff14c5004dbd8 /crypto/openssh/regress/ssh2putty.sh
parenteaecb3d1ae60457bac557fd719cacb819f801159 (diff)
parentff2597d3eebc3da3f7cf2a638607274cad9b199e (diff)
downloadFreeBSD-src-b32fed86db62816ab222f56c1f859a444ac8648b.zip
FreeBSD-src-b32fed86db62816ab222f56c1f859a444ac8648b.tar.gz
Pull in all the OpenSSH bits that we'd previously left out because we
didn't use them. This will make future merges from the vendor tree much easier. Approved by: re (gjb)
Diffstat (limited to 'crypto/openssh/regress/ssh2putty.sh')
-rwxr-xr-xcrypto/openssh/regress/ssh2putty.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/crypto/openssh/regress/ssh2putty.sh b/crypto/openssh/regress/ssh2putty.sh
new file mode 100755
index 0000000..691db16
--- /dev/null
+++ b/crypto/openssh/regress/ssh2putty.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# $OpenBSD: ssh2putty.sh,v 1.2 2009/10/06 23:51:49 dtucker Exp $
+
+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 "BEGIN RSA PRIVATE KEY" $KEYFILE >/dev/null 2>&1 ; then
+ :
+else
+ 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"
+
OpenPOWER on IntegriCloud