Skip to content

Support loading PEM files without rehash names #188

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

Open
arilou opened this issue Jun 4, 2025 · 5 comments
Open

Support loading PEM files without rehash names #188

arilou opened this issue Jun 4, 2025 · 5 comments

Comments

@arilou
Copy link
Contributor

arilou commented Jun 4, 2025

Before I go on and send a PR about this, I wanted to make sure you guys agree with this change.

Basically today rustls-native-certs follows the same logic as OpenSSL in regards of loading certificates only if they have a value
rehash name.

As far as I understand from OpenSSL this is used mainly as a performance reasons for the case there are many certificates in
a given directory and it will help "identify" the correct one.

Looking at other implementations for loading certificates from the SSL_CERT_DIR you can see here in Go
https://go.dev/src/crypto/x509/root_unix.go
That they dont enforce the rehash names, and simply loads all the certificates in the directory.

I was wondering if you will be willing to have the same type logic as the Go variant which is more permissive.

@djc
Copy link
Member

djc commented Jun 4, 2025

Why? What's your use case?

@arilou
Copy link
Contributor Author

arilou commented Jun 4, 2025

We've encountered environments, often customer setups where the base image is optimized for Go applications. These images typically work out-of-the-box with Go's certificate loading logic. However, when running Rust applications in the same images, no certificates are loaded at all, leading to TLS failures.

@djc
Copy link
Member

djc commented Jun 4, 2025

Sounds reasonable (who's we?). Would you be able to submit a PR in this direction?

@arilou
Copy link
Contributor Author

arilou commented Jun 4, 2025

Wiz (https://www.wiz.io/) and sure ill build some PR, just to make sure we are clear on the direction, I'm removing the re_hash requirements on the loading of the PEMs
Basically remove the check of is_hash_file_name(file_name) in the function load_pem_certs_from_dir

@djc
Copy link
Member

djc commented Jun 4, 2025

Makes sense. We might want to consider if this should be optional behavior and if so, whether it should be opt-in or opt-out.

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