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

Impl ZeroizeOnDrop for RsaPrivateKey+newtypes #311

Merged
merged 1 commit into from
Apr 26, 2023
Merged

Conversation

tarcieri
Copy link
Member

RsaPrivateKey self-zeroizes on drop, so add the ZeroizeOnDrop marker trait to RsaPrivateKey and all newtypes thereof, i.e. DecryptingKey and SigningKey for the various padding modes.

This also removes the Zeroize impl on RsaPrivateKey, since it self-zeroizes on Drop, and allowing Zeroize might accidentally permit use-after-zeroize vulnerabilities.

Closes #285.

`RsaPrivateKey` self-zeroizes on drop, so add the `ZeroizeOnDrop` marker
trait to `RsaPrivateKey` and all newtypes thereof, i.e. `DecryptingKey`
and `SigningKey` for the various padding modes.

This also removes the `Zeroize` impl on `RsaPrivateKey`, since it
self-zeroizes on `Drop`, and allowing `Zeroize` might accidentally
permit use-after-zeroize vulnerabilities.
@tarcieri tarcieri merged commit 78ea9cb into master Apr 26, 2023
9 checks passed
@tarcieri tarcieri deleted the zeroize-on-drop branch April 26, 2023 16:39
@tarcieri tarcieri mentioned this pull request Apr 27, 2023
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

Successfully merging this pull request may close these issues.

pkcs1v15::SigningKey and pkcs1v15::DecryptingKey should implement Zeroize and Drop
1 participant