mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-25 05:26:50 +00:00
fix(crypto): reject plaintext fallback without crypto (#4391)
* fix(crypto): reject plaintext fallback without crypto * test(crypto): gate no-feature regression under cfg
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#![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)));
|
||||
}
|
||||
Reference in New Issue
Block a user