2 # $OpenBSD: ssh2putty.sh,v 1.2 2009/10/06 23:51:49 dtucker Exp $
4 if test "x$1" = "x" -o "x$2" = "x" -o "x$3" = "x" ; then
5 echo "Usage: ssh2putty hostname port ssh-private-key"
13 # XXX - support DSA keys too
14 if grep "BEGIN RSA PRIVATE KEY" $KEYFILE >/dev
/null
2>&1 ; then
17 echo "Unsupported private key format"
22 openssl rsa -noout -text -in $KEYFILE | grep ^publicExponent |
25 test $?
-ne 0 && exit 1
28 openssl rsa -noout -modulus -in $KEYFILE | grep ^Modulus= |
29 sed 's/^Modulus=/0x/' | tr A-Z a-z
31 test $?
-ne 0 && exit 1
33 echo "rsa2@$PORT:$HOST $public_exponent,$modulus"