Topic: encrypting in reader NACK 0x5 AND/OR decrypting the one sent by tag

Hello,

I have a small (possibly silly) question, however I will post it - maybe someone can help.

Situation: given a known AND fixed -  UID, Key (0xffffffffffff), Nr (always 0x0), Nt (assume I can produce the same Nt all the time).

Question:
1. How should I encrypt the 0x5 NACK (0101 binary 4 bits) to know what the encrypted NACK will be returned by the tag the moment I "quess" the parity bits?

I have tried things like after the {Nr}{Ar} are computed, tried to compute and store the 4 bits produced with following (as a note I was simulating failure after the below calls so the authentication starts over without the below calls which I suppose affect the keystream):
1.a) order of bits is 0101 (0x5) and using XOR (plaintext bit XOR keystream bit)
arrNackEnc[0] = crypto1_bit(pcs, 0, 0) ^ 0;
arrNackEnc[1] = crypto1_bit(pcs, 1, 0) ^ 1;
arrNackEnc[2] = crypto1_bit(pcs, 0, 0) ^ 0;
arrNackEnc[3] = crypto1_bit(pcs, 1, 0) ^ 1;
1.b) order of bits is 0101 (0x5) and NOT using XOR - of plaintext bit with keystream bit
arrNackEnc[0] = crypto1_bit(pcs, 0, 0);
arrNackEnc[1] = crypto1_bit(pcs, 1, 0);
arrNackEnc[2] = crypto1_bit(pcs, 0, 0);
arrNackEnc[3] = crypto1_bit(pcs, 1, 0);

However, none of the above produced the same 4 bits returned by the tag after a successful parity bits guess.

Can someone enlighten on how to encrypt the 0x5 so that it will match the encrypted value of a NACK from tag? I just want to verify that the encrypted NACK is indeed the 0x5.

Also, given the above known and fixed UID, etc., how to decrypt the encrypted 4 bits send as NACK by tag, so that it will produce 0x5 confirming the statement in the papers as well as helping in decrypting the 4 bits with those approx 7.9*pow(10,9) keys to find the correct key.

Thanks a lot!!

Re: encrypting in reader NACK 0x5 AND/OR decrypting the one sent by tag

Hi,

Would still appreciate any hints smile

Thanks