Loading...
Searching...
No Matches
coap_dtls.c
Go to the documentation of this file.
/*
* coap_dtls.c -- (D)TLS functions for libcoap
*
* Copyright (C) 2023-2024 Olaf Bergmann <bergmann@tzi.org>
* Copyright (C) 2023-2024 Jon Shallow <supjps-libcoap@jpshallow.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
#include "coap3/coap_libcoap_build.h"
#ifdef _WIN32
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#endif
void
coap_dtls_map_key_type_to_define(const coap_dtls_pki_t *setup_data, coap_dtls_key_t *key) {
*key = setup_data->pki_key;
switch (key->key_type) {
case COAP_PKI_KEY_PEM:
key->key_type = COAP_PKI_KEY_DEFINE;
key->key.define.ca.s_byte = setup_data->pki_key.key.pem.ca_file;
key->key.define.public_cert.s_byte = setup_data->pki_key.key.pem.public_cert;
key->key.define.private_key.s_byte = setup_data->pki_key.key.pem.private_key;
key->key.define.public_cert_def = COAP_PKI_KEY_DEF_PEM;
key->key.define.private_key_def = COAP_PKI_KEY_DEF_PEM;
key->key.define.ca_def = COAP_PKI_KEY_DEF_PEM;
break;
case COAP_PKI_KEY_ASN1:
key->key_type = COAP_PKI_KEY_DEFINE;
key->key.define.ca.u_byte = setup_data->pki_key.key.asn1.ca_cert;
key->key.define.public_cert.u_byte = setup_data->pki_key.key.asn1.public_cert;
key->key.define.private_key.u_byte = setup_data->pki_key.key.asn1.private_key;
key->key.define.ca_len = setup_data->pki_key.key.asn1.ca_cert_len;
key->key.define.public_cert_len = setup_data->pki_key.key.asn1.public_cert_len;
key->key.define.private_key_len = setup_data->pki_key.key.asn1.private_key_len;
key->key.define.private_key_type = setup_data->pki_key.key.asn1.private_key_type;
key->key.define.public_cert_def = COAP_PKI_KEY_DEF_DER_BUF;
key->key.define.private_key_def = COAP_PKI_KEY_DEF_DER_BUF;
key->key.define.ca_def = COAP_PKI_KEY_DEF_DER_BUF;
break;
case COAP_PKI_KEY_PEM_BUF:
key->key_type = COAP_PKI_KEY_DEFINE;
key->key.define.ca.u_byte = setup_data->pki_key.key.pem_buf.ca_cert;
key->key.define.public_cert.u_byte = setup_data->pki_key.key.pem_buf.public_cert;
key->key.define.private_key.u_byte = setup_data->pki_key.key.pem_buf.private_key;
key->key.define.ca_len = setup_data->pki_key.key.pem_buf.ca_cert_len;
key->key.define.public_cert_len = setup_data->pki_key.key.pem_buf.public_cert_len;
key->key.define.private_key_len = setup_data->pki_key.key.pem_buf.private_key_len;
if (setup_data->is_rpk_not_cert) {
key->key.define.public_cert_def = COAP_PKI_KEY_DEF_RPK_BUF;
} else {
key->key.define.public_cert_def = COAP_PKI_KEY_DEF_PEM_BUF;
}
if (setup_data->is_rpk_not_cert) {
key->key.define.private_key_def = COAP_PKI_KEY_DEF_RPK_BUF;
} else {
key->key.define.private_key_def = COAP_PKI_KEY_DEF_PEM_BUF;
}
if (setup_data->is_rpk_not_cert) {
key->key.define.ca_def = COAP_PKI_KEY_DEF_RPK_BUF;
} else {
key->key.define.ca_def = COAP_PKI_KEY_DEF_PEM_BUF;
}
break;
case COAP_PKI_KEY_PKCS11:
key->key_type = COAP_PKI_KEY_DEFINE;
key->key.define.ca.s_byte = setup_data->pki_key.key.pkcs11.ca;
key->key.define.public_cert.s_byte = setup_data->pki_key.key.pkcs11.public_cert;
key->key.define.private_key.s_byte = setup_data->pki_key.key.pkcs11.private_key;
key->key.define.user_pin = setup_data->pki_key.key.pkcs11.user_pin;
if (strncasecmp(key->key.pkcs11.ca, "pkcs11:", 7) == 0) {
if (setup_data->is_rpk_not_cert) {
key->key.define.ca_def = COAP_PKI_KEY_DEF_PKCS11_RPK;
} else {
key->key.define.ca_def = COAP_PKI_KEY_DEF_PKCS11;
}
} else {
if (setup_data->is_rpk_not_cert) {
key->key.define.ca_def = COAP_PKI_KEY_DEF_RPK_BUF;
} else {
key->key.define.ca_def = COAP_PKI_KEY_DEF_DER;
}
}
if (strncasecmp(key->key.pkcs11.public_cert, "pkcs11:", 7) == 0) {
if (setup_data->is_rpk_not_cert) {
key->key.define.public_cert_def = COAP_PKI_KEY_DEF_PKCS11_RPK;
} else {
key->key.define.public_cert_def = COAP_PKI_KEY_DEF_PKCS11;
}
} else {
if (setup_data->is_rpk_not_cert) {
key->key.define.public_cert_def = COAP_PKI_KEY_DEF_RPK_BUF;
} else {
key->key.define.public_cert_def = COAP_PKI_KEY_DEF_DER;
}
}
if (strncasecmp(key->key.pkcs11.private_key, "pkcs11:", 7) == 0) {
if (setup_data->is_rpk_not_cert) {
key->key.define.private_key_def = COAP_PKI_KEY_DEF_PKCS11_RPK;
} else {
key->key.define.private_key_def = COAP_PKI_KEY_DEF_PKCS11;
}
} else {
if (setup_data->is_rpk_not_cert) {
key->key.define.private_key_def = COAP_PKI_KEY_DEF_RPK_BUF;
} else {
key->key.define.private_key_def = COAP_PKI_KEY_DEF_DER;
}
}
break;
case COAP_PKI_KEY_DEFINE:
/* Already configured */
break;
default:
break;
}
}
#if (COAP_MAX_LOGGING_LEVEL >= _COAP_LOG_ERR)
static const char *
coap_dtls_get_define_type(coap_pki_define_t def, coap_const_char_ptr_t name) {
switch (def) {
case COAP_PKI_KEY_DEF_PEM:
return name.s_byte;
case COAP_PKI_KEY_DEF_PEM_BUF:
return "PEM_BUF";
case COAP_PKI_KEY_DEF_RPK_BUF:
return "RPK_BUF";
case COAP_PKI_KEY_DEF_DER:
return name.s_byte;
case COAP_PKI_KEY_DEF_DER_BUF:
return "DER_BUF";
case COAP_PKI_KEY_DEF_PKCS11:
return name.s_byte;
case COAP_PKI_KEY_DEF_PKCS11_RPK:
return name.s_byte;
case COAP_PKI_KEY_DEF_ENGINE:
return name.s_byte;
default:
return "???";
}
}
#endif /* COAP_MAX_LOGGING_LEVEL >= _COAP_LOG_ERR */
int
coap_dtls_define_issue(coap_define_issue_key_t type, coap_define_issue_fail_t fail,
coap_dtls_key_t *key, const coap_dtls_role_t role, int ret) {
#if (COAP_MAX_LOGGING_LEVEL >= _COAP_LOG_ERR)
coap_pki_key_define_t define = key->key.define;
switch (type) {
case COAP_DEFINE_KEY_CA:
switch (fail) {
case COAP_DEFINE_FAIL_BAD:
coap_log_warn("*** setup_pki: (D)TLS: %s: %s CA configure failure\n",
coap_dtls_get_define_type(define.ca_def, define.ca),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
case COAP_DEFINE_FAIL_NOT_SUPPORTED:
coap_log_err("*** setup_pki: (D)TLS: %s: %s CA type not supported\n",
coap_dtls_get_define_type(define.ca_def, define.ca),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
case COAP_DEFINE_FAIL_NONE:
coap_log_err("*** setup_pki: (D)TLS: %s: %s CA not defined\n",
coap_dtls_get_define_type(define.ca_def, define.ca),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
default:
break;
}
break;
case COAP_DEFINE_KEY_ROOT_CA:
switch (fail) {
case COAP_DEFINE_FAIL_BAD:
coap_log_warn("*** setup_pki: (D)TLS: %s: %s Root CA configure failure\n",
coap_dtls_get_define_type(define.ca_def, define.ca),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
case COAP_DEFINE_FAIL_NOT_SUPPORTED:
coap_log_err("*** setup_pki: (D)TLS: %s: %s Root CA type not supported\n",
coap_dtls_get_define_type(define.ca_def, define.ca),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
case COAP_DEFINE_FAIL_NONE:
coap_log_err("*** setup_pki: (D)TLS: %s: %s Root CA not defined\n",
coap_dtls_get_define_type(define.ca_def, define.ca),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
default:
break;
}
break;
case COAP_DEFINE_KEY_PUBLIC:
switch (fail) {
case COAP_DEFINE_FAIL_BAD:
coap_log_warn("*** setup_pki: (D)TLS: %s: %s Certificate configure failure\n",
coap_dtls_get_define_type(define.public_cert_def, define.public_cert),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
case COAP_DEFINE_FAIL_NOT_SUPPORTED:
coap_log_err("*** setup_pki: (D)TLS: %s: %s Certificate type not supported\n",
coap_dtls_get_define_type(define.public_cert_def, define.public_cert),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
case COAP_DEFINE_FAIL_NONE:
coap_log_err("*** setup_pki: (D)TLS: %s: %s Certificate not defined\n",
coap_dtls_get_define_type(define.public_cert_def, define.public_cert),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
default:
break;
}
break;
case COAP_DEFINE_KEY_PRIVATE:
switch (fail) {
case COAP_DEFINE_FAIL_BAD:
coap_log_warn("*** setup_pki: (D)TLS: %s: %s Private Key configure failure\n",
coap_dtls_get_define_type(define.private_key_def, define.private_key),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
case COAP_DEFINE_FAIL_NOT_SUPPORTED:
coap_log_err("*** setup_pki: (D)TLS: %s: %s Private Key type not supported\n",
coap_dtls_get_define_type(define.private_key_def, define.private_key),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
case COAP_DEFINE_FAIL_NONE:
coap_log_err("*** setup_pki: (D)TLS: %s: %s Private Key not defined\n",
coap_dtls_get_define_type(define.private_key_def, define.private_key),
role == COAP_DTLS_ROLE_SERVER ? "Server" : "Client");
break;
default:
break;
}
default:
break;
}
#else /* COAP_MAX_LOGGING_LEVEL >= _COAP_LOG_ERR */
(void)type;
(void)fail;
(void)key;
(void)role;
#endif /* COAP_MAX_LOGGING_LEVEL < _COAP_LOG_ERR */
return ret;
}
void
coap_dtls_establish(coap_session_t *session) {
session->state = COAP_SESSION_STATE_HANDSHAKE;
#if COAP_CLIENT_SUPPORT
if (session->type == COAP_SESSION_TYPE_CLIENT)
session->tls = coap_dtls_new_client_session(session);
#endif /* COAP_CLIENT_SUPPORT */
#if COAP_SERVER_SUPPORT
if (session->type != COAP_SESSION_TYPE_CLIENT)
session->tls = coap_dtls_new_server_session(session);
#endif /* COAP_SERVER_SUPPORT */
if (!session->tls) {
coap_session_disconnected_lkd(session, COAP_NACK_TLS_LAYER_FAILED);
return;
}
coap_ticks(&session->last_rx_tx);
}
void
coap_dtls_close(coap_session_t *session) {
if (session->tls) {
coap_dtls_free_session(session);
session->tls = NULL;
}
session->sock.lfunc[COAP_LAYER_TLS].l_close(session);
}
#if !COAP_DISABLE_TCP
void
coap_tls_establish(coap_session_t *session) {
session->state = COAP_SESSION_STATE_HANDSHAKE;
#if COAP_CLIENT_SUPPORT
if (session->type == COAP_SESSION_TYPE_CLIENT)
session->tls = coap_tls_new_client_session(session);
#endif /* COAP_CLIENT_SUPPORT */
#if COAP_SERVER_SUPPORT
if (session->type != COAP_SESSION_TYPE_CLIENT)
session->tls = coap_tls_new_server_session(session);
#endif /* COAP_SERVER_SUPPORT */
if (!session->tls) {
coap_session_disconnected_lkd(session, COAP_NACK_TLS_LAYER_FAILED);
return;
}
coap_ticks(&session->last_rx_tx);
}
void
coap_tls_close(coap_session_t *session) {
if (session->tls) {
coap_tls_free_session(session);
session->tls = NULL;
}
session->sock.lfunc[COAP_LAYER_TLS].l_close(session);
}
#endif /* !COAP_DISABLE_TCP */
coap_dtls_get_define_type
static const char * coap_dtls_get_define_type(coap_pki_define_t def, coap_const_char_ptr_t name)
Definition coap_dtls.c:140
COAP_NACK_TLS_LAYER_FAILED
@ COAP_NACK_TLS_LAYER_FAILED
Definition coap_io.h:69
COAP_LAYER_TLS
@ COAP_LAYER_TLS
Definition coap_layers_internal.h:25
coap_libcoap_build.h
Library specific build wrapper for coap_internal.h.
coap_dtls_free_session
void coap_dtls_free_session(coap_session_t *coap_session COAP_UNUSED)
Definition coap_notls.c:199
coap_tls_free_session
void coap_tls_free_session(coap_session_t *coap_session COAP_UNUSED)
Definition coap_notls.c:275
coap_ticks
void coap_ticks(coap_tick_t *)
Returns the current value of an internal tick counter.
coap_tls_new_server_session
void * coap_tls_new_server_session(coap_session_t *coap_session)
Create a TLS new server-side session.
coap_dtls_define_issue
int coap_dtls_define_issue(coap_define_issue_key_t type, coap_define_issue_fail_t fail, coap_dtls_key_t *key, const coap_dtls_role_t role, int ret)
Report PKI DEFINE type issue.
Definition coap_dtls.c:165
coap_define_issue_key_t
coap_define_issue_key_t
Definition coap_dtls_internal.h:46
coap_dtls_new_client_session
void * coap_dtls_new_client_session(coap_session_t *coap_session)
Create a new client-side session.
coap_tls_establish
void coap_tls_establish(coap_session_t *session)
Layer function interface for layer below TLS accept/connect being established.
Definition coap_dtls.c:295
coap_dtls_establish
void coap_dtls_establish(coap_session_t *session)
Layer function interface for layer below DTLS connect being established.
Definition coap_dtls.c:266
coap_dtls_new_server_session
void * coap_dtls_new_server_session(coap_session_t *coap_session)
Create a new DTLS server-side session.
coap_define_issue_fail_t
coap_define_issue_fail_t
Definition coap_dtls_internal.h:53
coap_tls_new_client_session
void * coap_tls_new_client_session(coap_session_t *coap_session)
Create a new TLS client-side session.
coap_dtls_map_key_type_to_define
void coap_dtls_map_key_type_to_define(const coap_dtls_pki_t *setup_data, coap_dtls_key_t *key)
Map the PKI key definitions to the new DEFINE format.
Definition coap_dtls.c:26
coap_tls_close
void coap_tls_close(coap_session_t *session)
Layer function interface for TLS close for a session.
Definition coap_dtls.c:314
coap_dtls_close
void coap_dtls_close(coap_session_t *session)
Layer function interface for DTLS close for a session.
Definition coap_dtls.c:285
COAP_DEFINE_KEY_PRIVATE
@ COAP_DEFINE_KEY_PRIVATE
Definition coap_dtls_internal.h:50
COAP_DEFINE_KEY_ROOT_CA
@ COAP_DEFINE_KEY_ROOT_CA
Definition coap_dtls_internal.h:48
COAP_DEFINE_KEY_CA
@ COAP_DEFINE_KEY_CA
Definition coap_dtls_internal.h:47
COAP_DEFINE_KEY_PUBLIC
@ COAP_DEFINE_KEY_PUBLIC
Definition coap_dtls_internal.h:49
COAP_DEFINE_FAIL_NONE
@ COAP_DEFINE_FAIL_NONE
Definition coap_dtls_internal.h:56
COAP_DEFINE_FAIL_NOT_SUPPORTED
@ COAP_DEFINE_FAIL_NOT_SUPPORTED
Definition coap_dtls_internal.h:55
COAP_DEFINE_FAIL_BAD
@ COAP_DEFINE_FAIL_BAD
Definition coap_dtls_internal.h:54
coap_pki_define_t
coap_pki_define_t
The enum to define the format of the key parameter definition.
Definition coap_dtls.h:233
coap_dtls_role_t
coap_dtls_role_t
Definition coap_dtls.h:44
COAP_PKI_KEY_DEF_PKCS11
@ COAP_PKI_KEY_DEF_PKCS11
The PKI key type is PKCS11 (pkcs11:...).
Definition coap_dtls.h:245
COAP_PKI_KEY_DEF_DER_BUF
@ COAP_PKI_KEY_DEF_DER_BUF
The PKI key type is DER buffer (ASN.1).
Definition coap_dtls.h:242
COAP_PKI_KEY_DEF_PEM_BUF
@ COAP_PKI_KEY_DEF_PEM_BUF
The PKI key type is PEM buffer.
Definition coap_dtls.h:236
COAP_PKI_KEY_DEF_PEM
@ COAP_PKI_KEY_DEF_PEM
The PKI key type is PEM file.
Definition coap_dtls.h:234
COAP_PKI_KEY_DEF_ENGINE
@ COAP_PKI_KEY_DEF_ENGINE
The PKI key type is to be passed to ENGINE.
Definition coap_dtls.h:251
COAP_PKI_KEY_DEF_RPK_BUF
@ COAP_PKI_KEY_DEF_RPK_BUF
The PKI key type is RPK in buffer.
Definition coap_dtls.h:238
COAP_PKI_KEY_DEF_DER
@ COAP_PKI_KEY_DEF_DER
The PKI key type is DER file.
Definition coap_dtls.h:240
COAP_PKI_KEY_DEF_PKCS11_RPK
@ COAP_PKI_KEY_DEF_PKCS11_RPK
The PKI key type is PKCS11 w/ RPK (pkcs11:...).
Definition coap_dtls.h:248
COAP_DTLS_ROLE_SERVER
@ COAP_DTLS_ROLE_SERVER
Internal function invoked for server.
Definition coap_dtls.h:46
COAP_PKI_KEY_PKCS11
@ COAP_PKI_KEY_PKCS11
The PKI key type is PKCS11 (DER).
Definition coap_dtls.h:171
COAP_PKI_KEY_PEM_BUF
@ COAP_PKI_KEY_PEM_BUF
The PKI key type is PEM buffer.
Definition coap_dtls.h:170
COAP_PKI_KEY_DEFINE
@ COAP_PKI_KEY_DEFINE
The individual PKI key types are Definable.
Definition coap_dtls.h:172
COAP_PKI_KEY_PEM
@ COAP_PKI_KEY_PEM
The PKI key type is PEM file.
Definition coap_dtls.h:168
COAP_PKI_KEY_ASN1
@ COAP_PKI_KEY_ASN1
The PKI key type is ASN.1 (DER) buffer.
Definition coap_dtls.h:169
coap_log_warn
#define coap_log_warn(...)
Definition coap_debug.h:102
coap_log_err
#define coap_log_err(...)
Definition coap_debug.h:96
coap_session_disconnected_lkd
void coap_session_disconnected_lkd(coap_session_t *session, coap_nack_reason_t reason)
Notify session that it has failed.
Definition coap_session.c:911
COAP_SESSION_TYPE_CLIENT
@ COAP_SESSION_TYPE_CLIENT
client-side
Definition coap_session.h:46
COAP_SESSION_STATE_HANDSHAKE
@ COAP_SESSION_STATE_HANDSHAKE
Definition coap_session.h:58
coap_dtls_key_t
The structure that holds the PKI key information.
Definition coap_dtls.h:279
coap_dtls_key_t::define
coap_pki_key_define_t define
for definable type keys
Definition coap_dtls.h:286
coap_dtls_key_t::pem
coap_pki_key_pem_t pem
for PEM file keys
Definition coap_dtls.h:282
coap_dtls_key_t::pkcs11
coap_pki_key_pkcs11_t pkcs11
for PKCS11 keys
Definition coap_dtls.h:285
coap_dtls_key_t::key
union coap_dtls_key_t::@141053312230245272362072137106313076265242166207 key
coap_dtls_key_t::pem_buf
coap_pki_key_pem_buf_t pem_buf
for PEM memory keys
Definition coap_dtls.h:283
coap_dtls_key_t::key_type
coap_pki_key_t key_type
key format type
Definition coap_dtls.h:280
coap_dtls_key_t::asn1
coap_pki_key_asn1_t asn1
for ASN.1 (DER) memory keys
Definition coap_dtls.h:284
coap_dtls_pki_t
The structure used for defining the PKI setup data to be used.
Definition coap_dtls.h:312
coap_dtls_pki_t::is_rpk_not_cert
uint8_t is_rpk_not_cert
1 is RPK instead of Public Certificate.
Definition coap_dtls.h:330
coap_dtls_pki_t::pki_key
coap_dtls_key_t pki_key
PKI key definition.
Definition coap_dtls.h:373
coap_layer_func_t::l_close
coap_layer_close_t l_close
Definition coap_layers_internal.h:110
coap_pki_key_asn1_t::private_key
const uint8_t * private_key
ASN1 (DER) Private Key.
Definition coap_dtls.h:211
coap_pki_key_asn1_t::private_key_type
coap_asn1_privatekey_type_t private_key_type
Private Key Type.
Definition coap_dtls.h:215
coap_pki_key_asn1_t::public_cert_len
size_t public_cert_len
ASN1 Public Cert length.
Definition coap_dtls.h:213
coap_pki_key_asn1_t::private_key_len
size_t private_key_len
ASN1 Private Key length.
Definition coap_dtls.h:214
coap_pki_key_asn1_t::ca_cert
const uint8_t * ca_cert
ASN1 (DER) Common CA Cert.
Definition coap_dtls.h:209
coap_pki_key_asn1_t::ca_cert_len
size_t ca_cert_len
ASN1 CA Cert length.
Definition coap_dtls.h:212
coap_pki_key_asn1_t::public_cert
const uint8_t * public_cert
ASN1 (DER) Public Cert, or Public Key if RPK.
Definition coap_dtls.h:210
coap_pki_key_define_t
The structure that holds the PKI Definable key type definitions.
Definition coap_dtls.h:259
coap_pki_key_define_t::public_cert
coap_const_char_ptr_t public_cert
define: Public Cert
Definition coap_dtls.h:261
coap_pki_key_define_t::private_key_type
coap_asn1_privatekey_type_t private_key_type
define: ASN1 Private Key Type (if needed)
Definition coap_dtls.h:269
coap_pki_key_define_t::user_pin
const char * user_pin
define: User pin to access type PKCS11.
Definition coap_dtls.h:271
coap_pki_key_define_t::private_key
coap_const_char_ptr_t private_key
define: Private Key
Definition coap_dtls.h:262
coap_pki_key_define_t::ca
coap_const_char_ptr_t ca
define: Common CA Certificate
Definition coap_dtls.h:260
coap_pki_key_define_t::public_cert_len
size_t public_cert_len
define Public Cert length (if needed)
Definition coap_dtls.h:264
coap_pki_key_define_t::ca_len
size_t ca_len
define CA Cert length (if needed)
Definition coap_dtls.h:263
coap_pki_key_define_t::private_key_def
coap_pki_define_t private_key_def
define: Private Key type definition
Definition coap_dtls.h:268
coap_pki_key_define_t::private_key_len
size_t private_key_len
define Private Key length (if needed)
Definition coap_dtls.h:265
coap_pki_key_define_t::ca_def
coap_pki_define_t ca_def
define: Common CA type definition
Definition coap_dtls.h:266
coap_pki_key_define_t::public_cert_def
coap_pki_define_t public_cert_def
define: Public Cert type definition
Definition coap_dtls.h:267
coap_pki_key_pem_buf_t::ca_cert_len
size_t ca_cert_len
PEM buffer CA Cert length.
Definition coap_dtls.h:200
coap_pki_key_pem_buf_t::ca_cert
const uint8_t * ca_cert
PEM buffer Common CA Cert.
Definition coap_dtls.h:195
coap_pki_key_pem_buf_t::private_key_len
size_t private_key_len
PEM buffer Private Key length.
Definition coap_dtls.h:202
coap_pki_key_pem_buf_t::private_key
const uint8_t * private_key
PEM buffer Private Key If RPK and 'EC PRIVATE KEY' this can be used for both the public_cert and priv...
Definition coap_dtls.h:197
coap_pki_key_pem_buf_t::public_cert_len
size_t public_cert_len
PEM buffer Public Cert length.
Definition coap_dtls.h:201
coap_pki_key_pem_buf_t::public_cert
const uint8_t * public_cert
PEM buffer Public Cert, or Public Key if RPK.
Definition coap_dtls.h:196
coap_pki_key_pem_t::ca_file
const char * ca_file
File location of Common CA (and any intermediates) in PEM format.
Definition coap_dtls.h:179
coap_pki_key_pem_t::public_cert
const char * public_cert
File location of Public Cert.
Definition coap_dtls.h:181
coap_pki_key_pem_t::private_key
const char * private_key
File location of Private Key in PEM format.
Definition coap_dtls.h:182
coap_pki_key_pkcs11_t::private_key
const char * private_key
pkcs11: URI for Private Key
Definition coap_dtls.h:224
coap_pki_key_pkcs11_t::ca
const char * ca
pkcs11: URI for Common CA Certificate
Definition coap_dtls.h:222
coap_pki_key_pkcs11_t::user_pin
const char * user_pin
User pin to access PKCS11.
Definition coap_dtls.h:225
coap_pki_key_pkcs11_t::public_cert
const char * public_cert
pkcs11: URI for Public Cert
Definition coap_dtls.h:223
coap_session_t
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
Definition coap_session_internal.h:68
coap_session_t::last_rx_tx
coap_tick_t last_rx_tx
Definition coap_session_internal.h:111
coap_session_t::sock
coap_socket_t sock
socket object for the session, if any
Definition coap_session_internal.h:81
coap_session_t::state
coap_session_state_t state
current state of relationship with peer
Definition coap_session_internal.h:71
coap_session_t::tls
void * tls
security parameters
Definition coap_session_internal.h:87
coap_session_t::type
coap_session_type_t type
client or server side socket
Definition coap_session_internal.h:70
coap_socket_t::lfunc
coap_layer_func_t lfunc[COAP_LAYER_LAST]
Layer functions to use.
Definition coap_io_internal.h:68
coap_const_char_ptr_t
CoAP union for handling signed / unsigned chars.
Definition coap_str.h:72
coap_const_char_ptr_t::s_byte
const char * s_byte
signed char ptr
Definition coap_str.h:73
coap_const_char_ptr_t::u_byte
const uint8_t * u_byte
unsigned char ptr
Definition coap_str.h:74