Crate keybob[][src]

Utility crate that creates cryptographic keys

This crate provides an easy API to create and work with cryptographic keys. For now only Aes128 (32 byte) and Aes256 (64 byte) keys are supported but more can be added easily.

To create a key, you can either generate one from scratch or use a user provided password/ name (as salt) combination.

extern crate keybob;
use keybob::{Key, KeyType};
let key = Key::new(KeyType::Aes256);

Additionally, all keybob keys are easily serialized with serde

extern crate serde_json;
extern crate keybob;
use keybob::{Key, KeyType};
let k = Key::new(KeyType::Aes128);
let ser = serde_json::to_string(&k).unwrap();
let de: Key = serde_json::from_str(&ser).unwrap();
assert_eq!(k, de);

Key::from_pw uses the pbkdf2 key derivation function with a Hmac<Blake2b> hash to expand a user password/name (salt) into a key object of a certain type.

To then use the key, use as_slice() or as_mut_slice() on the key object.

For more examples, check the tests directory



A crytographic key of a certain type



The type of key that should be created