add keypair derivation

This commit is contained in:
Sam Kim 2021-10-12 10:36:17 -04:00 committed by Michael Vines
parent f350fa7147
commit 2eb326b0da
1 changed files with 8 additions and 0 deletions

View File

@ -57,6 +57,14 @@ impl ElGamal {
}
}
#[cfg(not(target_arch = "bpf"))]
#[allow(non_snake_case)]
pub fn from_signing_key(signing_key: &SigningKey, label: &'static [u8]) -> Self {
let secret = ElGamalSecretKey::new(signing_key, label);
let public = ElGamalPubkey::new(&secret);
Self {secret, public}
}
/// On input a public key and a message to be encrypted, the function
/// returns an ElGamal ciphertext of the message under the public key.
#[cfg(not(target_arch = "bpf"))]