element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Internet of Things
  • Technologies
  • More
Internet of Things
Blog Blockchain - Debug the Infineon Demo App with Android Studio and Your Phone
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Internet of Things to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 14 Mar 2020 12:41 PM Date Created
  • Views 1419 views
  • Likes 5 likes
  • Comments 4 comments
  • infineon
  • security2go
  • security_2go
  • blockchain
  • rt
Related
Recommended

Blockchain - Debug the Infineon Demo App with Android Studio and Your Phone

Jan Cumps
Jan Cumps
14 Mar 2020

This post is part of the Infineon Blockchain Starter Kit road test.

Blockchain - outside of the bitcoin context - is new to me.

Follow along with me on this path to learn the technology....

 

 

Let's dive into the example Android App "coinfinity". Look at the sources. And set up a debug session with a pysical Android smartphone.

image

 

I'm documenting the steps I used to run the demo application, with support for breakpoints, watching variables and stepping-through-source-code.

For many apps, you can use a software telephone emulator. I couldn't find one that supports NFC development.

Running the debug session on a real phone with NFC works. That's the way I'll go here.

 

Install Android Studio

 

I'm using the latest version available from the Android Developers area.

I've used the full install, for my OS (Windows 10 - 64 Bit).

I made a change in the configuration after the install, to choose a good place to store virtual Android emulators:

File -> Settings -> Appearance & Behavior -> System Settings -> Android SDK -> Android SDK Location -> Edit

 

image

The install takes some time. meanwhile, you can:

 

Enable Developer Mode on your Android Phone

 

You'll never find how to do that by scrolling through the telephone settings. It's hidden.

I followed these instructions: Run apps on a hardware device.

 

image

Once you have unlocked developer access, go to Developer Options in the Settings app and enable USB debugging.

If the Stay Awake option is available, it's good to set it during the debug activities.

 

Get the Example App Sources

 

The GitHub url is https://github.com/Infineon/BlockchainSecurity2Go-Android .

There are several options. You can download it as a ZIP file from GitHub, clone it with GIT or use the Android Studio menus to fetch the project from GitHib.

That last option is the simplest.

VCS -> Checkout from Version Control -> Git.

Then enter the URL, and click Clone.

This will download project and source files and prepare the Android Image.

 

If you use one of the other options, you can open the project from the location where you downloaded / cloned the repository via File -> Open ...

The result is the same. Android opens your project. And it's ready to run.

That can be a first test: try to load the app to your phone and run it:

 

image

This will load and run the application. Not in Debug, but in Run mode.

But there's a first interesting bonus: you can see the application log in Android Studio:  the first evidence of the traffic caused by tapping a Security 2Go card on an NFC device.

image

 

image

 

Debug a Real World Activity: Read one of the Public Keys of a Card

 

Now the real thing. Let's put a breakpoint on the part of the source where the app uses the NFC module to read one of the keys.

image

 

The public key is read in class co.coinfinity.infineonandroidapp.infineon.NfcUtils.

There, in the method readPublicKeyFromCard(), set a breakpoint on the following line:

 

// send apdu
GetKeyInfoResponseApdu resp = (GetKeyInfoResponseApdu) tranceive(card, apdu, "GET KEY INFO");

 

Then, instead of using the Run button, click on the Android Robot icon. That's the Debug button.

Your telephone will pop up a message that it's waiting for the debug connection, then starts the app.

Select the Key Index you want to read in the app (default is Key 1.

Then tap and leave one of the cards from the Security 2Go kit on your phone. The breakpoint is reached.

Use the Step icon to execute the tranceive() call.

You can now inspect the value returned by the call.

 

image

All exciting stuff !

 

 

Related Blog
Blockchain - HyperLedger Fabric pt 1: post and search transactions on a distributed trusted ledger
Blockchain - Hyperledger Burrow: set up a distributed ledger
Blockchain - Get Some Crypto Currency on an Infineon Security 2Go Card
Blockchain - Debug the Infineon Demo App with Android Studio and Your Phone
Blockchain - Analyse the Infineon Android Demo App - part a: Detect Card
Blockchain - Analyse the Infineon Android Demo App - part b: Retrieve Ethereum Crypto Currency Balance
Blockchain - Analyse the Infineon Android Demo App - part c: Transaction, Move Crypto Currency to Another Account
Blockchain - Talk Directly to the Infineon 2Go Smart Cards API
Blockchain - Smart Contract Test
Road Test notepad: Infineon Blockchain Starter Kit
Infineon Blockchain Starter Kit - Review
Blockchain - HyperLedger Fabric pt 2: application using blockchain and smart contract
Blockchain - HyperLedger Fabric pt 3: web console
  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 5 years ago in reply to Jan Cumps +1
    yes, it's an easter egg . I found how to invoke it on the app by reading the code. Not giving it away here ... not hard once you have the suspicion. I found how to invoke it in less than 2 minutes.
  • Jan Cumps
    Jan Cumps over 5 years ago

    Related: debug an Android app in a VM running on Windows:

    image

    image

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to Jan Cumps

    Jan Cumps wrote:

     

    yes, it's an easter egg image. I found how to invoke it on the app by reading the code. Not giving it away here ... not hard once you have the suspicion. I found how to invoke it in less than 2 minutes.

     

    Easter egg morphed:

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to Jan Cumps

    yes, it's an easter egg image. I found how to invoke it on the app by reading the code. Not giving it away here ... not hard once you have the suspicion. I found how to invoke it in less than 2 minutes.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 5 years ago

    Easter egg?

     

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube