mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
cmdgen: have --dump output private parts of PPKs.
This seems more useful than the previous behaviour of not prompting for a passphrase and only emitting the public part; if we want that back I suppose we could invent a "-O text-public". Also, document the text dump format a bit in the man page.
This commit is contained in:
parent
21c2e451da
commit
af9a66be2a
26
cmdgen.c
26
cmdgen.c
@ -810,22 +810,30 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Figure out whether we need to load the encrypted part of the
|
* Figure out whether we need to load the encrypted part of the
|
||||||
* key. This will be the case if either (a) we need to write
|
* key. This will be the case if (a) we need to write out
|
||||||
* out a private key format, or (b) the entire input key file
|
* a private key format, (b) the entire input key file is
|
||||||
* is encrypted.
|
* encrypted, or (c) we're outputting TEXT, in which case we
|
||||||
|
* want all of the input file including private material if it
|
||||||
|
* exists.
|
||||||
*/
|
*/
|
||||||
if (outtype == PRIVATE || outtype == OPENSSH_AUTO ||
|
bool intype_entirely_encrypted =
|
||||||
outtype == OPENSSH_NEW || outtype == SSHCOM ||
|
|
||||||
intype == SSH_KEYTYPE_OPENSSH_PEM ||
|
intype == SSH_KEYTYPE_OPENSSH_PEM ||
|
||||||
intype == SSH_KEYTYPE_OPENSSH_NEW ||
|
intype == SSH_KEYTYPE_OPENSSH_NEW ||
|
||||||
intype == SSH_KEYTYPE_SSHCOM)
|
intype == SSH_KEYTYPE_SSHCOM;
|
||||||
|
bool intype_has_private =
|
||||||
|
!(intype == SSH_KEYTYPE_SSH1_PUBLIC ||
|
||||||
|
intype == SSH_KEYTYPE_SSH2_PUBLIC_RFC4716 ||
|
||||||
|
intype == SSH_KEYTYPE_SSH2_PUBLIC_OPENSSH);
|
||||||
|
bool outtype_has_private =
|
||||||
|
outtype == PRIVATE || outtype == OPENSSH_AUTO ||
|
||||||
|
outtype == OPENSSH_NEW || outtype == SSHCOM;
|
||||||
|
if (outtype_has_private || intype_entirely_encrypted ||
|
||||||
|
(outtype == TEXT && intype_has_private))
|
||||||
load_encrypted = true;
|
load_encrypted = true;
|
||||||
else
|
else
|
||||||
load_encrypted = false;
|
load_encrypted = false;
|
||||||
|
|
||||||
if (load_encrypted && (intype == SSH_KEYTYPE_SSH1_PUBLIC ||
|
if (load_encrypted && !intype_has_private) {
|
||||||
intype == SSH_KEYTYPE_SSH2_PUBLIC_RFC4716 ||
|
|
||||||
intype == SSH_KEYTYPE_SSH2_PUBLIC_OPENSSH)) {
|
|
||||||
fprintf(stderr, "puttygen: cannot perform this action on a "
|
fprintf(stderr, "puttygen: cannot perform this action on a "
|
||||||
"public-key-only input file\n");
|
"public-key-only input file\n");
|
||||||
RETURN(1);
|
RETURN(1);
|
||||||
|
@ -167,9 +167,16 @@ permitted for SSH-1 keys.
|
|||||||
|
|
||||||
\dt \cw{text}
|
\dt \cw{text}
|
||||||
|
|
||||||
\dd Save a textual dump of all the numbers that comprise the key.
|
\dd Save a textual dump of the numeric components comprising the key
|
||||||
Useful for debugging, or for using PuTTYgen as a key generator for
|
(both the public and private parts, if present). Useful for debugging,
|
||||||
applications other than SSH.
|
or for using PuTTYgen as a key generator for applications other than
|
||||||
|
SSH.
|
||||||
|
|
||||||
|
\lcont{
|
||||||
|
The output consists of a series of \cw{name=value} lines, where each
|
||||||
|
\c{value} is either a C-like string literal in double quotes, or a
|
||||||
|
hexadecimal number starting with \cw{0x...}
|
||||||
|
}
|
||||||
|
|
||||||
If no output type is specified, the default is \c{private}.
|
If no output type is specified, the default is \c{private}.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user