Authenticate against Ultralight C with TapLinx

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

Authenticate against Ultralight C with TapLinx

475 次查看
stba
Contributor I

I am trying to use the TapLinx library on Java Desktop with Mifare Ultralight C.

I was able to program the security key with the method: 

ultralightC.program3DESkey()
 
I am also able to read data via RFIDDiscover with my key.
 
I am now struggeling with authentication programatically. What I have is this:
 
byte[] keyBytes = hexStringToByteArray(key);


byte[] keyBytes1 = new byte[24];
System.arraycopy(keyBytes, 0, keyBytes1, 0, 8);
System.arraycopy(keyBytes, 8, keyBytes1, 8, 8);
System.arraycopy(keyBytes, 0, keyBytes1, 16, 8);

SecretKeySpec twoKey3DES = new SecretKeySpec(keyBytes1, "TripleDES");
keyData.setKey(twoKey3DES);
ultralightC.authenticate(keyData);
 
However I get:
Exception in thread "main" java.lang.SecurityException: Authentication failed!
at com.nxp.nfclib.ultralight.UltralightC.a(Unknown Source)
at com.nxp.nfclib.ultralight.UltralightC.authenticate(Unknown Source)
at dev.netprint.closedloop.lib.TapLinxTest.main(TapLinxTest.java:38)
 
I cannot make the key only 16 bytes since it will then say the key is to short. How do I have to encode the according key so the authentication works?
标记 (1)
0 项奖励
回复
0 回复数