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

Should Signer consume SecretKey on creation? #61

Closed
fjarri opened this issue Jul 9, 2021 · 0 comments · Fixed by #91
Closed

Should Signer consume SecretKey on creation? #61

fjarri opened this issue Jul 9, 2021 · 0 comments · Fixed by #91
Labels
API Related to public API cryptography Needs attention of someone who knows what they're doing
Milestone

Comments

@fjarri
Copy link
Contributor

fjarri commented Jul 9, 2021

This is the case for SigningKey in RustCrypto. But what dangerous scenarios does that really prevent?

For those not familiar with the concept in Rust: currently one can do this:

let sk = SecretKey::random();
let signer = Signer::new(&sk); // passed by reference, cloned inside
// `sk` still usable here

A possible change matching SigningKey behavior is to do this:

let sk = SecretKey::random();
let signer = Signer::new(sk); // passed by value and consumed
// `sk` cannot be used anymore
@fjarri fjarri added cryptography Needs attention of someone who knows what they're doing API Related to public API labels Jul 9, 2021
@fjarri fjarri added this to the v1.0.0 milestone Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to public API cryptography Needs attention of someone who knows what they're doing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant