version 1.4, 2015/08/22 16:36:05 |
version 1.5, 2015/09/11 14:30:23 |
|
|
int |
int |
pkey_main(int argc, char **argv) |
pkey_main(int argc, char **argv) |
{ |
{ |
ENGINE *e = NULL; |
|
char **args, *infile = NULL, *outfile = NULL; |
char **args, *infile = NULL, *outfile = NULL; |
char *passargin = NULL, *passargout = NULL; |
char *passargin = NULL, *passargout = NULL; |
BIO *in = NULL, *out = NULL; |
BIO *in = NULL, *out = NULL; |
|
|
EVP_PKEY *pkey = NULL; |
EVP_PKEY *pkey = NULL; |
char *passin = NULL, *passout = NULL; |
char *passin = NULL, *passout = NULL; |
int badarg = 0; |
int badarg = 0; |
#ifndef OPENSSL_NO_ENGINE |
|
char *engine = NULL; |
|
#endif |
|
int ret = 1; |
int ret = 1; |
|
|
informat = FORMAT_PEM; |
informat = FORMAT_PEM; |
|
|
goto bad; |
goto bad; |
passargout = *(++args); |
passargout = *(++args); |
} |
} |
#ifndef OPENSSL_NO_ENGINE |
|
else if (strcmp(*args, "-engine") == 0) { |
|
if (!args[1]) |
|
goto bad; |
|
engine = *(++args); |
|
} |
|
#endif |
|
else if (!strcmp(*args, "-in")) { |
else if (!strcmp(*args, "-in")) { |
if (args[1]) { |
if (args[1]) { |
args++; |
args++; |
|
|
BIO_printf(bio_err, "-outform X output format (DER or PEM)\n"); |
BIO_printf(bio_err, "-outform X output format (DER or PEM)\n"); |
BIO_printf(bio_err, "-out file output file\n"); |
BIO_printf(bio_err, "-out file output file\n"); |
BIO_printf(bio_err, "-passout arg output file pass phrase source\n"); |
BIO_printf(bio_err, "-passout arg output file pass phrase source\n"); |
#ifndef OPENSSL_NO_ENGINE |
|
BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n"); |
|
#endif |
|
return 1; |
return 1; |
} |
} |
#ifndef OPENSSL_NO_ENGINE |
|
e = setup_engine(bio_err, engine, 0); |
|
#endif |
|
|
|
if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { |
if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { |
BIO_printf(bio_err, "Error getting passwords\n"); |
BIO_printf(bio_err, "Error getting passwords\n"); |
|
|
|
|
if (pubin) |
if (pubin) |
pkey = load_pubkey(bio_err, infile, informat, 1, |
pkey = load_pubkey(bio_err, infile, informat, 1, |
passin, e, "Public Key"); |
passin, "Public Key"); |
else |
else |
pkey = load_key(bio_err, infile, informat, 1, |
pkey = load_key(bio_err, infile, informat, 1, passin, "key"); |
passin, e, "key"); |
|
if (!pkey) |
if (!pkey) |
goto end; |
goto end; |
|
|