Giter Site home page Giter Site logo

Lock NFC cards about nfccard-tool HOT 3 CLOSED

somq avatar somq commented on May 29, 2024
Lock NFC cards

from nfccard-tool.

Comments (3)

somq avatar somq commented on May 29, 2024

If I remember correctly you could write the Static Lock bytes (2, 3) on the information block (2) (See NFCForum-TS-Type-2-Tag_1.1.pdf#2.1.2)
The idea here would be to start on block 2 instead of block 4 if there is some lock flag to pass.

For the implem this, for instance, could be done this way

// Prepare the buffer to write on the card
const rawDataToWrite = nfcCard.prepareBytesToWrite(message);

// Write the buffer on the card starting at block 4
// ~~const preparationWrite = await reader.write(2, rawDataToWrite.preparedData);~~
// Prefer computing the start block internally and pass a flag to lock/not lock
// Lock => Start at block 2, No lock => start at 4
const preparationWrite = await reader.write({ ndef: rawDataToWrite.preparedData, lock: true })

Hope this helps,
I would review your PR if you wish to push one.

from nfccard-tool.

brentrbutcher avatar brentrbutcher commented on May 29, 2024

I totally would, but I am way under qualified. Theoretically, if I tried to do this in my own application how could I do it?

I am seeing that bytes 2 and 3 of block 2 must be set to 1b to ostensibly lock the tag. How could I go about that? I would love to try to write the PR if I can figure it out in my own application first.

from nfccard-tool.

somq avatar somq commented on May 29, 2024

Did you check this issue @brentrbutcher?

You are right about bytes 2 & 3 of block 2, it should be 0x01 and 0xff iirc.
The buffer to write is prepared here fyi.

I will try to take some time to work on the lib in the next weeks.
Have a good day!

from nfccard-tool.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.