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

Add clean() and is_zero() to SecretKey to clean up the memories #149

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

chiro-hiro
Copy link
Contributor

@chiro-hiro chiro-hiro commented Dec 28, 2022

This pull request aimed to solve #130, example use case:

// Generate raw key pair in bytes array
pub fn generate_raw_keypair() -> RawKeyPair {
    let mut rng = thread_rng();
    let secret = SecretKey::random(&mut rng);
    let secret_key = secret.serialize();
    secret.clear();
    let public_key = PublicKey::from_secret_key(&secret).serialize();
    RawKeyPair {
        public_key,
        secret_key,
    }
}

@sorpaas sorpaas merged commit 48dabd8 into paritytech:master Mar 6, 2023
@chiro-hiro chiro-hiro deleted the clean_up_secret_key branch March 15, 2023 15:21
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.

2 participants