Authenticate against Ultralight C with TapLinx

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Authenticate against Ultralight C with TapLinx

340 Views
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?
Tags (1)
0 Kudos
Reply
0 Replies