Integrity Error on Change Key Desfire EV3 on Android

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Integrity Error on Change Key Desfire EV3 on Android

290 次查看
saikumar_CH
Junior Contributor I

Environment Details:

Card:
- MIFARE DESFire EV3

SDK:
- NXP TapLinx

Android:
- Android Studio + Kotlin

Transport:
- IsoDep

Library Interface:
- IDESFireEV1

Goal:
1. Create DESFire EV3 application
2. Change application master key (key 0)
3. Authenticate with new key

Working:
- PICC authentication
- formatPICC()
- createApplication()
- selectApplication()

Failing:
- authenticate() on newly created AES application
OR
- changeKey() with SW2=30Working:
- PICC authentication
- formatPICC()
- createApplication()
- selectApplication()

Failing:
- changeKey() with SW2=30

 Logcat:
Integrity Error SW2 = 30
 com.nxp.nfclib.desfire.DESFireUtil.invalidResponse(:260)
com.nxp.nfclib.desfire.DESFireResponse.invalidResponse(:174)
 com.nxp.nfclib.desfire.DESFireEV2.changeKeyCommandTransfer(:1034)
com.nxp.nfclib.desfire.DESFireEV1.changeKeyHelper(:1215)
com.nxp.nfclib.desfire.DESFireEV2.changeKey(:851)



private fun createApplication() {
        val s = EV1ApplicationKeySettings.Builder()
            .setAppMasterKeyChangeable(true)
            .setAppKeySettingsChangeable(true)
            .setAuthenticationRequiredForFileManagement(true)
            .setAuthenticationRequiredForDirectoryConfigurationData(true)
            .setMaxNumberOfApplicationKeys(3)
            .setKeyTypeOfApplicationKeys(KeyType.TWO_KEY_THREEDES)
            .build()
        desfire.createApplication(AID, s)
        detail("  createApplication: AID=${AID.toHex()}, type=$KEY_TYPE, numKeys=3")
    }



desfire.changeKey(keyNo, KeyType.TWO_KEY_THREEDES, oldKey, newKey, 0x00)

 

0 项奖励
回复
1 回复

235 次查看
KaiLi
NXP TechSupport
NXP TechSupport

Hello @saikumar_CH 

