pub fn decrypt<M: AsRef<[u8]>>(&self, message: M) -> Result<Vec<u8>> {
        decrypt_seal(
            self.0.master_key.as_bytes(),
            self.0.user_context.as_bytes(),
            message.as_ref(),
        )
    }
/// Extracts the original message from a sealed cell.
///
/// # Examples
///
/// If you know the master key and the context then getting back your data is easy:
///
/// ```
/// # fn main() -> Result<(), themis::Error> {
/// use themis::secure_cell::SecureCell;
///
/// let cell = SecureCell::with_key(b"password").seal();
///
/// let encrypted = cell.encrypt(b"byte string")?;
/// let decrypted = cell.decrypt(&encrypted)?;
/// assert_eq!(decrypted, b"byte string");
/// # Ok(())
/// # }
/// ```
///
/// However, if the key or the context are invalid then decryption fails:
///
/// ```
/// # use themis::secure_cell::SecureCell;
/// #
/// # let cell = SecureCell::with_key(b"password").seal();
/// # let encrypted = cell.encrypt(b"byte string").unwrap();
/// #
/// let different_cell = SecureCell::with_key(b"qwerty123").seal();
/// let the_other_cell = SecureCell::with_key_and_context(b"password", b"context").seal();
///
/// assert!(different_cell.decrypt(&encrypted).is_err());
/// assert!(the_other_cell.decrypt(&encrypted).is_err());
/// ```
///
/// Secure Cell in sealing mode checks data integrity and can see if the data was corrupted,
/// returning an error on decryption attempts:
///
/// ```
/// # use themis::secure_cell::SecureCell;
/// #
/// # let cell = SecureCell::with_key(b"password").seal();
/// # let encrypted = cell.encrypt(b"byte string").unwrap();
/// #
/// // Let's flip some bits somewhere.
/// let mut corrupted = encrypted.clone();
/// corrupted[20] = !corrupted[20];
///
/// assert!(cell.decrypt(&corrupted).is_err());
/// ```
Extracts the original message from a sealed cell.
Extracts the original message from a sealed cell .
pub fn decrypt<M: AsRef<[u8]>>(&self, message: M) -> Result<Vec<u8>> {
        decrypt_seal(
            self.0.master_key.as_bytes(),
            self.0.user_context.as_bytes(),
            message.as_ref(),
        )
    }
pub fn decrypt < M : AsRef < [ u8 ] > > ( & self , message : M ) -> Result < Vec < u8 > > { decrypt_seal ( self . 0 . master_key . as_bytes ( ) , self . 0 . user_context . as_bytes ( ) , message . as_ref ( ) , ) }
Extracts the original message from a sealed cell.
Extracts the original message from a sealed cell .
&self
message
M
&self
message
M
examples
If you know the master key and the context then getting back your data is easy.


If you know the master key and the context then getting back your data is easy .
fn main() -> result<(), themis::error> {
use themis::secure_cell::SecureCell.

let cell = SecureCell::with_key(b"password").seal().

let encrypted = cell.encrypt(b"byte string")?;
let decrypted = cell.decrypt(&encrypted)?;
assert_eq!(decrypted, b"byte string").
use themis :: secure_cell :: SecureCell . let cell = SecureCell :: with_key ( b " password " ) . seal () . let encrypted = cell . encrypt ( b " byte string " ) ? ; let decrypted = cell . decrypt ( &encrypted ) ? ; assert_eq! ( decrypted b " byte string " ) .
ok(())
None
}


However, if the key or the context are invalid then decryption fails.


However if the key or the context are invalid then decryption fails .
use themis::secure_cell::securecell;
None
let cell = securecell::with_key(b"password").seal();
None
let encrypted = cell.encrypt(b"byte string").unwrap();
let different_cell = SecureCell::with_key(b"qwerty123").seal();
let the_other_cell = SecureCell::with_key_and_context(b"password", b"context").seal().

assert!(different_cell.decrypt(&encrypted).is_err());
assert!(the_other_cell.decrypt(&encrypted).is_err());
```

Secure Cell in sealing mode checks data integrity and can see if the data was corrupted,
returning an error on decryption attempts.


let different_cell = SecureCell :: with_key ( b " qwerty123 " ) . seal () ; let the_other_cell = SecureCell :: with_key_and_context ( b " password " b " context " ) . seal () . assert! ( different_cell . decrypt ( &encrypted ) . is_err () ) ; assert! ( the_other_cell . decrypt ( &encrypted ) . is_err () ) ; ` ` ` Secure Cell in sealing mode checks data integrity and can see if the data was corrupted returning an error on decryption attempts .
use themis::secure_cell::securecell;
None
let cell = securecell::with_key(b"password").seal();
None
let encrypted = cell.encrypt(b"byte string").unwrap();
Let's flip some bits somewhere.

assert!(cell.decrypt(&corrupted).is_err());
```
Let ' s flip some bits somewhere . assert! ( cell . decrypt ( &corrupted ) . is_err () ) ; ` ` `