---
name: "SSL_get0_peer_rpk"
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_get0_peer_rpk"
---

# SSL\_get0\_peer\_rpk(3ssl)

raw public key (RFC7250) support

## NAME

SSL\_add\_expected\_rpk, SSL\_get\_negotiated\_client\_cert\_type, SSL\_get\_negotiated\_server\_cert\_type, SSL\_get0\_peer\_rpk, SSL\_SESSION\_get0\_peer\_rpk - raw public key (RFC7250) support

## SYNOPSIS

```
 #include <openssl/ssl.h>
 int SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk);
 int SSL_get_negotiated_client_cert_type(const SSL *s);
 int SSL_get_negotiated_server_cert_type(const SSL *s);
 EVP_PKEY *SSL_get0_peer_rpk(const SSL *s);
 EVP_PKEY *SSL_SESSION_get0_peer_rpk(const SSL_SESSION *ss);
```

## DESCRIPTION

**SSL\_add\_expected\_rpk()** adds a DANE TLSA record matching public key **rpk** to SSL **s**'s DANE validation policy.

**SSL\_get\_negotiated\_client\_cert\_type()** returns the connection's negotiated client certificate type.

**SSL\_get\_negotiated\_server\_cert\_type()** returns the connection's negotiated server certificate type.

**SSL\_get0\_peer\_rpk()** returns the peer's raw public key from SSL **s**.

**SSL\_SESSION\_get0\_peer\_rpk()** returns the peer's raw public key from SSL\_SESSION **ss**.

## NOTES

Raw public keys are used in place of certificates when the option is negotiated. **SSL\_add\_expected\_rpk()** may be called multiple times to configure multiple trusted keys, this makes it possible to allow for key rotation, where a peer might be expected to offer an "old" or "new" key and the endpoint must be able to accept either one.

When raw public keys are used, the certificate verify callback is called, and may be used to inspect the public key via **X509\_STORE\_CTX\_get0\_rpk**(3). Raw public keys have no subject, issuer, validity dates nor digital signature to verify. They can, however, be matched verbatim or by their digest value, this is done by specifying one or more TLSA records, see **SSL\_CTX\_dane\_enable**(3).

The raw public key is typically taken from the certificate assigned to the connection (e.g. via **SSL\_use\_certificate**(3)), but if a certificate is not configured, then the public key will be extracted from the assigned private key.

The **SSL\_add\_expected\_rpk()** function is a wrapper around **SSL\_dane\_tlsa\_add**(3). When DANE is enabled via **SSL\_dane\_enable**(3), the configured TLSA records will be used to validate the peer's public key or certificate. If DANE is not enabled, then no validation will occur.

## RETURN VALUES

**SSL\_add\_expected\_rpk()** returns 1 on success and 0 on failure.

**SSL\_get0\_peer\_rpk()** and **SSL\_SESSION\_get0\_peer\_rpk()** return the peer's raw public key as an EVP\_PKEY or NULL when the raw public key is not available.

**SSL\_get\_negotiated\_client\_cert\_type()** and **SSL\_get\_negotiated\_server\_cert\_type()** return one of the following values:

- TLSEXT\_cert\_type\_x509

  - TLSEXT\_cert\_type\_rpk

  ## SEE ALSO

**SSL\_CTX\_dane\_enable**(3), **SSL\_CTX\_set\_options**(3), **SSL\_dane\_enable**(3), **SSL\_get\_verify\_result**(3), **SSL\_set\_verify**(3), **SSL\_use\_certificate**(3), **X509\_STORE\_CTX\_get0\_rpk**(3)

## HISTORY

These functions were added in OpenSSL 3.2.

## COPYRIGHT

Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
