101 const uint8_t *asn1_public_cert,
188 #define COAP_DTLS_PKI_SETUP_VERSION 1 193 typedef struct coap_dtls_pki_t { 294 const char *identity_hint,
void coap_dtls_set_log_level(int level)
Sets the (D)TLS logging level to the specified level.
void coap_dtls_free_context(void *dtls_context)
Releases the storage allocated for dtls_context.
struct coap_pki_key_pem_t coap_pki_key_pem_t
The structure that holds the PKI PEM definitions.
uint8_t allow_self_signed
1 if self signed certs are allowed
The PKI key type is ASN.1 (DER)
void * coap_dtls_new_context(struct coap_context_t *coap_context)
Creates a new DTLS context for the given coap_context.
coap_pki_key_t key_type
key format type
struct coap_dtls_pki_t coap_dtls_pki_t
The structure used for defining the PKI setup data to be used.
int coap_dtls_get_log_level(void)
Get the current (D)TLS logging.
int coap_dtls_context_set_psk(struct coap_context_t *coap_context, const char *identity_hint, coap_dtls_role_t role)
Set the DTLS context's default PSK information.
Internal function invoked for server.
int coap_dtls_is_supported(void)
Check whether DTLS is available.
void * sni_call_back_arg
Passed in to the sni call-back function.
struct coap_tls_version_t coap_tls_version_t
The structure used for returning the underlying (D)TLS library information.
uint8_t verify_peer_cert
Set to 1 to support this version of the struct.
uint8_t allow_no_crl
1 ignore if CRL not there
uint64_t version
(D)TLS runtime Library Version
void * coap_tls_new_server_session(struct coap_session_t *coap_session, int *connected)
Create a TLS new server-side session.
void * coap_dtls_new_client_session(struct coap_session_t *coap_session)
Create a new client-side session.
void * coap_tls_new_client_session(struct coap_session_t *coap_session, int *connected)
Create a new TLS client-side session.
coap_dtls_sni_callback_t validate_sni_call_back
SNI check call-back function.
coap_dtls_security_setup_t additional_tls_setup_call_back
Additional Security call-back handler that is invoked when libcoap has done the standerd, defined validation checks at the TLS level, If not NULL, called from within the TLS Client Hello connection setup.
int coap_tls_is_supported(void)
Check whether TLS is available.
void * coap_dtls_new_server_session(struct coap_session_t *coap_session)
Create a new DTLS server-side session.
coap_tls_library_t type
Library type.
coap_tick_t coap_dtls_get_timeout(struct coap_session_t *coap_session, coap_tick_t now)
Get next timeout for this session.
struct coap_dtls_key_t coap_dtls_key_t
The structure that holds the PKI key information.
coap_tls_version_t * coap_get_tls_library_version(void)
Determine the type and version of the underlying (D)TLS library.
ssize_t coap_tls_write(struct coap_session_t *coap_session, const uint8_t *data, size_t data_len)
Send data to a TLS peer, with implicit flush.
const char * private_key
File location of Private Key in PEM format.
uint8_t require_peer_cert
1 if peer cert is required
coap_dtls_key_t pki_key
PKI key definition.
coap_pki_key_pem_t pem
for PEM keys
char * client_sni
If not NULL, SNI to use in client TLS setup.
int coap_dtls_context_set_pki_root_cas(struct coap_context_t *coap_context, const char *ca_file, const char *ca_dir)
Set the dtls context's default Root CA information for a client or server.
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
The structure that holds the PKI key information.
const uint8_t * public_cert
ASN1 (DER) Public Cert.
const char * ca_file
File location of Common CA in PEM format.
size_t ca_cert_len
ASN1 CA Cert length.
The structure used for returning the underlying (D)TLS library information.
uint8_t cert_chain_validation
1 if to check cert_chain_verify_depth
struct coap_pki_key_asn1_t coap_pki_key_asn1_t
The structure that holds the PKI ASN.1 (DER) definitions.
The structure that holds the PKI PEM definitions.
Internal function invoked for client.
const uint8_t * private_key
ASN1 (DER) Private Key.
int(* coap_dtls_security_setup_t)(void *tls_session, struct coap_dtls_pki_t *setup_data)
Additional Security setup handler that can be set up by coap_context_set_pki().
coap_dtls_cn_callback_t validate_cn_call_back
CN check call-back function.
unsigned int coap_dtls_get_overhead(struct coap_session_t *coap_session)
Get DTLS overhead over cleartext PDUs.
uint8_t allow_expired_certs
1 if expired certs are allowed
uint8_t check_cert_revocation
1 if revocation checks wanted
void coap_dtls_session_update_mtu(struct coap_session_t *coap_session)
Notify of a change in the CoAP session's MTU, for example after a PMTU update.
void coap_tls_free_session(struct coap_session_t *coap_session)
Terminates the TLS session (may send an ALERT if necessary) then frees the underlying TLS library obj...
coap_tick_t coap_dtls_get_context_timeout(void *dtls_context)
Do all pending retransmits and get next timeout.
int coap_dtls_context_check_keys_enabled(struct coap_context_t *coap_context)
Check whether one of the coap_dtls_context_set_{psk|pki}() functions have been called.
void * cn_call_back_arg
Passed in to the CN call-back function.
coap_asn1_privatekey_type_t
The enum used for determining the provided PKI ASN.1 (DER) Private Key formats.
uint8_t allow_expired_crl
1 if expired crl is allowed
void coap_dtls_handle_timeout(struct coap_session_t *coap_session)
Handle a DTLS timeout expiration.
The structure used for defining the PKI setup data to be used.
coap_asn1_privatekey_type_t private_key_type
Private Key Type.
uint8_t cert_chain_verify_depth
recommended depth is 3
void coap_dtls_free_session(struct coap_session_t *coap_session)
Terminates the DTLS session (may send an ALERT if necessary) then frees the underlying TLS library ob...
int coap_dtls_receive(struct coap_session_t *coap_session, const uint8_t *data, size_t data_len)
Handling incoming data from a DTLS peer.
const char * public_cert
File location of Public Cert in PEM format.
int coap_dtls_hello(struct coap_session_t *coap_session, const uint8_t *data, size_t data_len)
Handling client HELLO messages from a new candiate peer.
void coap_dtls_startup(void)
Initialize the underlying (D)TLS Library layer.
const uint8_t * ca_cert
ASN1 (DER) Common CA Cert.
int coap_dtls_send(struct coap_session_t *coap_session, const uint8_t *data, size_t data_len)
Send data to a DTLS peer.
size_t public_cert_len
ASN1 Public Cert length.
The structure that holds the PKI ASN.1 (DER) definitions.
int coap_dtls_context_set_pki(struct coap_context_t *coap_context, coap_dtls_pki_t *setup_data, coap_dtls_role_t role)
Set the DTLS context's default server PKI information.
uint64_t built_version
(D)TLS Built against Library Version
ssize_t coap_tls_read(struct coap_session_t *coap_session, uint8_t *data, size_t data_len)
Read some data from a TLS peer.
coap_dtls_key_t *(* coap_dtls_sni_callback_t)(const char *sni, void *arg)
Server Name Indication (SNI) Validation call-back that can be set up by coap_context_set_pki().
The CoAP stack's global state is stored in a coap_context_t object.
int coap_dtls_is_context_timeout(void)
Check if timeout is handled per CoAP session or per CoAP context.
size_t private_key_len
ASN1 Private Key length.
int(* coap_dtls_cn_callback_t)(const char *cn, const uint8_t *asn1_public_cert, size_t asn1_length, struct coap_session_t *coap_session, unsigned depth, int validated, void *arg)
CN Validation call-back that can be set up by coap_context_set_pki().
coap_pki_key_t
The enum used for determining the PKI key formats.
coap_pki_key_asn1_t asn1
for ASN.1 (DER) keys