Skip to main content

open

Function open 

Source
pub fn open<T, K>(blob: &[u8], key: Option<K>) -> Result<T, SerializationError>
where T: Decode<()>, K: AsRef<str>,
Expand description

Decode a byte blob produced by seal back into T.

If key is None the default key is used. String literals and owned Strings are both accepted. Returns an error if the key is wrong, the blob is truncated, or the ciphertext has been tampered with — the Poly1305 tag prevents decryption of modified data.

§Errors