#ed25519 #sign #rsa #ring #signature

sharpie

A simple digital signing and verification library based on ring

4 releases

0.2.0 Feb 8, 2023
0.1.2 Feb 3, 2023
0.1.1 Feb 3, 2023
0.1.0 Feb 3, 2023

#2335 in Cryptography

Apache-2.0

24KB
396 lines

sharpie

github crates.io docs.rs build status

This is a Rust library for signing and verifying digital signatures using RSA or ED25519.

Dependency

[dependencies]
sharpie = "0.1.2"

For most recent version see crates.io

Usage

Run the example:

$ cargo run -p sharpie --example sign

For Ed25519, use the sharpie::ed module.

use sharpie::ed::{sign, verify, PrivateKey, PublicKey};

Optionally, generate your keys with OpenSSL:

$ openssl genpkey -algorithm ED25519 -out ed.private.pem
$ openssl pkey -in private-key-ed.pem -pubout -out ed.public.pem

And then sign:

let privkey = PrivateKey::PEM(fs::read_to_string("fixtures/ed.private.pem")?);
let sig = sign(b"hello world", &privkey)?;

Or, verify:

let pubkey =
    PublicKey::PEM(fs::read_to_string("fixtures/ed.public.pem")?);

// sig is Vec<u8>
verify(b"hello world", &sig, pubkey)?;

Copyright

Copyright (c) 2022 @jondot. See LICENSE for further details.

Dependencies

~9MB
~260K SLoC