mifare

How to decrypt the first message sent from Mifare Desfire EV1

柔情痞子 提交于 2019-11-30 11:56:57
问题 Does anyone have a clue how to decrypt the first message sent from the card? I mean after the authentication success and then you send a command (for example 0x51 (GetRealTagUID). It returns 00+random32bits (always different). I try to decrypt it with: private byte[] decrypt(byte[] raw, byte[] encrypted, byte[] iv) throws Exception { IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC

How mature is the Android NFC ISODep support?

不羁的心 提交于 2019-11-30 07:28:59
I understand that this is a "discussion" topic that has no definite answer, but I would really like some feedback on what to expect when developing NFC APPs for Android, in particular using IsoDep to communicate with DESFire cards using APDU frames. Can I expect that the same APDU frames sent to a particular DESFire card responds identically across Android Devices and versions? What Android versions and devices should I test on as a minimum to be reasonably well covered? Is it common with bugs or regressions in the Android drivers or can I expect that these are rooted out a long time ago? What

How to decrypt the first message sent from Mifare Desfire EV1

别说谁变了你拦得住时间么 提交于 2019-11-30 01:39:24
Does anyone have a clue how to decrypt the first message sent from the card? I mean after the authentication success and then you send a command (for example 0x51 (GetRealTagUID). It returns 00+random32bits (always different). I try to decrypt it with: private byte[] decrypt(byte[] raw, byte[] encrypted, byte[] iv) throws Exception { IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, skeySpec, ivParameterSpec); byte[] decrypted = cipher

javax.smartcardio: how to send native commands to Desfire card?

二次信任 提交于 2019-11-29 23:30:58
问题 I am creating a java application communicating with a Mifare DESFire card through a PC/SC contactless reader and the javax.smartcardio API. I manage to send regular ISO 7816 APDUs (CLA, INS, P1-P2, Lc, Command data, Le). I have read on Ridrix's Blog that DESFire cards (at least the EV1 version that I am using) support both APDUs and Native commands where most of the commands are only 1 byte long. For example, the " Get Version " command: Command: 60 Response: af 04 01 01 00 02 18 05 I tested

desfire command set detail [closed]

╄→尐↘猪︶ㄣ 提交于 2019-11-29 22:29:22
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I have experience in java cards, but new in programming host application for Desfire, How or Where can I find command set description of Desfire? (I do not need general information like what NXP has mentioned in It's "Product short data sheet"s), I need the commands Instruction code and parameter details and

java.lang.nullpointerexception in j2me

一曲冷凌霜 提交于 2019-11-29 17:40:37
I am writing an application for read the mifare card,but when I pass the APDU the error occur that on emulator "java.lang.nullpointerexception".I have successfully detect the ISO14443_CARD after that I pass the APDU like if (tp.hasTargetType(TargetType.ISO14443_CARD)){ form.append("Target is ISO14443_CARD\n"); try { static byte[] APDU_AUTH1 = { (byte) 0xff, (byte) 0x86, (byte) 0x00, (byte) 0x00, (byte) 0x05,(byte)0x01,(byte)0x00,(byte)0xfc,(byte)0x60,(byte)0x00}; static byte[] STATUS_BYTE = {(byte)0x90,(byte)0x00}; if(STATUS_BYTE == iso14443.exchangeData(APDU_LOAD_KEY)) { String value1 = new

Writing NDEF data to NTAG216 tag using low-level NFC communication methods

给你一囗甜甜゛ 提交于 2019-11-29 16:26:00
问题 I have implemented the code to interact with an NTAG216 by means of low-level communication methods (following NTAG212 Mifare Ultralight with Authentication and the datasheet of NTAG216). What I have achieved so far: Set password write protection on NTAG216 if not set or if new/blank tag. If password is already set, authenticate using PWD_AUTH and comparing PACK. Read data. Write/overwrite data. What I haven't been able to do so far: Detect NDEF messages that I write to the tag in other apps.

How to detect NFC tag was removed

一笑奈何 提交于 2019-11-29 16:02:10
I am new at NFC technology. I am trying to read and write Mifare Classic 4K tags. I succeeded reading and writing. I can detect the tag on onNewIntent action. My problem is that I could't detect when an NFC tag was removed (similar to onNewIntent when detecting a tag). How can I solve this problem? There is no event that notifies your app if a tag is removed from the reader. A typical approach to detect removal is to actively poll the tag (e.g. by reading an NDEF message or a data block) until you receive IOException indicating that communication with the tag was lost. UPDATE As of Android API

Why doesn't Android HCE support Mifare Classic type?

旧时模样 提交于 2019-11-29 07:44:47
Mifare Classic is the most used cards and I can't understand why HCE (Host-based Card Emulation) only supports ISO 14443-4, but not Mifare Classic type. Because NXP stops them from using their proprietary protocols and algorithms? Or because they didn’t implement Mifare Classic in Android OS level? Any comments will be very appreciated. Short answer: Because Google decided to support only ISO/IEC 7816-4 over ISO-DEP (ISO/IEC 14443-4). Speculations on why they decided that way: First of all, ISO/IEC 7816-4 over ISO-DEP is the highes protocol layer that could be used to route communication to

Android nfcA.connect(), nfcA.transceive(), nfcA.setTimeout() and nfcA.getMaxTransceiveLength()

…衆ロ難τιáo~ 提交于 2019-11-29 04:35:38
I have a a number of newbie NfcA questions. There seems to be little guidance on this in the docs and elsewhere on the web, so I hope no-one minds me stringing a few basic questions together here... I am using nfcA.transceive() to write data to my NTAG213 tag like this: byte[] result = nfcA.transceive(new byte[] { (byte)0xA2, // WRITE (byte)(pageNum & 0x0ff), myData[0], myData[1], myData[2], myData[3] }); 1. The result array is a single byte of value 10. What does this mean and what other values should I look out for? I am also using the same method to read data from my NTAG213 tags: byte[]