This is a Rust library for signing and verifying digital signatures using RSA or ED25519.
toml
[dependencies]
sharpie = "0.1.2"
For most recent version see crates.io
Run the example:
rust
$ cargo run -p sharpie --example sign
For Ed25519
, use the sharpie::ed
module.
rust
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:
rust
let privkey = PrivateKey::PEM(fs::read_to_string("fixtures/ed.private.pem")?);
let sig = sign(b"hello world", &privkey)?;
Or, verify:
```rust let pubkey = PublicKey::PEM(fs::readtostring("fixtures/ed.public.pem")?);
// sig is Vec
Copyright (c) 2022 @jondot. See LICENSE for further details.