Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileSettings.encodeToData() is returning to few data #5

Open
MichaelsPlayground opened this issue Apr 10, 2024 · 2 comments
Open

FileSettings.encodeToData() is returning to few data #5

MichaelsPlayground opened this issue Apr 10, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@MichaelsPlayground
Copy link

Running FileSettings.encodeToData() is giving to few data, e.g.

File 01: length: 3 data: 0000e0

Using this output as input for FileSettings.decodeFromData(xx) gives an ArrayIndexOutOfBoundsException:

FATAL EXCEPTION: Thread-7
Process: de.androidcrypto.ntag424testapp, PID: 24668
java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
	at net.bplearning.ntag424.command.FileSettings.decodeFromData(FileSettings.java:46)
	at de.androidcrypto.ntag424testapp.MainActivity$28.run(MainActivity.java:4787)
	at java.lang.Thread.run(Thread.java:764)

NTAG 424 DNA NT4H2421Gx.pdf page 69 ff is stating a minimum of 7 bytes + extra bytes if SDM is enabled.

Greetings
Michael (AndroidCrypto)

@johnnyb johnnyb added the enhancement New feature or request label Apr 23, 2024
@johnnyb
Copy link
Owner

johnnyb commented Apr 23, 2024

encodeToData and decodeFromData are not symmetrical, according to the documentation. That said, perhaps we can find some other way of serializing/deserializing this information if you need to store it locally.

@MichaelsPlayground
Copy link
Author

The encodeToData returns this 3 byte (hex) byte sequence for file 01: 0000e0

As per NTAG424 datasheet the "GetFileSettings" command should return a minimum of 7 bytes + extra bytes if SDM is enabled:

NTAG424_GetFileSettingsResponse

If I'm using the (hex) byte sequence "0000e012200000" as input for decodeFromData I can build a new FileSettings object. I didn't test for decoding data including SDM options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants