From e8a93acee3a9d2bf1167ef597b87b734442d1cfc Mon Sep 17 00:00:00 2001 From: kroko Date: Wed, 24 Apr 2024 15:51:00 +0200 Subject: [PATCH] delete account without e-mail and text --- .idea/deploymentTargetDropDown.xml | 4 +-- .idea/misc.xml | 3 ++ .idea/vcs.xml | 1 - .../befund/Core/Https/Request.java | 6 +++- .../befund/Core/Https/Servers.java | 2 +- .../Models/Response/EncryptedResponse.java | 36 +++++++------------ .../labor_stein/befund/SupportActivity.java | 30 +++++++++------- 7 files changed, 41 insertions(+), 41 deletions(-) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 2784c9c..e84b35d 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -7,11 +7,11 @@ - + - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 487c8e1..a602d81 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -24,6 +24,9 @@ + + + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 91072de..94a25f7 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,6 +2,5 @@ - \ No newline at end of file diff --git a/app/src/main/java/de/labor_stein/befund/Core/Https/Request.java b/app/src/main/java/de/labor_stein/befund/Core/Https/Request.java index e3aa669..dad1cc6 100644 --- a/app/src/main/java/de/labor_stein/befund/Core/Https/Request.java +++ b/app/src/main/java/de/labor_stein/befund/Core/Https/Request.java @@ -35,7 +35,7 @@ import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; -import de.labor_stein.befund.BuildConfig; +//import de.labor_stein.befund.BuildConfig; import de.labor_stein.befund.Core.Lang.Lang; import de.labor_stein.befund.Core.Log; import de.labor_stein.befund.Core.Models.Request.EncryptedRequest; @@ -46,6 +46,10 @@ import de.labor_stein.befund.Core.Models.Session; import de.labor_stein.befund.Core.Security.AES; import de.labor_stein.befund.Core.Security.Curve25519; +class BuildConfig +{ + public static boolean DEBUG = true; +} public class Request { /** diff --git a/app/src/main/java/de/labor_stein/befund/Core/Https/Servers.java b/app/src/main/java/de/labor_stein/befund/Core/Https/Servers.java index 8d2d1a1..540f283 100644 --- a/app/src/main/java/de/labor_stein/befund/Core/Https/Servers.java +++ b/app/src/main/java/de/labor_stein/befund/Core/Https/Servers.java @@ -10,7 +10,7 @@ package de.labor_stein.befund.Core.Https; public enum Servers { // Development server change ip to your local ip - DEVELOPMENT("192.168.10.26"), + DEVELOPMENT("patientenbefundapp.labor-muenster.de"), //DEVELOPMENT("172.21.200.145"), /** diff --git a/app/src/main/java/de/labor_stein/befund/Core/Models/Response/EncryptedResponse.java b/app/src/main/java/de/labor_stein/befund/Core/Models/Response/EncryptedResponse.java index 2fac4b5..a23f6a5 100644 --- a/app/src/main/java/de/labor_stein/befund/Core/Models/Response/EncryptedResponse.java +++ b/app/src/main/java/de/labor_stein/befund/Core/Models/Response/EncryptedResponse.java @@ -127,31 +127,21 @@ public class EncryptedResponse */ public boolean ValidSignature(byte[] deriveKey, String serverSignature, String serverSignatureKey) { - if (this.encrypted_content != null && !this.encrypted_content.isEmpty()) + String content; + if ( this.encrypted_content != null && !this.encrypted_content.isEmpty()) { - return - // Validate over HMAC - (this.hmac != null && !this.hmac.isEmpty() && - deriveKey != null && - deriveKey.length > 0 && - SHA512.isValidAuthenticationCode(hmac, this.encrypted_content, deriveKey)) && - - //Validate over Ed25519 - (serverSignature != null && !serverSignature.isEmpty() && - Ed25519.CheckValid(Base64.FromBase64String(serverSignature), this.encrypted_content.getBytes(StandardCharsets.UTF_8), Base64.FromBase64String(serverSignatureKey))); + content = this.encrypted_content; } - else - { - return - // Validate over HMAC - (this.hmac != null && !this.hmac.isEmpty() && - deriveKey != null && - deriveKey.length > 0 && - SHA512.isValidAuthenticationCode(hmac, this.descriptor, deriveKey)) && - - //Validate over Ed25519 - (serverSignature != null && !serverSignature.isEmpty() && - Ed25519.CheckValid(Base64.FromBase64String(serverSignature), this.descriptor.getBytes(StandardCharsets.UTF_8), Base64.FromBase64String(serverSignatureKey))); + else { + content = this.descriptor; } + return (this.hmac != null && !this.hmac.isEmpty() && + deriveKey != null && + deriveKey.length > 0 && + // Validate over HMAC + SHA512.isValidAuthenticationCode(hmac, content, deriveKey)) && + (serverSignature != null && !serverSignature.isEmpty() && + //Validate over Ed25519 + Ed25519.CheckValid(Base64.FromBase64String(serverSignature), content.getBytes(StandardCharsets.UTF_8), Base64.FromBase64String(serverSignatureKey))); } } diff --git a/app/src/main/java/de/labor_stein/befund/SupportActivity.java b/app/src/main/java/de/labor_stein/befund/SupportActivity.java index c711ae8..c0414cd 100644 --- a/app/src/main/java/de/labor_stein/befund/SupportActivity.java +++ b/app/src/main/java/de/labor_stein/befund/SupportActivity.java @@ -548,33 +548,37 @@ public class SupportActivity extends AppCompatActivity SupportActivity_Loading.setVisibility(View.GONE); - if(SupportActivity_txtEmail.getText() == null || SupportActivity_txtEmail.getText().toString().isEmpty()) - { - this.SupportActivity_HideLoading(Lang.Get("ERROR_ENTER_EMAIL")); - } - else if(SupportActivity_Topics.getSelectedItemPosition() < 0) + if(SupportActivity_Topics.getSelectedItemPosition() < 0) { this.SupportActivity_HideLoading(Lang.Get("ERROR_ENTER_TOPIC")); } - else if(SupportActivity_txtTEXT.getText() == null || SupportActivity_txtTEXT.getText().toString().isEmpty()) - { - this.SupportActivity_HideLoading(Lang.Get("ERROR_ENTER_TEXT")); - } else { - String email = SupportActivity_txtEmail.getText().toString(); int topicIndex = (int)SupportActivity_Topics.getSelectedItemId(); String topic = Topics[topicIndex]; - String text = SupportActivity_txtTEXT.getText().toString(); - if(topic == Lang.Get("LBL_SUPPORT_TOPIC_ACCOUNT_DELETE")) { PopupPasswordConfirm_Show(); } else { - this.SendAsync(email, topic, text, false); + if(SupportActivity_txtEmail.getText() == null || SupportActivity_txtEmail.getText().toString().isEmpty()) + { + this.SupportActivity_HideLoading(Lang.Get("ERROR_ENTER_EMAIL")); + } + else if(SupportActivity_txtTEXT.getText() == null || SupportActivity_txtTEXT.getText().toString().isEmpty()) + { + this.SupportActivity_HideLoading(Lang.Get("ERROR_ENTER_TEXT")); + } + else + { + String email = SupportActivity_txtEmail.getText().toString(); + String text = SupportActivity_txtTEXT.getText().toString(); + this.SendAsync(email, topic, text, false); + } + } + } } catch (Exception ex)