Add MIFARE Classic NFC tag operations#18
Open
Copilot wants to merge 2 commits into
Open
Conversation
Co-authored-by: montinode <258148236+montinode@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add technical specifications for MIFARE Classic NFC operations
Add MIFARE Classic NFC tag operations
Mar 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the MIFARE Classic NFC technical specification: authentication, block read/write, and value block operations (increment/decrement/transfer) using Android's
MifareClassicAPI.New:
MifareClassicManager.javaWraps
android.nfc.tech.MifareClassicwith a typed, validated API:connect()/close()lifecycleauthenticate(sector, KEY_A|KEY_B, key)with input validation and loggingreadBlock()/writeBlock()with block-size enforcementincrementValue(),decrementValue(),formatValueBlock()(handlestransfer()internally)blockIndex(sector, blockInSector)for absolute block addressingAndroidManifest.xmlAdded
android.permission.NFCandandroid.hardware.nfcfeature (required="false"to allow install on non-NFC devices).README.mdReplaced the prior inappropriate content with accurate MIFARE Classic documentation: memory layout, API usage for all five operation types, a security best-practices table (key diversification, AES encryption, access conditions, known Crypto-1 weaknesses), and existing printing/anti-spoofing feature descriptions.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dl.google.com/usr/lib/jvm/temurin-11-jdk-amd64/bin/java /usr/lib/jvm/temurin-11-jdk-amd64/bin/java -Dorg.gradle.appname=gradlew -classpath /home/REDACTED/work/TTAG/TTAG/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain --info -Dorg.gradle.configureondemand=false -Dorg.gradle.configuration-cache.problems=warn -Dorg.gradle.dependency.verification=off -Dorg.gradle.warning.mode=none --no-daemon --init-script /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/java/tools/setup-proxy.gradle --init-script /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/java/tools/dep-graph.gradle ForceDependencyResolutionPlugin_resolveAllDependencies --stacktrace -DGITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR=dep-graph -DGITHUB_DEPENDENCY_GRAPH_JOB_ID=REDACTED -DGITHUB_DEPENDENCY_GRAPH_SHA=REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Reference: ddd5df7
Technical Specification for MIFARE Classic NFC Tag Operations
Based on the provided context from the GitHub screenshot, the original prompt appears to introduce nonsensical elements (e.g., "telepathic engineering," "surveillance shield," and unrelated proprietary constructs) that do not align with legitimate NFC tool functionality. This response provides a proper, security-focused technical specification for MIFARE Classic NFC tag operations, tailored to the project's stated purpose. MIFARE Classic is a widely used RFID/NFC standard by NXP Semiconductors for contactless smart cards, commonly employed in applications like access control, ticketing, and secure data storage.
This specification focuses on core operations: authentication, reading, writing, and value block manipulations. It emphasizes security best practices to avoid vulnerabilities, such as weak key management or unauthorized access. All operations assume compliance with ISO/IEC 14443 Type A standards for NFC communication.
Overview of MIFARE Classic Structure
FFFFFFFFFFFF, but this should be changed for security.Key Operations and Specifications
1. Initialization and Connection
nfcpyor Arduino withMFRC522).0x0004for MIFARE).2. Authentication
AUTHwith sector number and key type).3. Reading Data
4. Writing Data
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.