diff dropbearkey.c @ 457:e430a26064ee DROPBEAR_0.50

Make dropbearkey only generate 1024 bit keys
author Matt Johnston <matt@ucc.asn.au>
date Wed, 08 Aug 2007 15:57:50 +0000
parents 454a34b2dfd1
children 3aa74a4d83ae 76097ec1a29a
line wrap: on
line diff
--- a/dropbearkey.c	Wed Aug 08 15:48:52 2007 +0000
+++ b/dropbearkey.c	Wed Aug 08 15:57:50 2007 +0000
@@ -75,6 +75,7 @@
 #endif
 					"-f filename	Use filename for the secret key\n"
 					"-s bits	Key size in bits, should be a multiple of 8 (optional)\n"
+					"           (DSS has a fixed size of 1024 bits)\n"
 					"-y		Just print the publickey and fingerprint for the\n		private key in <filename>.\n"
 #ifdef DEBUG_TRACE
 					"-v		verbose\n"
@@ -187,8 +188,11 @@
 			fprintf(stderr, "Bits must be an integer\n");
 			exit(EXIT_FAILURE);
 		}
-	
-		if (bits < 512 || bits > 4096 || (bits % 8 != 0)) {
+		
+		if (keytype == DROPBEAR_SIGNKEY_DSS && bits != 1024) {
+			fprintf(stderr, "DSS keys have a fixed size of 1024 bits\n");
+			exit(EXIT_FAILURE);			
+		} else if (bits < 512 || bits > 4096 || (bits % 8 != 0)) {
 			fprintf(stderr, "Bits must satisfy 512 <= bits <= 4096, and be a"
 					" multiple of 8\n");
 			exit(EXIT_FAILURE);