[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] branch master updated: update verification-app
From: |
gnunet |
Subject: |
[taler-donau] branch master updated: update verification-app |
Date: |
Thu, 13 Jun 2024 15:16:58 +0200 |
This is an automated email from the git hooks/post-receive script.
lukas-matyja pushed a commit to branch master
in repository donau.
The following commit(s) were added to refs/heads/master by this push:
new 973736d update verification-app
973736d is described below
commit 973736d72bb05fd9e52bf04e9d5839628711b838
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
AuthorDate: Thu Jun 13 15:18:53 2024 +0200
update verification-app
---
verification-app/app/build.gradle | 2 +-
.../taler/donau/verification/MainActivity.java | 18 +++++++
.../java/taler/donau/verification/Results.java | 55 ++++++++++++++++-----
.../app/src/main/res/drawable/ngi_taler_logo.png | Bin 0 -> 17661 bytes
.../app/src/main/res/layout/fragment_results.xml | 37 +++++++++-----
.../app/src/main/res/values/strings.xml | 6 +++
6 files changed, 94 insertions(+), 24 deletions(-)
diff --git a/verification-app/app/build.gradle
b/verification-app/app/build.gradle
index f146172..2948556 100644
--- a/verification-app/app/build.gradle
+++ b/verification-app/app/build.gradle
@@ -62,7 +62,7 @@ dependencies {
implementation 'androidx.navigation:navigation-ui:2.7.5'
implementation 'com.github.yuriy-budiyev:code-scanner:2.3.2'
// https://mvnrepository.com/artifact/org.bouncycastle/bcpkix-jdk18on
- implementation group: 'org.bouncycastle', name: 'bcpkix-jdk18on', version:
'1.78.1'
+ implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version:
'1.70'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
diff --git
a/verification-app/app/src/main/java/taler/donau/verification/MainActivity.java
b/verification-app/app/src/main/java/taler/donau/verification/MainActivity.java
index f614ffb..ecf77f4 100644
---
a/verification-app/app/src/main/java/taler/donau/verification/MainActivity.java
+++
b/verification-app/app/src/main/java/taler/donau/verification/MainActivity.java
@@ -1,3 +1,19 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2024 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+
package taler.donau.verification;
import static androidx.core.content.PermissionChecker.PERMISSION_GRANTED;
@@ -53,6 +69,8 @@ public class MainActivity extends AppCompatActivity {
});
}
});
+ //temporary for debugging should be a valid cleartext message for
signing and the public key
+
//sendRequestDialog("AAAAZAAABdwAAAAAAAAADwAAAABFVVIAAAAAAAAAAACoq+wLL6w/nI0IwLKwbnXlkbZ6XLpHzA8MZkaPHba13bdUYbV+oeF/HrkLYubKnhzSSR5DgpcJKI4fH1kryuGhAAAH6A==:Y/YreQExHCGHv83mME0YMxd0DbMUMsEztJ5UHypm+bA=");
}
@Override
diff --git
a/verification-app/app/src/main/java/taler/donau/verification/Results.java
b/verification-app/app/src/main/java/taler/donau/verification/Results.java
index a045006..a993362 100644
--- a/verification-app/app/src/main/java/taler/donau/verification/Results.java
+++ b/verification-app/app/src/main/java/taler/donau/verification/Results.java
@@ -1,26 +1,54 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2024 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+
package taler.donau.verification;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
+import java.security.KeyFactory;
+import java.security.PublicKey;
+import java.security.Security;
+import java.security.Signature;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Base64;
+
import androidx.appcompat.app.AppCompatActivity;
import java.nio.charset.StandardCharsets;
+import java.security.KeyFactory;
+import java.security.PublicKey;
+import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
import org.bouncycastle.crypto.Signer;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.crypto.signers.Ed25519Signer;
import org.bouncycastle.crypto.util.OpenSSHPublicKeyUtil;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
public class Results extends AppCompatActivity {
- // QR-string:
YEAR:AMOUNT:FRACTION:TAXID:TAXIDSALT:EDD25519SIGNATURE:PUBLICKEY
+ // QR-string: YEAR:AMOUNT:FRACTION:TAXID:TAXIDSALT:EDD25519SIGNATURE
// Base64 encoded: SALT,TAXID,SIGNATURE, PUBLICKEY (public key only
temporary for testing)
+ // The public key should be requested directly from the Donau over HTTPS
- private final int NUMBER_OF_ARGUMENTS = 7;
+ private final int NUMBER_OF_ARGUMENTS = 6;
// hard coded (only temporary for testing)
private final int SIGNATURECODE = 1500;
// uint64_t
@@ -28,7 +56,7 @@ public class Results extends AppCompatActivity {
// uint32_t
private int fraction;
// uint64_t
- private long year;
+ private Long year;
private byte[] taxid;
private byte[] salt;
private byte[] eddsaSignature;
@@ -51,7 +79,7 @@ public class Results extends AppCompatActivity {
Intent intent = getIntent();
textView.setText(intent.getStringExtra("QR-String"));
- String[] parts = intent.getStringExtra("QR-String").split("/");
+ String[] parts = intent.getStringExtra("QR-String").split(":");
if (parts == null || parts.length != NUMBER_OF_ARGUMENTS) {
statusHandling(SignatureStatus.INVALID_NUMBER_OF_ARGUMENTS);
return;
@@ -70,11 +98,16 @@ public class Results extends AppCompatActivity {
return;
}
- checkSignature();
+ try {
+ checkSignature();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
- private void checkSignature() {
+ // FIXME: Maybe simpler with java native?!
+ private void checkSignature() throws Exception{
AsymmetricKeyParameter publicKeyParameters =
OpenSSHPublicKeyUtil.parsePublicKey(publicKey);
Signer verifier = new Ed25519Signer();
verifier.init(false, publicKeyParameters);
@@ -90,27 +123,25 @@ public class Results extends AppCompatActivity {
} else {
statusHandling(SignatureStatus.SIGNATURE_INVALID);
}
-
}
- // TODO: move strings to res/values/strings
private void statusHandling(SignatureStatus es) {
View rootView = findViewById(R.id.root_view);
switch (es) {
case INVALID_NUMBER_OF_ARGUMENTS:
- textView.setText("Invalid number of arguments!");
+ textView.setText(R.string.invalid_number_of_arguments);
rootView.setBackgroundResource(R.color.red);
break;
case MALFORMED_ARGUMENT:
- textView.setText("Malformed argument!");
+ textView.setText(R.string.malformed_argument);
rootView.setBackgroundResource(R.color.red);
break;
case SIGNATURE_INVALID:
- textView.setText("Donation Statment signature is invalid!");
+ textView.setText(R.string.invalid_signature);
rootView.setBackgroundResource(R.color.red);
break;
case SIGNATURE_VALID:
- textView.setText("Donation Statment signature is valid!");
+ textView.setText(R.string.valid_signature);
rootView.setBackgroundResource(R.color.green);
break;
}
diff --git a/verification-app/app/src/main/res/drawable/ngi_taler_logo.png
b/verification-app/app/src/main/res/drawable/ngi_taler_logo.png
new file mode 100644
index 0000000..31bff0d
Binary files /dev/null and
b/verification-app/app/src/main/res/drawable/ngi_taler_logo.png differ
diff --git a/verification-app/app/src/main/res/layout/fragment_results.xml
b/verification-app/app/src/main/res/layout/fragment_results.xml
index 53dce89..69f56f9 100644
--- a/verification-app/app/src/main/res/layout/fragment_results.xml
+++ b/verification-app/app/src/main/res/layout/fragment_results.xml
@@ -1,12 +1,27 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/root_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+android:id="@+id/root_view"
+xmlns:tools="http://schemas.android.com/tools"
+android:layout_width="match_parent"
+android:layout_height="match_parent"
+android:paddingStart="10dp"
+android:paddingEnd="10dp"
+android:orientation="vertical"
+tools:context=".MainActivity">
+<ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxWidth="200dp"
+ android:adjustViewBounds="true"
+ android:paddingBottom="30dp"
+ android:src="@drawable/ngi_taler_logo"
+ android:contentDescription="@string/NGI_TALER_logo" />
- <TextView
- android:id="@+id/textView"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20sp"
- android:layout_centerInParent="true"/>
-</RelativeLayout>
\ No newline at end of file
+<TextView
+ android:id="@+id/textView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="20sp"
+ android:layout_centerInParent="true"/>
+
+</LinearLayout>
diff --git a/verification-app/app/src/main/res/values/strings.xml
b/verification-app/app/src/main/res/values/strings.xml
index c9593d9..a0bd872 100644
--- a/verification-app/app/src/main/res/values/strings.xml
+++ b/verification-app/app/src/main/res/values/strings.xml
@@ -1,3 +1,9 @@
<resources>
<string name="app_name">Donau Verify</string>
+ <string name="NGI_TALER_logo" >NGI Taler Logo</string>
+ <string name="with_adapter">List</string>
+ <string name="invalid_number_of_arguments">Invalid number of
arguments!</string>
+ <string name="malformed_argument">Malformed argument!</string>
+ <string name="invalid_signature">Donation Statment signature is
invalid!</string>
+ <string name="valid_signature">Donation Statment signature is
valid!</string>
</resources>
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-donau] branch master updated: update verification-app,
gnunet <=