coap_tls_library.txt.in 4.22 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
// -*- mode:doc; -*-
// vim: set syntax=asciidoc,tw=0:

coap_tls_library(3)
===================
:doctype: manpage
:man source:   coap_tls_library
:man version:  @PACKAGE_VERSION@
:man manual:   libcoap Manual

NAME
----
coap_tls_library, coap_dtls_is_supported, coap_tls_is_supported,
14
coap_get_tls_library_version, coap_string_tls_version, coap_show_tls_version
15 16 17 18 19 20 21 22 23 24 25 26
- Work with CoAP contexts

SYNOPSIS
--------
*#include <coap@LIBCOAP_API_VERSION@/coap.h>*

*int coap_dtls_is_supported(void);*

*int coap_tls_is_supported(void);*

*coap_tls_version_t *coap_get_tls_library_version(void);*

27 28 29 30 31 32 33
*char *coap_string_tls_version(char *_buffer_, size_t _bufsize_);

*void coap_show_tls_version(coap_log_t _level_);*

Link with *-lcoap-@LIBCOAP_API_VERSION@*, *-lcoap-@LIBCOAP_API_VERSION@-gnutls*,
*-lcoap-@LIBCOAP_API_VERSION@-openssl* or
*-lcoap-@LIBCOAP_API_VERSION@-tinydtls* depending on your (D)TLS library
34 35 36 37 38
type.

DESCRIPTION
-----------
When the libcoap library was built, it will have been compiled using a
39
specific TLS implementation type (e.g. OpenSSL, GnuTLS, TinyDTLS or noTLS).
40 41 42 43 44 45 46 47
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.

48 49 50 51 52 53 54 55
*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
56 57 58 59
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.
60
Where possible, by default, the CoAP layer handles all this automatically.
61 62 63 64 65 66 67 68 69 70 71 72 73
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.

The *coap_dtls_is_supported*() function returns 1 if support for DTLS is
enabled, otherwise 0;

The *coap_tls_is_supported*() function returns 1 if support for TLS is
enabled, otherwise 0;

The *coap_get_tls_library_version*() function returns the TLS implementation
type and library version in a coap_tls_version_t* structure.

74 75 76 77 78 79 80 81 82 83 84
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_.

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().

85 86 87 88 89 90 91 92
[source, c]
----
#define COAP_TLS_LIBRARY_NOTLS    0
#define COAP_TLS_LIBRARY_TINYDTLS 1
#define COAP_TLS_LIBRARY_OPENSSL  2
#define COAP_TLS_LIBRARY_GNUTLS   3

typedef struct coap_tls_version_t {
93 94 95
  uint64_t version; /* (D)TLS runtime Library Version */
  int type; /* Library type. One of COAP_TLS_LIBRARY_* */
  uint64_t built_version; /* (D)TLS Built against Library Version */
96 97 98 99 100 101
}
----

RETURN VALUES
-------------
*coap_dtls_is_supported*() and *coap_tls_is_supported*() functions
102
return 0 if there is no support, 1 if support is available.
103 104 105 106

*coap_get_tls_library_version*() function returns the TLS implementation type
and library version in a coap_tls_version_t* structure.

107 108
*coap_string_tls_version*() function returns a pointer to the provided buffer.

109 110
SEE ALSO
--------
111
*coap_context*(3) and *coap_logging*(3).
112 113 114 115 116 117 118 119 120 121 122 123 124 125

FURTHER INFORMATION
-------------------
See "RFC7252: The Constrained Application Protocol (CoAP)" for further
information.

BUGS
----
Please report bugs on the mailing list for libcoap:
libcoap-developers@lists.sourceforge.net

AUTHORS
-------
The libcoap project <libcoap-developers@lists.sourceforge.net>