Trust Certs: Load in the PKI trust store for peer cert checking

Load in the PKI trust store with a new function
  coap_context_load_pki_trust_store()

By default, make the client and server applications do this unless
explicitely disabled.

This enables clients doing (D)TLS to not need to be provided with specific
certificates but can validate trust in the server provided certificates.

Note: A default trust store is not supported across all platform types or
some TLS libraries (version dependent).
This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2025-03-21 09:18:46 +00:00
1 parent 9271b692ab
commit 0de22aae0b
19 files changed
+507 -113

No files matched your search

+10
View File
@@ -135,6 +135,16 @@ int coap_dtls_context_set_pki_root_cas(coap_context_t *coap_context,
const char *ca_file,
const char *ca_dir);
/**
* Load dtls context's default trusted CAs for a client or server.
*
* @param coap_context The current coap_context_t object.
*
* @return @c 1 if successful, else @c 0.
*/
int coap_dtls_context_load_pki_trust_store(coap_context_t *coap_context);
/**
* Check whether one of the coap_dtls_context_set_{psk|pki}() functions have
* been called.
+9
View File
@@ -212,6 +212,15 @@ COAP_API int coap_context_set_pki_root_cas(coap_context_t *context,
const char *ca_file,
const char *ca_dir);
/**
* Load the hosts's default trusted CAs for a client or server.
*
* @param context The current coap_context_t object.
*
* @return @c 1 if successful, else @c 0.
*/
COAP_API int coap_context_load_pki_trust_store(coap_context_t *context);
/**
* Set the context keepalive timer for sessions.
* A keepalive message will be sent after if a session has been inactive,
+11
View File
@@ -586,6 +586,17 @@ int coap_context_set_pki_root_cas_lkd(coap_context_t *context,
const char *ca_file,
const char *ca_dir);
/**
* Load the context's default trusted CAs for a client or server.
*
* Note: This function must be called in the locked state.
*
* @param context The current coap_context_t object.
*
* @return @c 1 if successful, else @c 0.
*/
int coap_context_load_pki_trust_store_lkd(coap_context_t *context);
/**
* Set the context's default PSK hint and/or key for a server.
*