mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-28 09:08:58 +00:00
f8ee0e7071
* fix(crypto): reject plaintext fallback without crypto * test(crypto): gate no-feature regression under cfg
22 lines
575 B
Rust
22 lines
575 B
Rust
#![cfg(not(feature = "crypto"))]
|
|
|
|
use rustfs_crypto::{Error, decrypt_data, encrypt_data};
|
|
|
|
#[test]
|
|
fn encrypt_data_returns_error_without_crypto_feature() {
|
|
let plain = b"must not be returned as ciphertext";
|
|
|
|
let result = encrypt_data(b"password", plain);
|
|
|
|
assert!(matches!(result, Err(Error::ErrCryptoDisabled)));
|
|
}
|
|
|
|
#[test]
|
|
fn decrypt_data_returns_error_without_crypto_feature() {
|
|
let ciphertext = b"must not be returned as plaintext";
|
|
|
|
let result = decrypt_data(b"password", ciphertext);
|
|
|
|
assert!(matches!(result, Err(Error::ErrCryptoDisabled)));
|
|
}
|