Crates.io | edcert-letter |
lib.rs | edcert-letter |
version | 2.0.0 |
source | src |
created_at | 2016-03-20 14:09:39.59496 |
updated_at | 2016-10-22 14:25:58.790829 |
description | This crate provides an abstraction over Edcert. You can use the Letter |
homepage | |
repository | https://github.com/zombiemuffin/edcert-letter/ |
max_upload_size | |
id | 4500 |
size | 12,473 |
Hi and welcome on the git page of my crate "edcert-letter".
Edcert is a simple library for certification and authentication of data.
edcert-letter provides a Letter
The design uses the "super-secure, super-fast" elliptic curve Ed25519, which you can learn more about here
For cryptography it uses the sodiumoxide library, which is based on NaCl, the well known cryptography libraray by Dan Bernstein et al.
You can use Letter with a Ed25519 Keypair directly:
// You generate a ed25519 keypair
let (public_key, private_key) = ed25519::generate_keypair();
// Sign the letter with the private key
let test_str = "hello world";
let mut letter = Letter::with_private_key(test_str, &private_key);
// Now you can transport the letter and validate it using the public key.
assert_eq!(true, letter.is_valid(&public_key).is_ok());
letter.content = "world hello";
assert_eq!(false, letter.is_valid(&public_key).is_ok());
Or you can use Edcert Certificates:
// (let meta = ..., let expires = ...)
let (public_key, private_key) = ed25519::generate_keypair();
let mut cert = Certificate::generate_random(meta, expires);
cert.sign_with_master(&private_key);
let test_str = "hello world";
let mut letter = Letter::with_certificate(test_str, &cert);
assert_eq!(true, letter.is_valid(&public_key).is_ok());
letter.content = "world hello";
assert_eq!(false, letter.is_valid(&public_key).is_ok());
MIT
That means you can use this code in open source projects and/or commercial projects without any problems. Please read the license file "LICENSE" for details