-
Notifications
You must be signed in to change notification settings - Fork 74
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
TlsAcceptor reads invalid data #88
Comments
@tidely Are you accessing your server with FWIW I'm not able to reproduce with |
When accessing with the
I haven't messed with any of my supported signature schemes in my browsers, so I feel like this could still stem from some type of parsing bug. |
The example server doesn't customize the supported signature schemes and uses a default set with broad compatibility. Are you accessing the example server through some kind of proxy? Or on a machine that has some sort of corporate policy applied to it? I think a parsing bug is unlikely and instead suspect there's something interesting about the configuration of the machine you're testing on, or the way in which you're testing. 🤔 |
Exactly why this seems like a very weird bug.
I have no corporate policy or any proxy and I'm testing it on |
Could you share the method you used for this? |
I use the use rcgen::{CertificateParams, KeyPair, PKCS_ED25519};
use std::{fs::File, io::Write};
fn main() -> Result<(), Box<dyn core::error::Error>> {
let key_pair = KeyPair::generate_for(&PKCS_ED25519)?;
let params = CertificateParams::new(vec!["127.0.0.1".into(), "localhost".into()])?;
let cert = params.self_signed(&key_pair)?;
let pem_cert = cert.pem();
File::create("./cert.pem")?.write_all(pem_cert.as_bytes())?;
let pem_key = key_pair.serialize_pem();
File::create("./key.pem")?.write_all(pem_key.as_bytes())?;
println!("Certificate and private key were saved as: cert.pem & key.pem");
Ok(())
} I've successfully used this self-signed cert generation method before with the tonic crate. |
Aha, that is very revealing. AFAIK there is no current browser support for ED25519 keys in TLS; which is a great shame because AIUI they all have implementations of it for webcrypto. |
Well that explains it then, did not know that. Very interesting decision indeed... I assume my best bet is ECDSA then, I'll retry and close the issue once it works, thanks for the quick replies. |
Agreed, something like |
I was testing tokio-rustls on my own project, but it didn't let me accept connections using the TlsAcceptor.accept method. In search for a minimal reproducible example, I tried running the server example from this repo. After generating a cert and a key and running the example as instructed by README.md and visiting the page in my browser, the connection would fail during the TlsAcceptor.accept call with the error:
Custom { kind: InvalidData, error: InvalidMessage(InvalidContentType) }
I tried multiple configurations, all failing.
MacOS Safari
MacOS Chrome
Linux Firefox
The text was updated successfully, but these errors were encountered: