This commit is contained in:
veeso
2022-03-05 10:35:16 +01:00
committed by Christian Visintin
parent babbc5eadb
commit 697ab225ea
2 changed files with 7 additions and 10 deletions

View File

@@ -32,16 +32,16 @@ use magic_crypt::MagicCryptTrait;
///
/// Crypt a string using AES128; output is returned as a BASE64 string
pub fn aes128_b64_crypt(key: &str, input: &str) -> String {
let crypter = new_magic_crypt!(key.to_string(), 128);
crypter.encrypt_str_to_base64(input.to_string())
let crypter = new_magic_crypt!(key, 128);
crypter.encrypt_str_to_base64(input)
}
/// ### aes128_b64_decrypt
///
/// Decrypt a string using AES128
pub fn aes128_b64_decrypt(key: &str, secret: &str) -> Result<String, magic_crypt::MagicCryptError> {
let crypter = new_magic_crypt!(key.to_string(), 128);
crypter.decrypt_base64_to_string(secret.to_string())
let crypter = new_magic_crypt!(key, 128);
crypter.decrypt_base64_to_string(secret)
}
#[cfg(test)]