libcoap 4.3.4
Loading...
Searching...
No Matches
coap_dtls.h
Go to the documentation of this file.
1/*
2 * coap_dtls.h -- (Datagram) Transport Layer Support for libcoap
3 *
4 * Copyright (C) 2016 Olaf Bergmann <bergmann@tzi.org>
5 * Copyright (C) 2017 Jean-Claude Michelou <jcm@spinetix.com>
6 *
7 * SPDX-License-Identifier: BSD-2-Clause
8 *
9 * This file is part of the CoAP library libcoap. Please see README for terms
10 * of use.
11 */
12
18#ifndef COAP_DTLS_H_
19#define COAP_DTLS_H_
20
21#include "coap_time.h"
22#include "coap_str.h"
23
32
33#ifndef COAP_DTLS_HINT_LENGTH
34#define COAP_DTLS_HINT_LENGTH 128
35#endif
36#ifndef COAP_DTLS_MAX_PSK_IDENTITY
37#define COAP_DTLS_MAX_PSK_IDENTITY 64
38#endif
39#ifndef COAP_DTLS_MAX_PSK
40#define COAP_DTLS_MAX_PSK 64
41#endif
42
47
48#define COAP_DTLS_RPK_CERT_CN "RPK"
49
56
62int coap_tls_is_supported(void);
63
70
77
84
91
99
109
116
132typedef int (*coap_dtls_security_setup_t)(void *tls_session,
133 coap_dtls_pki_t *setup_data);
134
155typedef int (*coap_dtls_cn_callback_t)(const char *cn,
156 const uint8_t *asn1_public_cert,
157 size_t asn1_length,
158 coap_session_t *coap_session,
159 unsigned int depth,
160 int validated,
161 void *arg);
162
184
194
198typedef struct coap_pki_key_pem_t {
199 const char *ca_file;
200 const char *public_cert;
201 const char *private_key;
203
214 const uint8_t *ca_cert;
215 const uint8_t *public_cert;
216 const uint8_t *private_key;
219 size_t ca_cert_len;
223
236
240typedef struct coap_pki_key_pkcs11_t {
241 const char *ca;
242 const char *public_cert;
243 const char *private_key;
244 const char *user_pin;
248
261
275typedef coap_dtls_key_t *(*coap_dtls_pki_sni_callback_t)(const char *sni,
276 void *arg);
277
278
279#define COAP_DTLS_PKI_SETUP_VERSION 1
285 uint8_t version;
288 /* Options to enable different TLS functionality in libcoap */
298 uint8_t allow_no_crl;