summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYigit Sever2021-04-16 14:41:35 +0300
committerYigit Sever2021-04-16 14:41:35 +0300
commit45d98cdbf95580ea7e21d17a0518993fe23914a0 (patch)
treeb48baf4608325dd536d07cb5fd68684f9f047586 /src
parent109ae1f771ec5e8a5a9510c3b09fad579dab5ed7 (diff)
downloadgradecoin-45d98cdbf95580ea7e21d17a0518993fe23914a0.tar.gz
gradecoin-45d98cdbf95580ea7e21d17a0518993fe23914a0.tar.bz2
gradecoin-45d98cdbf95580ea7e21d17a0518993fe23914a0.zip
Passing auth test
Diffstat (limited to 'src')
-rw-r--r--src/handlers.rs9
1 files changed, 4 insertions, 5 deletions
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(
151 151
152 let res_json = warp::reply::json(&GradeCoinResponse { 152 let res_json = warp::reply::json(&GradeCoinResponse {
153 res: ResponseType::Error, 153 res: ResponseType::Error,
154 message: "Given IV has invalid length".to_owned(), 154 message: "Given IV has invalid length, use a 128 bit key".to_owned(),
155 }); 155 });
156 156
157 return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST)); 157 return Ok(warp::reply::with_status(res_json, StatusCode::BAD_REQUEST));
@@ -176,9 +176,8 @@ pub async fn authenticate_user(
176 } 176 }
177 }; 177 };
178 178
179 println!(">>>{:?}<<<", auth_packet); 179 let mut buf = auth_packet.to_vec();
180 180 let auth_plaintext = match cipher.decrypt(&mut buf) {
181 let auth_plaintext = match cipher.decrypt_vec(&auth_packet) {
182 Ok(p) => p, 181 Ok(p) => p,
183 Err(err) => { 182 Err(err) => {
184 println!( 183 println!(
@@ -195,7 +194,7 @@ pub async fn authenticate_user(
195 } 194 }
196 }; 195 };
197 196
198 let utf8_auth_plaintext = match String::from_utf8(auth_plaintext.clone()) { 197 let utf8_auth_plaintext = match String::from_utf8(auth_plaintext.to_vec()) {
199 Ok(text) => text, 198 Ok(text) => text,
200 Err(err) => { 199 Err(err) => {
201 debug!( 200 debug!(