C API for BALTECH SDK
pki_protocol.h
Go to the documentation of this file.
1 
9 #ifndef __PKI_PROTOCOL_H__
10 #define __PKI_PROTOCOL_H__
11 
12 
13 #include "protocol.h"
14 
15 
26 (
27  int security_level,
28  brp_buf host_cert_chain,
29  size_t host_cert_chain_len,
30  brp_buf dev_ca_cert_chain,
31  size_t dev_ca_cert_chain_len,
33  brp_buf private_key,
34  size_t private_key_len,
35  brp_time session_timeout
36 );
39 
40 
50 (
51  brp_protocol protocol,
52  brp_buf host_cert_chain,
53  size_t host_cert_chain_len
56 );
57 
58 
68 (
69  brp_protocol protocol,
70  brp_buf dev_ca_cert_chain,
71  size_t dev_ca_cert_chain_len
74 );
75 
76 
90 BRP_LIB brp_errcode brp_pki_pfs_gen_key
91 (
92  brp_protocol protocol,
93  brp_buf shared_secret
95 );
96 
97 
108 BRP_LIB brp_errcode brp_pki_init_pfs_session
109 (
110  brp_protocol protocol,
111  brp_buf session_key,
113  brp_buf shared_secret,
116  int security_level,
117  brp_buf private_key_derfmt,
118  brp_frame dev_cert_chain,
119  brp_frame host_cert_chain,
122  brp_frame dev_cert,
124  brp_time session_timeout
129 );
130 
131 
141 BRP_LIB brp_errcode brp_pki_tunnel_send_frame
142 (
143  brp_protocol protocol,
144  brp_buf session_key,
146  unsigned long seq_ctr,
148  brp_frame plain_cmd
150 );
151 
152 
162 BRP_LIB brp_errcode brp_pki_tunnel_recv_any_frame
163 (
164  brp_protocol protocol,
165  brp_buf session_key,
167  unsigned long seq_ctr,
169  int cmd_code,
171  brp_frame plain_rsp,
172  brp_time timeout
173 );
176 
177 
178 
204 (
205  brp_protocol protocol,
206  brp_buf persistent_buf,
208  size_t peristent_buf_size,
212  size_t * persistent_buf_actlen
213 );
216 
217 
225 BRP_LIB size_t brp_pki_get_session_buf_size
226 (
227  brp_protocol protocol
228 );
230 
231 
251 (
252  brp_protocol protocol,
253  brp_buf persistent_buf,
254  size_t persistent_buf_size
256 );
257 
258 
268 (
269  brp_protocol protocol,
270  brp_buf dev_cert_buf,
271  size_t dev_cert_buf_size,
276  size_t * dev_cert_len
277 );
281 
282 
283 #endif //__BRP_H__
284  // end of defgroup brp_lib
BRP_LIB brp_errcode brp_pki_get_dev_cert(brp_protocol protocol, brp_buf dev_cert_buf, size_t dev_cert_buf_size, size_t *dev_cert_len)
This command retrieves the certificate of the device which it created a PKI connection to...
BRP_LIB brp_errcode brp_append_dev_ca_certs(brp_protocol protocol, brp_buf dev_ca_cert_chain, size_t dev_ca_cert_chain_len)
Adds certificate(s) to the devices CA certificate chain.
unsigned int brp_errcode
This type is used library-wide for passing error codes in the return value of functions.
Definition: errorcodes.h:23
struct brp_protocol_t * brp_protocol
This is a generic handle of a protocol.
Definition: protocol.h:34
BRP_LIB brp_protocol brp_create_pki(int security_level, brp_buf host_cert_chain, size_t host_cert_chain_len, brp_buf dev_ca_cert_chain, size_t dev_ca_cert_chain_len, brp_buf private_key, size_t private_key_len, brp_time session_timeout)
Creates a new PKI protocol layer.
unsigned long brp_time
absolute/relative timeout/delay in ms.
Definition: common.h:67
This file primarly defines the common part of all protocol's data structures (:brp_protocol_t) and AP...
BRP_LIB brp_errcode brp_pki_restore_session(brp_protocol protocol, brp_buf persistent_buf, size_t persistent_buf_size)
This command reloads the current PKI session that was stored by brp_pki_save_session().
BRP_LIB brp_errcode brp_pki_save_session(brp_protocol protocol, brp_buf persistent_buf, size_t peristent_buf_size, size_t *persistent_buf_actlen)
This command stores the current PKI session state in a persistent storage for being continued later u...
BRP_LIB size_t brp_pki_get_session_buf_size(brp_protocol protocol)
Returns the size of the buffer required to store the session state using brp_pki_save_session().
BRP_LIB brp_errcode brp_append_host_certs(brp_protocol protocol, brp_buf host_cert_chain, size_t host_cert_chain_len)
Adds certificate(s) to the host certificate chain.
unsigned char * brp_buf
represents a pointer to a protocol data buffer.
Definition: common.h:61