Skip to content

SSL_copy_session_id

NAME

SSL_copy_session_id - copy the session and configuration of one SSL object to another

SYNOPSIS

#include <openssl/ssl.h>

The following function has been deprecated since OpenSSL 4.2, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int SSL_copy_session_id(SSL *to, const SSL *from);

DESCRIPTION

SSL_copy_session_id() sets the session of to to the session of from, as SSL_set_session(3) would. It also gives to the SSL method, session ID context and certificate configuration of from. The two objects share the certificate configuration, so later changes made to it through either object affect both.

to and from must have been created from the same SSL_CTX, or from SSL_CTX objects with the same providers loaded. Otherwise SSL_copy_session_id() may fail.

RETURN VALUES

SSL_copy_session_id() returns 1 on success and 0 on failure.

NOTES

This function is deprecated. To resume a session on a new connection, use SSL_set_session(3). To create a copy of an SSL object, use SSL_dup(3).

SEE ALSO

ssl(7), SSL_set_session(3), SSL_dup(3), BIO_f_ssl(3)

HISTORY

SSL_copy_session_id() was deprecated in OpenSSL 4.2.

Copyright 2026 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html.