]> git.ipfire.org Git - thirdparty/openssl.git/blob - doc/man3/SSL_get0_peer_rpk.pod
RFC7250 (RPK) support
[thirdparty/openssl.git] / doc / man3 / SSL_get0_peer_rpk.pod
1 =pod
2
3 =head1 NAME
4
5 SSL_add_expected_rpk,
6 SSL_get_negotiated_client_cert_type,
7 SSL_get_negotiated_server_cert_type,
8 SSL_get0_peer_rpk,
9 SSL_SESSION_get0_peer_rpk - raw public key (RFC7250) support
10
11 =head1 SYNOPSIS
12
13 #include <openssl/ssl.h>
14
15 int SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk);
16 int SSL_get_negotiated_client_cert_type(const SSL *s);
17 int SSL_get_negotiated_server_cert_type(const SSL *s);
18 EVP_PKEY *SSL_get0_peer_rpk(const SSL *s);
19 EVP_PKEY *SSL_SESSION_get0_peer_rpk(const SSL_SESSION *ss);
20
21 =head1 DESCRIPTION
22
23 SSL_add_expected_rpk() adds a DANE TLSA record matching public key B<rpk>
24 to SSL B<s>'s DANE validation policy.
25
26 SSL_get_negotiated_client_cert_type() returns the connection's negotiated
27 client certificate type.
28
29 SSL_get_negotiated_server_cert_type() returns the connection's negotiated
30 server certificate type.
31
32 SSL_get0_peer_rpk() returns the peer's raw public key from SSL B<s>.
33
34 SSL_SESSION_get0_peer_rpk() returns the peer's raw public key from
35 SSL_SESSION B<ss>.
36
37 =head1 NOTES
38
39 Raw public keys are used in place of certificates when the option is
40 negotiated.
41 B<SSL_add_expected_rpk()> may be called multiple times to configure
42 multiple trusted keys, this makes it possible to allow for key rotation,
43 where a peer might be expected to offer an "old" or "new" key and the
44 endpoint must be able to accept either one.
45
46 When raw public keys are used, the certificate verify callback is called, and
47 may be used to inspect the public key via X509_STORE_CTX_get0_rpk(3).
48 Raw public keys have no subject, issuer, validity dates nor digital signature
49 to verify. They can, however, be matched verbatim or by their digest value, this
50 is done by specifying one or more TLSA records, see L<SSL_CTX_dane_enable(3)>.
51
52 The raw public key is typically taken from the certificate assigned to the
53 connection (e.g. via L<SSL_use_certificate(3)>), but if a certificate is not
54 configured, then the public key will be extracted from the assigned
55 private key.
56
57 The SSL_add_expected_rpk() function is a wrapper around
58 L<SSL_dane_tlsa_add(3)>.
59 When DANE is enabled via L<SSL_dane_enable(3)>, the configured TLSA records
60 will be used to validate the peer's public key or certificate.
61 If DANE is not enabled, then no validation will occur.
62
63 =head1 RETURN VALUES
64
65 SSL_add_expected_rpk() returns 1 on success and 0 on failure.
66
67 SSL_get0_peer_rpk() and SSL_SESSION_get0_peer_rpk() return the peer's raw
68 public key as an EVP_PKEY or NULL when the raw public key is not available.
69
70 SSL_get_negotiated_client_cert_type() and SSL_get_negotiated_server_cert_type()
71 return one of the following values:
72
73 =over 4
74
75 =item TLSEXT_cert_type_x509
76
77 =item TLSEXT_cert_type_rpk
78
79 =back
80
81 =head1 SEE ALSO
82
83 L<SSL_CTX_dane_enable(3)>,
84 L<SSL_CTX_set_options(3)>,
85 L<SSL_dane_enable(3)>,
86 L<SSL_get_verify_result(3)>,
87 L<SSL_set_verify(3)>,
88 L<SSL_use_certificate(3)>,
89 L<X509_STORE_CTX_get0_rpk(3)>
90
91 =head1 HISTORY
92
93 These functions were added in OpenSSL 3.2.
94
95 =head1 COPYRIGHT
96
97 Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
98
99 =cut