Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustls: no process-level CryptoProvider available -- call CryptoProvider::install_default() before this point #339

Closed
maxpowel opened this issue Jul 5, 2024 · 4 comments

Comments

@maxpowel
Copy link

maxpowel commented Jul 5, 2024

Hello

When using rutls on versions > 0.22.0 this error is raised:

[2024-07-05][12:21:59][tokio_tungstenite::tls::encryption::rustls][DEBUG] Added 129/129 native root certificates (ignored 0)
thread 'tokio-runtime-worker' panicked at /home/maxpowel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.23.10/src/crypto/mod.rs:259:14:
no process-level CryptoProvider available -- call CryptoProvider::install_default() before this point

I investigated a bit about CryptoProvider::install_default() and it looks something related with latest changes rustls made in crypto part.

This line in my Cargo.toml works fine:

tokio-tungstenite = { version = "0.22.0", features = ["rustls-tls-native-roots"] }

but this raises the error

tokio-tungstenite = { version = "0.23.1", features = ["rustls-tls-native-roots"] }

The error appears as soon as you call tokio_tungstenite::connect_async

Thank you

@agalakhov
Copy link
Member

agalakhov commented Jul 5, 2024

See #336.

@maxpowel
Copy link
Author

maxpowel commented Jul 5, 2024

Ah sorry, I tried to find any reference to this problem and I did not find it. Thank you

@maxpowel maxpowel closed this as completed Jul 5, 2024
@malongshuai
Copy link

i changed my Cargo.toml and solved:

ring = { version = "0.17" }
rustls = { version = "0.23", features = ["ring","logging","tls12"], default-features = false }
tokio-tungstenite = { version = "0.23", features = ["rustls-tls-webpki-roots"] }

@jiangxiaoqiang
Copy link

add this code to fixed:

rustls::crypto::ring::default_provider().install_default().expect("Failed to install rustls crypto provider");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants