version 1.4, 2015/08/19 18:25:31 |
version 1.5, 2015/09/11 14:30:23 |
|
|
|
|
static struct { |
static struct { |
char *challenge; |
char *challenge; |
#ifndef OPENSSL_NO_ENGINE |
|
char *engine; |
|
#endif |
|
char *infile; |
char *infile; |
char *keyfile; |
char *keyfile; |
int noout; |
int noout; |
|
|
.type = OPTION_ARG, |
.type = OPTION_ARG, |
.opt.arg = &spkac_config.challenge, |
.opt.arg = &spkac_config.challenge, |
}, |
}, |
#ifndef OPENSSL_NO_ENGINE |
|
{ |
{ |
.name = "engine", |
|
.argname = "id", |
|
.desc = "Use the engine specified by the given identifier", |
|
.type = OPTION_ARG, |
|
.opt.arg = &spkac_config.engine, |
|
}, |
|
#endif |
|
{ |
|
.name = "in", |
.name = "in", |
.argname = "file", |
.argname = "file", |
.desc = "Input file (default stdin)", |
.desc = "Input file (default stdin)", |
|
|
spkac_usage(void) |
spkac_usage(void) |
{ |
{ |
fprintf(stderr, |
fprintf(stderr, |
"usage: spkac [-challenge string] [-engine id] [-in file] " |
"usage: spkac [-challenge string] [-in file] " |
"[-key file] [-noout]\n" |
"[-key file] [-noout]\n" |
" [-out file] [-passin src] [-pubkey] [-spkac name] " |
" [-out file] [-passin src] [-pubkey] [-spkac name] " |
"[-spksect section]\n" |
"[-spksect section]\n" |
|
|
int |
int |
spkac_main(int argc, char **argv) |
spkac_main(int argc, char **argv) |
{ |
{ |
ENGINE *e = NULL; |
|
int i, ret = 1; |
int i, ret = 1; |
BIO *in = NULL, *out = NULL; |
BIO *in = NULL, *out = NULL; |
char *passin = NULL; |
char *passin = NULL; |
|
|
BIO_printf(bio_err, "Error getting password\n"); |
BIO_printf(bio_err, "Error getting password\n"); |
goto end; |
goto end; |
} |
} |
#ifndef OPENSSL_NO_ENGINE |
|
e = setup_engine(bio_err, spkac_config.engine, 0); |
|
#endif |
|
|
|
if (spkac_config.keyfile) { |
if (spkac_config.keyfile) { |
pkey = load_key(bio_err, |
pkey = load_key(bio_err, |
strcmp(spkac_config.keyfile, "-") ? spkac_config.keyfile |
strcmp(spkac_config.keyfile, "-") ? spkac_config.keyfile |
: NULL, FORMAT_PEM, 1, passin, e, "private key"); |
: NULL, FORMAT_PEM, 1, passin, "private key"); |
if (!pkey) { |
if (!pkey) { |
goto end; |
goto end; |
} |
} |