[−][src]Crate tox_encryptsave
E.g.
use tox_encryptsave::*; 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_ne!(plaintext, encrypted.as_slice()); assert!(is_encrypted(&encrypted)); // decrypted is same as plaintext assert_eq!(plaintext, pass_decrypt(&encrypted, password).unwrap().as_slice());
Structs
PassKey | Key and |
Enums
DecryptionError | Error when trying to decrypt data. |
EncryptionError | Error encrypting data. |
KeyDerivationError | Deriving secret key for |
Constants
EXTRA_LENGTH | Minimal size in bytes of an encrypted file. |
KEY_LENGTH | Length in bytes of the key used to encrypt/decrypt data.
Number of bytes in a |
MAGIC_LENGTH | Length (in bytes) of |
MAGIC_NUMBER | Bytes used to verify whether given data has been encrypted using TES. |
SALT_LENGTH | Length in bytes of the salt used to encrypt/decrypt data.
Number of bytes in a |
Functions
get_salt | Get |
is_encrypted | Check if given piece of data appears to be encrypted by TES. |
pass_decrypt | Try to decrypt given TES data with provided passphrase. |
pass_encrypt | Try to encrypt given data with provided passphrase. |