yogesh patel
yogesh patel

Reputation: 375

SmartCard ATR change not reflected in code

I am working with SmartCard API with both C++ (Windows API) and Java also.

I have a problem with getting ATR after deleting OS. My application is made to delete OS from the SmartCard. When the OS is deleted ATR of the card is changed, but it didn't reflect in my code. After deleting OS I still get the same ATR but when I restart my application it shows correct ATR.

Snippets of my code.

CardConnect();
getATR(); //get correct ATR
eraseOS(deleteOScmd,size); //Erasing OS

CardConnect(); //again connecting
getATR();      // againg try to get ATR but shows same as first call. 

This is same happening with Java Code also. I want to dispaly new ATR but can't get updated ATR.

Can anybody help me? Thanks.

Upvotes: 0

Views: 320

Answers (1)

guidot
guidot

Reputation: 5333

By deleting the OS you are so far away from any standard use of a smart card, that any explanation is possible. The reader, the smart card reader driver, the resource manager or anybody else could rely on the fact, that in case no new smartcard was inserted, the old ATR is still valid and simply provide a cached copy of the previous data. (Note that all but the historical bytes from ATR are associated with communication between card and the reader and there is no reason for a change). In real life it is quite dangerous to allow anything like erasure of the OS to happen.

I suspect, that you attach a meaning to the ATR which should better be placed into a user data object.

Upvotes: 1

Related Questions