lamport_ots

Crates.iolamport_ots
lib.rslamport_ots
version0.1.1
sourcesrc
created_at2022-03-02 22:41:58.160397
updated_at2022-03-09 18:28:51.925605
descriptionA Rust implementation of Leslie Lamport's one-time signature scheme
homepage
repositoryhttps://github.com/WillyWoosley/lamport_ots
max_upload_size
id542576
size19,214
(WillyWoosley)

documentation

https://docs.rs/lamport_ots

README

lamport_ots

Crate Documentation License

A Rust implementation of Leslie Lamport's eponymous signature scheme, providing a method of digitally signing data through the use of crypotgraphic hashes. Notably, this scheme is believed to be secure even in the face of attack by quantum computers.

Documentation:

Full documentation for this crate can be found here.

Usage:

A Typical Example

use lamport_ots::KeyPair;
use sha2::Sha256;

// Generate a randomized Public/Private KeyPair
let keypair = KeyPair::<Sha256>::generate();

// Use that KeyPair to generate a signature for passed data
let signature = keypair.sign(b"Hello world!");

// That signature can now verify the signed data
assert!(signature.verify(b"Hello world!"));
assert!(!signature.verify(b"Hello moon!"));

Signing a File

Since lamport_ots expects byte-data for signing and verifying, working with files (or any Read data) will require that data to first be read into a buffer.

use lamport_ots::KeyPair;
use sha2::Sha256;

use std::fs::File;
use std::io::Read;

// Generate a randomized Public/Private KeyPair
let keypair = KeyPair::<Sha256>::generate();

// Read the desired file into a buffer
let mut f = File::open("my_file.txt").unwrap();
let mut buffer = Vec::new();
f.read_to_end(&mut buffer);

// Sign the buffer
let signature = keypair.sign(&buffer);

// That signature can now verify the buffers contents
assert!(signature.verify(&buffer));

Dependencies:

This crate makes use of the rand and RustCrypto digest crates. Further, it is intended for use with any of RustCrypto's numerous hash functions, or any other hashing algorithm which implements their digest trait.

A Word of Caution:

This crate has been in no way vetted for security by any competent authority, and thus is not intended for any serious use without prior inspection. Use at your own risk.

License:

This software distributed under the MIT License.

Commit count: 28

cargo fmt