11 #ifndef __BRP_BALTECH_API_CMDS_PKI_H__    12 #define __BRP_BALTECH_API_CMDS_PKI_H__    13 #include "../typedefs.h"    17 #define BRP_Pki_ErrCrypto BRP_ERR_STATUS(0x0900, 0x01)    21 #define BRP_Pki_ErrTunnel BRP_ERR_STATUS(0x0900, 0x02)    25 #define BRP_Pki_ErrCert BRP_ERR_STATUS(0x0900, 0x03)    29 #define BRP_Pki_ErrSeqctr BRP_ERR_STATUS(0x0900, 0x04)    33 #define BRP_Pki_ErrSeclevelUnsupported BRP_ERR_STATUS(0x0900, 0x05)    37 #define BRP_Pki_ErrSessionTimeout BRP_ERR_STATUS(0x0900, 0x06) brp_errcode brp_Pki_Tunnel2(brp_protocol protocol, unsigned SequenceCounter, brp_buf CmdHMAC, brp_buf EncryptedCmd, size_t EncryptedCmd_len, brp_buf *RspHMAC, brp_buf *EncryptedRsp, size_t *EncryptedRsp_len, brp_mempool *mempool)
Runs a command in the Security Level authenticated by the brp_Pki_PfsGenKey(), brp_Pki_PfsAuthHostCer...
 
unsigned int brp_errcode
This type is used library-wide for passing error codes in the return value of functions. 
 
struct brp_protocol_t * brp_protocol
This is a generic handle of a protocol. 
 
struct brp_mempool_object_t * brp_mempool
mempool handle. 
 
brp_errcode brp_Pki_GetX509Csr(brp_protocol protocol, brp_buf *Csr, size_t *Csr_len, brp_mempool *mempool)
Every reader is shipped with a unique ECC P-256 key, generated at the time of manufacturing. 
 
brp_errcode brp_Pki_PfsAuthHostCert(brp_protocol protocol, brp_buf EncryptedPayload, size_t EncryptedPayload_len)
This command authenticates the host's certificate chain to the reader. 
 
brp_errcode brp_Pki_PfsAuthRdrCert(brp_protocol protocol, brp_buf *EncryptedResponse, size_t *EncryptedResponse_len, brp_mempool *mempool)
After successfully authenticating the host against the reader using the brp_Pki_PfsAuthHostCert() com...
 
brp_errcode brp_Pki_PfsGenKey(brp_protocol protocol, brp_buf TmpHostPubKey, size_t TmpHostPubKey_len, brp_buf *TmpRdrPubKey, size_t *TmpRdrPubKey_len, brp_mempool *mempool)
This command prepares a perfect forward secrecy (PFS) session by exchanging the public part of tempor...
 
brp_errcode brp_Pki_StoreX509Cert(brp_protocol protocol, unsigned SecLevel, brp_buf Cert, size_t Cert_len)
After signing a CSR using the brp_Pki_GetX509Csr() command, run this command to store the resulting i...
 
unsigned char * brp_buf
represents a pointer to a protocol data buffer. 
 
brp_errcode brp_Pki_StoreX509RootCert(brp_protocol protocol, unsigned SecLevel, brp_buf Cert, size_t Cert_len)
Every security level that should be usable with the PKI must be provided with a root certificate...