summaryrefslogtreecommitdiff
path: root/src/lib/libssl/doc/SSL_CTX_set_client_cert_cb.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/doc/SSL_CTX_set_client_cert_cb.3')
-rw-r--r--src/lib/libssl/doc/SSL_CTX_set_client_cert_cb.3143
1 files changed, 0 insertions, 143 deletions
diff --git a/src/lib/libssl/doc/SSL_CTX_set_client_cert_cb.3 b/src/lib/libssl/doc/SSL_CTX_set_client_cert_cb.3
deleted file mode 100644
index 7a7d9466d2..0000000000
--- a/src/lib/libssl/doc/SSL_CTX_set_client_cert_cb.3
+++ /dev/null
@@ -1,143 +0,0 @@
1.\"
2.\" $OpenBSD: SSL_CTX_set_client_cert_cb.3,v 1.2 2014/12/02 14:11:01 jmc Exp $
3.\"
4.Dd $Mdocdate: December 2 2014 $
5.Dt SSL_CTX_SET_CLIENT_CERT_CB 3
6.Os
7.Sh NAME
8.Nm SSL_CTX_set_client_cert_cb ,
9.Nm SSL_CTX_get_client_cert_cb
10.Nd handle client certificate callback function
11.Sh SYNOPSIS
12.In openssl/ssl.h
13.Ft void
14.Fo SSL_CTX_set_client_cert_cb
15.Fa "SSL_CTX *ctx"
16.Fa "int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)"
17.Fc
18.Ft int
19.Fo "(*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))"
20.Fa "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey"
21.Fc
22.Ft int
23.Fn "(*client_cert_cb)" "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey"
24.Sh DESCRIPTION
25.Fn SSL_CTX_set_client_cert_cb
26sets the
27.Fa client_cert_cb()
28callback that is called when a client certificate is requested by a server and
29no certificate was yet set for the SSL object.
30.Pp
31When
32.Fa client_cert_cb
33is
34.Dv NULL ,
35no callback function is used.
36.Pp
37.Fn SSL_CTX_get_client_cert_cb
38returns a pointer to the currently set callback function.
39.Pp
40.Fn client_cert_cb
41is the application-defined callback.
42If it wants to set a certificate,
43a certificate/private key combination must be set using the
44.Fa x509
45and
46.Fa pkey
47arguments and 1 must be returned.
48The certificate will be installed into
49.Fa ssl ;
50see the
51.Sx NOTES
52and
53.Sx BUGS
54sections.
55If no certificate should be set,
560 has to be returned and no certificate will be sent.
57A negative return value will suspend the handshake and the handshake function
58will return immediately.
59.Xr SSL_get_error 3
60will return
61.Dv SSL_ERROR_WANT_X509_LOOKUP
62to indicate that the handshake was suspended.
63The next call to the handshake function will again lead to the call of
64.Fa client_cert_cb() .
65It is the job of the
66.Fa client_cert_cb()
67to store information
68about the state of the last call, if required to continue.
69.Sh NOTES
70During a handshake (or renegotiation)
71a server may request a certificate from the client.
72A client certificate must only be sent when the server did send the request.
73.Pp
74When a certificate has been set using the
75.Xr SSL_CTX_use_certificate 3
76family of functions,
77it will be sent to the server.
78The TLS standard requires that only a certificate is sent if it matches the
79list of acceptable CAs sent by the server.
80This constraint is violated by the default behavior of the OpenSSL library.
81Using the callback function it is possible to implement a proper selection
82routine or to allow a user interaction to choose the certificate to be sent.
83.Pp
84If a callback function is defined and no certificate was yet defined for the
85.Vt SSL
86object, the callback function will be called.
87If the callback function returns a certificate, the OpenSSL library
88will try to load the private key and certificate data into the
89.Vt SSL
90object using the
91.Fn SSL_use_certificate
92and
93.Fn SSL_use_private_key
94functions.
95Thus it will permanently install the certificate and key for this SSL object.
96It will not be reset by calling
97.Xr SSL_clear 3 .
98If the callback returns no certificate, the OpenSSL library will not send a
99certificate.
100.Sh SEE ALSO
101.Xr ssl 3 ,
102.Xr SSL_clear 3 ,
103.Xr SSL_CTX_add_extra_chain_cert 3 ,
104.Xr SSL_CTX_use_certificate 3 ,
105.Xr SSL_free 3 ,
106.Xr SSL_get_client_CA_list 3
107.Sh BUGS
108The
109.Fa client_cert_cb()
110cannot return a complete certificate chain;
111it can only return one client certificate.
112If the chain only has a length of 2,
113the root CA certificate may be omitted according to the TLS standard and
114thus a standard conforming answer can be sent to the server.
115For a longer chain, the client must send the complete chain
116(with the option to leave out the root CA certificate).
117This can be accomplished only by either adding the intermediate CA certificates
118into the trusted certificate store for the
119.Vt SSL_CTX
120object (resulting in having to add CA certificates that otherwise maybe would
121not be trusted), or by adding the chain certificates using the
122.Xr SSL_CTX_add_extra_chain_cert 3
123function, which is only available for the
124.Vt SSL_CTX
125object as a whole and that therefore probably can only apply for one client
126certificate, making the concept of the callback function
127(to allow the choice from several certificates) questionable.
128.Pp
129Once the
130.Vt SSL
131object has been used in conjunction with the callback function,
132the certificate will be set for the
133.Vt SSL
134object and will not be cleared even when
135.Xr SSL_clear 3
136is called.
137It is therefore
138.Em mandatory
139to destroy the
140.Vt SSL
141object using
142.Xr SSL_free 3
143and create a new one to return to the previous state.