licel / jcardsim

https://jcardsim.org
222 stars 123 forks source link

Wrong Checksum.ALG_ISO3309_CRC32 implementation #203

Closed stelian42 closed 1 year ago

stelian42 commented 1 year ago

Jcardsim's implementation of ALG_ISO3309_CRC32 is not conformant to the spec: https://docs.oracle.com/javacard/3.0.5/api/javacard/security/Checksum.html#ALG_ISO3309_CRC32

The doc above clearly specifies that input and output should be reflected, and testing on two separate Javacards (one from NXP the other from ST) confirms the doc is right.

Obviously, the test data in CRC32Test is wrong as well.

The attached screenshots from this online CRC calculator shows the current (bad) crc result and the one that should be expected (good)

bad

good