C API for BALTECH SDK

§ 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 in future by brp_pki_restore_session().

This command allows to freeze the current session i.e. in a database and finishing the current process. When the device is reconnected at a later point in time one can use brp_pki_restore_session() to restore the session without the need of reauthentication (which requires about 30secs).

ATTENTION:

  • the protocol must be in idle state (no command must be executed).
  • if a BRP command is run after brp_pki_save_session() the session has to be saved again (by running brp_pki_save_session()). Otherwise restoring the session will fail.
Returns
BRP_OK on success or BRP_ERR_BUFFER_OVERFLOW if persistent_session_size is smaller than persistent_session_len.
Parameters
protocola pki protocol handle, that shall be saved
persistent_bufa pointer to a buffer where to store the session. If NULL, persistent_buf_size has to be 0, too (persistent_buf_len will be set anyway)
peristent_buf_sizesize of persistent_session in bytes
persistent_buf_actlenactual length of persistent_session in bytes. If NULL, this parameter will be ignored.