Loading...
Searching...
No Matches
security.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 HAW Hamburg
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
158#ifndef OBJECTS_SECURITY_H
159#define OBJECTS_SECURITY_H
160
161#ifdef __cplusplus
162extern "C" {
163#endif
164
165#include <stdio.h>
166#include <stdlib.h>
167#include <string.h>
168#include <assert.h>
169
170#include "liblwm2m.h"
171#include "net/credman.h"
172#include "lwm2m_client.h"
173#include "lwm2m_client_config.h"
174
175/* these are defined in liblwm2m.h, and are reproduced here for documentation purposes */
176#ifdef DOXYGEN
184#define LWM2M_SECURITY_MODE_PRE_SHARED_KEY 0
185
189#define LWM2M_SECURITY_MODE_RAW_PUBLIC_KEY 1
190
194#define LWM2M_SECURITY_MODE_CERTIFICATE 2
195
199#define LWM2M_SECURITY_MODE_NONE 3
209#define LWM2M_SECURITY_URI_ID 0
210
214#define LWM2M_SECURITY_BOOTSTRAP_ID 1
215
219#define LWM2M_SECURITY_SECURITY_ID 2
220
224#define LWM2M_SECURITY_PUBLIC_KEY_ID 3
225
229#define LWM2M_SECURITY_SERVER_PUBLIC_KEY_ID 4
230
234#define LWM2M_SECURITY_SECRET_KEY_ID 5
235
239#define LWM2M_SECURITY_SMS_SECURITY_ID 6
240
244#define LWM2M_SECURITY_SMS_KEY_PARAM_ID 7
245
249#define LWM2M_SECURITY_SMS_SECRET_KEY_ID 8
250
254#define LWM2M_SECURITY_SMS_SERVER_NUMBER_ID 9
255
259#define LWM2M_SECURITY_SHORT_SERVER_ID 10
260
264#define LWM2M_SECURITY_HOLD_OFF_ID 11
265
269#define LWM2M_SECURITY_BOOTSTRAP_TIMEOUT_ID 12
271#endif /* DOXYGEN */
272
281#ifndef CONFIG_LWM2M_OBJ_SECURITY_INSTANCES_MAX
282#define CONFIG_LWM2M_OBJ_SECURITY_INSTANCES_MAX (2)
283#endif
284
288#ifndef CONFIG_LWM2M_OBJ_SECURITY_PUB_KEY_ID_BUFSIZE
289#define CONFIG_LWM2M_OBJ_SECURITY_PUB_KEY_ID_BUFSIZE (128)
290#endif
291
295#ifndef CONFIG_LWM2M_OBJ_SECURITY_SERVER_PUB_KEY_BUFSIZE
296#define CONFIG_LWM2M_OBJ_SECURITY_SERVER_PUB_KEY_BUFSIZE (128)
297#endif
298
302#ifndef CONFIG_LWM2M_OBJ_SECURITY_SEC_KEY_BUFSIZE
303#define CONFIG_LWM2M_OBJ_SECURITY_SEC_KEY_BUFSIZE (64)
304#endif
315 uint16_t server_id;
316
322 const char *server_uri;
323
330
339 const uint8_t *pub_key_or_id;
340
345
354 const uint8_t *secret_key;
355
360
369 const uint8_t *server_pub_key;
370
375
380
386
393
402
416 int32_t instance_id);
417
427
428#ifdef __cplusplus
429}
430#endif
431
432#endif /* OBJECTS_SECURITY_H */
POSIX.1-2008 compliant version of the assert macro.
(D)TLS credentials management module definitions
credman_tag_t lwm2m_object_security_get_credential(uint16_t instance_id)
Get the credential of a given instance of the security object.
lwm2m_object_t * lwm2m_object_security_init(lwm2m_client_data_t *client_data)
Initialize the Security object.
struct lwm2m_obj_security_args lwm2m_obj_security_args_t
Arguments for a new Security object instance creation (lwm2m_object_security_instance_create).
int lwm2m_object_security_instance_create(const lwm2m_obj_security_args_t *args, int32_t instance_id)
Create a new Security instance and add it to the object list.
uint16_t credman_tag_t
Tag of the credential.
Definition credman.h:96
Definitions and public API for a LwM2M client using Wakaama.
LwM2M client configurations.
stdio wrapper to extend the C libs stdio
LwM2M client descriptor.
Arguments for a new Security object instance creation (lwm2m_object_security_instance_create).
Definition security.h:311
const uint8_t * pub_key_or_id
Pointer to the Key ID when using LWM2M_SECURITY_MODE_PRE_SHARED_KEY.
Definition security.h:339
uint16_t server_id
Server's short ID the instance is associated to.
Definition security.h:315
const uint8_t * server_pub_key
Pointer to the server public key encoded as a SubjectPublicKeyInfo sequence when using LWM2M_SECURITY...
Definition security.h:369
size_t secret_key_len
Length of lwm2m_obj_security_args_t::secret_key.
Definition security.h:359
const char * server_uri
Server's URI the instance is associated to.
Definition security.h:322
bool is_bootstrap
When true the security instance is associated to the Bootstrap-Server.
Definition security.h:379
uint8_t security_mode
Security mode to use.
Definition security.h:329
size_t pub_key_or_id_len
Length of lwm2m_obj_security_args_t::pub_key_or_id.
Definition security.h:344
const uint8_t * secret_key
Pointer to the Key when using LWM2M_SECURITY_MODE_PRE_SHARED_KEY.
Definition security.h:354
uint32_t client_hold_off_time
Time, in seconds, to wait before initiating a 'Client Initiated Bootstrap', after it has been determi...
Definition security.h:385
uint32_t bootstrap_account_timeout
Time, in seconds, that the client waits before it purges the Bootstrap-Server's account.
Definition security.h:391
size_t server_pub_key_len
Length of lwm2m_obj_security_args_t::server_pub_key.
Definition security.h:374