Anjay Lite
Loading...
Searching...
No Matches
security_object.h
Go to the documentation of this file.
1/*
2 * Copyright 2023-2025 AVSystem <avsystem@avsystem.com>
3 * AVSystem Anjay Lite LwM2M SDK
4 * All rights reserved.
5 *
6 * Licensed under AVSystem Anjay Lite LwM2M Client SDK - Non-Commercial License.
7 * See the attached LICENSE file for details.
8 */
9
10#include <anj/init.h>
11
20#ifndef ANJ_DM_SECURITY_OBJECT_H
21# define ANJ_DM_SECURITY_OBJECT_H
22
23# include <stdbool.h>
24# include <stddef.h>
25# include <stdint.h>
26
27# include <anj/defs.h>
28# include <anj/dm/core.h>
29
30# ifdef ANJ_WITH_PERSISTENCE
31# include <anj/persistence.h>
32# endif // ANJ_WITH_PERSISTENCE
33
34# ifdef ANJ_WITH_SECURITY
35# include <anj/crypto.h>
36# endif // ANJ_WITH_SECURITY
37
38# ifdef __cplusplus
39extern "C" {
40# endif
41
62
63# ifdef ANJ_WITH_DEFAULT_SECURITY_OBJ
64
66# ifdef ANJ_WITH_BOOTSTRAP
67# define ANJ_DM_SECURITY_OBJ_INSTANCES 2
68# else // ANJ_WITH_BOOTSTRAP
69# define ANJ_DM_SECURITY_OBJ_INSTANCES 1
70# endif // ANJ_WITH_BOOTSTRAP
92
136
146typedef struct {
148 anj_dm_obj_inst_t inst[ANJ_DM_SECURITY_OBJ_INSTANCES];
149 anj_dm_obj_inst_t cache_inst[ANJ_DM_SECURITY_OBJ_INSTANCES];
151 security_instances[ANJ_DM_SECURITY_OBJ_INSTANCES];
153 cache_security_instances[ANJ_DM_SECURITY_OBJ_INSTANCES];
157
167
182 anj_dm_security_obj_t *security_obj_ctx,
183 const anj_dm_security_instance_init_t *instance);
184
198 anj_dm_security_obj_t *security_obj_ctx);
199
200# ifdef ANJ_WITH_SECURITY
201
220 bool bootstrap_credentials,
221 anj_crypto_security_info_t *out_psk_identity,
222 anj_crypto_security_info_t *out_psk_key);
223# endif // ANJ_WITH_SECURITY
224
225# ifdef ANJ_WITH_PERSISTENCE
241 anj_dm_security_obj_t *security_obj_ctx,
242 const anj_persistence_context_t *ctx);
243
259 anj_dm_security_obj_t *security_obj_ctx,
260 const anj_persistence_context_t *ctx);
261# endif // ANJ_WITH_PERSISTENCE
262
263# endif // ANJ_WITH_DEFAULT_SECURITY_OBJ
264
265# ifdef __cplusplus
266}
267# endif
268
269#endif // ANJ_DM_SECURITY_OBJECT_H
#define ANJ_SEC_OBJ_MAX_SERVER_PUBLIC_KEY_SIZE
Definition anj_config.h:123
#define ANJ_SEC_OBJ_MAX_SECRET_KEY_SIZE
Definition anj_config.h:132
#define ANJ_SEC_OBJ_MAX_PUBLIC_KEY_OR_IDENTITY_SIZE
Definition anj_config.h:114
Cryptographic data descriptors used by Security Object and networking.
Core type and constant definitions for Anjay Lite.
struct anj_struct anj_t
Definition defs.h:136
#define ANJ_SERVER_URI_MAX_SIZE
Definition defs.h:147
uint16_t anj_iid_t
Definition defs.h:128
Core data model API: object management, read/write helpers, bootstrap.
Global configuration validation header for Anjay Lite.
Persistence API for storing and restoring Anjay Lite state.
void anj_dm_security_obj_init(anj_dm_security_obj_t *security_obj_ctx)
int anj_dm_security_obj_get_psk(const anj_t *anj, bool bootstrap_credentials, anj_crypto_security_info_t *out_psk_identity, anj_crypto_security_info_t *out_psk_key)
anj_dm_security_mode_t
Definition security_object.h:46
@ ANJ_DM_SECURITY_CERTIFICATE
Definition security_object.h:54
@ ANJ_DM_SECURITY_NOSEC
Definition security_object.h:57
@ ANJ_DM_SECURITY_EST
Definition security_object.h:60
@ ANJ_DM_SECURITY_PSK
Definition security_object.h:48
@ ANJ_DM_SECURITY_RPK
Definition security_object.h:51
int anj_dm_security_obj_store(anj_t *anj, anj_dm_security_obj_t *security_obj_ctx, const anj_persistence_context_t *ctx)
int anj_dm_security_obj_install(anj_t *anj, anj_dm_security_obj_t *security_obj_ctx)
int anj_dm_security_obj_restore(anj_t *anj, anj_dm_security_obj_t *security_obj_ctx, const anj_persistence_context_t *ctx)
int anj_dm_security_obj_add_instance(anj_dm_security_obj_t *security_obj_ctx, const anj_dm_security_instance_init_t *instance)
Definition crypto.h:101
Definition defs.h:124
Definition defs.h:157
Definition security_object.h:97
uint16_t ssid
Definition security_object.h:122
const anj_iid_t * iid
Definition security_object.h:134
uint32_t client_hold_off_time
Definition security_object.h:128
anj_crypto_security_info_t public_key_or_identity
Definition security_object.h:109
bool bootstrap_server
Definition security_object.h:102
anj_crypto_security_info_t secret_key
Definition security_object.h:115
const char * server_uri
Definition security_object.h:99
anj_crypto_security_info_t server_public_key
Definition security_object.h:112
anj_dm_security_mode_t security_mode
Definition security_object.h:105
Definition security_object.h:74
uint16_t ssid
Definition security_object.h:79
anj_iid_t iid
Definition security_object.h:80
uint32_t client_hold_off_time
Definition security_object.h:78
anj_crypto_security_info_t public_key_or_identity
Definition security_object.h:87
bool bootstrap_server
Definition security_object.h:76
anj_crypto_security_info_t secret_key
Definition security_object.h:89
anj_crypto_security_info_t server_public_key
Definition security_object.h:88
anj_dm_security_mode_t security_mode
Definition security_object.h:77
Definition security_object.h:146
anj_dm_obj_t obj
Definition security_object.h:147
anj_iid_t new_instance_iid
Definition security_object.h:155
bool installed
Definition security_object.h:154
Definition persistence.h:91