1 unstable release
0.3.0 | Apr 28, 2024 |
---|---|
0.2.0 |
|
0.1.0 |
|
#1836 in Cryptography
183 downloads per month
32KB
394 lines
encrypted-message
Safely encrypt & store serializable data using AES-256-GCM.
Install
[dependencies]
encrypted-message = "0.3"
Integration with Diesel
EncryptedMessage
implements FromSql
& ToSql
, allowing you to use EncryptedMessage
as a field type in your models.
- MySQL: Enable the
diesel
&diesel-mysql
features. Supports theJson
type. - PostgreSQL: Enable the
diesel
&diesel-postgres
features. Supports theJson
&Jsonb
types.
[dependencies]
encrypted-message = { version = "0.3", features = ["diesel", "diesel-<mysql|postgres>"] }
Examples
examples/basic.rs
, a basic example of how to useencrypted-message
.examples/config_with_external_data.rs
, an example of aConfig
that depends on external data, like a user-provided key or password.
Security
This crate uses trusted, pure-Rust encryption using the aes_gcm
crate
from the Rust Crypto organization.
Keys are handled safely using the secrecy
crate,
which internally uses the zeroize
crate (also from Rust Crypto)
to zero-out the keys in memory when no longer used.
Dependencies
~2.2–4.5MB
~97K SLoC