Random Unix puttygen improvements highlighted by a post to comp.security.ssh:
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Fri, 7 Jul 2006 14:18:47 +0000 (14:18 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Fri, 7 Jul 2006 14:18:47 +0000 (14:18 +0000)
 - fix diagnostic if keyfile and '-t' both specified
 - add diagnostic for generating a key but discarding the private part
 - document '-q' option

git-svn-id: svn://svn.tartarus.org/sgt/putty@6750 cda61777-01e9-0310-a592-d414129be87e

cmdgen.c
doc/man-pg.but

index e46e697..763d05e 100644 (file)
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -128,7 +128,7 @@ void usage(int standalone)
 {
     fprintf(stderr,
            "Usage: puttygen ( keyfile | -t type [ -b bits ] )\n"
-           "                [ -C comment ] [ -P ]\n"
+           "                [ -C comment ] [ -P ] [ -q ]\n"
            "                [ -o output-keyfile ] [ -O type | -l | -L"
            " | -p ]\n");
     if (standalone)
@@ -149,6 +149,7 @@ void help(void)
            "  -b    specify number of bits when generating key\n"
            "  -C    change or specify key comment\n"
            "  -P    change key passphrase\n"
+           "  -q    quiet: do not display progress bar\n"
            "  -O    specify output type:\n"
            "           private             output PuTTY private key format\n"
            "           private-openssh     export OpenSSH private key\n"
@@ -339,7 +340,7 @@ int main(int argc, char **argv)
                        else {
                            errs = TRUE;
                            fprintf(stderr,
-                                   "puttygen: no such option `--%s'\n", opt);
+                                   "puttygen: no such option `-%s'\n", opt);
                        }
                    }
                    p = NULL;
@@ -490,11 +491,21 @@ int main(int argc, char **argv)
      * Bomb out if we've been asked to both load and generate a
      * key.
      */
-    if (keytype != NOKEYGEN && intype) {
+    if (keytype != NOKEYGEN && infile) {
        fprintf(stderr, "puttygen: cannot both load and generate a key\n");
        return 1;
     }
 
+    /* 
+     * We must save the private part when generating a new key.
+     */
+    if (keytype != NOKEYGEN &&
+       (outtype != PRIVATE && outtype != OPENSSH && outtype != SSHCOM)) {
+       fprintf(stderr, "puttygen: this would generate a new key but "
+               "discard the private part\n");
+       return 1;
+    }
+
     /*
      * Analyse the type of the input file, in case this affects our
      * course of action.
index 5e3d9ea..f0cb89b 100644 (file)
@@ -10,8 +10,8 @@
 
 \c puttygen ( keyfile | -t keytype [ -b bits ] )
 \e bbbbbbbb   iiiiiii   bb iiiiiii   bb iiii
-\c          [ -C new-comment ] [ -P ]
-\e            bb iiiiiiiiiii     bb
+\c          [ -C new-comment ] [ -P ] [ -q ]
+\e            bb iiiiiiiiiii     bb     bb
 \c          [ -O output-type | -l | -L | -p ]
 \e            bb iiiiiiiiiii   bb   bb   bb
 \c          [ -o output-file ]
@@ -56,6 +56,10 @@ generate SSH-1 keys).
 
 \dd Specify the size of the key to generate, in bits. Default is 1024.
 
+\dt \cw{\-q}
+
+\dd Suppress the progress display when generating a new key.
+
 In the second phase, \c{puttygen} optionally alters properties of
 the key it has loaded or generated. The options to control this are:
 
@@ -145,10 +149,14 @@ fingerprint. Otherwise, the \c{\-o} option is required.
 The following options do not run PuTTYgen as normal, but print
 informational messages and then quit:
 
-\dt \cw{\-\-help}
+\dt \cw{\-h}, \cw{\-\-help}
 
 \dd Display a message summarizing the available options.
 
+\dt \cw{\-V}, \cw{\-\-version}
+
+\dd Display the version of PuTTYgen.
+
 \dt \cw{\-\-pgpfp}
 
 \dd Display the fingerprints of the PuTTY PGP Master Keys, to aid