如何在IronZIP中使用Claude Code

Curtis Chau
Curtis Chau
更新: 2026年10月26日

通过更新后仍然能够使用正确的密码打开案例存档,列出每个文件并干净提取,同时保持其证据在旧ZIP加密而不是AES-256下。文件列表中没有任何显示更改。 Claude Code是由Anthropic开发的编码代理,可从命令行、VS Code和JetBrains IDE中使用,也可以作为桌面应用程序和浏览器使用。 无论它在哪运行,它都会读取存储库、编辑文件并运行shell命令,从而可以阶段性更新存档、提取它、读取其原始目录并在替换原件之前比较每个文件。

IronZIP从.NET打开、编辑和保存受密码保护的ZIP文件,支持AES-128、AES-256或旧的传统加密,也称为ZipCrypto。 每次编辑都是一个调用。 打开存档的调用是什么,如何用更正的文件替换旧的条目,以及保存前是否再次设置加密会决定结果,以及任何错误选择都不会引发异常。 本页的其余部分为每月的证据摄取准备Claude Code,包含四个经过测试的提示和每个提示背后的IronZIP行为。

两个模型设置覆盖了会话。 Sonnet处理列表和项目规则,opusplan别名与Opus规划更新器并用Sonnet编写。

快速入门
NuGet使用NuGet安装

PM > Install-Package IronZip

通过在 NuGet 包管理器控制台中运行上述命令安装 IronZIP,或在 NuGet 包管理器中搜索该包。

从存储库文件夹启动claude,并在此请求之前运行/model sonnet。

Add the IronZIP NuGet package, version 2026.10.2, to CaseArchive.csproj.

Then make Program.cs list every ZIP file under archives/:

- Apply the license key from IRONZIP_LICENSE_KEY before any other IronZIP call.
- Open each file as an IronZipArchive with the password from CASE_ARCHIVE_PASSWORD.
- Print a block per archive with its entry count, then each entry's name, size and IsCrypted value.
- If an archive won't open, print its exception message and move on to the next one.

Don't change any archive.
Don't print or echo the value of either variable. Tell me whether each one is set.
Text

即使使用正确的密码,CASE-1043也可能会失败。 打开现有ZIP部分解释了原因。



Claude Code在.NET存档项目中做什么?

Claude Code编写更新器,构建每个阶段的存档,解压缩它,读取其目录并列出未通过的检查。 在检查失败后,它编辑代码并再次运行整个摄取。 您的部分是定义每个案例存档必须包含的内容,并在最后阅读报告。

在第一个提示中将IronZIP命名为唯一的存档库。 攻击者发布恶意包,名为AI编码工具幻觉,并且自选包的代理可以安装一个。 该攻击被称为slopsquatting。

如何设置Claude Code?

Anthropic的快速启动涵盖了安装Claude Code和登录。 一个工作中的安装会打印claude --version的版本号。

如何设置一个Claude Code可以工作的项目吗?

测试存储库CaseArchive是一个.NET 9控制台项目,存档文件夹中有三个AES-256案例存档,两个新文件在一个传入文件夹中,还有一个设置摄取规则的Markdown页面在文档文件夹中。 添加了一个新文件名,匹配的名字替换了它的条目,remove.txt中列出的名字被移除,没有传入文件夹的案例保持原样。 存档密码来自CASE_ARCHIVE_PASSWORD。

在每个会话开始时加载写在CLAUDE.md中的规则。 在快速启动后的包准备就位后,接下来的请求会编写该文件和一个审阅者。

Create CLAUDE.md in the repo root with a "Case archives" heading.
Put these rules under it for future sessions:

- Archives are read and written with IronZIP and nothing else.
- The IronZIP package stays at the version CaseArchive.csproj references now.
- The intake rules live in docs/case-archives.md.
- Look up an IronZIP member in docs/IronZip.xml before you use it.
- The XML has no entry for IronZip.Entry. Its Name, Size and IsCrypted exist anyway.
- A file replaces an archive under archives/ after it has passed every check, never before.
- CASE_ARCHIVE_PASSWORD and IRONZIP_LICENSE_KEY values never appear in output, logs or files.

Copy docs/IronZip.xml now from the local NuGet cache folder for that IronZIP version.
If the cache has no such file, stop and tell me.

Then create .claude/agents/archive-auditor.md.
Give it frontmatter with the name archive-auditor, a one-line description and a tools field.
The tools field lists Read, Grep and Glob, so the auditor can't edit.
In its instructions, tell it to:

- collect the IronZIP types and members used under Services/
- flag any member that docs/IronZip.xml lacks, and list Entry members separately
- point out each save of an opened archive that doesn't set the encryption again first
Text

运行中的Claude Code会话不会检测到新创建的.claude/agents文件夹,所以在开始之前提交该文件夹,并在其中放置一个占位符文件。

在第一次打开之前设置许可证。 没有钥匙,打开和提取都会抛出LicensingException,消息显示“需要生产许可证”。 IRONZIP_LICENSE_KEY变量本身不许可证IronZIP。在校准探测中,该变量已设置且License.IsLicensed保持为false,因此程序从中分配IronZip.License.LicenseKey。 IronZIP许可证密钥页面解释了如何获得密钥以及在哪里可以设置。

哪条IronZIP更新规则属于CLAUDE.md?

校准探头测量了IronZIP 2026.10.2上的每一行对照夹具存档和匹配的探头存档。将其块粘贴在案例存档标题下,然后用claude --continue重新启动会话以读取它。

Measured on IronZIP 2026.10.2, these rules apply to every archive update:

- Open with new IronZipArchive(path, password) or IronZipArchive.FromArchive(path, password).
- IronZipArchive.FromFile(path) builds a new archive that stores the ZIP file itself as one entry.
- A protected archive with exactly one entry does not open.
- The constructor and FromArchive throw "Invalid Password!" with the right password.
- ExtractArchiveToDirectory reads it, so rebuild it from an extracted copy in a new IronZipArchive.
- Saving an opened archive writes every entry with the Traditional cipher.
- Call Encrypt(password, EncryptionMethods.AES256) before the save to keep AES-256.
- Entries() reports IsCrypted true either way.
- Opening does not check the password. The save does.
- Entries() lists an archive opened with a wrong password, and SaveAs then throws ZipException.
- Add stores the file name without its folder.
- Adding a name the archive already holds keeps both entries, and extraction writes the later one.
- ReplaceEntry(name, path) stores the new entry under the path it is given, folders included.
- Replace an entry with Delete(name) and then Add(path).
- Delete and ReplaceEntry throw for a name the archive does not hold. Test Contains(name) first.
- Add throws UnauthorizedAccessException for a folder. Add files one at a time.
- Save() writes back over the file the archive was opened from.
Markdown

为什么更新后的存档会失去其AES-256加密?

如果没有再次设置方法,保存将回退到传统加密。 在我们的校准探头中,使用密码打开CASE-1044并在没有任何更改的情况下保存,将所有三个条目以传统加密方式写入。 然后Python标准zipfile模块无法读取AES条目,接着用密码解密每一个。 在保存之前用Encrypt调用EncryptionMethods.AES256保持了更新后的CASE-1042的所有五个条目在AES-256,包括三个新条目。 传递到保存调用的ZipSaveOptions名为AES-256,则对于一个条目已删除的存档也做了同样的处理。

无论哪种方式,用密码提取都能成功,所以只有原始目录显示降级。 每个AES条目携带额外字段0x9901,其强度字节对于256位密钥为3,而探头中的传统条目没有此类字段。

如何用IronZIP打开现有的ZIP?

将路径和密码传递给构造函数。 将文件添加到ZIP示例通过FromFile打开其存档,而生成的探头通一未加密条目的CASE-1042.zip,并添加照片。 IronZIP的skill.md警告FromFile总是建立一个新存档,构造函数和FromArchive作为打开存档的调用。

有一个受保护条目的存档需要不同的方法。 在探测中,这种类型的AES-256存档抛出“密码错误!”来自构造函数、FromArchive和字节数组构造函数,而用相同密码提取工作。 构造函数为一个条目的传统存档抛出同样的错误。 重建将存档提取到临时文件夹,复制传入的文件,保存一个新的存档,首先调用Encrypt。重建的CASE-1043保留了三个AES-256条目,之后可以正常打开。

如何提示IronZIP代码完全编译?

运行/model opusplan,然后循环Shift+Tab直到在状态栏中出现计划模式,然后发送请求。

Build the monthly intake in Services/IntakeUpdater.cs and Services/ArchiveCheck.cs.
Program.cs runs both after the listing.

IntakeUpdater applies @docs/case-archives.md to each case folder under incoming/:

- It writes out/staged/<case id>.zip with AES-256 and the same password.
- It leaves archives/ untouched.
- A case without an incoming folder keeps its archive byte for byte.

ArchiveCheck judges a staged archive without trusting IronZIP's listing:

1. Extract both archives with IronZIP and the password into new temp folders.
2. Compare each staged entry's SHA-256 with its source.
3. Parse the staged file's central directory bytes itself, without decrypting.

A case fails on any of these:

- a repeated entry name
- an entry without AES extra field 0x9901 at key strength 3
- staged names that differ from the expected set

An added or replaced entry's source is the incoming file.
A kept entry's source is its extracted original.
The expected set is the original names minus those in remove.txt, plus incoming names.
Leave out remove.txt itself.

Move a passing case's staged file over the original.
Use a plain file move, not a second IronZIP save.
A second intake on the same incoming files must pass and leave the same entries.

Write out/intake-report.csv with one row per case:

- entries before and after
- names added, replaced and removed
- pass or fail, with the reason

Print how many cases pass.
Only the directory parse may read an archive without IronZIP.
Don't add another package.
When all cases pass, have @agent-archive-auditor review Services/.
Text

提示中的每个检查都阻止了不同的错误通过。

  1. 与来源哈希:一个替换的条目与其传入文件进行比较,因此此旧文本保持不变的语句失败。
  2. 目录解析:重复名称和缺失条目在提取时也通过未被注意。
  3. 首先阶段:一个未通过检查的更新能让原始存档保持不变。
提示: 如果计划在每次保存前调用 Encrypt,从提取的副本重建 CASE-1043,并且不能两次存储被替换的名称,原因可能是它首先删除旧条目,或者因为它从头构建了每个分段存档,那就接受这个计划。 没有这些写入操作的计划仍然正确列出归档。

错误的密码会损坏案例存档吗?

IronZIP用任何密码打开时列出一个AES保护的存档,因此第一个错误来得较晚。 在校准探头中保存抛出ZipException(“AES密码无效”)并没有写出文件,提取抛出ArgumentException(“密码错误!!”)。 最后的提示让经纪人证明这一路径使原始内容保持不变。

Prove a wrong archive password can't damage anything, in these steps:

1. Hash every file under archives/ with SHA-256.
2. Launch the built program a second time, in a child process.
3. Hash the files again once the child exits.
4. Print both hash lists side by side.
5. Print the child's exit code and the failure reasons it wrote to out/intake-report.csv.

The child inherits IRONZIP_LICENSE_KEY and gets a wrong CASE_ARCHIVE_PASSWORD.
It also gets a --child flag, under which it starts no process.

Three things have to hold:

- Every hash matches.
- The report has a failed row for CASE-1042 and one for CASE-1043, each with IronZIP's error text.
- The exit code is non-zero.

Change the program only where one of those fails, then run the check again.
Text

在实际运行中这些提示生成了什么?

Claude Code按顺序在一个会话中接收到四个提示,并在第三个之前将规则块附加到CLAUDE.md。 在运行之后,提交的代码从一个干净的克隆中重建并与原始存档对比运行。 Python库pyzipper与IronZIP没有共享代码,读取了每个结果。

  • Claude Code自己运行的Quickstart列表显示CASE-1042中有4个加密条目,CASE-1044有3个,而CASE-1043为“密码无效!”。
  • 在摄取之后,CASE-1042持有5个条目而不是4个。
  • CASE-1042更新添加了两张照片,替换了见证声明并删除了invoice-7781.pdf。
  • CASE-1043从1个条目变为3个。
  • CASE-1044保留了每一个字节。
  • 三个存档中的11个条目都使用AES-256。
  • 每个条目都匹配其源文件的SHA-256。
  • 计划从提取的副本中构建每个阶段存档,包括单条目CASE-1043,并且没有打开存档进行编辑。
  • 在更新器的唯一保存之前运行加密。
  • 目录解析器读取了每个条目的名称和AES强度字节,没有读取大小。
  • 在第三个提示结束时,存档审核子代理运行一次,报告没有未记录的IronZIP成员。
  • 干净重建通过了包含传入文件的两个案例在2.1秒内并报告CASE-1044被跳过。
  • 重建的条目与运行的条目相匹配。
  • 用错误密码,所有三个案例在提取时失败,显示“密码错误!!”。
  • 在那个错误密码运行中,存档哈希没有改变,进程结束代码1。
  • 在第四个提示之前,错误密码在第一个提取时让程序停下,没有处理的异常且无报告,并且哈希依然匹配。
  • 有些步骤与页面中的运行不一样。 每个提示都无人值守地发送,作为一个恢复的无头会话,因此/model选择作为命令行选项传递,每个新提示重载CLAUDE.md无需手动重启。 计划对话框在该模式下不可用,因此计划通过键入回复批准。 第四个提示的证明作为shell命令运行,因此程序没有增加子进程代码,且从未读取子进程标志。 在第四个提示期间,Claude Code还用正确的密码运行了一次摄取,这重新写入CASE-1042和CASE-1043并有相同的条目。

Cursor指南也在任何文件更改之前进行规划,并在其运行时,Plan Mode将IronZIP端口保存为可编辑的Markdown计划。 在ChatGPT Codex指南中,摄取规则写在AGENTS.md中,这是在任何工作开始之前Codex加载的文件,而本指南使用CLAUDE.md。 AI编码助手指南设置一个完整的IronZIP任务具有固定通过列表,而共享的运行记录命名Claude Code版本、模型、提示时间和测试机器来支持这些结果。


故障排除


有问题吗?

如果您有任何问题,请联系support@ironsoftware.com

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

阅读更多

准备开始了吗?

NuGet 下载量 25,383版本:2026.11刚刚发布