HFQR / xitca-web

Apache License 2.0
654 stars 41 forks source link

rustls-ring-crypto for server #1006

Closed programingjd closed 3 months ago

programingjd commented 3 months ago

It would be nice to have a rustls-ring-crypto feature on the server side, not just for the client crate. This would enable the use of rustls without having to install build tools to build either openssl or aws-lc.

fakeshadow commented 3 months ago

Make sense but I wonder if there is alternative like offering a general solution where the crypto provider can be supplied by library user.

I'll look into the issue and come up with something.

fakeshadow commented 3 months ago

Turns out there is also a bug where importing rustls/ring independently would cause a runtime panic if xitca-web/rustls feature is also enabled. This is more like a rustls issue but thankfully following change would fix it.

With latest releases rustls's crypto providers has been removed from server side libraries. And if you want ring crypto you can do following in your Cargo,toml:

[dependencies]
xitca-web = { version = "0.4.1", features = ["rustls"] } 
rustls = { version = "0.23.4", default-features = false, features = ["logging", "std", "tls12", "ring"] }

The client side still needs specific crate feature for crypto provider due to the fact that rustls configuration happens inside xitca-client

fakeshadow commented 3 months ago

I tested briefly locally and it works fine. If there is further issue regarding this one feel free to re-open.

programingjd commented 3 months ago

I am not using xitca-web but rather xitca-server with xitca-http. It works fine like that too. I was able to replace the openssl feature with the rustls feature on xitcha-http, and it worked. The dependency on aws-lc-rs is gone. Thank you very much for the quick turnaround.