-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat: derive from Clone
on PrivateKeyDer
enum
#29
feat: derive from Clone
on PrivateKeyDer
enum
#29
Conversation
I think we specifically want to avoid making private key material types |
Can you speak to your motivation for this change? In the past we've explicitly avoided adding Edit: oops, sorry for the double post :-) Looks like Ctz and I were racing. |
Some previous discussion in #8, #26, rustls/pemfile#19 |
I have a project where I depend on these keys, and I'd like to have the ability to Due to an architectural decision on the project I'm working on (tailcallhq/tailcall), we have restrictions on where to do IO operations, and we wish to evaluate these keys early and use them later on. If I can't clone, what I'll end up having to do is holding the bytes/string (which is clonable, can be leaked, and will not have the explicitly of knowing it is a private key), and later on (right before using it), call |
And also, thanks for the quick response! 😄 |
These objects are immutable, so having multiple independent copies is not really useful. Have you considered wrapping them in Rc/Arc? This gives you (~free/cheap) clone without any underlying copies happening. |
It makes sense @ctz! I'm quite new to the Rust ecosystem, so I didn't knew about this "workaround". Thanks for the hand! |
I think this is a place where we could help users with more documentation on the rationale for not including |
Hey guys, update on my use case: early evaluate the What I'm planning to do to avoid such issue is hold the plain file (content) on the application and late evaluate it to an |
You should be able to use clone_key()? https://docs.rs/rustls-pki-types/latest/rustls_pki_types/enum.PrivateKeyDer.html#method.clone_key |
It worked @djc, thanks 🙌🏽 was able to achieve a clone-like behavior by using I apologize for my ignorance, but what's the difference between deriving explicitly from |
The idea was that It's admittedly a nuanced topic -- this is the line we've ended up at for now. |
No description provided.