Forum / MIFARE general topics and applications / NTAG424DNATT authenticateEV2First Error
-
Hi, sorry i don't know if this is the right section, i'm using a clean ntag424DNATT, samsung s4 and Android studio. I want use the authenticateEV2First command, i'm following the example application. I'll post my code here. These are the problems: when i call the ntag424DNATT.isoSelectApplicationByDFName(NTAG424DNATT_APP_NAME) the result is: null, when i call ntag424DNATT.isoSelectApplicationByFileID(id) with byte id="E110" or id="3F00" the response is piccException with code 6A82 that equals at File or application not found, if i try to authenticate without select application before, the app return code exception 911C that equals ILLEGAL_COMMAND_CODE Command code not supported. Please someone can help me? why i have that response?
private void cardLogic(final Intent intent){
CardType type= m_libInstance.getCardType(intent); //return NTAG424DNATT
try{
if(DESFireFactory.getInstance().getNTAG424DNATT(m_libInstance.getCustomModules()) instanceof INTAG424DNATT){//is true
tag424DNATTCardLogic(DESFireFactory.getInstance().getNTAG424DNATT(m_libInstance.getCustomModules()));
}
}catch (Exception e){
TextView tv=findViewById(R.id.nfc_memory_label);
tv.setText("tap again");
}
}
that call the follow method:
private void tag424DNATTCardLogic(INTAG424DNATT ntag424DNATT){
ntag424DNA_global=ntag424DNATT;
String i,k;
i=ntag424DNATT.toString();//ok
k=ntag424DNATT.getType().getTagName();//ok
//byte[] getVersion = ntag424DNATT.getVersion();
if(ntag424DNATT==null){
i="null";
}else{
i="non nulla";//go this, => is ok
}
/*if (getVersion[0] == (byte) 0x04) { //if i call this method i have the piccException with code 6A82
i="is nxp";
}else{
i="non nxp";
}
i=
int k=ntag424DNA.getTotalMemory();*/
byte[] KEY_AES128_DEFAULT = {
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,(byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,(byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00
};
byte[] NTAG424DNATT_APP_NAME =
{(byte) 0xD2, (byte) 0x76, 0x00, 0x00, (byte) 0x85, 0x01, 0x01};// i tryed with this or with {(byte) 0xD2, (byte) 0x76, 0x00, 0x00, (byte) //0x85, 0x01, 0x00}
byte[] ISO_file_ID= UtilityManager.hex2Byte("E110");// or with that byte[] id=UtilityManager.hex2Byte("3F00");
try{
//byte[] UID= ntag424DNA.getCardUID();//Exception need authentication to have this
CardType ct= ntag424DNATT.getType();
byte[] appName= ntag424DNATT.isoSelectApplicationByDFName(NTAG424DNATT_APP_NAME);// return null
byte[] appID=ntag424DNATT.isoSelectApplicationByFileID(ISO_file_ID);// return piccException with code 6A82
KeyData aesKeyData = new KeyData();
Key keyDefault = new SecretKeySpec(KEY_AES128_DEFAULT, "AES");
aesKeyData.setKey(keyDefault);
byte [] lencap=UtilityManager.hex2Byte("00");
ntag424DNATT.authenticateEV2First(0, aesKeyData,null);// if i try to do this without doing isoSelectApplicationByDFName or ID return exception 911C //that equals ILLEGAL_COMMAND_CODE
TagTamper tagTamper = ntag424DNATT.getTTStatus();
ntag424DNATT.isoSelectApplicationByDFName(NTAG424DNA_APP_NAME);
aesKeyData.setKey(keyDefault);
ntag424DNATT.authenticateEV2First(0, aesKeyData, null);
Log.d(TAG,"autenticazione riuscita");
}catch (Exception e){
TextView tv=findViewById(R.id.NFC_error_TextView);
tv.setText("Autenticazione fallita:"+e.getMessage());
}
}
the example application do the same. So why this doesn't work?
Thank you in advice for your help.
+ 0 | - 0
Post was sent twice.
Find reply on first post.
The TapLinx team
+ 0 | - 0
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.