Crates.io | sharpie |
lib.rs | sharpie |
version | 0.2.0 |
source | src |
created_at | 2023-02-03 12:54:43.948656 |
updated_at | 2023-02-08 18:28:47.851911 |
description | A simple digital signing and verification library based on ring |
homepage | |
repository | https://github.com/jondot/sharpie |
max_upload_size | |
id | 775537 |
size | 44,062 |
This is a Rust library for signing and verifying digital signatures using RSA or ED25519.
[dependencies]
sharpie = "0.1.2"
For most recent version see crates.io
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 (c) 2022 @jondot. See LICENSE for further details.