KeyForge

Modern, dark-themed Android NFC utility for tag reading, writing, and Host Card Emulation (HCE).

Mobile Utility GPL-3.0 License Kotlin / Jetpack Compose Active Status

Overview

KeyForge is a comprehensive Android application built using Jetpack Compose that operates as an all-in-one NFC utility tool. It supports standard NDEF Type 4 tags, raw MIFARE Classic, and MIFARE Ultralight cards, allowing users to scan, analyze, format, and emulate keys.

Built with Kotlin Coroutines for asynchronous, non-blocking hardware I/O, KeyForge provides a responsive interface with real-time feedback when interacting with physical tags.

Key Features

Advanced NFC Reader

  • Smart Payload Parsing: Extracts and parses NDEF payloads such as URLs and plain text records dynamically.
  • Sector Analysis: Dumps raw block pages on MIFARE Ultralight cards and authenticates MIFARE Classic sectors using standard defaults or custom key rings.

NFC Writer

  • Custom NDEF Payloads: Write, format, and clear custom URI or Text data onto compatible physical tags.
  • Write Protection Safeguards: Instantly check size constraints and write lock bits on target tags before initiating writes.

Host Card Emulation (HCE)

  • Virtual Tag Emulation: Programmatically emulate an NFC Forum Type 4 Tag, sharing custom URLs or contact cards with nearby readers.
  • Live Access Logging: View real-time transactions in a live debugger terminal panel as external terminals communicate with your phone.

Hardware Constraints & Fob Workarounds

⚠️ Emulation Limits

Standard Android devices **cannot emulate** MIFARE Classic/Ultralight tags or spoof custom hardware UIDs for commercial access control systems (such as e-bike or building entry fobs). This is a physical constraint of the phone's NFC controller hardware and OS security protocols (which randomize dynamic UIDs).


Workaround: Use KeyForge to scan the original key fob's sector data, save it, write it to a physical MIFARE Classic 1K Gen2 / CUID (UID-changeable) Magic Sticker, and adhere the sticker to the back of your phone under its protective case.

Build & Deploy

To compile the project debug package locally, connect your device via USB with ADB Debugging enabled and run:

bash - Android Gradle
# Assemble and compile the Debug APK ./gradlew assembleDebug # Deploy APK onto the connected Android device ./gradlew installDebug # Alternative installation via direct ADB adb install -r app/build/outputs/apk/debug/app-debug.apk