cancel
Showing results for 
Search instead for 
Did you mean: 

ST25TA read/write password protection

LOVEKUSH PRATAP
Associate II
Posted on September 14, 2017 at 09:00

Hello,

I got stuck while trying to make changes in code of ST25TA02K-P NFC tag for  read/write access protection through password. I'm using X-NUCLEO-NFCC03A1 as reader and writter .

So does ST25TA support  protection through password . If yes ,how we can do this and what changes is required in code and what is the memory mapping of tag .

https://community.st.com/tags♯/?tags=nfc03a1

‌ 

https://community.st.com/tags♯/?tags=st25ta02k-p

 

https://community.st.com/tags♯/?tags=nfc%20tags

 

https://community.st.com/tags♯/?tags=password

#st25ta02k-p #nfc-tags #password #nfc03a1
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on September 20, 2017 at 12:26

Hello,

The commented code of lib_nfctype4pcd.c you are refering to was meant to be informative,

by showing a transcription of procedure 7.4 of the datasheet into the X-CUBE-NFC3 environment.

As you noticed it can not be compiled directly. You have to place it in some function

corresponding to the procedure, that you would call from your scenario.

For your information, the PCDNFCT4_ReadNDEF function from file lib_nfctype4pcd.c

corresponds to procedure 7.2 of the datasheet. You may implement in a similar fashion

a new PCDNFCT4_ProtectNDEF function corresponding to procedure 7.4.

Let me know it this clears things up.

Best regards

View solution in original post

7 REPLIES 7
Thomas Q.
ST Employee
Posted on September 15, 2017 at 09:59

Hello,

Read/write access protection through password is supported on the ST25TA02K-P for the NDEF file.

Section 3 of the

http://www.st.com/resource/en/datasheet/st25ta02k-p.pdf

 gives the memory mapping of the tag, and Section 7 gives some examples

of procedures regarding the read access :

- 7.4 : activation of the read protection (Enable verification refering to section 5.7.3)

- 7.3 : accessing a read protected NDEF file

- 7.5 : deactivation of the read protection (Disable verification refering to section 5.7.4)

The same procedures can be applied for write access using 0x0002 as security attribute for

Enable Verification Requirement and Disable Verification Requirement commands.

When using procedure 7.4 for the write access , the RF session must be closed in an additional step

(with a S(DESELECT) command or with a shutdown of the RF field) for the write protection to be activated.

If you provide a code sample, i can elaborate an example based on it.

Best regards

Posted on September 15, 2017 at 12:42

Thanks for support, I have some questions to ask:

1-What is verify command and how to use it in the code? explain by code.

2- What does it mean by NDEF file? Is it NDEF.c in code of X-CUBE-NFC3?

3- What is the memory address in tag where we have to write the password?

5- What changes wil be made for ;

    - 7.4 : activation of the read protection (Enable verification refering to section 5.7.3)

    - 7.3 : accessing a read protected NDEF file

    - 7.5 : deactivation of the read protection (Disable verification refering to section 5.7.4)

Posted on September 15, 2017 at 17:41

Hello,

The Verify command is described in section 5.7.1 of the

http://www.st.com/resource/en/datasheet/st25ta02k-p.pdf

.

The NDEF file is the memory area used to store the NDEF message

length and content on the tag (see section 3, with a focus on 3.1.3).

The Read and Write passwords are not memory mapped and thus can not

be accessed with ReadBinary or UpdateBinary commands.

A password value to access the NDEF file is presented using the Verify command.

A password value can be modified by first presenting it with the Verify command,

then it is modified with the ChangeReferenceData command (see section 5.7.2).

The

X-CUBE-NFC3 software is not dedicated to custom features from ST tags.

Regarding

the ST25TA02K-P, only standard NFCT4 commands are implemented.

The archive in attachment contains 3 source files from the original

package, that were modified to implement the Verify, ChangeReferenceData,

EnableVerificationRequirement and Dis

ableVerificationRequirement commands.

I suggest you use them as a replacement to the 3 files from the original package,

it should ease your implementation of password authentication on the ST25TA02K.

If you need to implement more custom commands from the ST25TA02K, it can be

achieved in a similar way by adding more content to

these

3 files.

At lines 227 and 235 of the modified lib_nfctype4pcd.c file, you will also find in

comment a suggested implementation of procedure 7.4, and of password modification.

Let me know if you need further clarifications.

Best regards

________________

Attachments :

STM32CubeExpansion_NFC3_V1.2.0_ST25TA02K.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyRg&d=%2Fa%2F0X0000000b7j%2FPn4FsDZ6TB5AOvEPspuCRJbwH3r4e5NXjS97or6ua2o&asPdf=false
Posted on September 20, 2017 at 09:13

Hello

Thanks for support. It helped me a lot .  

Now I'm trying to activate the read protection by password  as you mention  in line 227- 232 in lib_nfctype4pcd.c file but one error came during compilation 'error : &sharp169 expected declaration' ' error: expected identifier or '('.

How can I resolve this error?

Will I have to add these line in main() of main.c file or is there any other way ?

Posted on September 20, 2017 at 10:54

Hello,

There were indeed some typos in the source from my previous post, sorry i couldn't check the compilation at that time.

Find attached an update of the source without the typos.

Best regards

________________

Attachments :

STM32CubeExpansion_NFC3_V1.2.0_ST25TA02K.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyQJ&d=%2Fa%2F0X0000000b7R%2FgnZoaN6fN3EjtV7V_6QbtH35DXxQvEehYvBIY1emx8c&asPdf=false
Posted on September 20, 2017 at 11:22

Hello 

Thanks for support. But I already did these changes.

As you can see the error in caption below and I mentioned it previously .So I think these lines (lines below ''activation of the read protection by password'' for read protection) of code should be in some function.  help me out . 

0690X00000608JFQAY.png
Posted on September 20, 2017 at 12:26

Hello,

The commented code of lib_nfctype4pcd.c you are refering to was meant to be informative,

by showing a transcription of procedure 7.4 of the datasheet into the X-CUBE-NFC3 environment.

As you noticed it can not be compiled directly. You have to place it in some function

corresponding to the procedure, that you would call from your scenario.

For your information, the PCDNFCT4_ReadNDEF function from file lib_nfctype4pcd.c

corresponds to procedure 7.2 of the datasheet. You may implement in a similar fashion

a new PCDNFCT4_ProtectNDEF function corresponding to procedure 7.4.

Let me know it this clears things up.

Best regards