1COAP_TLS_LIBRARY(3) libcoap Manual COAP_TLS_LIBRARY(3)
2
3
4
6 coap_tls_library, coap_dtls_is_supported, coap_tls_is_supported,
7 coap_get_tls_library_version, coap_string_tls_version,
8 coap_show_tls_version - Work with CoAP contexts
9
11 #include <coap2/coap.h>
12
13 int coap_dtls_is_supported(void);
14
15 int coap_tls_is_supported(void);
16
17 coap_tls_version_t *coap_get_tls_library_version(void);
18
19 *char *coap_string_tls_version(char *buffer, size_t bufsize);
20
21 void coap_show_tls_version(coap_log_t level);
22
23 Link with -lcoap-2, -lcoap-2-gnutls, -lcoap-2-openssl or
24 -lcoap-2-tinydtls depending on your (D)TLS library type.
25
27 When the libcoap library was built, it will have been compiled using a
28 specific TLS implementation type (e.g. OpenSSL, GnuTLS, TinyDTLS or
29 noTLS). When the libcoap library is linked into an application, it is
30 possible that the application needs to dynamically determine whether
31 DTLS or TLS is supported, what type of TLS implementation libcoap was
32 compiled with, as well as detect what is the version of the currently
33 loaded TLS library is.
34
35 NOTE: If OpenSSL is being used, then the minimum OpenSSL library
36 version is 1.1.0.
37
38 NOTE: If GnuTLS is being used, then the minimum GnuTLS library version
39 is 3.3.0.
40
41 NOTE: If GnuTLS is going to interoperate with TinyDTLS, then a minimum
42 revision of GnuTLS 3.5.5 which supports CCM algorithms is required by
43 TinyDTLS as TinyDTLS currently only supports CCM.
44
45 Network traffic can be encrypted or un-encrypted with libcoap - how to
46 set this up is described in coap_context(3).
47
48 Due to the nature of TLS, there can be Callbacks that are invoked as
49 the TLS session negotiates encryption algorithms, encryption keys etc.
50 Where possible, by default, the CoAP layer handles all this
51 automatically. However, there is the flexibility of the Callbacks for
52 imposing additional security checks etc. when PKI is being used. These
53 callbacks need to need to match the TLS implementation type.
54
55 The coap_dtls_is_supported() function returns 1 if support for DTLS is
56 enabled, otherwise 0;
57
58 The coap_tls_is_supported() function returns 1 if support for TLS is
59 enabled, otherwise 0;
60
61 The coap_get_tls_library_version() function returns the TLS
62 implementation type and library version in a coap_tls_version_t*
63 structure.
64
65 The coap_string_tls_version() function is used to update the provided
66 buffer with information about the current (D)TLS library that libcoap
67 was built against, as well as the current linked version of the (D)TLS
68 library. buffer defines the buffer to provide the information and
69 bufsize is the size of buffer.
70
71 The coap_show_tls_version() function is used log information about the
72 current (D)TLS library that libcoap was built against, as well as the
73 current linked version of the (D)TLS library. level defines the minimum
74 logging level for this information to be output using coap_log().
75
76 typedef enum coap_tls_library_t {
77 COAP_TLS_LIBRARY_NOTLS = 0, /**< No DTLS library */
78 COAP_TLS_LIBRARY_TINYDTLS, /**< Using TinyDTLS library */
79 COAP_TLS_LIBRARY_OPENSSL, /**< Using OpenSSL library */
80 COAP_TLS_LIBRARY_GNUTLS, /**< Using GnuTLS library */
81 } coap_tls_library_t;
82
83 typedef struct coap_tls_version_t {
84 uint64_t version; /* (D)TLS runtime Library Version */
85 coap_tls_library_t type; /**< Library type. One of COAP_TLS_LIBRARY_* */
86 uint64_t built_version; /* (D)TLS Built against Library Version */
87 }
88
90 coap_dtls_is_supported() and coap_tls_is_supported() functions return 0
91 if there is no support, 1 if support is available.
92
93 coap_get_tls_library_version() function returns the TLS implementation
94 type and library version in a coap_tls_version_t* structure.
95
96 coap_string_tls_version() function returns a pointer to the provided
97 buffer.
98
100 coap_context(3) and coap_logging(3).
101
103 See "RFC7252: The Constrained Application Protocol (CoAP)" for further
104 information.
105
107 Please report bugs on the mailing list for libcoap:
108 libcoap-developers@lists.sourceforge.net
109
111 The libcoap project <libcoap-developers@lists.sourceforge.net>
112
113
114
115coap_tls_library 4.2.1 07/28/2020 COAP_TLS_LIBRARY(3)