Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
object_security.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * Copyright (c) 2021 Cascoda Ltd.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Distribution License
6  * v1.0 which accompanies this distribution.
7  *
8  * The Eclipse Distribution License is available at
9  * http://www.eclipse.org/org/documents/edl-v10.php.
10  *
11  * Contributors:
12  * Ciaran Woodward - Cascoda Ltd.
13  *
14  *******************************************************************************/
15 /*
16  * object_security.h
17  *
18  * Security object abstraction.
19  *
20  * Created on: 21.01.2021
21  * Author: Ciaran Woodward
22  * Copyright (c) Cascoda Ltd. All rights reserved.
23  */
24 
25 #ifndef OBJECT_SECURITY_H_
26 #define OBJECT_SECURITY_H_
27 
28 #include "liblwm2m.h"
29 
40 lwm2m_object_t *get_security_object(int serverId,
41  const char *serverUri,
42  char *bsPskId,
43  char *psk,
44  uint16_t pskLen,
45  bool isBootstrap);
46 
51 void clean_security_object(lwm2m_object_t *objectP);
52 
59 const char *security_get_server_uri(lwm2m_object_t *objectP, uint16_t secObjInstID);
60 
67 int32_t security_get_mode(lwm2m_object_t *objectP, uint16_t secObjInstID);
68 
76 const char *security_get_public_id(lwm2m_object_t *objectP, uint16_t secObjInstID, size_t *idLen);
77 
85 const char *security_get_secret_key(lwm2m_object_t *objectP, uint16_t secObjInstID, size_t *keyLen);
86 
91 void security_display_object(lwm2m_object_t *objectP);
92 
99 void security_copy_object(lwm2m_object_t *objectDest, lwm2m_object_t *objectSrc);
100 
101 #endif /* OBJECT_SECURITY_H_ */
void clean_security_object(lwm2m_object_t *objectP)
Free and clean up the security object.
Definition: object_security.c:497
const char * security_get_secret_key(lwm2m_object_t *objectP, uint16_t secObjInstID, size_t *keyLen)
Get the secret key from security object.
Definition: object_security.c:634
const char * security_get_server_uri(lwm2m_object_t *objectP, uint16_t secObjInstID)
Get the server URI from security object.
Definition: object_security.c:596
int32_t security_get_mode(lwm2m_object_t *objectP, uint16_t secObjInstID)
Get the security mode from security object.
Definition: object_security.c:608
lwm2m_object_t * get_security_object(int serverId, const char *serverUri, char *bsPskId, char *psk, uint16_t pskLen, bool isBootstrap)
Create the security object and return a pointer to it.
Definition: object_security.c:516
const char * security_get_public_id(lwm2m_object_t *objectP, uint16_t secObjInstID, size_t *idLen)
Get the public id from security object.
Definition: object_security.c:620
void security_display_object(lwm2m_object_t *objectP)
Print the security object to output, for debugging.
Definition: object_security.c:478
void security_copy_object(lwm2m_object_t *objectDest, lwm2m_object_t *objectSrc)
Create a copy of the security object source into the destination, with freshly allocated internal dat...
Definition: object_security.c:438