mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 11:32:48 -05:00
Allow cmdgen to read keys from standard input.
This reworks the cmdgen main program so that it loads the input file into a LoadedFile right at the start, and then every time it needs to do something with the contents, it calls one of the API functions taking a BinarySource instead of one taking a Filename. The usefulness of this is that now we can read from things that aren't regular files, and can't be rewound or reopened. In particular, the filename "-" is now taken (per the usual convention) to mean standard input. So now you can pipe a public or private key file into cmdgen's standard input and have it do something useful. For example, I was recently experimenting with the SFTP-only SSH server that comes with 'proftpd', which keeps its authorized_keys file in RFC 4716 format instead of the OpenSSH one-liner format, and I found I wanted to do grep 'my-key-comment' ~/.ssh/authorized_keys | puttygen -p - to quickly get hold of my existing public key to put in that file. But I had to go via a temporary file to make that work, because puttygen couldn't read from standard input. Next time, it will be able to!
This commit is contained in:
1
ssh.h
1
ssh.h
@ -1260,6 +1260,7 @@ void ssh2_write_pubkey(FILE *fp, const char *comment,
|
||||
char *ssh2_fingerprint_blob(ptrlen);
|
||||
char *ssh2_fingerprint(ssh_key *key);
|
||||
int key_type(const Filename *filename);
|
||||
int key_type_s(BinarySource *src);
|
||||
const char *key_type_to_str(int type);
|
||||
|
||||
bool import_possible(int type);
|
||||
|
Reference in New Issue
Block a user