Skip to main content
Graduate II
October 14, 2024
Solved

About ST25TV02kcTag encryption issues

  • October 14, 2024
  • 1 reply
  • 1094 views

Hi!St Community

 

My goal is to set a password for the user memory area on the card.

During the process of writing the encryption code for the card, I read the manual for the ST25TV02KC.

Rance_4-1728922336122.png

 

 

 

Rance_0-1728921724082.pngBased on the underlined sentence in the image, I first send the data related to the PresentPassword request format.

 

 

 

Rance_2-1728921813115.png

The corresponding configuration bits in the code are as follows

 arr[0] = 0x20;
						arr[1] = 0xb3;
						arr[2] = 0x02;
						arr[3] = uid[7];
						arr[4] = uid[6];
						arr[5] = uid[5];
						arr[6] = uid[4];
						arr[7] = uid[3];
						arr[8] = uid[2];
						arr[9] = uid[1];
						arr[10] = uid[0];
						arr[11] = 0x01;
						arr[12] = 0x11;
						arr[13] = 0x22;
						arr[14] = 0x33;
						arr[15] = 0x44;
						arr[16] = 0x55;
						arr[17] = 0x66;
						arr[18] = 0x77;
						arr[19] = 0x88;
						arr[20] = (PY_CRC_16_S_X25(arr,20)%256);
						arr[21] = (PY_CRC_16_S_X25(arr,20)/256);

 The send should have been successful, but the return value of the FIFO seems abnormal.

Rance_3-1728922019762.png

Could it be because the order of my operations was incorrect ?

 

 

 

 

Before this, I completed the read and write operations on the blocks according to the relevant instructions in the datasheet , and now I will demonstrate that

Related instruction:

Rance_5-1728922880564.png

Code section:

Rance_7-1728922916644.png

Print result(display normally):

Rance_8-1728923060737.png

Rance_9-1728923115801.png

 

 

So, in order to encrypt the block, what exactly should I do? What configurations do I need to set up first?

 

 

 

 

 

 

 

    This topic has been closed for replies.
    Best answer by JL. Lebon

    Hello, 

    I think that the first byte of your command is wrong.
    The first byte of the command is the Request Flag byte. It sets up the data rate and the modulation requested for the answer, plus other parameters.

    In your read and write commands, the request flag is set to 0x22.

    In your Present password command, the request flag is set to 0x20.

    The difference is that in the bit 1 of the request flag. This bit sets the data rate of the answer. In your read and write commands, it is set to High Data rate. In your Present password command, it is set to Low data rate.
    Some readers do not support the Low Data rate. So please, try the Present password command with the request flag set to 0x22.
    Best regards.

    1 reply

    JL. LebonAnswer
    ST Employee
    October 15, 2024

    Hello, 

    I think that the first byte of your command is wrong.
    The first byte of the command is the Request Flag byte. It sets up the data rate and the modulation requested for the answer, plus other parameters.

    In your read and write commands, the request flag is set to 0x22.

    In your Present password command, the request flag is set to 0x20.

    The difference is that in the bit 1 of the request flag. This bit sets the data rate of the answer. In your read and write commands, it is set to High Data rate. In your Present password command, it is set to Low data rate.
    Some readers do not support the Low Data rate. So please, try the Present password command with the request flag set to 0x22.
    Best regards.

    Technical Moderator
    October 15, 2024

    Hi,

    In addition to this reply, I suggest to use the RFAL library that provides support for ST25TV commands such as PresentPasword.

    Rgds

    BT