From 4044d8337111c480989480c487bef3027bcbb6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Wed, 27 Jul 2005 21:35:18 +0000 Subject: [PATCH] (cms_create_sd): support wrapping in content info git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15807 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hx509/hxtool.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/hx509/hxtool.c b/lib/hx509/hxtool.c index e7e82625a..dc5802a95 100644 --- a/lib/hx509/hxtool.c +++ b/lib/hx509/hxtool.c @@ -211,6 +211,29 @@ cms_create_sd(struct cms_create_sd_options *opt, int argc, char **argv) _hx509_unmap_file(p, sz); hx509_lock_free(lock); + if (opt->content_info_flag) { + ContentInfo ci; + size_t size; + + ret = hx509_cms_wrap_ContentInfo(oid_id_pkcs7_signedData(), + &o, + &ci); + if (ret) + errx(1, "hx509_cms_wrap_ContentInfo: %d", ret); + + free_octet_string(&o); + + ASN1_MALLOC_ENCODE(ContentInfo, o.data, o.length, &ci, + &size, ret); + if (ret) + errx(1, "encode ContentInfo"); + if (o.length != size) + abort(); + + free_ContentInfo(&ci); + + } + ret = _hx509_write_file(argv[1], o.data, o.length); if (ret) errx(1, "hx509_write_file: %d", ret);