Read an unique ID from RFID card in Python

I have an OmniKey 5321 SmartCard reader, and a PC with Debian. The following Python code reads the cards:

from smartcard.CardMonitoring import CardMonitor, CardObserver
from smartcard.util import *
import sys

class printobserver( CardObserver ):
    def update( self, observable, (addedcards, removedcards) ):
        for card in addedcards:
            print "+Inserted: ", toHexString( card.atr )
        for card in removedcards:
            print "-Removed:  ", toHexString( card.atr )

    print "Insert or remove a smartcard in the system."
    print ""
    cardmonitor = CardMonitor()
    cardobserver = printobserver()
    cardmonitor.addObserver( cardobserver )
    raw_input('Press Enter to exit\n')
    print "Unexpected error: ", sys.exc_info()[0]

The Python code runs fine, but gives me back the same atr tag for many cards. The given atr is:

3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A

How can I read something uniqe from the cards? I've understand that I have to send some commands, and the replies will contains the UID, but how can I find the commands? How will I send them?



Once you connected to the card (or actually the reader), you can send the PC/SC standardized command for getting the card UID from the reader:

FF CA 00 00 00

Need Your Help

What is Content Build Action in Visual Studio?

visual-studio visual-studio-2012 build buildaction

What does the Content Build Action in Visual Studio do? It does not look like it's doing anything.

Concatenate Variable in a string Jquery

jquery string laravel concatenation

I have a laravel project and using an ajax call, I need the Edit button link to be rendered correctly so I have this: