---
name: "SSL_CTX_use_serverinfo"
section: "3ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/SSL_CTX_use_serverinfo"
---

# SSL\_CTX\_use\_serverinfo(3ssl)

use serverinfo extension

## NAME

SSL\_CTX\_use\_serverinfo\_ex, SSL\_CTX\_use\_serverinfo, SSL\_CTX\_use\_serverinfo\_file - use serverinfo extension

## SYNOPSIS

```
 #include <openssl/ssl.h>
 int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version,
                               const unsigned char *serverinfo,
                               size_t serverinfo_length);
 int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo,
                            size_t serverinfo_length);
 int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file);
```

## DESCRIPTION

These functions load "serverinfo" TLS extensions into the SSL\_CTX. A "serverinfo" extension is returned in response to an empty ClientHello Extension.

**SSL\_CTX\_use\_serverinfo\_ex()** loads one or more serverinfo extensions from a byte array into **ctx**. The **version** parameter specifies the format of the byte array provided in **\*serverinfo** which is of length **serverinfo\_length**.

If **version** is **SSL\_SERVERINFOV2** then the extensions in the array must consist of a 4-byte context, a 2-byte Extension Type, a 2-byte length, and then length bytes of extension\_data. The context and type values have the same meaning as for **SSL\_CTX\_add\_custom\_ext**(3). If serverinfo is being loaded for extensions to be added to a Certificate message, then the extension will only be added for the first certificate in the message (which is always the end-entity certificate).

If **version** is **SSL\_SERVERINFOV1** then the extensions in the array must consist of a 2-byte Extension Type, a 2-byte length, and then length bytes of extension\_data. The type value has the same meaning as for **SSL\_CTX\_add\_custom\_ext**(3). The following default context value will be used in this case:

```
 SSL_EXT_TLS1_2_AND_BELOW_ONLY | SSL_EXT_CLIENT_HELLO
 | SSL_EXT_TLS1_2_SERVER_HELLO | SSL_EXT_IGNORE_ON_RESUMPTION
```

**SSL\_CTX\_use\_serverinfo()** does the same thing as **SSL\_CTX\_use\_serverinfo\_ex()** except that there is no **version** parameter so a default version of SSL\_SERVERINFOV1 is used instead.

**SSL\_CTX\_use\_serverinfo\_file()** loads one or more serverinfo extensions from **file** into **ctx**.  The extensions must be in PEM format.  Each extension must be in a format as described above for **SSL\_CTX\_use\_serverinfo\_ex()**.  Each PEM extension name must begin with the phrase "BEGIN SERVERINFOV2 FOR " for SSL\_SERVERINFOV2 data or "BEGIN SERVERINFO FOR " for SSL\_SERVERINFOV1 data.

If more than one certificate (RSA/DSA) is installed using **SSL\_CTX\_use\_certificate()**, the serverinfo extension will be loaded into the last certificate installed.  If e.g. the last item was an RSA certificate, the loaded serverinfo extension data will be loaded for that certificate.  To use the serverinfo extension for multiple certificates, **SSL\_CTX\_use\_serverinfo()** needs to be called multiple times, once **after** each time a certificate is loaded via a call to **SSL\_CTX\_use\_certificate()**.

## RETURN VALUES

On success, the functions return 1. On failure, the functions return 0.  Check out the error stack to find out the reason.

## SEE ALSO

[**ssl**(7)](/ssl/7.md)

## COPYRIGHT

Copyright 2013-2017 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\>.
