hx509: private key exclusion options
Add two ways to exclude private keys when dealing with an hx509 certificate store. One as a load option (load no private keys, never add private keys), one as a store option (store no private keys). This is useful for CA code so it can have a single store with the issuer's credentials _and_ the chain for it, and copy those to a store with the issued certificate and _not_ accidentally include the issuer's private key. It would be much safer still to flip the default for this flag, but that could break out-of-tree libhx509 dependents.
This commit is contained in:
@@ -300,6 +300,26 @@ hx509_cert_init(hx509_context context, const Certificate *c, heim_error_t *error
|
||||
return cert;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a certificate object, but drop any private key assignment.
|
||||
*
|
||||
* @param context A hx509 context.
|
||||
* @param src Certificate object
|
||||
* @param error
|
||||
*
|
||||
* @return Returns an hx509 certificate
|
||||
*
|
||||
* @ingroup hx509_cert
|
||||
*/
|
||||
|
||||
HX509_LIB_FUNCTION hx509_cert HX509_LIB_CALL
|
||||
hx509_cert_copy_no_private_key(hx509_context context,
|
||||
hx509_cert src,
|
||||
heim_error_t *error)
|
||||
{
|
||||
return hx509_cert_init(context, src->data, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate and init an hx509 certificate object containing only a private key
|
||||
* (but no Certificate).
|
||||
|
Reference in New Issue
Block a user