Uses Table cipher and aes-128-gcm for test

This commit is contained in:
zonyitoo
2020-02-24 13:03:57 +08:00
parent 2139b356b4
commit 5b77751144
3 changed files with 6 additions and 7 deletions

View File

@@ -804,13 +804,12 @@ impl Display for CipherType {
mod test_cipher {
use crate::crypto::{new_stream, CipherType, CryptoMode};
#[cfg(feature = "aes-cfb")]
#[test]
fn test_get_cipher() {
let key = CipherType::Aes128Cfb.bytes_to_key(b"PassWORD");
let iv = CipherType::Aes128Cfb.gen_init_vec();
let mut encryptor = new_stream(CipherType::Aes128Cfb, &key[0..], &iv[0..], CryptoMode::Encrypt);
let mut decryptor = new_stream(CipherType::Aes128Cfb, &key[0..], &iv[0..], CryptoMode::Decrypt);
let key = CipherType::Table.bytes_to_key(b"PassWORD");
let iv = CipherType::Table.gen_init_vec();
let mut encryptor = new_stream(CipherType::Table, &key[0..], &iv[0..], CryptoMode::Encrypt);
let mut decryptor = new_stream(CipherType::Table, &key[0..], &iv[0..], CryptoMode::Decrypt);
let message = "HELLO WORLD";
let mut encrypted_msg = Vec::new();

View File

@@ -70,7 +70,7 @@ fn socks5_relay_stream() {
const LOCAL_ADDR: &str = "127.0.0.1:8200";
const PASSWORD: &str = "test-password";
const METHOD: CipherType = CipherType::Aes256Cfb;
const METHOD: CipherType = CipherType::Aes128Gcm;
let mut rt = Builder::new().basic_scheduler().enable_all().build().unwrap();
let rt_handle = rt.handle().clone();

View File

@@ -31,7 +31,7 @@ const UDP_ECHO_SERVER_ADDR: &str = "127.0.0.1:50403";
const UDP_LOCAL_ADDR: &str = "127.0.0.1:9011";
const PASSWORD: &str = "test-password";
const METHOD: CipherType = CipherType::Aes128Cfb;
const METHOD: CipherType = CipherType::Aes128Gcm;
fn get_svr_config() -> Config {
let mut cfg = Config::new(ConfigType::Server);