version 1.4, 2015/08/19 18:25:31 |
version 1.5, 2015/09/11 14:30:23 |
|
|
static struct { |
static struct { |
int check; |
int check; |
const EVP_CIPHER *enc; |
const EVP_CIPHER *enc; |
#ifndef OPENSSL_NO_ENGINE |
|
char *engine; |
|
#endif |
|
char *infile; |
char *infile; |
int informat; |
int informat; |
int modulus; |
int modulus; |
|
|
.type = OPTION_FLAG, |
.type = OPTION_FLAG, |
.opt.flag = &rsa_config.check, |
.opt.flag = &rsa_config.check, |
}, |
}, |
#ifndef OPENSSL_NO_ENGINE |
|
{ |
{ |
.name = "engine", |
|
.argname = "id", |
|
.desc = "Use the engine specified by the given identifier", |
|
.type = OPTION_ARG, |
|
.opt.arg = &rsa_config.engine, |
|
}, |
|
#endif |
|
{ |
|
.name = "in", |
.name = "in", |
.argname = "file", |
.argname = "file", |
.desc = "Input file (default stdin)", |
.desc = "Input file (default stdin)", |
|
|
rsa_usage() |
rsa_usage() |
{ |
{ |
fprintf(stderr, |
fprintf(stderr, |
"usage: rsa [-ciphername] [-check] [-engine id] [-in file] " |
"usage: rsa [-ciphername] [-check] [-in file] " |
"[-inform fmt]\n" |
"[-inform fmt]\n" |
" [-modulus] [-noout] [-out file] [-outform fmt] " |
" [-modulus] [-noout] [-out file] [-outform fmt] " |
"[-passin src]\n" |
"[-passin src]\n" |
|
|
int |
int |
rsa_main(int argc, char **argv) |
rsa_main(int argc, char **argv) |
{ |
{ |
ENGINE *e = NULL; |
|
int ret = 1; |
int ret = 1; |
RSA *rsa = NULL; |
RSA *rsa = NULL; |
int i; |
int i; |
|
|
goto end; |
goto end; |
} |
} |
|
|
#ifndef OPENSSL_NO_ENGINE |
|
e = setup_engine(bio_err, rsa_config.engine, 0); |
|
#endif |
|
|
|
if (!app_passwd(bio_err, rsa_config.passargin, rsa_config.passargout, |
if (!app_passwd(bio_err, rsa_config.passargin, rsa_config.passargout, |
&passin, &passout)) { |
&passin, &passout)) { |
BIO_printf(bio_err, "Error getting passwords\n"); |
BIO_printf(bio_err, "Error getting passwords\n"); |
|
|
tmpformat = rsa_config.informat; |
tmpformat = rsa_config.informat; |
|
|
pkey = load_pubkey(bio_err, rsa_config.infile, |
pkey = load_pubkey(bio_err, rsa_config.infile, |
tmpformat, 1, passin, e, "Public Key"); |
tmpformat, 1, passin, "Public Key"); |
} else |
} else |
pkey = load_key(bio_err, rsa_config.infile, |
pkey = load_key(bio_err, rsa_config.infile, |
(rsa_config.informat == FORMAT_NETSCAPE && |
(rsa_config.informat == FORMAT_NETSCAPE && |
rsa_config.sgckey ? FORMAT_IISSGC : |
rsa_config.sgckey ? FORMAT_IISSGC : |
rsa_config.informat), 1, passin, e, "Private Key"); |
rsa_config.informat), 1, passin, "Private Key"); |
|
|
if (pkey != NULL) |
if (pkey != NULL) |
rsa = EVP_PKEY_get1_RSA(pkey); |
rsa = EVP_PKEY_get1_RSA(pkey); |