sharpie

Crates.iosharpie
lib.rssharpie
version0.2.0
sourcesrc
created_at2023-02-03 12:54:43.948656
updated_at2023-02-08 18:28:47.851911
descriptionA simple digital signing and verification library based on ring
homepage
repositoryhttps://github.com/jondot/sharpie
max_upload_size
id775537
size44,062
Dotan J. Nahum (jondot)

documentation

https://docs.rs/sharpie/

README

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.

Commit count: 7

cargo fmt