(store_func): use hx509_cert_binary

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19911 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2007-01-14 23:25:28 +00:00
parent 7e631d7fda
commit e993ff978b
2 changed files with 5 additions and 9 deletions

View File

@@ -678,16 +678,12 @@ static int
store_func(hx509_context context, void *ctx, hx509_cert c) store_func(hx509_context context, void *ctx, hx509_cert c)
{ {
FILE *f = (FILE *)ctx; FILE *f = (FILE *)ctx;
size_t size;
heim_octet_string data; heim_octet_string data;
int ret; int ret;
ASN1_MALLOC_ENCODE(Certificate, data.data, data.length, ret = hx509_cert_binary(context, c, &data);
_hx509_get_cert(c), &size, ret);
if (ret) if (ret)
return ret; return ret;
if (data.length != size)
_hx509_abort("internal ASN.1 encoder error");
dump_pem_file(context, "CERTIFICATE", f, data.data, data.length); dump_pem_file(context, "CERTIFICATE", f, data.data, data.length);
free(data.data); free(data.data);

View File

@@ -488,11 +488,11 @@ store_func(hx509_context context, void *ctx, hx509_cert c)
os.data = NULL; os.data = NULL;
os.length = 0; os.length = 0;
ASN1_MALLOC_ENCODE(Certificate, os.data, os.length, ret = hx509_cert_binary(context, c, &os);
_hx509_get_cert(c), &size, ret);
if (ret) if (ret)
goto out; return ret;
ASN1_MALLOC_ENCODE(PKCS12_OctetString,
ASN1_MALLOC_ENCODE(PKCS12_OctetString,
cb.certValue.data,cb.certValue.length, cb.certValue.data,cb.certValue.length,
&os, &size, ret); &os, &size, ret);
free(os.data); free(os.data);