hx509: Add HX509_CERTS_STORE_NO_ROOTS flag

This will allow us to add a --no-roots option to

    hxtool copy-certificate

which is convenient when copying certificate chains from stores that may
include root CA certificates.
This commit is contained in:
Nicolas Williams
2022-12-19 16:24:23 -06:00
parent 49c00512a7
commit 6def4750bc
3 changed files with 17 additions and 0 deletions

View File

@@ -550,6 +550,14 @@ store_func(hx509_context context, void *ctx, hx509_cert c)
heim_octet_string data;
int ret = 0;
if ((sc->store_flags & HX509_CERTS_STORE_NO_ROOTS)) {
int self_signed = 0;
ret = hx509_cert_is_self_signed(context, c, &self_signed);
if (ret || self_signed)
return ret;
}
if (hx509_cert_have_private_key_only(c)) {
data.length = 0;
data.data = NULL;