![]() |
![]()
| ![]() |
![]()
NAMEcoap_tls_library, coap_get_tls_library_version, coap_string_tls_support, coap_string_tls_version, coap_show_tls_version, coap_tls_engine_configure, coap_tls_engine_remove - Work with CoAP TLS libraries SYNOPSIS#include <coap3/coap.h> coap_tls_version_t *coap_get_tls_library_version(void); char *coap_string_tls_support(char *buffer, size_t bufsize); char *coap_string_tls_version(char *buffer, size_t bufsize); void coap_show_tls_version(coap_log_t level); int coap_tls_engine_configure(coap_str_const_t *conf_mem); int coap_tls_engine_remove(void); For specific (D)TLS library support, link with -lcoap-3-notls, -lcoap-3-gnutls, -lcoap-3-openssl, -lcoap-3-mbedtls, -lcoap-3-wolfssl or -lcoap-3-tinydtls. Otherwise, link with -lcoap-3 to get the default (D)TLS library support. DESCRIPTIONWhen the libcoap library was built, it will have been compiled using a specific TLS implementation type (e.g. OpenSSL, GnuTLS, Mbed TLS, wolfSSL, TinyDTLS or noTLS). When the libcoap library is linked into an application, it is possible that the application needs to dynamically determine whether DTLS or TLS is supported, what type of TLS implementation libcoap was compiled with, as well as detect what is the version of the currently loaded TLS library is. NOTE: If OpenSSL is being used, then the minimum OpenSSL library version is 1.1.0. NOTE: If GnuTLS is being used, then the minimum GnuTLS library version is 3.3.0. NOTE: If GnuTLS is going to interoperate with TinyDTLS, then a minimum revision of GnuTLS 3.5.5 which supports CCM algorithms is required by TinyDTLS as TinyDTLS currently only supports CCM. Network traffic can be encrypted or un-encrypted with libcoap - how to set this up is described in coap_context(3). Due to the nature of TLS, there can be Callbacks that are invoked as the TLS session negotiates encryption algorithms, encryption keys etc. Where possible, by default, the CoAP layer handles all this automatically. However, there is the flexibility of the Callbacks for imposing additional security checks etc. when PKI is being used. These callbacks need to need to match the TLS implementation type. FUNCTIONSFunction: coap_get_tls_library_version() The coap_get_tls_library_version() function returns the TLS implementation type and library version in a coap_tls_version_t* structure. typedef enum coap_tls_library_t { Function: coap_string_tls_support() The coap_string_tls_support() function is used to update the provided buffer with ascii readable information about what type of PSK, PKI etc. keys the current (D)TLS library supports. buffer defines the buffer to provide the information and bufsize is the size of buffer. Function: coap_string_tls_version() The coap_string_tls_version() function is used to update the provided buffer with information about the current (D)TLS library that libcoap was built against, as well as the current linked version of the (D)TLS library. buffer defines the buffer to provide the information and bufsize is the size of buffer. Function: coap_show_tls_version() The coap_show_tls_version() function is used log information about the current (D)TLS library that libcoap was built against, as well as the current linked version of the (D)TLS library. level defines the minimum logging level for this information to be output using coap_log(). Function: coap_tls_engine_configure() The coap_tls_engine_configure() function is used to configure a TLS ENGINE (currently only OpenSSL). It parses the provided configuration in conf_mem and initializes the ENGINE appropriately. The format of the parameters is documented in coap-tls-engine-conf(5). Function: coap_tls_engine_remove() The coap_tls_engine_remove() function removes a previously configured TLS ENGINE. This function is called when coap_free_context() is called. RETURN VALUEScoap_get_tls_library_version() returns the TLS implementation type and library version in a coap_tls_version_t* structure. coap_string_tls_version() and coap_string_tls_support() return a pointer to the provided buffer. coap_tls_engine_configure() returns 1 if the TLS ENGINE was successfully configured, otherwise 0. coap_tls_engine_remove() returns 1 if the TLS ENGINE was successfully removed, otherwise 0. EXAMPLES*CoAP Server DTLS PKI Setup with OpenSSL Engine * #include <coap3/coap.h> #define ENGINE_CONFIG \ SEE ALSOcoap_encryption(3) and coap_supported(3) FURTHER INFORMATIONSee "RFC7252: The Constrained Application Protocol (CoAP)" "RFC8323: CoAP (Constrained Application Protocol) over TCP, TLS, and WebSockets" for further information. BUGSPlease raise an issue on GitHub at https://github.com/obgm/libcoap/issues to report any bugs. Please raise a Pull Request at https://github.com/obgm/libcoap/pulls for any fixes. AUTHORSThe libcoap project <libcoap-developers@lists.sourceforge.net>
|