Recommends you to refer Sample_Application_Android\src\main\java\com\nxp\sampletaplinx\WriteActivity, there has desfireEV3CardLogic could be helpful to you.

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2362155%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9C%A8%20Android%20%E4%B8%8A%E6%9B%B4%E6%94%B9%E5%AF%86%E9%92%A5%E6%97%B6%E5%87%BA%E7%8E%B0%E5%AE%8C%E6%95%B4%E6%80%A7%E9%94%99%E8%AF%AF%20Desfire%20EV3%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2362155%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E7%8E%AF%E5%A2%83%E8%AF%A6%E6%83%85%EF%BC%9A%3C%2FP%3E%3CP%3E%E5%8D%A1%EF%BC%9A%3CBR%20%2F%3E-%20MIFARE%20DESFire%20EV3%3C%2FP%3E%3CP%3ESDK%3A%3CBR%20%2F%3E-%20NXP%20TapLinx%3C%2FP%3E%3CP%3EAndroid%3A%3CBR%20%2F%3E-%20Android%20Studio%20%2B%20Kotlin%3C%2FP%3E%3CP%3E%E8%BF%90%E8%BE%93%EF%BC%9A%3CBR%20%2F%3E-%20IsoDep%3C%2FP%3E%3CP%3E%E5%BA%93%E6%8E%A5%E5%8F%A3%EF%BC%9A%3CBR%20%2F%3E-%20IDESFireEV1%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E7%9B%AE%E6%A0%87%EF%BC%9A%3C%2FSPAN%3E%3CBR%20%2F%3E%201%3CSPAN%3E.%20%E5%88%9B%E5%BB%BA%20DESFire%20EV3%20%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%3C%2FSPAN%3E%3CBR%20%2F%3E%202%3CSPAN%3E.%3C%2FSPAN%3E%E6%9B%B4%E6%94%B9%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E4%B8%BB%E5%AF%86%E9%92%A5%EF%BC%88%E5%AF%86%E9%92%A5%200%EF%BC%89%3CBR%20%2F%3E%203%3CSPAN%3E.%E4%BD%BF%E7%94%A8%E6%96%B0%E5%AF%86%E9%92%A5%E9%AA%8C%E8%AF%81%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CPRE%20translate%3D%22no%22%3EWorking%3A%0A-%20PICC%20authentication%0A-%20formatPICC()%0A-%20createApplication()%0A-%20selectApplication()%0A%0AFailing%3A%0A-%20authenticate()%20on%20newly%20created%20AES%20application%0AOR%0A-%20changeKey()%20with%20SW2%3D30Working%3A%0A-%20PICC%20authentication%0A-%20formatPICC()%0A-%20createApplication()%0A-%20selectApplication()%0A%0AFailing%3A%0A-%20changeKey()%20with%20SW2%3D30%0A%0A%20Logcat%3A%0AIntegrity%20Error%20SW2%20%3D%2030%0A%20com.nxp.nfclib.desfire.DESFireUtil.invalidResponse(%3A260)%0Acom.nxp.nfclib.desfire.DESFireResponse.invalidResponse(%3A174)%0A%20com.nxp.nfclib.desfire.DESFireEV2.changeKeyCommandTransfer(%3A1034)%0Acom.nxp.nfclib.desfire.DESFireEV1.changeKeyHelper(%3A1215)%0Acom.nxp.nfclib.desfire.DESFireEV2.changeKey(%3A851)%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CPRE%20translate%3D%22no%22%3E%3CSPAN%20class%3D%22%22%3Eprivate%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Efun%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EcreateApplication%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E()%3C%2FSPAN%3E%3C%2FSPAN%3E%20%7B%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22%22%3Eval%3C%2FSPAN%3E%20s%20%3D%20EV1ApplicationKeySettings.Builder()%0A%20%20%20%20%20%20%20%20%20%20%20%20.setAppMasterKeyChangeable(%3CSPAN%20class%3D%22%22%3Etrue%3C%2FSPAN%3E)%0A%20%20%20%20%20%20%20%20%20%20%20%20.setAppKeySettingsChangeable(%3CSPAN%20class%3D%22%22%3Etrue%3C%2FSPAN%3E)%0A%20%20%20%20%20%20%20%20%20%20%20%20.setAuthenticationRequiredForFileManagement(%3CSPAN%20class%3D%22%22%3Etrue%3C%2FSPAN%3E)%0A%20%20%20%20%20%20%20%20%20%20%20%20.setAuthenticationRequiredForDirectoryConfigurationData(%3CSPAN%20class%3D%22%22%3Etrue%3C%2FSPAN%3E)%0A%20%20%20%20%20%20%20%20%20%20%20%20.setMaxNumberOfApplicationKeys(%3CSPAN%20class%3D%22%22%3E3%3C%2FSPAN%3E)%0A%20%20%20%20%20%20%20%20%20%20%20%20.setKeyTypeOfApplicationKeys(KeyType.TWO_KEY_THREEDES)%0A%20%20%20%20%20%20%20%20%20%20%20%20.build()%0A%20%20%20%20%20%20%20%20desfire.createApplication(AID%2C%20s)%0A%20%20%20%20%20%20%20%20detail(%3CSPAN%20class%3D%22%22%3E%22%20%20createApplication%3A%20AID%3D%3CSPAN%20class%3D%22%22%3E%24%7BAID.toHex()%7D%3C%2FSPAN%3E%2C%20type%3D%3CSPAN%20class%3D%22%22%3E%24KEY_TYPE%3C%2FSPAN%3E%2C%20numKeys%3D3%22%3C%2FSPAN%3E)%0A%20%20%20%20%7D%0A%0A%0A%0Adesfire.changeKey(keyNo%2C%20KeyType.TWO_KEY_THREEDES%2C%20oldKey%2C%20newKey%2C%20%3CSPAN%20class%3D%22%22%3E0x00%3C%2FSPAN%3E)%3C%2FPRE%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2362432%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Integrity%20Error%20on%20Change%20Key%20Desfire%20EV3%20on%20Android%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2362432%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F262534%22%20target%3D%22_blank%22%3E%40saikumar_CH%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%E5%BB%BA%E8%AE%AE%E6%82%A8%E5%8F%82%E8%80%83%20Sample_Anpplication_Android%5Csrc%5Cmain%5Cjava%5Ccomnxp%5Csampletaplinx%5CWriteActivity%20%EF%BC%8C%E9%82%A3%E9%87%8C%E7%9A%84%3CSPAN%3EdesfireEV3CardLogic%20%E5%8F%AF%E8%83%BD%E4%BC%9A%E5%AF%B9%E6%82%A8%E6%9C%89%E6%89%80%E5%B8%AE%E5%8A%A9%E3%80%82%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E