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

Debug implementation leaks private exponent #479

Open
aumetra opened this issue Feb 19, 2025 · 1 comment · May be fixed by #480
Open

Debug implementation leaks private exponent #479

aumetra opened this issue Feb 19, 2025 · 1 comment · May be fixed by #480
Labels
bug Something isn't working

Comments

@aumetra
Copy link
Contributor

aumetra commented Feb 19, 2025

The struct RsaPrivateKey has a default derive implementation of Debug which is nice for debugging, but it since it's the default derive it also prints out the value of the private exponent d.

Min repr:

/*
[dependencies]
rsa = "0.10.0-pre.4"
*/

use rsa::{rand_core, RsaPrivateKey};

fn main() {
    let rsa = RsaPrivateKey::new(&mut rand_core::OsRng, 1024).unwrap();
    println!("{rsa:?}");
}

The output will be:

[snip...], d: BoxedUint([value of the private exponent]), [...snip]
@dignifiedquire dignifiedquire added the bug Something isn't working label Feb 19, 2025
@dignifiedquire
Copy link
Member

ugh, thanks for reporting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants