Skip to content

Add --delete flag to uninstall profiled applet from card (closes #157) - #158

Open
Ankit65k wants to merge 1 commit into
crocs-muni:mainfrom
Ankit65k:feature/delete-applet-flag
Open

Add --delete flag to uninstall profiled applet from card (closes #157)#158
Ankit65k wants to merge 1 commit into
crocs-muni:mainfrom
Ankit65k:feature/delete-applet-flag

Conversation

@Ankit65k

Copy link
Copy Markdown

Closes #157.

What changed

  • Added --delete boolean flag to Args.java
  • Added Installer.uninstallFromCard(), which prompts for confirmation, then
    invokes GlobalPlatformPro to delete the applet by AID — mirrors the
    argument handling in installOnCard (reuses --key, --debug) as suggested
  • Wired the call into JCProfiler.run(), executing after the visualisation
    stage completes (per your suggestion to run after profiling, not instead
    of the pipeline)

Verified

  • Traced GlobalPlatformPro's actual --delete flag in its source (GPTool.java,
    OPT_DELETE) to confirm syntax rather than assuming it. Found that --force
    only affects deletion of a package AID's dependents, so it's intentionally
    omitted here since we're deleting a single applet instance AID.
  • Also noted GPTool suppresses errors on --delete by design (behaves like rm),
    so a zero exit code doesn't guarantee the AID was actually present/removed —
    left a comment about this in the code.

Tested

  • ./gradlew compileJava and ./gradlew build -x test succeed on JDK 21
  • --delete appears correctly in --help output
  • Confirmation prompt logic verified locally

Not tested

  • I don't have a physical Java Card + reader, so I couldn't verify the actual
    GPTool delete call against real hardware. Would appreciate if you could test
    that part, or point me to a way to test it myself.

Open question

  • Right now --delete only fires if --stop-after allows the pipeline to
    reach visualisation. If --stop-after is set earlier (e.g. profiling),
    --delete is silently skipped. Let me know if that's the intended behavior
    or if it should work independently of --stop-after.

@lzaoral

lzaoral commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Hello! I have got a very strong suspicion that your PR was AI generated. Could you comment on that, please?

@Ankit65k

Ankit65k commented Jul 31, 2026

Copy link
Copy Markdown
Author

Hi @lzaoral — fair question, and I'll be honest about it: I leaned on an AI assistant quite a bit for this, especially for drafting the code and finding my way around the codebase (Java Card and this project's architecture are still fairly new to me). That said, here's what I actually did myself :-
[1] Went through Installer.java, Args.java, and JCProfiler.java on my own to understand how things currently work
Checked GlobalPlatformPro's real --delete flag by reading through GPTool.java directly instead of just assuming — that's how I realized --force doesn't apply when deleting a single AID
[2] Tested it locally (build, --help output, the confirmation prompt logic), and flagged in the PR that I hadn't been able to test on actual hardware,Reworked the design based on your feedback (moving it to run after profiling, adding the confirmation prompt)
If the project has concerns about AI-assisted contributions, or you'd like me to rewrite parts by hand or walk through my reasoning in more detail, just let me know — happy to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to uninstall the profiled applet

2 participants