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

Returns the byte size of the encrypted data stored in this box.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.