frost/frost-p256
Conrado Gouvea af2839f6dc
Add P-256 support (#77)
* add support for P-256 curve

* use a fixed-size array for P_256 point encoding (instead of )

* Apply suggestions from code review

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>

* frost-p256: remove direct elliptic_curve dependency; use the one from p256

* fix comment in invert()

* frost-p256: rename shorthand alias

* Apply suggestions from code review

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>

* improve imports, docs, use expect instead of unwrap

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>
2022-07-01 14:16:22 +00:00
..
src Add P-256 support (#77) 2022-07-01 14:16:22 +00:00
tests Add P-256 support (#77) 2022-07-01 14:16:22 +00:00
Cargo.toml Add P-256 support (#77) 2022-07-01 14:16:22 +00:00
README.md Add P-256 support (#77) 2022-07-01 14:16:22 +00:00

README.md

An implementation of Schnorr signatures on the P-256 curve for both single and threshold numbers of signers (FROST).

Examples

Creating a Signature with a single signer, serializing and deserializing it, and verifying the signature:

use rand::thread_rng;
use frost_p256::*;

let msg = b"Hello!";

// Generate a secret key and sign the message
let sk = SigningKey::new(thread_rng());
let sig = sk.sign(thread_rng(), msg);

// Types can be converted to raw byte arrays using `from_bytes`/`to_bytes`
let sig_bytes = sig.to_bytes();
let pk_bytes = VerifyingKey::from(&sk).to_bytes();

// Deserialize and verify the signature.
let sig = Signature::from_bytes(sig_bytes)?;

assert!(
    VerifyingKey::from_bytes(pk_bytes)
        .and_then(|pk| pk.verify(msg, &sig))
        .is_ok()
);
# Ok::<(), Error>(())