Module tox::toxencryptsave
source · Expand description
Tox Encrypt Save (a.k.a. TES) module. Can be used to ecrypt / decrypt data that will be stored on persistent storage. E.g.
use tox::toxencryptsave::*;
let plaintext = b"pls no encrypt";
let password = b"123456";
// to encrypt data
let encrypted = pass_encrypt(plaintext, password)
.expect("Failed to encrypt >.<\"");
// confirm that the data is encrypted
assert!(plaintext != encrypted.as_slice());
assert!(is_encrypted(&encrypted));
// decrypted is same as plaintext
assert_eq!(plaintext,
pass_decrypt(&encrypted, password).unwrap().as_slice());
Structs
Key and
Salt
that are used to encrypt/decrypt data.Enums
Constants
Minimal size in bytes of an encrypted file.
Length in bytes of the key used to encrypt/decrypt data.
Number of bytes in a
PrecomputedKey
.Length (in bytes) of
MAGIC_NUMBER
.Bytes used to verify whether given data has been encrypted using TES.
Length in bytes of the salt used to encrypt/decrypt data.
Number of bytes in a
Salt
.Functions
Get
Salt
from data encrypted with TES.Check if given piece of data appears to be encrypted by TES.
Try to decrypt given TES data with provided passphrase.
Try to encrypt given data with provided passphrase.