version 1.5, 2015/08/19 18:25:31 |
version 1.6, 2015/09/11 14:30:23 |
|
|
|
|
static struct { |
static struct { |
const EVP_CIPHER *cipher; |
const EVP_CIPHER *cipher; |
#ifndef OPENSSL_NO_ENGINE |
|
char *engine; |
|
#endif |
|
char *infile; |
char *infile; |
int informat; |
int informat; |
int iter; |
int iter; |
|
|
.value = PKCS8_EMBEDDED_PARAM, |
.value = PKCS8_EMBEDDED_PARAM, |
.opt.value = &pkcs8_config.p8_broken, |
.opt.value = &pkcs8_config.p8_broken, |
}, |
}, |
#ifndef OPENSSL_NO_ENGINE |
|
{ |
{ |
.name = "engine", |
|
.argname = "id", |
|
.desc = "Use the engine specified by the given identifier", |
|
.type = OPTION_ARG, |
|
.opt.arg = &pkcs8_config.engine, |
|
}, |
|
#endif |
|
{ |
|
.name = "in", |
.name = "in", |
.argname = "file", |
.argname = "file", |
.desc = "Input file (default stdin)", |
.desc = "Input file (default stdin)", |
|
|
static void |
static void |
pkcs8_usage() |
pkcs8_usage() |
{ |
{ |
fprintf(stderr, "usage: pkcs8 [-embed] [-engine id] [-in file] " |
fprintf(stderr, "usage: pkcs8 [-embed] [-in file] " |
"[-inform fmt] [-nocrypt]\n" |
"[-inform fmt] [-nocrypt]\n" |
" [-noiter] [-nooct] [-nsdb] [-out file] [-outform fmt] " |
" [-noiter] [-nooct] [-nsdb] [-out file] [-outform fmt] " |
"[-passin src]\n" |
"[-passin src]\n" |
|
|
int |
int |
pkcs8_main(int argc, char **argv) |
pkcs8_main(int argc, char **argv) |
{ |
{ |
ENGINE *e = NULL; |
|
BIO *in = NULL, *out = NULL; |
BIO *in = NULL, *out = NULL; |
X509_SIG *p8 = NULL; |
X509_SIG *p8 = NULL; |
PKCS8_PRIV_KEY_INFO *p8inf = NULL; |
PKCS8_PRIV_KEY_INFO *p8inf = NULL; |
|
|
return (1); |
return (1); |
} |
} |
|
|
#ifndef OPENSSL_NO_ENGINE |
|
e = setup_engine(bio_err, pkcs8_config.engine, 0); |
|
#endif |
|
|
|
if (!app_passwd(bio_err, pkcs8_config.passargin, |
if (!app_passwd(bio_err, pkcs8_config.passargin, |
pkcs8_config.passargout, &passin, &passout)) { |
pkcs8_config.passargout, &passin, &passout)) { |
BIO_printf(bio_err, "Error getting passwords\n"); |
BIO_printf(bio_err, "Error getting passwords\n"); |
|
|
} |
} |
if (pkcs8_config.topk8) { |
if (pkcs8_config.topk8) { |
pkey = load_key(bio_err, pkcs8_config.infile, |
pkey = load_key(bio_err, pkcs8_config.infile, |
pkcs8_config.informat, 1, passin, e, "key"); |
pkcs8_config.informat, 1, passin, "key"); |
if (!pkey) |
if (!pkey) |
goto end; |
goto end; |
if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, |
if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, |