Struct pwbox::ErasedPwBox
source · [−]pub struct ErasedPwBox { /* private fields */ }
Expand description
Password-encrypted box suitable for (de)serialization.
Serialization
When used with a human-readable format (JSON, YAML, TOML, …), the pwbox
is serialized as the following structure:
const TOML: &str = r#"
ciphertext = 'cd9d2fb2355d8c60d92dcc860abc0c4b20ddd12dd52a4dd53caca0a2f87f7f5f'
mac = '83ae22646d7834f254caea78862eafda'
kdf = 'scrypt-nacl'
cipher = 'xsalsa20-poly1305'
[kdfparams]
salt = '87d68fb57d9c2331cf2bd9fdd7551057798bd36d0d2999481311cfae39863691'
memlimit = 16777216
opslimit = 524288
[cipherparams]
iv = 'db39c466e2f8ae7fbbc857df48d99254017b059624af7106'
"#;
let pwbox = toml::from_str(TOML).unwrap();
let pwbox = Eraser::new().add_suite::<Sodium>().restore(&pwbox).unwrap();
assert!(pwbox.open("correct horse battery staple").is_ok());
Implementations
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for ErasedPwBox
impl Send for ErasedPwBox
impl Sync for ErasedPwBox
impl Unpin for ErasedPwBox
impl UnwindSafe for ErasedPwBox
Blanket Implementations
Mutably borrows from an owned value. Read more