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