Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
FlutterCrypto committed Apr 7, 2023
1 parent 9104d5a commit 9873997
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,36 @@ public void onTagDiscovered(Tag tag) {
// proceed only when te do have a positive read result = 0x'9000' at the end of response data
if (selectPpseResponseOk != null) {

/**
* step 2 code start
*/

//writeToUiAppend("");
printStepHeader(2, "search applications on card");
writeToUiAppend("02 analyze select PPSE response and search for tag 0x4F (applications on card)");

BerTlvParser parser = new BerTlvParser();
BerTlvs tlv4Fs = parser.parse(selectPpseResponseOk);
// find all entries for tag 0x4f
List<BerTlv> tag4fList = tlv4Fs.findAll(new BerTag(0x4F));
if (tag4fList.size() < 1) {
writeToUiAppend("there is no tag 0x4F available, stopping here");
startEndSequence(nfc);
}
writeToUiAppend("Found tag 0x4F " + tag4fList.size() + (tag4fList.size() == 1 ? " time:" : " times:"));
ArrayList<byte[]> aidList = new ArrayList<>();
for (int i4f = 0; i4f < tag4fList.size(); i4f++) {
BerTlv tlv4f = tag4fList.get(i4f);
byte[] tlv4fBytes = tlv4f.getBytesValue();
aidList.add(tlv4fBytes);
writeToUiAppend("application Id (AID): " + bytesToHexNpe(tlv4fBytes));
}
writeToUiAppend(etData, "02 analyze select PPSE response completed");

/**
* step 2 code end
*/

} else {
// if (isoDepInTechList) {
writeToUiAppend("The discovered NFC tag does not have an IsoDep interface.");
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="Talk to your CreditCard part 1"
android:text="Talk to your CreditCard part 2"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="bold" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<string name="app_name">Talk to your Credit Card</string>
<string name="action_licenses">Used libraries and their licenses</string>
<string name="copy_right" translatable="false">Copyrights © %1$d</string>
<string name="app_description">This is the first app (part 1) for the \"Talk to your Credit Card\" application.\n\nThe full app reads your Credit Card and retrieves the card number and expiration date.</string>
<string name="app_description">This is the second app (part 2) for the \"Talk to your Credit Card\" application.\n\nThe full app reads your Credit Card and retrieves the card number and expiration date.</string>
</resources>
Binary file removed docs/app01.png
Binary file not shown.
Binary file added docs/app02a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/app02b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/full/app01.png
Binary file not shown.
Binary file added docs/full/app02a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/full/app02b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions logfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ timeout new: 10000 ms
------------------------------------
*********************************
************ step 02 ************
* search applications on card *
*********************************
02 analyze select PPSE response and search for tag 0x4F (applications on card)
Found tag 0x4F 1 time:
application Id (AID): a0000000041010
*********************************
************ step 99 ************
* our journey ends *
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Talk to your Credit Card part 1
# Talk to your Credit Card part 2

This app shows how to talk with a Credit Card and get information's like the Credit Card number,
the card's expiration date and some other data.
Expand All @@ -18,7 +18,7 @@ The app uses the NFC **ReaderMode** to get access to the card.

There are apps available for each step in my GitHub repository - the naming shows the step that has the code including this step.

This is the app for the first step 1: **select the Paypass Payment System Environment (PPSE)** in **TalkToYourCreditCardPart1**.
This is the app for the first step 2: **identify applications on the card** in **TalkToYourCreditCardPart2**.

The app is tested on real Android devices running Android versions 5.0.1, 8.0 and 13.

Expand All @@ -31,7 +31,7 @@ These are the steps to read a payment card, it is a kind of "question & answer"
- read all files given in the AFL list and find the file where there are the elements "Application Primary Account Number" and "Application Expiration Date"
- print out the "Application Primary Account Number" ("PAN") = card number and "Application Expiration Date" = expiration date of the card.

![step 1: after reading a Credit Card](docs/app01.png?raw=true)
![step 2: after reading a Credit Card](docs/app02a.png?raw=true) ![step 2: after reading a Credit Card](docs/app02b.png?raw=true)

In AndroidManifest.xml grant these permissions:
```plaintext
Expand Down

0 comments on commit 9873997

Please sign in to comment.