60 #ifndef OPENSSL_NO_DSA
63 #include <sys/types.h>
75 #define PROG gendsa_main
77 int MAIN(
int,
char **);
79 int MAIN(
int argc,
char **argv)
84 char *inrand=NULL,*dsaparams=NULL;
85 char *passargout = NULL, *passout = NULL;
88 #ifndef OPENSSL_NO_ENGINE
105 if (argc <= 0)
break;
106 if (strcmp(*argv,
"-out") == 0)
108 if (--argc < 1)
goto bad;
111 else if (strcmp(*argv,
"-passout") == 0)
113 if (--argc < 1)
goto bad;
114 passargout= *(++argv);
116 #ifndef OPENSSL_NO_ENGINE
117 else if (strcmp(*argv,
"-engine") == 0)
119 if (--argc < 1)
goto bad;
123 else if (strcmp(*argv,
"-rand") == 0)
125 if (--argc < 1)
goto bad;
128 else if (strcmp(*argv,
"-") == 0)
130 #ifndef OPENSSL_NO_DES
131 else if (strcmp(*argv,
"-des") == 0)
133 else if (strcmp(*argv,
"-des3") == 0)
136 #ifndef OPENSSL_NO_IDEA
137 else if (strcmp(*argv,
"-idea") == 0)
140 #ifndef OPENSSL_NO_SEED
141 else if (strcmp(*argv,
"-seed") == 0)
144 #ifndef OPENSSL_NO_AES
145 else if (strcmp(*argv,
"-aes128") == 0)
147 else if (strcmp(*argv,
"-aes192") == 0)
149 else if (strcmp(*argv,
"-aes256") == 0)
152 #ifndef OPENSSL_NO_CAMELLIA
153 else if (strcmp(*argv,
"-camellia128") == 0)
155 else if (strcmp(*argv,
"-camellia192") == 0)
157 else if (strcmp(*argv,
"-camellia256") == 0)
160 else if (**argv !=
'-' && dsaparams == NULL)
170 if (dsaparams == NULL)
175 #ifndef OPENSSL_NO_DES
177 BIO_printf(
bio_err,
" -des3 - encrypt the generated key with DES in ede cbc mode (168 bit key)\n");
179 #ifndef OPENSSL_NO_IDEA
180 BIO_printf(
bio_err,
" -idea - encrypt the generated key with IDEA in cbc mode\n");
182 #ifndef OPENSSL_NO_SEED
186 #ifndef OPENSSL_NO_AES
190 #ifndef OPENSSL_NO_CAMELLIA
194 #ifndef OPENSSL_NO_ENGINE
201 BIO_printf(
bio_err,
" - a DSA parameter file as generated by the dsaparam command\n");
205 #ifndef OPENSSL_NO_ENGINE
222 if ((dsa=PEM_read_bio_DSAparams(in,NULL,NULL,NULL)) == NULL)
231 if (out == NULL)
goto end;
236 #ifdef OPENSSL_SYS_VMS
254 BIO_printf(
bio_err,
"warning, not much extra random data, consider using the -rand option\n");
266 if (!PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,NULL, passout))
282 static void *dummy=&dummy;