Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

CRC32 Checksum between Java and JavaCard

JavaCard Applet Development Related Questions and Answers.
Riddle
Posts: 12
Joined: Mon Dec 28, 2015 11:41 pm
Points :70
Contact:

CRC32 Checksum between Java and JavaCard

Post by Riddle » Tue Jan 12, 2016 3:27 am

I am working on sending a message with a CRC32 code from the java host to the java card.

Host:
I create a checksum and send it with the message to the card:

Code: Select all

Checksum checksum = new CRC32();
checksum.update(rawData, 0, rawData.length);
long checksum_value = checksum.getValue();


Card:
I also create a checksum.

Code: Select all

Checksum checksum = Checksum.getInstance(Checksum.ALG_ISO3309_CRC32, false);
checksum.doFinal(data, (short)0, (short)data.length, checksum_value, (short)0);


The result is different from what the host creates.

Does anyone know how to fix this problem?

Tarantino
Posts: 101
Joined: Wed Aug 19, 2015 1:56 am
Points :478
Contact:

Re: CRC32 Checksum between Java and JavaCard

Post by Tarantino » Thu Jan 14, 2016 10:50 pm

What is the initial value that your Java CRC32 starts with?

Suppose that Java CRC32 starts with an initial value from 0xFFFFFFFF.
You should set the card to this initial value.

Code: Select all

byte[] ini = new byte[]{(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF};
checksum.init(ini, (short)0, (short)ini.length);
The greatest glory in living lies not in never falling, but in rising every time we fall.--Nelson Mandela

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: CRC32 Checksum between Java and JavaCard

Post by UNKNwYSHSA » Wed Jan 20, 2016 6:04 am

Yes, for algorithm ALG_ISO3309_CRCXX, the initialize value is 0xFFFF(16 bits)/0xFFFFFFFF(32 bits).
For more details, see JC api for javacard.security.Checksum.
sense and simplicity

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 75 guests

JavaCard OS : Disclaimer