Allow passing in pool and anchor to signedData
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17169 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -48,6 +48,18 @@ command = {
|
|||||||
argument = "signer-friendly-name"
|
argument = "signer-friendly-name"
|
||||||
help = "certificate to sign with"
|
help = "certificate to sign with"
|
||||||
}
|
}
|
||||||
|
option = {
|
||||||
|
long = "anchors"
|
||||||
|
type = "strings"
|
||||||
|
argument = "certificate-store"
|
||||||
|
help = "trust anchors"
|
||||||
|
}
|
||||||
|
option = {
|
||||||
|
long = "pool"
|
||||||
|
type = "strings"
|
||||||
|
argument = "certificate-pool"
|
||||||
|
help = "certificate store to pull certificates from"
|
||||||
|
}
|
||||||
option = {
|
option = {
|
||||||
long = "pass"
|
long = "pass"
|
||||||
type = "strings"
|
type = "strings"
|
||||||
|
@@ -169,7 +169,7 @@ cms_create_sd(struct cms_create_sd_options *opt, int argc, char **argv)
|
|||||||
heim_octet_string o;
|
heim_octet_string o;
|
||||||
hx509_query *q;
|
hx509_query *q;
|
||||||
hx509_lock lock;
|
hx509_lock lock;
|
||||||
hx509_certs store;
|
hx509_certs store, pool, anchors;
|
||||||
hx509_cert cert;
|
hx509_cert cert;
|
||||||
size_t sz;
|
size_t sz;
|
||||||
void *p;
|
void *p;
|
||||||
@@ -191,6 +191,7 @@ cms_create_sd(struct cms_create_sd_options *opt, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = hx509_certs_init(context, "MEMORY:cert-store", 0, NULL, &store);
|
ret = hx509_certs_init(context, "MEMORY:cert-store", 0, NULL, &store);
|
||||||
|
ret = hx509_certs_init(context, "MEMORY:cert-pool", 0, NULL, &pool);
|
||||||
|
|
||||||
for (i = 0; i < opt->certificate_strings.num_strings; i++) {
|
for (i = 0; i < opt->certificate_strings.num_strings; i++) {
|
||||||
ret = hx509_certs_append(context, store, lock,
|
ret = hx509_certs_append(context, store, lock,
|
||||||
@@ -200,6 +201,28 @@ cms_create_sd(struct cms_create_sd_options *opt, int argc, char **argv)
|
|||||||
opt->certificate_strings.strings[i], ret);
|
opt->certificate_strings.strings[i], ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < opt->pool_strings.num_strings; i++) {
|
||||||
|
ret = hx509_certs_append(context, pool, lock,
|
||||||
|
opt->pool_strings.strings[i]);
|
||||||
|
if (ret)
|
||||||
|
errx(1, "hx509_certs_append: pool: %s: %d",
|
||||||
|
opt->pool_strings.strings[i], ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opt->anchors_strings.num_strings) {
|
||||||
|
ret = hx509_certs_init(context, "MEMORY:cert-anchors", 0, NULL,
|
||||||
|
&anchors);
|
||||||
|
|
||||||
|
for (i = 0; i < opt->anchors_strings.num_strings; i++) {
|
||||||
|
ret = hx509_certs_append(context, anchors, lock,
|
||||||
|
opt->anchors_strings.strings[i]);
|
||||||
|
if (ret)
|
||||||
|
errx(1, "hx509_certs_append: anchor: %s: %d",
|
||||||
|
opt->anchors_strings.strings[i], ret);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
anchors = NULL;
|
||||||
|
|
||||||
ret = hx509_query_alloc(context, &q);
|
ret = hx509_query_alloc(context, &q);
|
||||||
if (ret)
|
if (ret)
|
||||||
errx(1, "hx509_query_alloc: %d", ret);
|
errx(1, "hx509_query_alloc: %d", ret);
|
||||||
@@ -225,10 +248,14 @@ cms_create_sd(struct cms_create_sd_options *opt, int argc, char **argv)
|
|||||||
sz,
|
sz,
|
||||||
NULL,
|
NULL,
|
||||||
cert,
|
cert,
|
||||||
|
anchors,
|
||||||
|
pool,
|
||||||
&o);
|
&o);
|
||||||
if (ret)
|
if (ret)
|
||||||
errx(1, "hx509_cms_create_signed: %d", ret);
|
errx(1, "hx509_cms_create_signed: %d", ret);
|
||||||
|
|
||||||
|
hx509_certs_free(&anchors);
|
||||||
|
hx509_certs_free(&pool);
|
||||||
_hx509_unmap_file(p, sz);
|
_hx509_unmap_file(p, sz);
|
||||||
hx509_lock_free(lock);
|
hx509_lock_free(lock);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user