SSL_get0_peer_rpk.3ossl 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "SSL_GET0_PEER_RPK 3ossl"
  58. .TH SSL_GET0_PEER_RPK 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. SSL_add_expected_rpk,
  65. SSL_get_negotiated_client_cert_type,
  66. SSL_get_negotiated_server_cert_type,
  67. SSL_get0_peer_rpk,
  68. SSL_SESSION_get0_peer_rpk \- raw public key (RFC7250) support
  69. .SH SYNOPSIS
  70. .IX Header "SYNOPSIS"
  71. .Vb 1
  72. \& #include <openssl/ssl.h>
  73. \&
  74. \& int SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk);
  75. \& int SSL_get_negotiated_client_cert_type(const SSL *s);
  76. \& int SSL_get_negotiated_server_cert_type(const SSL *s);
  77. \& EVP_PKEY *SSL_get0_peer_rpk(const SSL *s);
  78. \& EVP_PKEY *SSL_SESSION_get0_peer_rpk(const SSL_SESSION *ss);
  79. .Ve
  80. .SH DESCRIPTION
  81. .IX Header "DESCRIPTION"
  82. \&\fBSSL_add_expected_rpk()\fR adds a DANE TLSA record matching public key \fBrpk\fR
  83. to SSL \fBs\fR's DANE validation policy.
  84. .PP
  85. \&\fBSSL_get_negotiated_client_cert_type()\fR returns the connection's negotiated
  86. client certificate type.
  87. .PP
  88. \&\fBSSL_get_negotiated_server_cert_type()\fR returns the connection's negotiated
  89. server certificate type.
  90. .PP
  91. \&\fBSSL_get0_peer_rpk()\fR returns the peer's raw public key from SSL \fBs\fR.
  92. .PP
  93. \&\fBSSL_SESSION_get0_peer_rpk()\fR returns the peer's raw public key from
  94. SSL_SESSION \fBss\fR.
  95. .SH NOTES
  96. .IX Header "NOTES"
  97. Raw public keys are used in place of certificates when the option is
  98. negotiated.
  99. \&\fBSSL_add_expected_rpk()\fR may be called multiple times to configure
  100. multiple trusted keys, this makes it possible to allow for key rotation,
  101. where a peer might be expected to offer an "old" or "new" key and the
  102. endpoint must be able to accept either one.
  103. .PP
  104. When raw public keys are used, the certificate verify callback is called, and
  105. may be used to inspect the public key via \fBX509_STORE_CTX_get0_rpk\fR\|(3).
  106. Raw public keys have no subject, issuer, validity dates nor digital signature
  107. to verify. They can, however, be matched verbatim or by their digest value, this
  108. is done by specifying one or more TLSA records, see \fBSSL_CTX_dane_enable\fR\|(3).
  109. .PP
  110. The raw public key is typically taken from the certificate assigned to the
  111. connection (e.g. via \fBSSL_use_certificate\fR\|(3)), but if a certificate is not
  112. configured, then the public key will be extracted from the assigned
  113. private key.
  114. .PP
  115. The \fBSSL_add_expected_rpk()\fR function is a wrapper around
  116. \&\fBSSL_dane_tlsa_add\fR\|(3).
  117. When DANE is enabled via \fBSSL_dane_enable\fR\|(3), the configured TLSA records
  118. will be used to validate the peer's public key or certificate.
  119. If DANE is not enabled, then no validation will occur.
  120. .SH "RETURN VALUES"
  121. .IX Header "RETURN VALUES"
  122. \&\fBSSL_add_expected_rpk()\fR returns 1 on success and 0 on failure.
  123. .PP
  124. \&\fBSSL_get0_peer_rpk()\fR and \fBSSL_SESSION_get0_peer_rpk()\fR return the peer's raw
  125. public key as an EVP_PKEY or NULL when the raw public key is not available.
  126. .PP
  127. \&\fBSSL_get_negotiated_client_cert_type()\fR and \fBSSL_get_negotiated_server_cert_type()\fR
  128. return one of the following values:
  129. .IP TLSEXT_cert_type_x509 4
  130. .IX Item "TLSEXT_cert_type_x509"
  131. .PD 0
  132. .IP TLSEXT_cert_type_rpk 4
  133. .IX Item "TLSEXT_cert_type_rpk"
  134. .PD
  135. .SH "SEE ALSO"
  136. .IX Header "SEE ALSO"
  137. \&\fBSSL_CTX_dane_enable\fR\|(3),
  138. \&\fBSSL_CTX_set_options\fR\|(3),
  139. \&\fBSSL_dane_enable\fR\|(3),
  140. \&\fBSSL_get_verify_result\fR\|(3),
  141. \&\fBSSL_set_verify\fR\|(3),
  142. \&\fBSSL_use_certificate\fR\|(3),
  143. \&\fBX509_STORE_CTX_get0_rpk\fR\|(3)
  144. .SH HISTORY
  145. .IX Header "HISTORY"
  146. These functions were added in OpenSSL 3.2.
  147. .SH COPYRIGHT
  148. .IX Header "COPYRIGHT"
  149. Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.