Fixing minor nits: conversion to u16 and removing keypair constructor

This commit is contained in:
Kevin Lewi
2021-06-28 19:19:11 -07:00
committed by Kevin Lewi
parent 809337f458
commit c8c57785af
3 changed files with 10 additions and 13 deletions
+5 -11
View File
@@ -76,16 +76,6 @@ impl<G: Group> KeyPair<G> {
&self.sk
}
/// A constructor that receives public and private key independently as
/// bytes
pub fn new(public: PublicKey, private: PrivateKey) -> Result<Self, InternalPakeError> {
Ok(Self {
pk: public,
sk: private,
_g: PhantomData,
})
}
/// Generating a random key pair given a cryptographic rng
pub(crate) fn generate_random<R: RngCore + CryptoRng>(rng: &mut R) -> Self {
let sk = G::random_nonzero_scalar(rng);
@@ -131,7 +121,11 @@ impl<G: Group> KeyPair<G> {
pub fn from_private_key_slice(input: &[u8]) -> Result<Self, InternalPakeError> {
let sk = PrivateKey(Key::from_arr(GenericArray::from_slice(input))?);
let pk = Self::public_from_private(&sk);
Self::new(pk, sk)
Ok(Self {
pk,
sk,
_g: PhantomData,
})
}
#[cfg(test)]