Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9185851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:22:42+00:00 2026-06-17T19:22:42+00:00

I recently bought a smart card reader (Gemplus USB Smart Card Reader) which came

  • 0

I recently bought a smart card reader (Gemplus USB Smart Card Reader) which came with some cards. I’ve been reading several tutorials about how to work with them but I have a couple of questions. I’m trying to comunicate (Sending APDU) with the smart card but with not success. I installed an applet into a Virtual smart card (using Netbeans).

My process method is like this:

    byte[] buffer = apdu.getBuffer();
    byte CLA = (byte) (buffer[ISO7816.OFFSET_CLA] & 0xFF);
    byte INS = (byte) (buffer[ISO7816.OFFSET_INS] & 0xFF);

    if (CLA != HW_CLA){
        ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
    }        
    switch (INS) {
        case HW_INS_ADD:               
            add(apdu);
            break;
        case HW_INS_SUBTRACT:                
            subtract(apdu);
            break;
        default:
            ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
    }

The add and subtract method adds or substract 5 units to a declared variable (balance). I would like to save into the card the balance value after making an operation. Does anyone know how can i write that value into the card? And if possible, how can i read it before?

Appreciate any help.
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:22:43+00:00Added an answer on June 17, 2026 at 7:22 pm

    Any state within persistent (persistent memory means EEPROM or flash) fields will be kept until the Applet instance is deleted. The same goes for state within non-transient array elements. Of course, you need to retain a persistent reference to the array for this to be the case. The contents of transient (transient means RAM) CLEAR_ON_DESELECT arrays will be cleared once a context switch is made, e.g. when another Applet is selected (and the current one deselected) or when a soft or hard reset happens. Of course CLEAR_ON_RESET arrays will only be wiped on a reset (including loss of power).

    Basically all object instances live in persistent memory, this means any object instance created with new. This is also the case for any object created by the platform where the API does not explicitly specify that the result is transient. The APDU buffer itself will always be cleared each time the process method is called.

    If you want to store something like a balance, you need to know about the Java Card transaction mechanism, especially if your operations are not atomic.

    Note that many Java Card simulators do not keep any state when the process containing the simulator ends. This is not a good representation of how real Java Card implementations behave.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just recently bought some hardware that came with a header file and object
I recently bought Programming Scala , and have been reading through it. The language
So I just recently bought some web hosting and I'm trying to get my
Well, recently i bought a software that submits RSS to various RSS directories. Some
I recently bought some webspace with dailyrazor.com. I have deployed an application I have
I have recently bought an Arduino Uno, which is basically an atMega328 avr processor
I'm really new to jQuery but familiar with some other languages. I recently bought
I recently bought a new computer that came with Mountain Lion (OS 10.8). I'd
I've recently bought a new computer, installed XCode 4 on it (which comes with
I've recently started working with AndEngine. I went through online tutorials, video lectures, bought

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.