.\" generated by cd2nroff 0.1 from curl_easy_ssls_import.md .TH curl_easy_ssls_import 3 "2026-10-31" libcurl .SH NAME curl_easy_ssls_import \- import SSL sessions .SH SYNOPSIS .nf #include CURLcode curl_easy_ssls_import(CURL *handle, const char *session_key, const unsigned char *shmac, size_t shmac_len, const unsigned char *sdata, size_t sdata_len); .fi .SH DESCRIPTION This function imports a previously exported SSL session ticket. \fBsdata\fP and \fBsdata_len\fP must always be provided. If \fBsession_key\fP is \fBNULL\fP, then \fBshmac\fP and \fBshmac_len\fP must be given as received during the export. See \fIcurl_easy_ssls_export(3)\fP for a description of those. Import of session tickets from other curl versions may fail due to changes in the handling of \fBshmac\fP or \fBsdata\fP. A session ticket which has already expired is silently discarded. The session key identifies origin and used TLS configurations. Configuration parameters identified by a file path are only matched to the path, not the file\(aqs content. It is the applications responsibility to handle updates to CA, CRL or key files, e.g. discarding previous sessions. Otherwise, imported sessions may establish trusted connections to servers that would fail to verify otherwise. Most TLS sessions handed out by servers have a short lifetime. If continued use of these sessions is acceptable can only be decided by the application. Also, TLS session that are tied to client authentication, e.g. a client certificate, are never exported by libcurl. .SH PROTOCOLS This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. only This option works only with the following TLS backends: GnuTLS, OpenSSL, mbedTLS and wolfSSL .SH EXAMPLE .nf extern unsigned char *shmac, *sdata; int main(void) { CURLSHcode sh; CURLSH *share = curl_share_init(); CURLcode result; CURL *curl; sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION); if(sh) printf("Error: %s\\n", curl_share_strerror(sh)); curl = curl_easy_init(); if(curl) { size_t hlen = 4, slen = 5; curl_easy_setopt(curl, CURLOPT_SHARE, share); /* read shmac and sdata from storage */ result = curl_easy_ssls_import(curl, NULL, shmac, hlen, sdata, slen); /* always cleanup */ curl_easy_cleanup(curl); } curl_share_cleanup(share); } .fi .SH AVAILABILITY Added in curl 8.12.0 .SH RETURN VALUE This function returns a CURLcode indicating success or error. CURLE_OK (0) means everything was OK, non\-zero means an error occurred, see \fIlibcurl\-errors(3)\fP. If \fICURLOPT_ERRORBUFFER(3)\fP was set with \fIcurl_easy_setopt(3)\fP there can be an error message stored in the error buffer when non\-zero is returned. .SH SEE ALSO .BR CURLOPT_SHARE (3), .BR curl_easy_ssls_export (3), .BR curl_share_setopt (3)