![]() |
API参考
|
TLS session 更多...

宏定义 | |
| #define | HITLS_SESSION_ID_CTX_MAX_SIZE 32u |
| Session id Maximum size of the CTX. | |
| #define | HITLS_SESSION_ID_MAX_SIZE 32u |
| Maximum size of a session ID | |
类型定义 | |
| typedef int32_t(* | HITLS_NewSessionCb) (HITLS_Ctx *ctx, HITLS_Session *session) |
| This callback is called when a new session is negotiated. Users can use sessions. | |
| typedef void(* | HITLS_SessionRemoveCb) (HITLS_Config *config, HITLS_Session *sess) |
| Remove a session. | |
| typedef HITLS_Session *(* | HITLS_SessionGetCb) (HITLS_Ctx *ctx, const uint8_t *data, int32_t len, int32_t *copy) |
| Get a session based on the session ID. | |
| typedef int32_t(* | HITLS_SessionTicketExtProcessCb) (HITLS_Ctx *ctx, const uint8_t *data, int32_t len, void *arg) |
| Session ticket extension callback. | |
| typedef int32_t(* | HITLS_TicketKeyCb) (uint8_t *keyName, uint32_t keyNameSize, HITLS_CipherParameters *cipher, uint8_t isEncrypt) |
| Obtain and verify ticket_key on the server. | |
函数 | |
| int32_t | HITLS_CFG_SetSessionTicketSupport (HITLS_Config *config, bool support) |
| Set whether to support the session ticket function. | |
| int32_t | HITLS_CFG_GetSessionTicketSupport (const HITLS_Config *config, bool *isSupport) |
| Query whether the session ticket function is supported. | |
| int32_t | HITLS_CFG_SetTicketNums (HITLS_Config *config, uint32_t ticketNums) |
| Setting TLS1.3, number of new session tickets sent after a complete link is established. | |
| uint32_t | HITLS_CFG_GetTicketNums (HITLS_Config *config) |
| Obtain TLS1.3, number of new session tickets sent after complete link establishment. | |
| int32_t | HITLS_SetTicketNums (HITLS_Ctx *ctx, uint32_t ticketNums) |
| Setting TLS1.3, number of new session tickets sent after complete link establishment | |
| uint32_t | HITLS_GetTicketNums (HITLS_Ctx *ctx) |
| Obtain TLS1.3, Number of new session tickets sent after complete link establishment. | |
| int32_t | HITLS_CFG_SetNewSessionCb (HITLS_Config *config, const HITLS_NewSessionCb newSessionCb) |
| Set a callback for negotiating a new session call. | |
| int32_t | HITLS_CFG_SetSessionGetCb (HITLS_Config *config, const HITLS_SessionGetCb sessionGetCb) |
| Set a callback for obtaining a session based on the session ID. | |
| int32_t | HITLS_CFG_SetSessionRemoveCb (HITLS_Config *config, const HITLS_SessionRemoveCb sessionRemoveCb) |
| Set a callback for removing a session. | |
| int32_t | HITLS_SetSessionTicketExtProcessCb (HITLS_Ctx *ctx, const HITLS_SessionTicketExtProcessCb sessionTicketExtCb, void *arg) |
| Set a callback for processing the session ticket extension. | |
| int32_t | HITLS_SetSessionTicketExtData (HITLS_Ctx *ctx, uint8_t *data, uint32_t dataSize) |
| Set the session ticket extension data. | |
| int32_t | HITLS_CFG_SetTicketKeyCallback (HITLS_Config *config, HITLS_TicketKeyCb callback) |
| Set the ticket key callback, which is used only by the server, cb can be NULL. | |
| int32_t | HITLS_CFG_GetSessionTicketKey (const HITLS_Config *config, uint8_t *key, uint32_t keySize, uint32_t *outSize) |
| Obtain the default ticket key of the HiTLS. The key is used to encrypt and decrypt the ticket in the new session ticket when the HITLS_TicketKeyCb callback function is not set. | |
| int32_t | HITLS_CFG_SetSessionTicketKey (HITLS_Config *config, const uint8_t *key, uint32_t keySize) |
| Set the default ticket key of the HiTLS. The key is used to encrypt and decrypt tickets in the new session ticket when the HITLS_TicketKeyCb callback function is not set. | |
| int32_t | HITLS_CFG_SetSessionIdCtx (HITLS_Config *config, const uint8_t *sessionIdCtx, uint32_t len) |
| Set the user-specific session ID ctx, only on the server. | |
| int32_t | HITLS_CFG_SetSessionCacheMode (HITLS_Config *config, uint32_t mode) |
| Set the session cache mode. | |
| int32_t | HITLS_CFG_GetSessionCacheMode (HITLS_Config *config, uint32_t *mode) |
| Obtain the session cache mode. | |
| int32_t | HITLS_CFG_SetSessionCacheSize (HITLS_Config *config, uint32_t size) |
| Set the maximum number of sessions in the session cache. | |
| int32_t | HITLS_CFG_GetSessionCacheSize (HITLS_Config *config, uint32_t *size) |
| Obtain the maximum number of sessions in the session cache. | |
| int32_t | HITLS_CFG_SetSessionTimeout (HITLS_Config *config, uint64_t timeout) |
| Set the session timeout interval. | |
| int32_t | HITLS_CFG_GetSessionTimeout (const HITLS_Config *config, uint64_t *timeout) |
| Obtain the timeout interval of a session. | |
| int32_t | HITLS_IsSessionReused (HITLS_Ctx *ctx, bool *isReused) |
| Whether the link is multiplexed with a session | |
| int32_t | HITLS_SetSessionIdCtx (HITLS_Ctx *ctx, const uint8_t *sessionIdCtx, uint32_t len) |
| Set the user-specific session ID ctx of the HiTLS link, only on the server. | |
| int32_t | HITLS_GetSessionTicketKey (const HITLS_Ctx *ctx, uint8_t *key, uint32_t keySize, uint32_t *outSize) |
| Obtain the default ticket key of the HiTLS. The key is used to encrypt and decrypt the ticket in the new session ticket when the HITLS_TicketKeyCb callback function is not set. | |
| int32_t | HITLS_SetSessionTicketKey (HITLS_Ctx *ctx, const uint8_t *key, uint32_t keySize) |
| Set the default ticket key of the HiTLS. The key is used to encrypt and decrypt the ticket in the new session ticket when the HITLS_TicketKeyCb callback function is not set. | |
| int32_t | HITLS_SetSession (HITLS_Ctx *ctx, HITLS_Session *session) |
| Set the handle for the session information about the HiTLS link. | |
| HITLS_Session * | HITLS_GetSession (const HITLS_Ctx *ctx) |
| Obtain the handle of the session information and directly obtain the pointer. | |
| HITLS_Session * | HITLS_GetDupSession (HITLS_Ctx *ctx) |
| Obtain the handle of the copied session information. | |
| HITLS_Session * | HITLS_SESS_New (void) |
| Apply for a new session. | |
| HITLS_Session * | HITLS_SESS_Dup (HITLS_Session *sess) |
| Duplicate a session, the number of reference times increases by 1. | |
| void | HITLS_SESS_Free (HITLS_Session *sess) |
| Release the session information handle. | |
| int32_t | HITLS_SESS_SetMasterKey (HITLS_Session *sess, const uint8_t *masterKey, uint32_t masterKeySize) |
| Set the master key of a session. | |
| uint32_t | HITLS_SESS_GetMasterKeyLen (const HITLS_Session *sess) |
| Obtain the master key length of a session. | |
| int32_t | HITLS_SESS_GetMasterKey (const HITLS_Session *sess, uint8_t *masterKey, uint32_t *masterKeySize) |
| Obtain the master key of a session. | |
| int32_t | HITLS_SESS_GetProtocolVersion (const HITLS_Session *sess, uint16_t *version) |
| Obtain the session protocol version. | |
| int32_t | HITLS_SESS_SetProtocolVersion (HITLS_Session *sess, uint16_t version) |
| Set the session protocol version. | |
| int32_t | HITLS_SESS_SetCipherSuite (HITLS_Session *sess, uint16_t cipherSuite) |
| Set the session password suite. | |
| int32_t | HITLS_SESS_GetCipherSuite (const HITLS_Session *sess, uint16_t *cipherSuite) |
| Obtain the session password suite. | |
| int32_t | HITLS_SESS_SetSessionIdCtx (HITLS_Session *sess, uint8_t *sessionIdCtx, uint32_t sessionIdCtxSize) |
| Set the session ID ctx. | |
| int32_t | HITLS_SESS_GetSessionIdCtx (const HITLS_Session *sess, uint8_t *sessionIdCtx, uint32_t *sessionIdCtxSize) |
| Obtain the session ID ctx. | |
| int32_t | HITLS_SESS_SetSessionId (HITLS_Session *sess, uint8_t *sessionId, uint32_t sessionIdSize) |
| Set the session ID. | |
| int32_t | HITLS_SESS_GetSessionId (const HITLS_Session *sess, uint8_t *sessionId, uint32_t *sessionIdSize) |
| Obtain the session ID. | |
| int32_t | HITLS_SESS_SetHaveExtMasterSecret (HITLS_Session *sess, uint8_t haveExtMasterSecret) |
| Set whether to contain the master key extension. | |
| int32_t | HITLS_SESS_GetHaveExtMasterSecret (HITLS_Session *sess, bool *haveExtMasterSecret) |
| Obtain the master key extension. | |
| int32_t | HITLS_SESS_SetTimeout (HITLS_Session *sess, uint64_t timeout) |
| Set the timeout interval, in seconds. | |
| uint64_t | HITLS_SESS_GetTimeout (HITLS_Session *sess) |
| Get the timeout interval, in seconds. | |
| bool | HITLS_SESS_IsResumable (const HITLS_Session *sess) |
| Check whether the session can be recovered. Only simple check is performed, but the validity period is not checked. | |
| bool | HITLS_SESS_HasTicket (const HITLS_Session *sess) |
| Check whether the session has a ticket. | |
| void * | HITLS_SESS_GetUserData (const HITLS_Session *sess) |
| Obtain the user data in the session object. | |
| int32_t | HITLS_SESS_SetUserData (HITLS_Session *sess, void *userData) |
| Set the user data in the session object. | |
| int32_t | HITLS_CFG_ClearTimeoutSession (HITLS_Config *config, uint64_t nowTime) |
| Clear the timeout session. | |
| int32_t | HITLS_CFG_RemoveSession (HITLS_Config *config, HITLS_Session *sess) |
| Remove the session. | |
TLS session
| typedef int32_t(* HITLS_NewSessionCb) (HITLS_Ctx *ctx, HITLS_Session *session) |
This callback is called when a new session is negotiated. Users can use sessions.
| ctx | [IN] ctx context |
| session | [IN] Session handle |
| 1 | Success. If a user removes a session, the user needs to release the session handle. |
| 0 | failed. The user does not use the session. |
| typedef HITLS_Session *(* HITLS_SessionGetCb) (HITLS_Ctx *ctx, const uint8_t *data, int32_t len, int32_t *copy) |
Get a session based on the session ID.
| ctx | [IN] Context |
| data | [IN] Session ID data |
| len | [IN] Session ID length |
| copy | [OUT] Whether to copy the session. 1: copy; 0: do not copy |
| Session | handle, if successful. NULL, if failure. |
| typedef void(* HITLS_SessionRemoveCb) (HITLS_Config *config, HITLS_Session *sess) |
Remove a session.
| ctx | [IN] Context |
| sess | [IN] Session |
| typedef int32_t(* HITLS_SessionTicketExtProcessCb) (HITLS_Ctx *ctx, const uint8_t *data, int32_t len, void *arg) |
Session ticket extension callback.
| ctx | [IN] ctx context |
| data | [IN] Session ticket extension data |
| len | [IN] Session ticket extension data length |
| arg | [IN] User-defined parameter |
| 1,if | successful. |
| For | other error codes, see hitls_error.h |
| typedef int32_t(* HITLS_TicketKeyCb) (uint8_t *keyName, uint32_t keyNameSize, HITLS_CipherParameters *cipher, uint8_t isEncrypt) |
Obtain and verify ticket_key on the server.
| keyName | [IN/OUT] name values corresponding to aes_key and hmac_key |
| keyNameSize | [IN] length of keyName |
| cipher | [IN/OUT] Encryption information |
| isEncrypt | [IN] Indicates whether to encrypt data. true: encrypt data. false: decrypt data. |
| int32_t HITLS_CFG_ClearTimeoutSession | ( | HITLS_Config * | config, |
| uint64_t | nowTime ) |
Clear the timeout session.
| config | [IN] Configuration handle. |
| nowTime | [IN] Current time. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_CFG_GetSessionCacheMode | ( | HITLS_Config * | config, |
| uint32_t * | mode ) |
Obtain the session cache mode.
| config | [IN] config Context. |
| mode | [OUT] Cache mode, corresponding to the HITLS_SESS_CACHE_MODE enumerated value. |
| int32_t HITLS_CFG_GetSessionCacheSize | ( | HITLS_Config * | config, |
| uint32_t * | size ) |
Obtain the maximum number of sessions in the session cache.
| config | [IN] Config context. |
| size | [OUT] Maximum number of sessions in the cache. |
| int32_t HITLS_CFG_GetSessionTicketKey | ( | const HITLS_Config * | config, |
| uint8_t * | key, | ||
| uint32_t | keySize, | ||
| uint32_t * | outSize ) |
Obtain the default ticket key of the HiTLS. The key is used to encrypt and decrypt the ticket in the new session ticket when the HITLS_TicketKeyCb callback function is not set.
| config | [IN] Config Context. |
| key | [OUT] Obtained ticket key. |
| keySize | [IN] Size of the key array. |
| outSize | [OUT] Size of the obtained ticket key. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_CFG_GetSessionTicketSupport | ( | const HITLS_Config * | config, |
| bool * | isSupport ) |
Query whether the session ticket function is supported.
| config | [IN] Config handle |
| isSupport | [OUT] Whether to support the session ticket. |
| HITLS_SUCCESS,if | successful. |
| HITLS_NULL_INPUT,config | is null. |
| int32_t HITLS_CFG_GetSessionTimeout | ( | const HITLS_Config * | config, |
| uint64_t * | timeout ) |
Obtain the timeout interval of a session.
| config | [IN] Config context. |
| timeout | [OUT] Session timeout interval, in seconds. |
| uint32_t HITLS_CFG_GetTicketNums | ( | HITLS_Config * | config | ) |
Obtain TLS1.3, number of new session tickets sent after complete link establishment.
| config | [IN] config handle |
| int32_t HITLS_CFG_RemoveSession | ( | HITLS_Config * | config, |
| HITLS_Session * | sess ) |
Remove the session.
| config | [IN] Configuration handle. |
| sess | [IN] Session information handle. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_CFG_SetNewSessionCb | ( | HITLS_Config * | config, |
| const HITLS_NewSessionCb | newSessionCb ) |
Set a callback for negotiating a new session call.
| config | [OUT] config handle |
| newSessionCb | [IN] Callback. |
| HITLS_SUCCESS,if | successful. |
| HITLS_NULL_INPUT,config | is null. |
| int32_t HITLS_CFG_SetSessionCacheMode | ( | HITLS_Config * | config, |
| uint32_t | mode ) |
Set the session cache mode.
| config | [OUT] Config context. |
| mode | [IN] Cache mode, corresponding to the HITLS_SESS_CACHE_MODE enumerated value. |
| int32_t HITLS_CFG_SetSessionCacheSize | ( | HITLS_Config * | config, |
| uint32_t | size ) |
Set the maximum number of sessions in the session cache.
| config | [OUT] Config context. |
| size | [IN] Maximum number of sessions in the cache. |
| int32_t HITLS_CFG_SetSessionGetCb | ( | HITLS_Config * | config, |
| const HITLS_SessionGetCb | sessionGetCb ) |
Set a callback for obtaining a session based on the session ID.
| config | [OUT] config handle |
| sessionGetCb | [IN] Callback. |
| HITLS_SUCCESS,if | successful. |
| HITLS_NULL_INPUT,config | is null. |
| int32_t HITLS_CFG_SetSessionIdCtx | ( | HITLS_Config * | config, |
| const uint8_t * | sessionIdCtx, | ||
| uint32_t | len ) |
Set the user-specific session ID ctx, only on the server.
| config | [OUT] Config context. |
| sessionIdCtx | [IN] Session ID Context. |
| len | [IN] Session id context length, a maximum of 32 bytes. |
| int32_t HITLS_CFG_SetSessionRemoveCb | ( | HITLS_Config * | config, |
| const HITLS_SessionRemoveCb | sessionRemoveCb ) |
Set a callback for removing a session.
| config | [OUT] config handle |
| sessionRemoveCb | [IN] Callback. |
| HITLS_SUCCESS,if | successful. |
| HITLS_NULL_INPUT,config | is null. |
| int32_t HITLS_CFG_SetSessionTicketKey | ( | HITLS_Config * | config, |
| const uint8_t * | key, | ||
| uint32_t | keySize ) |
Set the default ticket key of the HiTLS. The key is used to encrypt and decrypt tickets in the new session ticket when the HITLS_TicketKeyCb callback function is not set.
| config | [OUT] Config Context. |
| key | [IN] Ticket key to be set. |
| keySize | [IN] Size of the ticket key. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_CFG_SetSessionTicketSupport | ( | HITLS_Config * | config, |
| bool | support ) |
Set whether to support the session ticket function.
| config | [OUT] Config handle |
| support | [IN] Whether to support the session ticket. The options are as follows: true: yes; false: no. |
| HITLS_SUCCESS,if | successful. |
| HITLS_NULL_INPUT,config | is null. |
| int32_t HITLS_CFG_SetSessionTimeout | ( | HITLS_Config * | config, |
| uint64_t | timeout ) |
Set the session timeout interval.
| config | [OUT] Config context. |
| timeout | [IN] Session timeout interval, in seconds. |
| int32_t HITLS_CFG_SetTicketKeyCallback | ( | HITLS_Config * | config, |
| HITLS_TicketKeyCb | callback ) |
Set the ticket key callback, which is used only by the server, cb can be NULL.
| config | [OUT] Config Context |
| callback | [IN] Ticket key callback |
| int32_t HITLS_CFG_SetTicketNums | ( | HITLS_Config * | config, |
| uint32_t | ticketNums ) |
Setting TLS1.3, number of new session tickets sent after a complete link is established.
This interface should be called before handshake. The default number is 2. If the number is greater than or equal to 1, only one ticket is sent after the session is resumed. When this parameter is set to 0, the ticket is not sent for the complete handshake and session resumption.
| config | [OUT] Config handle |
| ticketNums | [IN] Number of new session tickets sent. |
| HITLS_SUCCESS,if | successful. |
| HITLS_NULL_INPUT,config | is empty. |
| HITLS_Session * HITLS_GetDupSession | ( | HITLS_Ctx * | ctx | ) |
Obtain the handle of the copied session information.
| ctx | [IN] TLS connection handle |
| HITLS_Session * HITLS_GetSession | ( | const HITLS_Ctx * | ctx | ) |
Obtain the handle of the session information and directly obtain the pointer.
| ctx | [IN] TLS connection handle |
| int32_t HITLS_GetSessionTicketKey | ( | const HITLS_Ctx * | ctx, |
| uint8_t * | key, | ||
| uint32_t | keySize, | ||
| uint32_t * | outSize ) |
Obtain the default ticket key of the HiTLS. The key is used to encrypt and decrypt the ticket in the new session ticket when the HITLS_TicketKeyCb callback function is not set.
| ctx | [OUT] TLS connection handle |
| key | [OUT] Obtained ticket key |
| keySize | [IN] Size of the key array |
| outSize | [OUT] Size of the obtained ticket key. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| uint32_t HITLS_GetTicketNums | ( | HITLS_Ctx * | ctx | ) |
Obtain TLS1.3, Number of new session tickets sent after complete link establishment.
| ctx | [IN] ctx context |
| int32_t HITLS_IsSessionReused | ( | HITLS_Ctx * | ctx, |
| bool * | isReused ) |
Whether the link is multiplexed with a session
| ctx | [IN] config Context. |
| isReused | [OUT] Indicates whether to reuse a session. |
| HITLS_Session * HITLS_SESS_Dup | ( | HITLS_Session * | sess | ) |
Duplicate a session, the number of reference times increases by 1.
| sess | [IN] Session information handle |
| void HITLS_SESS_Free | ( | HITLS_Session * | sess | ) |
Release the session information handle.
| sess | [IN] Session information handle |
| void |
| int32_t HITLS_SESS_GetCipherSuite | ( | const HITLS_Session * | sess, |
| uint16_t * | cipherSuite ) |
Obtain the session password suite.
| sess | [IN] Session information handle. |
| cipherSuite | [OUT] Cipher suite. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_GetHaveExtMasterSecret | ( | HITLS_Session * | sess, |
| bool * | haveExtMasterSecret ) |
Obtain the master key extension.
| sess | [IN] Session information handle. |
| haveExtMasterSecret | [OUT] Whether the master key extension is contained. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_GetMasterKey | ( | const HITLS_Session * | sess, |
| uint8_t * | masterKey, | ||
| uint32_t * | masterKeySize ) |
Obtain the master key of a session.
| sess | [IN] Session information handle. |
| masterKey | [OUT] Master key. |
| masterKeySize | [OUT] Size of the master key. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| uint32_t HITLS_SESS_GetMasterKeyLen | ( | const HITLS_Session * | sess | ) |
Obtain the master key length of a session.
| sess | [IN] Session information handle |
| int32_t HITLS_SESS_GetProtocolVersion | ( | const HITLS_Session * | sess, |
| uint16_t * | version ) |
Obtain the session protocol version.
| sess | [IN] Session information handle. |
| version | [OUT] Protocol version. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_GetSessionId | ( | const HITLS_Session * | sess, |
| uint8_t * | sessionId, | ||
| uint32_t * | sessionIdSize ) |
Obtain the session ID.
| sess | [IN] Session information handle |
| sessionId | [OUT] Session id |
| sessionIdSize | [OUT] Session ID length |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_GetSessionIdCtx | ( | const HITLS_Session * | sess, |
| uint8_t * | sessionIdCtx, | ||
| uint32_t * | sessionIdCtxSize ) |
Obtain the session ID ctx.
| sess | [IN] Session information handle. |
| sessionIdCtx | [OUT] Session ID Context. |
| sessionIdCtxSize | [OUT] Session id Context length. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| uint64_t HITLS_SESS_GetTimeout | ( | HITLS_Session * | sess | ) |
Get the timeout interval, in seconds.
| sess | [OUT] Session information handle |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| void * HITLS_SESS_GetUserData | ( | const HITLS_Session * | sess | ) |
Obtain the user data in the session object.
| sess | [IN] Pointer to the HITLS session to be printed. |
| bool HITLS_SESS_HasTicket | ( | const HITLS_Session * | sess | ) |
Check whether the session has a ticket.
| sess | [IN] Session information handle |
| bool HITLS_SESS_IsResumable | ( | const HITLS_Session * | sess | ) |
Check whether the session can be recovered. Only simple check is performed, but the validity period is not checked.
| sess | [IN] Session information handle. |
| HITLS_Session * HITLS_SESS_New | ( | void | ) |
Apply for a new session.
| void |
| int32_t HITLS_SESS_SetCipherSuite | ( | HITLS_Session * | sess, |
| uint16_t | cipherSuite ) |
Set the session password suite.
| sess | [OUT] Session information handle. |
| cipherSuite | [IN] Password suite. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_SetHaveExtMasterSecret | ( | HITLS_Session * | sess, |
| uint8_t | haveExtMasterSecret ) |
Set whether to contain the master key extension.
| sess | [OUT] Session information handle. |
| haveExtMasterSecret | [IN] Whether the master key extension is include. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_SetMasterKey | ( | HITLS_Session * | sess, |
| const uint8_t * | masterKey, | ||
| uint32_t | masterKeySize ) |
Set the master key of a session.
| sess | [OUT] Session information handle. |
| masterKey | [IN] Master key. |
| masterKeySize | [IN] Size of the master key. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_SetProtocolVersion | ( | HITLS_Session * | sess, |
| uint16_t | version ) |
Set the session protocol version.
| sess | [OUT] Session information handle |
| version | [IN] Protocol version |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_SetSessionId | ( | HITLS_Session * | sess, |
| uint8_t * | sessionId, | ||
| uint32_t | sessionIdSize ) |
Set the session ID.
| sess | [OUT] Session information handle. |
| sessionId | [IN] Session id. |
| sessionIdSize | [IN] The session ID contains a maximum of 32 bytes. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_SetSessionIdCtx | ( | HITLS_Session * | sess, |
| uint8_t * | sessionIdCtx, | ||
| uint32_t | sessionIdCtxSize ) |
Set the session ID ctx.
| sess | [OUT] Session information handle. |
| sessionIdCtx | [IN] Session ID Context. |
| sessionIdCtxSize | [IN] Session ID Context length. The maximum length is 32 bytes. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_SetTimeout | ( | HITLS_Session * | sess, |
| uint64_t | timeout ) |
Set the timeout interval, in seconds.
| sess | [OUT] Session information handle |
| timeout | [IN] Timeout interval, in seconds. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SESS_SetUserData | ( | HITLS_Session * | sess, |
| void * | userData ) |
Set the user data in the session object.
| userData | [IN] Pointer to the user data. |
| sess | [IN] Pointer to the HITLS session to be printed. |
| HITLS_SUCCESS | if successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SetSession | ( | HITLS_Ctx * | ctx, |
| HITLS_Session * | session ) |
Set the handle for the session information about the HiTLS link.
| ctx | [OUT] TLS connection handle |
| session | [IN] Session information handle. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SetSessionIdCtx | ( | HITLS_Ctx * | ctx, |
| const uint8_t * | sessionIdCtx, | ||
| uint32_t | len ) |
Set the user-specific session ID ctx of the HiTLS link, only on the server.
| ctx | [OUT] Config context. |
| sessionIdCtx | [IN] Session ID Context. |
| len | [IN] Session ID context length, which cannot exceed 32 bytes. |
| int32_t HITLS_SetSessionTicketExtData | ( | HITLS_Ctx * | ctx, |
| uint8_t * | data, | ||
| uint32_t | dataSize ) |
Set the session ticket extension data.
| ctx | [OUT] config handle |
| data | [IN] Session ticket extension data. |
| dataSize | [IN] Size of the session ticket extension data. |
| HITLS_SUCCESS,if | successful. |
| HITLS_NULL_INPUT,config | is null. |
| HITLS_MEMCPY_FAIL,memory | copy fails. |
| int32_t HITLS_SetSessionTicketExtProcessCb | ( | HITLS_Ctx * | ctx, |
| const HITLS_SessionTicketExtProcessCb | sessionTicketExtCb, | ||
| void * | arg ) |
Set a callback for processing the session ticket extension.
| ctx | [OUT] config handle |
| extSessionTicketCb | [IN] Callback. |
| arg | [IN] User-defined parameter |
| HITLS_SUCCESS,if | successful. |
| HITLS_NULL_INPUT,config | is null. |
| int32_t HITLS_SetSessionTicketKey | ( | HITLS_Ctx * | ctx, |
| const uint8_t * | key, | ||
| uint32_t | keySize ) |
Set the default ticket key of the HiTLS. The key is used to encrypt and decrypt the ticket in the new session ticket when the HITLS_TicketKeyCb callback function is not set.
| ctx | [OUT] TLS connection handle. |
| key | [IN] Ticket key to be set. |
| keySize | [IN] Size of the ticket key. |
| HITLS_SUCCESS,if | successful. |
| For | other error codes, see hitls_error.h. |
| int32_t HITLS_SetTicketNums | ( | HITLS_Ctx * | ctx, |
| uint32_t | ticketNums ) |
Setting TLS1.3, number of new session tickets sent after complete link establishment
This interface should be called before handshake. The default number is 2. If the number is greater than or equal to 1, only one ticket is sent after the session is resumed. When this parameter is set to 0, tickets will not be sent for the complete handshake and session recovery.
| ctx | [OUT] ctx context |
| ticketNums | [IN] Number of sent new session tickets. |
| HITLS_SUCCESS,if | successful. |
| HITLS_NULL_INPUT,ctx | is null. |