Module proj_crypto::asymmetric::key_id
[−]
[src]
Key ID module
Used to select the correct public key from the other party from the set of known public keys
Example
extern crate sodiumoxide; extern crate proj_crypto; use proj_crypto::asymmetric::key_exchange::gen_keypair; use proj_crypto::asymmetric::PublicKey; use proj_crypto::asymmetric::key_id::*; use std::collections::HashMap; sodiumoxide::init(); // keypairs let (me, one, two, three) = (gen_keypair(), gen_keypair(), gen_keypair(), gen_keypair()); let mut db: HashMap<PublicKeyId, PublicKey> = HashMap::new(); db.insert(id_of_pk(&one.0), one.0.clone()); db.insert(id_of_pk(&two.0), two.0.clone()); db.insert(id_of_pk(&three.0), three.0.clone()); let pk = find_public_key(&id_of_pk(&two.0), &db).unwrap();
Structs
PublicKeyId |
Public Key - just an alias. Implements drop() so the memory will be wiped when it goes out of scope The type of the identifier used to specify the other party's public key. This has to be a custom struct so that I can implement std::hash::Hash |
Functions
find_public_key |
Given an identifier, attempts to find the correct public key to use in LongKeys. |
id_of_pk |
Calculate the ID of a public key |