Tuesday, July 1, 2014

Host Card Emulation Series: HCE Virtual Card Life Cycle Management

HCE has introduced a new and powerful way to create, issue and manage virtual cards stored in the cloud. The value of HCE is clear but with that recognition comes a great deal of other questions. One of the most common questions is that surrounding virtual card life cycle management. This blog post will discuss one tools made available by SimplyTapp to manage your virtual card in the cloud in the SimplyTapp system.


SimplyTapp offers STBridge as tool to manage card life cycle. STBridge allows an issuer to connect to a virtual card instance in the SimplyTapp cloud.

STBridge is used to communicate APDUs, and other GP commands, to a specific virtual card residing in the cloud platform. STBridge supports standard GPJ shell commands.

STBridge packaged as an executable jar (STBridge) and can be executed in the following format:

java -jar STBridge.jar -ck consumer_key -cs consumer_secret -at access_token_to_card -ts access_token_secret [-s jcsh_script_to_run

STBridge Paramater list:

-ck the issuer consumer key
-cs the issuer consumer secret
-at the card access token
-ts the card access token secret

There are various ways for obtaining the parameters from a virtual card in cloud needed to execute STBridge.
This example we are we are working with a previously create virtual card.

Managing An Active Card

Appending scripts to the STBridge.jar executable file allows one to manage card life cycle. The following are examples of how to manage card life cycle.

Card is personalized by running a personalization (perso) script.
After perso script is executed, the card is in activated state.

Post card personalization, you can connect to card and  run any various card management scripts. Activating an activated card does nothing and deactivating a deactivated card does not change the state of the card, but scripts will execute.
The following are examples of executing card management scripts on a  active virtual card in the cloud.

Deactivate Card.

vcbp_deactivate_card.jcsh is script to deactivate the card. 
After running the script, the card agent is disabled from performing contact-less transactions.  







Activate card

vcbp_activate_card.jcsh is script to activate the card again. 
After running the script, the card agent is enabled to perform contact-less transactions. 

Terminate card

vcbp_terminate_card.jcsh is script to terminate the card.
 After running the script, the card agent is disabled from performing contact-less transaction. The card agent does not load anymore after refreshing/restarting the wallet. This is like a kill switch, the state cannot be changed from terminated.  

Running vcbp_terminate_card script updates the card state in the database to "dead". 
Once a card is terminated it is marked as dead and can not be recovered to active state from  the data base.

The complete STBridge tutorial can be found at:  http://wiki.simplytapp.com/utilities-resources/stbridge/stbridge-guide

31 comments:

  1. Hi Tom, thanks for the blog on HCE. I am using SimpllyTapp sdk as given in http://blog.simplytapp.com/2014/10/the-absolute-simplest-hce-application.html . But am facing 2 issues, one is a crash whose stacktrace is given below

    W/dalvikvm( 9324): threadid=17: thread exiting with uncaught exception (group=0x41efec08)
    D/MainActivity( 9324): Account is Disabled cardId=6164 code=24
    D/MainActivity( 9324): Account is Disabled cardId=6164 code=24
    E/AndroidRuntime( 9324): FATAL EXCEPTION: Thread-2714
    E/AndroidRuntime( 9324): Process: com.example.sampletapp, PID: 9324
    E/AndroidRuntime( 9324): java.lang.NullPointerException
    E/AndroidRuntime( 9324): at com.simplytapp.cardagent.c.run(SourceFile:1794)
    E/AndroidRuntime( 9324): at java.lang.Thread.run(Thread.java:841)
    W/ActivityManager( 3042): Force finishing activity com.example.sampletapp/.MainActivity
    I/CardAgent( 9324): activated, tGetAccountParams is still accessing remote card applet, waiting...
    I/ServiceKeeper( 3042): In getseinfo pid = 3042 uid = 1000 seinfo= system
    D/CrashAnrDetector( 3042): processName: com.example.sampletapp
    D/CrashAnrDetector( 3042): broadcastEvent : com.example.sampletapp data_app_crash
    W/ApplicationPackageManager( 3042): getCSCPackageItemText()
    V/SmartFaceService - 3rd party pause( 3042): onReceive [android.intent.action.ACTIVITY_STATE/com.example.sampletapp/pause]
    D/SSRMv2:CustomFrequencyManagerService( 3042): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT frequency : 1200000 uid : 1000 pid : 3042 pkgName : ACTIVITY_RESUME_BOOSTER@4
    W/ActivityManager( 3042): mDVFSHelper.acquire()

    In another issue, am trying you read card data using SoftPcd as below but transceiveWithCard() function is returning same value 6F00 in all the cases. Your help would be greatly appreciated.
    SoftPcd softPcd = new SoftPcd((short)5000);
    try {
    virtualCard.transactWithSoftPcd(softPcd);
    } catch (IOException e) {
    e.printStackTrace();
    }
    try {
    softPcd.connect();
    byte[] apdu = softPcd.transceiveWithCard(new byte[]{0x00,(byte)0xA4,0x04,0x00,0x05,(byte)0x32,0x50,0x41,0x59,(byte)0x2E});
    apdu = softPcd.transceiveWithCard(new byte[]{0x00,(byte)0xA4,0x04,0x00,0x07,(byte)0xA0,0x00,0x00,0x02,0x77,0x10,0x10,0x00});
    apdu = softPcd.transceiveWithCard(new byte[]{(byte)0x80,(byte)0xA8,0x00,0x00,0x15,(byte)0x83,0x13,(byte)0xD0,(byte)0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x01,0x01,0x24,0x01,0x24,0x02,0x66,0x33,(byte)0x82,0x01,0x00});
    apdu = softPcd.transceiveWithCard(new byte[]{0x00,(byte)0xB2,0x01,0x0C,0x00});
    apdu = softPcd.transceiveWithCard(new byte[]{0x00,(byte)0xB2,0x01,0x14,0x00});
    apdu = softPcd.transceiveWithCard(new byte[]{0x00,(byte)0xB2,0x02,0x14,0x00});
    apdu = softPcd.transceiveWithCard(new byte[]{0x00,(byte)0xB2,0x03,0x14,0x00});
    apdu = softPcd.transceiveWithCard(new byte[]{0x00,(byte)0xB2,0x04,0x14,0x00});
    apdu = softPcd.transceiveWithCard(new byte[]{0x00,(byte)0xB2,0x01,0x1C,0x00});
    apdu = softPcd.transceiveWithCard(new byte[]{(byte)0x80,(byte)0xAE,(byte)0x80,0x00,0x2A,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x24,
    0x00,(byte)0x80,0x00,(byte)0x80,0x00,0x01,0x24,0x13,0x06,0x27,0x00,0x02,0x66,0x33,(byte)0x82,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00});
    softPcd.disconnect();
    } catch (IOException e) {
    e.printStackTrace();
    }

    Thanks,
    Pradeep.

    ReplyDelete
  2. We've all had a puncture at some time while we've been cycling along enjoying the chosen cycle route. You may also gain some knowledge of your local area as you pick up information on places of interest when you're out on your cycle ride. bicycle reviews

    ReplyDelete
  3. تعد شركة تركيب اثاث ايكيا بالرياض هي الشركة الرائده والاولي في كافة الاثاث من تركيب وفك ونقل وتخزين وكافة الاعمال المتعلقة بالاثاث في الرياض وكافة المناطق والمحافظات بالمملكة العربية السعودية، وقد تصدرت شركة خبراء المملكة لتكون الأولى في مجال فك ونقل وتركيب الأثاث المنزلي وايضا فك وتركيب الستائر بالرياض وهي تتميز عن باقي شركات الرياض نظرا لما تقدمة من خدمات بشكل احترافي كما انها تتميز عن غيرها بكفاءة الفنيين والامتخصصين في مجال تركيب الاثاث فلا داعي لكثرة البحث فلديك خبراء المملكة فهم فعلا خبراء ومتميزون في جميع خدماتهم المقدمة
    شركة تركيب اثاث ايكيا بالرياض
    فني تركيب اثاث ايكيا بالرياض
    شركة تركيب ستائر بالرياض
    عامل تركيب ستائر بالرياض
    شركة تركيب غرف نوم بالرياض
    فني تركيب غرف نوم بالرياض
    شركة تركيب باركية بالرياض
    شركة تركيب عفش بالرياض
    ما يميز شركة تركيب نقل وتركيب اثاث بالرياض
    - تعد شركة تركيب اثاث ايكيا من الشركات المفضلة لكثير من العملاء فهم من منحوها الصدارة والتميز لتميز الخدمات المقدمة لهم وهي الاولي في تركيب الاثاث لزيادة خبراتها الكبيرة لسنوات.
    تتميز ايضا شركة خبراء المملكة بكبر فرق العمل المتخصصة والمدربة بمهاره وتقنية عالية كما اننا ندعم صفوفنا بصفة مستمرة من العمال والموظفين والفنيين الأكفاء والمهرة كما انها Jستقبل العمالة الفليبنية

    ReplyDelete
  4. very interesting post.this is my first time visit here.i found so mmany interesting stuff in your blog especially its discussion..thanks for the post!
    Time management

    ReplyDelete

  5. I have seen article reading. I am very satisfied. The website opening speed is fast and its texture is good.Thank you so much for sharing.
    Click Here : 2006 Cat 140H (616) w/10365 Hrs For Sale at $98k

    ReplyDelete
  6. Hi…this is Abhinav here, from few months I am visiting and following you. What I really like about you is that your writing style. Please keep making such as information for us.
    Top CA firms in India, Top CA in India.

    ReplyDelete
  7. quickbooks vs quicken are two most used accounting software around the world ,here we have discuss how they affect the working and how can we troubleshoot them easily.

    ReplyDelete
  8. Thanks for sharing your thoughts. I truly appreciate your efforts and I will be waiting for your further write ups thank you once again. for more information click here:- Download AOL Desktop Gold

    ReplyDelete
  9. Hlw everyone i am here to share some knowledge regarding the quickbook error 15215 server not responding visit this site and have all the information regarding this errorquickbooks unexpected error 5: A QBs Repairing Guide

    ReplyDelete
  10. Hey There. I found your weblog using msn. This is an extremely smartly written article. I’ll be sure to bookmark it and return to learn extra of your helpful information. Thanks for the post.
    I’ll certainly return.
    스포츠토토

    ReplyDelete
  11. We absolutely love your blog and find almost all of your post’s to be just what I’m looking for.
    Does one offer guest writers to write content for you personally?
    I wouldn’t mind publishing a post or elaborating on a number of the subjects you write with regards to here.
    Again, awesome web log!
    일본야동

    ReplyDelete
  12. The ability to work from anywhere with an internet connection provides me with greater flexibility while traveling, whether it be to visit family, travel to watch my favorite sports on TV. I’m looking for this kind of flexibility. 안전놀이터

    ReplyDelete
  13. If you have any recommendations, please let me know. Appreciate it! Feel free to visit my website;

    야설

    ReplyDelete
  14. This type of article will be able to think and analyzed to the readers thats leads them in a bright future. I think this is one of the most significant information for me.
    한국야동

    ReplyDelete
  15. And i’m glad reading your article. But should remark on some general things, The web site style is perfect, the articles is really great. Feel free to visit my website;
    국산야동

    ReplyDelete
  16. Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies.Thanks digital business card online

    ReplyDelete
  17. Thank you so much for describing all the steps from card activation to card deactivation in Virtual Card Life Cycle in the best and simplest terms. I am willing to use all of this information with my Dissertation Writing Services.

    ReplyDelete
  18. Card is personalized by running a personalization (perso) script. Dissertation writers UK

    ReplyDelete
  19. The content is great here, and I have found a lot of interesting things to read. dental in Faridabad

    ReplyDelete
  20. Roulette chips have no worth away from the roulette wheel. When you are prepared 1xbet korea to go away the desk, place all of your remaining roulette chips on the desk and tell the supplier you'd prefer to money out. Thomas Bass, in his e-book The Eudaemonic Pie , has claimed find a way to|to have the ability to} predict wheel efficiency in actual time. This is an updated and improved version of Edward O. Thorp's strategy, where Newtonian Laws of Motion are applied to trace the roulette ball's deceleration; therefore the British title. This kind of bet is well-liked in Germany heaps of|and lots of} European casinos. It is also be|can be} offered as a 5-chip bet in lots of} Eastern European casinos.

    ReplyDelete