pub fn open<T, K>(blob: &[u8], key: Option<K>) -> Result<T, SerializationError>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
SerializationError::Cipherif authentication fails (wrong key or tampered blob).SerializationError::Decodeif the decrypted bytes cannot be interpreted asT.