Hi and welcome on the git page of my crate "edcert".
Edcert is a simple library for certification and authentication of data.
How it works
- You create a master keypair. This will be used to sign the highest certificate.
- You create a root certificate. Sign this with the master key.
- You can now create other certificates and use certificates to sign each other.
- Transmit your certificates in a json-encoded format over the network.
- Sign and verify data with the certificates using the ".sign" and ".verify" methods.
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.
Example
use Timelike;
use UTC;
use Duration;
use Meta;
use Certificate;
use CertificateValidator;
use NoRevoker;
// create random master key
let = generate_keypair;
// create random certificate
let meta = new_empty;
let expires = UTC now
.checked_add
.expect
.with_nanosecond
.unwrap;
let mut cert = generate_random;
// sign certificate with master key
cert.sign_with_master;
// the certificate is valid given the master public key
assert_eq!;
// but wait! if we want to validate more than one certificate with the same
// public key, which is more than likely, we can use this:
let cv = new;
// now we use the CV to validate certificates
assert_eq!;
// now we sign data with it
let data = ;
// and sign the data with the certificate
let signature = cert.sign.expect;
// the signature must be valid
assert_eq!;
License
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