revtel / react-native-nfc-manager

React Native NFC module for Android & iOS
MIT License
1.39k stars 317 forks source link

Password authentication - when password set from another app. #537

Closed AkooMakoo closed 2 years ago

AkooMakoo commented 2 years ago

Hello!

I managed to set a password on a NTAG213 by using the example code. The password that I set is: 1234abcd which converted to bytes: 18 52 171 205 And then stored on the tag.

To authenticate and write data, I use this code:

const password = [18, 52, 171, 205];
await NfcManager.requestTechnology([NfcTech.MifareIOS]);
await NfcManager.sendMifareCommandIOS([0x1b, ...password]);

And everything works a charm.

The problem is when I set the password from an external tool, the NFC Tools app or the NfcOpenReader app. The NFC tools app lets me enter any strings I want without limiting the length or checking the characters.

image

The NfcOpenReader app limiting to 4 bytes hex string:

image

On each app, I'm entering: 1234abcd as a password for the tag, but when I'm trying to authenticate with the code above the line:

await NfcManager.sendMifareCommandIOS([0x1b, ...password]);

Throws an error that says that the tag connection was lost.

image

Any suggestions on how I can solve that and support passwords defined by other tools?

AkooMakoo commented 2 years ago

I managed to authenticate a password that was set with the NfcOpenReader app, but still no luck with the NFC tools app.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 2 years ago

This issue was closed because it has been stalled for 5 days with no activity.

amitsingheplanetsoft commented 11 months ago

how can i set password less or more than 8 characters