21#define strcasecmp _stricmp
22#define strncasecmp _strnicmp
90 if (strncasecmp(key->
key.
pkcs11.
ca,
"pkcs11:", 7) == 0) {
138#if (COAP_MAX_LOGGING_LEVEL >= _COAP_LOG_ERR)
167#if (COAP_MAX_LOGGING_LEVEL >= _COAP_LOG_ERR)
173 coap_log_warn(
"*** setup_pki: (D)TLS: %s: %s CA configure failure\n",
178 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s CA type not supported\n",
183 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s CA not defined\n",
194 coap_log_warn(
"*** setup_pki: (D)TLS: %s: %s Root CA configure failure\n",
199 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Root CA type not supported\n",
204 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Root CA not defined\n",
215 coap_log_warn(
"*** setup_pki: (D)TLS: %s: %s Certificate configure failure\n",
220 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Certificate type not supported\n",
225 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Certificate not defined\n",
236 coap_log_warn(
"*** setup_pki: (D)TLS: %s: %s Private Key configure failure\n",
241 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Private Key type not supported\n",
246 coap_log_err(
"*** setup_pki: (D)TLS: %s: %s Private Key not defined\n",
268#if COAP_CLIENT_SUPPORT
272#if COAP_SERVER_SUPPORT
297#if COAP_CLIENT_SUPPORT
301#if COAP_SERVER_SUPPORT
static const char * coap_dtls_get_define_type(coap_pki_define_t def, coap_const_char_ptr_t name)
@ COAP_NACK_TLS_LAYER_FAILED
Library specific build wrapper for coap_internal.h.
void coap_dtls_free_session(coap_session_t *coap_session COAP_UNUSED)
void coap_tls_free_session(coap_session_t *coap_session COAP_UNUSED)
void coap_ticks(coap_tick_t *)
Returns the current value of an internal tick counter.
void * coap_tls_new_server_session(coap_session_t *coap_session)
Create a TLS new server-side session.
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.
void * coap_dtls_new_client_session(coap_session_t *coap_session)
Create a new client-side session.
void coap_tls_establish(coap_session_t *session)
Layer function interface for layer below TLS accept/connect being established.
void coap_dtls_establish(coap_session_t *session)
Layer function interface for layer below DTLS connect being established.
void * coap_dtls_new_server_session(coap_session_t *coap_session)
Create a new DTLS server-side session.
void * coap_tls_new_client_session(coap_session_t *coap_session)
Create a new TLS client-side session.
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.
void coap_tls_close(coap_session_t *session)
Layer function interface for TLS close for a session.
void coap_dtls_close(coap_session_t *session)
Layer function interface for DTLS close for a session.
@ COAP_DEFINE_KEY_PRIVATE
@ COAP_DEFINE_KEY_ROOT_CA
@ COAP_DEFINE_FAIL_NOT_SUPPORTED
coap_pki_define_t
The enum to define the format of the key parameter definition.
@ COAP_PKI_KEY_DEF_PKCS11
The PKI key type is PKCS11 (pkcs11:...).
@ COAP_PKI_KEY_DEF_DER_BUF
The PKI key type is DER buffer (ASN.1).
@ COAP_PKI_KEY_DEF_PEM_BUF
The PKI key type is PEM buffer.
@ COAP_PKI_KEY_DEF_PEM
The PKI key type is PEM file.
@ COAP_PKI_KEY_DEF_ENGINE
The PKI key type is to be passed to ENGINE.
@ COAP_PKI_KEY_DEF_RPK_BUF
The PKI key type is RPK in buffer.
@ COAP_PKI_KEY_DEF_DER
The PKI key type is DER file.
@ COAP_PKI_KEY_DEF_PKCS11_RPK
The PKI key type is PKCS11 w/ RPK (pkcs11:...).
@ COAP_DTLS_ROLE_SERVER
Internal function invoked for server.
@ COAP_PKI_KEY_PKCS11
The PKI key type is PKCS11 (DER)
@ COAP_PKI_KEY_PEM_BUF
The PKI key type is PEM buffer.
@ COAP_PKI_KEY_DEFINE
The individual PKI key types are Definable.
@ COAP_PKI_KEY_PEM
The PKI key type is PEM file.
@ COAP_PKI_KEY_ASN1
The PKI key type is ASN.1 (DER) buffer.
#define coap_log_warn(...)
#define coap_log_err(...)
void coap_session_disconnected_lkd(coap_session_t *session, coap_nack_reason_t reason)
Notify session that it has failed.
@ COAP_SESSION_TYPE_CLIENT
client-side
@ COAP_SESSION_STATE_HANDSHAKE
The structure that holds the PKI key information.
coap_pki_key_define_t define
for definable type keys
coap_pki_key_pem_t pem
for PEM file keys
coap_pki_key_pkcs11_t pkcs11
for PKCS11 keys
union coap_dtls_key_t::@3 key
coap_pki_key_pem_buf_t pem_buf
for PEM memory keys
coap_pki_key_t key_type
key format type
coap_pki_key_asn1_t asn1
for ASN.1 (DER) memory keys
The structure used for defining the PKI setup data to be used.
uint8_t is_rpk_not_cert
1 is RPK instead of Public Certificate.
coap_dtls_key_t pki_key
PKI key definition.
coap_layer_close_t l_close
const uint8_t * private_key
ASN1 (DER) Private Key.
coap_asn1_privatekey_type_t private_key_type
Private Key Type.
size_t public_cert_len
ASN1 Public Cert length.
size_t private_key_len
ASN1 Private Key length.
const uint8_t * ca_cert
ASN1 (DER) Common CA Cert.
size_t ca_cert_len
ASN1 CA Cert length.
const uint8_t * public_cert
ASN1 (DER) Public Cert, or Public Key if RPK.
The structure that holds the PKI Definable key type definitions.
coap_const_char_ptr_t public_cert
define: Public Cert
coap_asn1_privatekey_type_t private_key_type
define: ASN1 Private Key Type (if needed)
const char * user_pin
define: User pin to access type PKCS11.
coap_const_char_ptr_t private_key
define: Private Key
coap_const_char_ptr_t ca
define: Common CA Certificate
size_t public_cert_len
define Public Cert length (if needed)
size_t ca_len
define CA Cert length (if needed)
coap_pki_define_t private_key_def
define: Private Key type definition
size_t private_key_len
define Private Key length (if needed)
coap_pki_define_t ca_def
define: Common CA type definition
coap_pki_define_t public_cert_def
define: Public Cert type definition
size_t ca_cert_len
PEM buffer CA Cert length.
const uint8_t * ca_cert
PEM buffer Common CA Cert.
size_t private_key_len
PEM buffer Private Key length.
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...
size_t public_cert_len
PEM buffer Public Cert length.
const uint8_t * public_cert
PEM buffer Public Cert, or Public Key if RPK.
const char * ca_file
File location of Common CA (and any intermediates) in PEM format.
const char * public_cert
File location of Public Cert.
const char * private_key
File location of Private Key in PEM format.
const char * private_key
pkcs11: URI for Private Key
const char * ca
pkcs11: URI for Common CA Certificate
const char * user_pin
User pin to access PKCS11.
const char * public_cert
pkcs11: URI for Public Cert
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
coap_socket_t sock
socket object for the session, if any
coap_session_state_t state
current state of relationship with peer
void * tls
security parameters
coap_session_type_t type
client or server side socket
coap_layer_func_t lfunc[COAP_LAYER_LAST]
Layer functions to use.
CoAP union for handling signed / unsigned chars.
const char * s_byte
signed char ptr
const uint8_t * u_byte
unsigned char ptr