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

Upgrade to rustls 0.22 breaks access to cert details #498

Closed
robklg opened this issue Feb 14, 2024 · 1 comment
Closed

Upgrade to rustls 0.22 breaks access to cert details #498

robklg opened this issue Feb 14, 2024 · 1 comment

Comments

@robklg
Copy link
Contributor

robklg commented Feb 14, 2024

@hannesdejager maybe I'm overlooking something, but I'm looking into upgrading to rustls 0.22.

Here:

session.cert_chain = Some(certs.iter().map(|c| crate::auth::ClientCert(c.0.clone())).collect());

we copy the certificate bytes and we need it later for matching the client certificate here:

impl ClientCert {
/// Returns true if the Common Name from the client certificate matches the allowed_cn
pub fn verify_cn(&self, allowed_cn: &str) -> Result<bool, std::io::Error> {
let client_cert = parse_x509_certificate(&self.0);
let subject = match client_cert {
Ok(c) => c.1.subject().to_string(),
Err(e) => return Err(std::io::Error::new(std::io::ErrorKind::Other, e.to_string())),
};
Ok(subject.contains(allowed_cn))

But since rustls 0.22.0 peer_certificates no longer returns rustls::Certificate but it was replaced by CertificateDer from a new crate rustls_pki_types. CertificateDer does not allow access to the certificate data, so we cannot convert it to our ClientCert.

Do you have any idea how we can solve this, or do we need to raise an issue with rustls_pki_types?

@hannesdejager
Copy link
Collaborator

I upgraded it to 0.23.8 in #516

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

2 participants