I'm trying to write some data into a NFC using the acr 122u card reader. So far, I'm able to do it. My problem is that I need to also make the NFC password protected. I can add the password using a phone app like nfctools, but I need this process to be automated in the future.
For this I am using python smartcard.System to connect and write to the NFC tag. My problem is that I can't find anywhere how to save a password into the tag.
from smartcard.System import readers
from smartcard.CardConnection import CardConnection
from smartcard.scard import SCARD_SHARE_DIRECT
reader = readers()[0]
print(reader)
connection = reader.createConnection()
connection.connect()
command = [0xFF, 0xD6, 0x00, 0x05, 0x04, 0x34, 0x03, 0x3d,0x91]
r, sw1, sw2 = connection.transmit(command)
This works for writing. I've tried this for authentication:
auth= [0xFF, 0x00, 0x00, 0x00, 0x07, 0xd4, 0x42, 0x1b, 0x01, 0x01, 0x01, 0x01]
r, sw1, sw2 = connection.transmit(auth)
print(r)
print(sw1)
print(sw2)
auth2= [0xFF, 0x86, 0x00, 0x00, 0x05, 0x01, 0x00, 0x04, 0x60, 0x00]
r, sw1, sw2 = connection.transmit(auth2)
print(r)
print(sw1)
print(sw2)
And this does not work. As far as I know, this would only authenticate me into the NFC and will not write the password into the NFC itself.
Any tips? Thanks
Edit: I'm using the API file in the acs website http://www.acs.com.hk/download-manual/419/API-ACR122U-2.04.pdf