# `encrypted-message`
[](https://crates.io/crates/encrypted-message)
[](https://docs.rs/encrypted-message)
[](https://github.com/RigoOnRails/encrypted-message/actions/workflows/development.yml)
[](LICENSE)
Safely encrypt & store serializable data using AES-256-GCM.
## Install
```toml
[dependencies]
encrypted-message = "0.2"
```
## Diesel support
`EncryptedMessage` implements [`FromSql`](https://docs.diesel.rs/2.1.x/diesel/deserialize/trait.FromSql.html) & [`ToSql`](https://docs.diesel.rs/2.1.x/diesel/serialize/trait.ToSql.html).
```toml
[dependencies]
encrypted-message = { version = "0.2", features = ["diesel", "diesel-<mysql|postgres>"] }
```
## Examples
- [`examples/basic.rs`](examples/basic.rs), a basic example of how to use `encrypted-message`.
- [`examples/key_config_with_external_data.rs`](examples/key_config_with_external_data.rs), an example of a `KeyConfig` that depends on external data, like a user-provided key or password.
## Security
This crate uses trusted, pure-Rust encryption using the [`aes_gcm`](https://crates.io/crates/aes_gcm) crate
from the [Rust Crypto][rust-crypto] organization.
Keys are handled safely using the [`secrecy`](https://crates.io/crates/secrecy) crate,
which internally uses the [`zeroize`](https://crates.io/crates/zeroize) crate (also from [Rust Crypto][rust-crypto])
to zero-out the keys in memory when no longer used.
[rust-crypto]: https://github.com/RustCrypto