From abe7d7e11638b5496fa89da73823701dc0f6e5d4 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 16 Apr 2021 14:41:35 +0300 Subject: Passing auth test --- src/handlers.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/handlers.rs') diff --git a/src/handlers.rs b/src/handlers.rs index 2401c0d..ee0fbf0 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -151,7 +151,7 @@ pub async fn authenticate_user( let res_json = warp::reply::json(&GradeCoinResponse { res: ResponseType::Error, - message: "Given IV has invalid length".to_owned(), + message: "Given IV has invalid length, use a 128 bit key".to_owned(), }); return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); @@ -176,9 +176,8 @@ pub async fn authenticate_user( } }; - println!(">>>{:?}<<<", auth_packet); - - let auth_plaintext = match cipher.decrypt_vec(&auth_packet) { + let mut buf = auth_packet.to_vec(); + let auth_plaintext = match cipher.decrypt(&mut buf) { Ok(p) => p, Err(err) => { println!( @@ -195,7 +194,7 @@ pub async fn authenticate_user( } }; - let utf8_auth_plaintext = match String::from_utf8(auth_plaintext.clone()) { + let utf8_auth_plaintext = match String::from_utf8(auth_plaintext.to_vec()) { Ok(text) => text, Err(err) => { debug!( -- cgit v1.2.3-70-g09d2