diff options
author | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:42:53 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:42:53 +0000 |
commit | 87552344215a38d3a2b0d4d63dc151e05978bbe1 (patch) | |
tree | 9f4b96055e6ccaa915e8d59d9f2805e9e119371d /regress/ssh2putty.sh | |
parent | a25ec0b132c44c9e341e08464ff830de06b81126 (diff) | |
parent | ef94e5613d37bcbf880f21ee6094e4b1c7683a4c (diff) |
import openssh-5.1p1-gsskex-cjwatson-20080722.patch
Diffstat (limited to 'regress/ssh2putty.sh')
-rwxr-xr-x | regress/ssh2putty.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/regress/ssh2putty.sh b/regress/ssh2putty.sh new file mode 100755 index 000000000..dfdeeff4a --- /dev/null +++ b/regress/ssh2putty.sh | |||
@@ -0,0 +1,33 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | if test "x$1" = "x" -o "x$2" = "x" -o "x$3" = "x" ; then | ||
4 | echo "Usage: ssh2putty hostname port ssh-private-key" | ||
5 | exit 1 | ||
6 | fi | ||
7 | |||
8 | HOST=$1 | ||
9 | PORT=$2 | ||
10 | KEYFILE=$3 | ||
11 | |||
12 | # XXX - support DSA keys too | ||
13 | if grep "BEGIN RSA PRIVATE KEY" $KEYFILE >/dev/null 2>&1 ; then | ||
14 | : | ||
15 | else | ||
16 | echo "Unsupported private key format" | ||
17 | exit 1 | ||
18 | fi | ||
19 | |||
20 | public_exponent=` | ||
21 | openssl rsa -noout -text -in $KEYFILE | grep ^publicExponent | | ||
22 | sed 's/.*(//;s/).*//' | ||
23 | ` | ||
24 | test $? -ne 0 && exit 1 | ||
25 | |||
26 | modulus=` | ||
27 | openssl rsa -noout -modulus -in $KEYFILE | grep ^Modulus= | | ||
28 | sed 's/^Modulus=/0x/' | tr A-Z a-z | ||
29 | ` | ||
30 | test $? -ne 0 && exit 1 | ||
31 | |||
32 | echo "rsa2@$PORT:$HOST $public_exponent,$modulus" | ||
33 | |||