curv icon indicating copy to clipboard operation
curv copied to clipboard

Implement elliptic curve trait for P-256

Open omershlo opened this issue 6 years ago • 3 comments

Basically - we need to find a good library that implement P-256 elliptic curve and implement with it the trait:

pub trait ECScalar<SK> {
    fn new_random() -> Self;
    fn get_element(&self) -> SK;
    fn set_element(&mut self, element: SK);
    fn from(n: &BigInt) -> Self;
    fn to_big_int(&self) -> BigInt;
    fn q(&self) -> BigInt;
    fn add(&self, other: &SK) -> Self;
    fn mul(&self, other: &SK) -> Self;
    fn sub(&self, other: &SK) -> Self;
    fn invert(&self) -> Self;
}

pub trait ECPoint<PK, SK>
    where Self: Sized{
    fn generator() -> Self;
    fn get_element(&self) -> PK;
    fn x_coor(&self) -> BigInt;
    fn y_coor(&self) -> BigInt;
    fn bytes_compressed_to_big_int(&self) -> BigInt;
    fn from_bytes(bytes: &[u8]) ->  Result<Self, ErrorKey>;
    fn pk_to_key_slice(&self) -> Vec<u8>;
    fn scalar_mul(self, fe: &SK) -> Self;
    fn add_point(&self, other: &PK) -> Self;
    fn sub_point(&self, other: &PK) -> Self;
    fn from_coor(x: &BigInt, y: &BigInt) -> Self;
}

omershlo avatar Oct 13 '18 16:10 omershlo

any updates?

imerkle avatar May 24 '19 18:05 imerkle

Hi! Not really (sadly): do you want to recommend on s good library or help?

omershlo avatar May 25 '19 15:05 omershlo

There are many c libraries but haven't found a good pure rust library for this curve.

imerkle avatar May 27 '19 21:05 imerkle