1
0
mirror of https://github.com/actix/examples synced 2024-12-05 03:01:55 +01:00
examples/https-tls/rustls-client-cert/README.md

35 lines
779 B
Markdown
Raw Normal View History

2023-05-22 15:21:48 +02:00
# TLS Client Certificate (using Rustls)
2020-10-30 05:22:24 +01:00
## Usage
### Certificate
2022-03-06 01:43:10 +01:00
All the self-signed certificate are in the ./certs directory, including the CA certificate generated by [`mkcert`] that was used to create the server and client certs.
2020-10-30 05:22:24 +01:00
### Server
```sh
cd https-tls/rustls-client-cert
2020-10-30 05:22:24 +01:00
cargo run
```
The server runs HTTP on port 8080 and HTTPS on port 8443.
### Providing Client Cert
Using [HTTPie]:
2022-03-06 01:43:10 +01:00
2020-10-30 05:22:24 +01:00
```sh
http https://127.0.0.1:8443/ --verify=certs/rootCA.pem --cert=certs/client-cert.pem --cert-key=certs/client-key.pem
2020-10-30 05:22:24 +01:00
```
Using [cURL]:
2022-03-06 01:43:10 +01:00
2020-10-30 05:22:24 +01:00
```sh
curl https://127.0.0.1:8443/ --cacert certs/rootCA.pem --cert certs/client-cert.pem --key certs/client-key.pem
```
[`mkcert`]: https://github.com/FiloSottile/mkcert
2022-03-06 01:43:10 +01:00
[curl]: https://curl.haxx.se/
[httpie]: https://httpie.org/