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 later using brp_pki_restore_session().

This command freezes the current session, e.g. in a database, and finishes the current process. When the device is reconnected later, you can use brp_pki_restore_session() to restore the session without having to re-authenticate (which requires about 30 secs).

ATTENTION:

  • The protocol must be in idle state (no command must be executed).
  • If you run a BRP command after brp_pki_save_session(), you have to save the session 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.