jPOS icon indicating copy to clipboard operation
jPOS copied to clipboard

KeySerialNumber overhaul

Open ar opened this issue 2 years ago • 0 comments

The KeySerialNumber class in its current implementation has several issues that need to be addressed. The properties baseID, deviceID, and transactionCounter are currently stored as simple String variables with limited validation. However, the standard requires that the transaction counter is just the rightmost 21 bits of the 10-byte Key Serial Number (KSN). As part of this refactor, the implementation is updated to comply and enforce this standard.

Instead of keeping three Strings, we now keep two longs (baseId, deviceId) and an int (transactionCounter).

Also added handy methods to get byte representation of those as well as the whole image (getBytes()).

ar avatar May 09 '23 02:05 ar