SSL_get0_peer_rpk.pod 3.0 KB

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