]> andersk Git - openssh.git/blame - regress/ssh2putty.sh
- djm@cvs.openbsd.org 2009/11/20 00:54:01
[openssh.git] / regress / ssh2putty.sh
CommitLineData
f3dad773 1#!/bin/sh
47370d5c 2# $OpenBSD: ssh2putty.sh,v 1.2 2009/10/06 23:51:49 dtucker Exp $
f3dad773 3
4if test "x$1" = "x" -o "x$2" = "x" -o "x$3" = "x" ; then
5 echo "Usage: ssh2putty hostname port ssh-private-key"
6 exit 1
7fi
8
9HOST=$1
10PORT=$2
11KEYFILE=$3
12
13# XXX - support DSA keys too
575a5ece 14if grep "BEGIN RSA PRIVATE KEY" $KEYFILE >/dev/null 2>&1 ; then
15 :
16else
f3dad773 17 echo "Unsupported private key format"
18 exit 1
19fi
20
21public_exponent=`
22 openssl rsa -noout -text -in $KEYFILE | grep ^publicExponent |
23 sed 's/.*(//;s/).*//'
24`
25test $? -ne 0 && exit 1
26
27modulus=`
28 openssl rsa -noout -modulus -in $KEYFILE | grep ^Modulus= |
29 sed 's/^Modulus=/0x/' | tr A-Z a-z
30`
31test $? -ne 0 && exit 1
32
33echo "rsa2@$PORT:$HOST $public_exponent,$modulus"
34
This page took 1.276125 seconds and 5 git commands to generate.