-
Notifications
You must be signed in to change notification settings - Fork 0
/
u_cx_security.h
186 lines (164 loc) · 4.95 KB
/
u_cx_security.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
* This file was automatically generated using csnake v0.3.5.
*
* This file should not be edited directly, any changes will be
* overwritten next time the script is run.
*
* Source code for csnake is available at:
* https://gitlab.com/andrejr/csnake
*
* csnake is also available on PyPI, at :
* https://pypi.org/project/csnake
*/
#ifndef _U_CX_SECURITY_H_
#define _U_CX_SECURITY_H_
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include "u_cx_types.h"
#include "u_cx.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* ------------------------------------------------------------
* RESPONSES
* ---------------------------------------------------------- */
typedef struct
{
int32_t cert_type;
const char * name;
} uCxSecurityListCertificates_t;
typedef struct
{
int32_t extension;
int32_t enabled;
} uCxSecurityListTlsExtensions_t;
/* ------------------------------------------------------------
* PUBLIC FUNCTIONS
* ---------------------------------------------------------- */
/**
* Remove X.509 certificates and private keys.
*
* Output AT command:
* > AT+USECR=<cert_type>,<name>
*
* @param[in] puCxHandle: uCX API handle
* @param cert_type:
* @param name:
*/
int32_t uCxSecurityCertificateRemove(uCxHandle_t * puCxHandle, uCertType_t cert_type, const char * name);
/**
* Remove X.509 certificates and private keys.
*
* Output AT command:
* > AT+USECR=<remove_all>
*
* @param[in] puCxHandle: uCX API handle
* @param remove_all:
*/
int32_t uCxSecurityCertificateRemoveAll(uCxHandle_t * puCxHandle, uRemoveAll_t remove_all);
/**
* Write an X.509 certificate or private key using binary transfer.
*
* Output AT command:
* > AT+USECUB=<cert_type>,<name>
*
* @param[in] puCxHandle: uCX API handle
* @param cert_type:
* @param name:
* @param[in] pWData: binary data to write
* @param wDataLen: number of bytes to write
*/
int32_t uCxSecurityUploadCertificate2(uCxHandle_t * puCxHandle, uCertType_t cert_type, const char * name, uint8_t * pWData, size_t wDataLen);
/**
* Write an X.509 certificate or private key using binary transfer.
*
* Output AT command:
* > AT+USECUB=<cert_type>,<name>,<password>
*
* @param[in] puCxHandle: uCX API handle
* @param cert_type:
* @param name:
* @param password: Decryption password; applicable only for PKCS8 encrypted client private keys. The maximum
* length is 64 characters.
* NOTE: Supported Encryption method for private keys is AES only
* @param[in] pWData: binary data to write
* @param wDataLen: number of bytes to write
*/
int32_t uCxSecurityUploadCertificate3(uCxHandle_t * puCxHandle, uCertType_t cert_type, const char * name, const char * password, uint8_t * pWData, size_t wDataLen);
/**
* Read all uploaded certificate names
*
* Output AT command:
* > AT+USECL?
*
* @param[in] puCxHandle: uCX API handle
*/
void uCxBeginSecurityListCertificates(uCxHandle_t * puCxHandle);
/**
*
*
* @param[in] puCxHandle: uCX API handle
* @param[out] pSecurityListCertificatesRsp: Please see \ref uCxSecurityListCertificates_t
*/
bool uCxSecurityListCertificatesGetResponse(uCxHandle_t * puCxHandle, uCxSecurityListCertificates_t * pSecurityListCertificatesRsp);
/**
* Read all TLS extension settings
*
* Output AT command:
* > AT+USETE?
*
* @param[in] puCxHandle: uCX API handle
*/
void uCxBeginSecurityListTlsExtensions(uCxHandle_t * puCxHandle);
/**
*
*
* @param[in] puCxHandle: uCX API handle
* @param[out] pSecurityListTlsExtensionsRsp: Please see \ref uCxSecurityListTlsExtensions_t
*/
bool uCxSecurityListTlsExtensionsGetResponse(uCxHandle_t * puCxHandle, uCxSecurityListTlsExtensions_t * pSecurityListTlsExtensionsRsp);
/**
* Turn Server Name Indication TLS extension on and off on a system level
*
* Output AT command:
* > AT+USETE0=<enabled>
*
* @param[in] puCxHandle: uCX API handle
* @param enabled:
*/
int32_t uCxSecuritySetTlsServerNameIndication(uCxHandle_t * puCxHandle, uEnabled_t enabled);
/**
* Read Server Name Indication setting
*
* Output AT command:
* > AT+USETE0?
*
* @param[in] puCxHandle: uCX API handle
* @param[out] pEnabled:
*/
int32_t uCxSecurityGetTlsServerNameIndication(uCxHandle_t * puCxHandle, uEnabled_t * pEnabled);
/**
* Turn Handshake Fragmentation TLS extension on and off on a system level
*
* Output AT command:
* > AT+USETE1=<enabled>
*
* @param[in] puCxHandle: uCX API handle
* @param enabled:
*/
int32_t uCxSecuritySetTlsHandshakeFrag(uCxHandle_t * puCxHandle, uEnabled_t enabled);
/**
* Read Handshake Fragmentation setting
*
* Output AT command:
* > AT+USETE1?
*
* @param[in] puCxHandle: uCX API handle
* @param[out] pEnabled:
*/
int32_t uCxSecurityGetTlsHandshakeFrag(uCxHandle_t * puCxHandle, uEnabled_t * pEnabled);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _U_CX_SECURITY_H_ */