66 #define PROG pkcs8_main
68 int MAIN(
int,
char **);
70 int MAIN(
int argc,
char **argv)
73 char **args, *infile = NULL, *outfile = NULL;
74 char *passargin = NULL, *passargout = NULL;
80 int informat, outformat;
86 char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
89 #ifndef OPENSSL_NO_ENGINE
104 while (!badarg && *args && *args[0] ==
'-')
106 if (!strcmp(*args,
"-v2"))
115 "Unknown cipher %s\n", *args);
122 else if (!strcmp(*args,
"-v1"))
131 "Unknown PBE algorithm %s\n", *args);
138 else if (!strcmp(*args,
"-inform"))
147 else if (!strcmp(*args,
"-outform"))
156 else if (!strcmp (*args,
"-topk8"))
158 else if (!strcmp (*args,
"-noiter"))
160 else if (!strcmp (*args,
"-nocrypt"))
162 else if (!strcmp (*args,
"-nooct"))
164 else if (!strcmp (*args,
"-nsdb"))
166 else if (!strcmp (*args,
"-embed"))
168 else if (!strcmp(*args,
"-passin"))
170 if (!args[1])
goto bad;
171 passargin= *(++args);
173 else if (!strcmp(*args,
"-passout"))
175 if (!args[1])
goto bad;
176 passargout= *(++args);
178 #ifndef OPENSSL_NO_ENGINE
179 else if (strcmp(*args,
"-engine") == 0)
181 if (!args[1])
goto bad;
185 else if (!strcmp (*args,
"-in"))
194 else if (!strcmp (*args,
"-out"))
220 BIO_printf(
bio_err,
"-embed use (nonstandard) embedded DSA parameters format\n");
226 #ifndef OPENSSL_NO_ENGINE
232 #ifndef OPENSSL_NO_ENGINE
242 if ((pbe_nid == -1) && !cipher)
250 "Can't open input file %s\n", infile);
262 "Can't open output file %s\n", outfile);
269 #ifdef OPENSSL_SYS_VMS
291 PEM_write_bio_PKCS8_PRIV_KEY_INFO(out, p8inf);
312 p8pass, strlen(p8pass),
313 NULL, 0, iter, p8inf)))
321 PEM_write_bio_PKCS8(out, p8);
338 p8inf = PEM_read_bio_PKCS8_PRIV_KEY_INFO(in,NULL,NULL, NULL);
350 p8 = PEM_read_bio_PKCS8(in, NULL, NULL, NULL);
429 PKCS8_PRIV_KEY_INFO_free(p8inf);