hyperledger-archives / ursa

Hyperledger Ursa (a shared cryptographic library) has moved to end-of-life status, with the components of Ursa still in use moved to their relevant Hyperledger projects (AnonCreds, Indy, Aries and Iroha).

Home Page:https://wiki.hyperledger.org/display/ursa

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`ursa` crashes on seed lenght shorter than 32 bytes for `secp256k1`

Erigara opened this issue · comments

Ursa crashes if seed length is less than 32 bytes for secp256k1, but other algorithms work fine with this seed.

The problem seems to be that in other cases the input seed is hashed before being passed to the rng generator.

Minimal example that reproduce issue

use ursa::{
    keys::KeyGenOption,
    signatures::{
        secp256k1::EcdsaSecp256k1Sha256,
        SignatureScheme,
    },
};

fn main() {
    let options = KeyGenOption::UseSeed(vec![1, 2, 3]);
    let key_pair = EcdsaSecp256k1Sha256::new().keypair(Some(options));
    println!("{:?}", key_pair);
}