1 个不稳定版本
0.0.0 | 2020年4月3日 |
---|
#16 in #persist
3KB
+---------------------+
| |
| Encrypted |
| |
+---------------------+
用于程序中加密数据的封装器。使用可插拔的加密后端就地“打开”数据。此crate目前为空,并将很快填充!
use encrypted::{Encrypter, Encrypted, DetachedKey};
impl Encrypter for MyKeyType { ... }
impl Detachedkey for MyKeyType {}
fn main() {
let key: Arc<_> = // ... create your encryption key
let mut e = Encrypted::new("Hello!".to_string());
e.close(Arc::clone(&key)).unwrap();
// Now `e` is encrypted
assert_eq!(e.encrypted(), true);
}