1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
Commit Graph

22 Commits

Author SHA1 Message Date
Simon Tatham
1efded20a1 kh2reg: stop using deprecated base64.decodestring.
Python 3 gave me a warning that I should have been using decodebytes
instead.
2020-03-09 19:27:17 +00:00
Simon Tatham
143f8a2d10 kh2reg: fix Python 3 iterator bug with multiple hostnames.
A known_hosts line can have multiple comma-separated hostnames on it,
or more usually a hostname and an IP address.

In the RSA and DSA key handlers, I was making a list of the integer
parameters of the public key by using the 'map' function, and then
iterating over it once per hostname on the line. But in Python 3, the
'map' function returns an iterator, not a list, so after you've
iterated to its end once, it's empty, and iterating over it a second
time stops immediately. As a result, the registry line for the second
hostname was coming out empty.
2020-03-09 19:26:49 +00:00
Simon Tatham
2ec2b796ed Migrate all Python scripts to Python 3.
Most of them are now _mandatory_ P3 scripts, because I'm tired of
maintaining everything to be compatible with both versions.

The current exceptions are gdb.py (which has to live with whatever gdb
gives it), and kh2reg.py (which is actually designed for other people
to use, and some of them might still be stuck on P2 for the moment).
2020-03-04 21:23:49 +00:00
Simon Tatham
a085acbadf Support the new "ssh-ed448" key type.
This is standardised by RFC 8709 at SHOULD level, and for us it's not
too difficult (because we use general-purpose elliptic-curve code). So
let's be up to date for a change, and add it.

This implementation uses all the formats defined in the RFC. But we
also have to choose a wire format for the public+private key blob sent
to an agent, and since the OpenSSH agent protocol is the de facto
standard but not (yet?) handled by the IETF, OpenSSH themselves get to
say what the format for a key should or shouldn't be. So if they don't
support a particular key method, what do you do?

I checked with them, and they agreed that there's an obviously right
format for Ed448 keys, which is to do them exactly like Ed25519 except
that you have a 57-byte string everywhere Ed25519 had a 32-byte
string. So I've done that.
2020-03-02 07:09:08 +00:00
Simon Tatham
5f204d1ef1 kh2reg.py: handle OpenSSH hashed hostnames.
Obviously we can't do that by inverting the hash function itself, but
if the user provides one or more host names on the command line that
they're expecting to appear in the file, we can at least compare the
stored hashes against those.
2019-04-21 14:46:12 +01:00
Simon Tatham
0842d4627e kh2reg.py: add -o option to write output to a file.
Generally useful, I always think.
2019-04-21 14:46:12 +01:00
Simon Tatham
ac1dd1bd2e kh2reg.py: switch from getopt to argparse.
This change gives us an automatic --help option, which is always
useful for a script used very rarely. It also makes it that much
easier to add extra options.
2019-04-21 14:46:12 +01:00
Simon Tatham
91333f7c74 kh2reg.py: refactor main program to bottom of file.
Now most of the program consists of function and class definitions,
and the code that activates it all is localised in one place at the
bottom instead of interleaved between the definitions.
2019-04-21 14:46:12 +01:00
Simon Tatham
33d4d223a5 kh2reg.py: work with Python 3. 2019-04-21 14:46:12 +01:00
Simon Tatham
5a508a84a2 kh2reg.py: support ECDSA point compression.
We support it in the ECC code proper these days, as of the bignum
rewrite in commit 25b034ee3. So we should support it in this auxiliary
script too, and fortunately, there's no real difficulty in doing so
because I already had some Python code kicking around in
test/eccref.py for taking modular square roots.
2019-04-21 14:46:12 +01:00
Owen Dunn
142a458fee Add blank line at bottom of .reg files we generate
The specification at http://support.microsoft.com/kb/310516 says .reg
files should have a blank line at the end.
2017-03-17 10:11:20 +00:00
Simon Tatham
c722b2f07f Support Ed25519 in kh2reg.py. 2016-03-25 09:58:40 +00:00
Jacob Nevins
a5588cd635 kh2reg.py: remove accidental hard tabs. 2016-03-22 00:43:30 +00:00
Jacob Nevins
7332d0567e Partial update of kh2reg.py for new formats.
Only ECDSA so far, because ed25519 requires real maths to deal with the
compressed point format.
2016-03-22 00:36:19 +00:00
Jacob Nevins
56a42d09d4 Make kh2reg.py compatible with modern Python.
Bare string exceptions aren't supported any more.
Patch by Will Aoki, plus a backward compatibility tweak from Colin Watson.
Seen working with Python 2.4.3 and 2.7.6.
2015-02-24 10:30:18 +00:00
Simon Tatham
4d8782e74f Rework versioning system to not depend on Subversion.
I've shifted away from using the SVN revision number as a monotonic
version identifier (replacing it in the Windows version resource with
a count of days since an arbitrary epoch), and I've removed all uses
of SVN keyword expansion (replacing them with version information
written out by Buildscr).

While I'm at it, I've done a major rewrite of the affected code which
centralises all the computation of the assorted version numbers and
strings into Buildscr, so that they're all more or less alongside each
other rather than scattered across multiple source files.

I've also retired the MD5-based manifest file system. A long time ago,
it seemed like a good idea to arrange that binaries of PuTTY would
automatically cease to identify themselves as a particular upstream
version number if any changes were made to the source code, so that if
someone made a local tweak and distributed the result then I wouldn't
get blamed for the results. Since then I've decided the whole idea is
more trouble than it's worth, so now distribution tarballs will have
version information baked in and people can just cope with that.

[originally from svn r10262]
2014-09-24 10:33:13 +00:00
Jacob Nevins
8b88d653de Ansgar Wiechers points out that known_hosts (at least OpenSSH's) has grown a
means of specifying port numbers, so we should support that.

[originally from svn r8519]
2009-04-26 23:44:28 +00:00
Jacob Nevins
54c3773c91 Discard hashed hostnames from input.
[originally from svn r8518]
2009-04-26 23:03:02 +00:00
Jacob Nevins
5aa719d16e Consistently use a single notation to refer to SSH protocol versions, as
discussed. Use Barrett and Silverman's convention of "SSH-1" for SSH protocol
version 1 and "SSH-2" for protocol 2 ("SSH1"/"SSH2" refer to ssh.com
implementations in this scheme). <http://www.snailbook.com/terms.html>

[originally from svn r5480]
2005-03-10 16:36:05 +00:00
Jacob Nevins
7bc5b64c20 Fix usage comments
[originally from svn r3519]
2003-10-21 13:26:12 +00:00
Jacob Nevins
a90f643907 Add `--unix' mode to generate ~/.putty/sshhostkeys from known_hosts.
(should now be called `kh2putty.py')

[originally from svn r3508]
2003-10-14 23:23:28 +00:00
Jacob Nevins
a2a2668458 Slightly less grotty script to convert OpenSSH known_hosts and known_hosts2
host key files to .REG files for Windows.
(renamed from 'hosts2reg' because of 8.3 considerations)

[originally from svn r1586]
2002-03-10 22:00:06 +00:00