| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "SSL_SESSION_GET_TIME 3SSL" |
| 58 |
.TH SSL_SESSION_GET_TIME 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
SSL_SESSION_get_time, SSL_SESSION_set_time, SSL_SESSION_get_timeout, |
| 65 |
SSL_SESSION_set_timeout, SSL_SESSION_get_time_ex, SSL_SESSION_set_time_ex, |
| 66 |
SSL_get_time, SSL_set_time, SSL_get_timeout, SSL_set_timeout |
| 67 |
\&\- retrieve and manipulate session time and timeout settings |
| 68 |
.SH SYNOPSIS |
| 69 |
.IX Header "SYNOPSIS" |
| 70 |
.Vb 1 |
| 71 |
\& #include <openssl/ssl.h> |
| 72 |
\& |
| 73 |
\& long SSL_SESSION_get_timeout(const SSL_SESSION *s); |
| 74 |
\& long SSL_SESSION_set_timeout(SSL_SESSION *s, long tm); |
| 75 |
\& |
| 76 |
\& long SSL_get_timeout(const SSL_SESSION *s); |
| 77 |
\& long SSL_set_timeout(SSL_SESSION *s, long tm); |
| 78 |
\& |
| 79 |
\& time_t SSL_SESSION_get_time_ex(const SSL_SESSION *s); |
| 80 |
\& time_t SSL_SESSION_set_time_ex(SSL_SESSION *s, time_t tm); |
| 81 |
.Ve |
| 82 |
.PP |
| 83 |
The following functions have been deprecated since OpenSSL 3.4, and can be |
| 84 |
hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value, |
| 85 |
see \fBopenssl_user_macros\fR\|(7): |
| 86 |
.PP |
| 87 |
.Vb 4 |
| 88 |
\& long SSL_SESSION_get_time(const SSL_SESSION *s); |
| 89 |
\& long SSL_SESSION_set_time(SSL_SESSION *s, long tm); |
| 90 |
\& long SSL_get_time(const SSL_SESSION *s); |
| 91 |
\& long SSL_set_time(SSL_SESSION *s, long tm); |
| 92 |
.Ve |
| 93 |
.SH DESCRIPTION |
| 94 |
.IX Header "DESCRIPTION" |
| 95 |
\&\fBSSL_SESSION_get_time_ex()\fR returns the time at which the session \fBs\fR was |
| 96 |
established. The time is given in seconds since the Epoch and therefore |
| 97 |
compatible to the time delivered by the \fBtime()\fR call. |
| 98 |
.PP |
| 99 |
\&\fBSSL_SESSION_set_time_ex()\fR replaces the creation time of the session \fBs\fR with |
| 100 |
the chosen value \fBtm\fR. |
| 101 |
.PP |
| 102 |
\&\fBSSL_SESSION_get_timeout()\fR returns the timeout value set for session \fBs\fR |
| 103 |
in seconds. |
| 104 |
.PP |
| 105 |
\&\fBSSL_SESSION_set_timeout()\fR sets the timeout value for session \fBs\fR in seconds |
| 106 |
to \fBtm\fR. |
| 107 |
.PP |
| 108 |
\&\fBSSL_SESSION_get_time()\fR and \fBSSL_SESSION_set_time()\fR functions use |
| 109 |
the long datatype instead of time_t and are therefore deprecated due to not |
| 110 |
being Y2038\-safe on 32 bit systems. Note that such systems still need |
| 111 |
to be configured to use 64 bit time_t to be able to avoid overflow in system time. |
| 112 |
.PP |
| 113 |
The \fBSSL_get_time()\fR, \fBSSL_set_time()\fR, \fBSSL_get_timeout()\fR, and \fBSSL_set_timeout()\fR |
| 114 |
functions are synonyms for the SSL_SESSION_*() counterparts. |
| 115 |
.SH NOTES |
| 116 |
.IX Header "NOTES" |
| 117 |
Sessions are expired by examining the creation time and the timeout value. |
| 118 |
Both are set at creation time of the session to the actual time and the |
| 119 |
default timeout value at creation, respectively, as set by |
| 120 |
\&\fBSSL_CTX_set_timeout\fR\|(3). |
| 121 |
Using these functions it is possible to extend or shorten the lifetime |
| 122 |
of the session. |
| 123 |
.SH "RETURN VALUES" |
| 124 |
.IX Header "RETURN VALUES" |
| 125 |
\&\fBSSL_SESSION_get_time_ex()\fR and \fBSSL_SESSION_get_timeout()\fR return the currently |
| 126 |
valid values. |
| 127 |
.PP |
| 128 |
\&\fBSSL_SESSION_set_time_ex()\fR returns time on success. |
| 129 |
.PP |
| 130 |
\&\fBSSL_SESSION_set_timeout()\fR returns 1 on success. |
| 131 |
.PP |
| 132 |
If any of the function is passed the NULL pointer for the session \fBs\fR, |
| 133 |
0 is returned. |
| 134 |
.SH BUGS |
| 135 |
.IX Header "BUGS" |
| 136 |
The data type long is typically 32 bits on many systems, hence the old |
| 137 |
functions \fBSSL_SESSION_get_time()\fR and \fBSSL_SESSION_set_time()\fR are not always |
| 138 |
Y2038 safe. |
| 139 |
.SH "SEE ALSO" |
| 140 |
.IX Header "SEE ALSO" |
| 141 |
\&\fBssl\fR\|(7), |
| 142 |
\&\fBSSL_CTX_set_timeout\fR\|(3), |
| 143 |
\&\fBSSL_get_default_timeout\fR\|(3) |
| 144 |
.SH HISTORY |
| 145 |
.IX Header "HISTORY" |
| 146 |
The functions \fBSSL_SESSION_get_time_ex()\fR and \fBSSL_SESSION_set_time_ex()\fR were |
| 147 |
added in OpenSSL 3.3. |
| 148 |
.SH COPYRIGHT |
| 149 |
.IX Header "COPYRIGHT" |
| 150 |
Copyright 2001\-2024 The OpenSSL Project Authors. All Rights Reserved. |
| 151 |
.PP |
| 152 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 153 |
this file except in compliance with the License. You can obtain a copy |
| 154 |
in the file LICENSE in the source distribution or at |
| 155 |
<https://www.openssl.org/source/license.html>. |