diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2008-05-30 15:04:58 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2008-05-30 15:04:58 +0000 |
commit | 467325b81db5c8add715f7879b34dc23e9f71e3c (patch) | |
tree | 8cc61ed3a8db777f50331ac0d5c3e70c91eeaf8a /apps | |
parent | 00f716bbe6f533f852ee12d56b9bc68c65f17d65 (diff) |
Add support for ENGINE loaded keys in dsa app.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dsa.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/apps/dsa.c b/apps/dsa.c index 9e103037dd..7518a2fe96 100644 --- a/apps/dsa.c +++ b/apps/dsa.c @@ -240,37 +240,27 @@ bad: goto end; } - in=BIO_new(BIO_s_file()); out=BIO_new(BIO_s_file()); - if ((in == NULL) || (out == NULL)) + if (out == NULL) { ERR_print_errors(bio_err); goto end; } - if (infile == NULL) - BIO_set_fp(in,stdin,BIO_NOCLOSE); - else - { - if (BIO_read_filename(in,infile) <= 0) - { - perror(infile); - goto end; - } - } - BIO_printf(bio_err,"read DSA key\n"); - if (informat == FORMAT_ASN1) { - if(pubin) dsa=d2i_DSA_PUBKEY_bio(in,NULL); - else dsa=d2i_DSAPrivateKey_bio(in,NULL); - } else if (informat == FORMAT_PEM) { - if(pubin) dsa=PEM_read_bio_DSA_PUBKEY(in,NULL, NULL, NULL); - else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,passin); - } else - { - BIO_printf(bio_err,"bad input format specified for key\n"); - goto end; - } + { + EVP_PKEY *pkey; + if (pubin) + pkey = load_pubkey(bio_err, infile, informat, 1, + passin, e, "Public Key"); + else + pkey = load_key(bio_err, infile, informat, 1, + passin, e, "Private Key"); + + if (pkey != NULL) + dsa = pkey == NULL ? NULL : EVP_PKEY_get1_DSA(pkey); + EVP_PKEY_free(pkey); + } if (dsa == NULL) { BIO_printf(bio_err,"unable to load Key\n"); |