问题
Following some example I can read all blocks of sector 0 of a Mifare 1K card with the following commands:
- Load Authentication Keys
- Authentication
- Read Binary Blocks
For the first command I used a key of FF FF FF FF FF FF. When I try to read block 4 (sector 1) I get an access denied error. I suppose it is due to the fact that sector has a non default key. Is it correct ?
I'm not familiar with smart cards, the one I'm testing is for logging access to workplace, I (erroneously ?) thought it was as simple as a single read. All I need is the 6 digit code stamped on the card. I now suspect I have to know the key before accessing the information on the card.
Besides I thought there was a standard for Mifare 1K adpu.
According to documentation on internet the error condition is Sw1 = 0x63
but according to my specific reader manual (AccessIs ATR210) it is Sw1 = 0x69
. There are major differences in the adpu command too and it is confusing for me.
回答1:
Mifare and smart cards are different, only the latter understand APDUs. For the former the reader translates a pseudo-APDU to the respective command, therefore the reader or its driver may require different bytes.
If the card you describe is used for a real world application, then a key different from the default is the very minimum one has to do to maintain the low MIFARE classic security. Besides a different value, the read access may not be possible using key A at all, see the data sheet, section 8.7.2.
I have no idea, what is stamped on your card, but 6 digits are less than the key value, which requires 6 bytes. Just the key value(s), i. e. for key A and B will allow you to access everything possibly restricted by the configured access bits.
来源:https://stackoverflow.com/questions/56538255/smart-card-mifare-1k-keys