Skip to content

Commit 10d1be7

Browse files
committed
server: support reading CRL PEM for client auth.
This commit updates the `tests/server.c` example program to support reading one or more CRLs from a single PEM encoded CRL file, provided via `AUTH_CRL`. This option is only processed when the server is performing mandatory client authentication (e.g. `AUTH_CERT` was provided).
1 parent 2b85c80 commit 10d1be7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/server.c

+17
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,23 @@ main(int argc, const char **argv)
303303
rustls_allow_any_authenticated_client_builder_new(
304304
client_cert_root_store);
305305

306+
char *auth_crl = getenv("AUTH_CRL");
307+
char crlbuf[10000];
308+
size_t crlbuf_len;
309+
if(auth_crl) {
310+
result =
311+
read_file(argv[0], auth_crl, crlbuf, sizeof(crlbuf), &crlbuf_len);
312+
if(result != DEMO_OK) {
313+
goto cleanup;
314+
}
315+
316+
result = rustls_allow_any_authenticated_client_builder_add_crl(
317+
client_cert_verifier_builder, (uint8_t *)crlbuf, certbuf_len);
318+
if(result != RUSTLS_RESULT_OK) {
319+
goto cleanup;
320+
}
321+
}
322+
306323
client_cert_verifier = rustls_allow_any_authenticated_client_verifier_new(
307324
client_cert_verifier_builder);
308325
rustls_server_config_builder_set_client_verifier(config_builder,

0 commit comments

Comments
 (0)