Add support for ENGINE loaded keys in dsa app.

This commit is contained in:
Dr. Stephen Henson
2008-05-30 15:04:58 +00:00
parent 00f716bbe6
commit 467325b81d

View File

@@ -240,37 +240,27 @@ bad:
goto end; goto end;
} }
in=BIO_new(BIO_s_file());
out=BIO_new(BIO_s_file()); out=BIO_new(BIO_s_file());
if ((in == NULL) || (out == NULL)) if (out == NULL)
{ {
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto end; 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"); BIO_printf(bio_err,"read DSA key\n");
if (informat == FORMAT_ASN1) { {
if(pubin) dsa=d2i_DSA_PUBKEY_bio(in,NULL); EVP_PKEY *pkey;
else dsa=d2i_DSAPrivateKey_bio(in,NULL); if (pubin)
} else if (informat == FORMAT_PEM) { pkey = load_pubkey(bio_err, infile, informat, 1,
if(pubin) dsa=PEM_read_bio_DSA_PUBKEY(in,NULL, NULL, NULL); passin, e, "Public Key");
else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,passin); else
} else pkey = load_key(bio_err, infile, informat, 1,
{ passin, e, "Private Key");
BIO_printf(bio_err,"bad input format specified for key\n");
goto end; if (pkey != NULL)
} dsa = pkey == NULL ? NULL : EVP_PKEY_get1_DSA(pkey);
EVP_PKEY_free(pkey);
}
if (dsa == NULL) if (dsa == NULL)
{ {
BIO_printf(bio_err,"unable to load Key\n"); BIO_printf(bio_err,"unable to load Key\n");