Unlocking CapCut Pro Drafts on macOS: Call the App's Own Crypto Routines
This removes the last barrier for automating video editing on macOS: an AI agent can now generate a CapCut Pro project file that actually opens, without owning the encryption key. The approach is fragile across app updates, but the verification method (just decrypt and check JSON) keeps the risk manageable.
CapCut Pro on macOS encrypts all five draft files with AES-GCM, and the key never leaves the binary. A working bypass doesn't extract the key at all—the app's own C++ class `lvve::EncryptUtils` exposes encrypt/decrypt methods that can be called with `this=NULL` through `dlopen` + `dlsym`. The author ships a ~100-line C++ shim that loads the dylib, enables encryption, and round-trips plaintext to ciphertext, verified byte-for-byte for inputs of 50 bytes or more.
Calling those methods carries ABI traps: the `std::string` return uses sret, moving `this` from x0 to x1; `enable(NULL, true)` must run before encryption; the `param` argument is `"{}"`; and plaintext under 50 bytes makes `decrypt` throw `std::out_of_range`. The shim runs as a separate subprocess because the 170MB dylib is too fragile to load into Python's main process.
Writing drafts the app accepts is a separate battle. The strategy clones a real empty draft as a donor, replaces only the timeline content, re-encrypts all five files, registers the draft in `root_meta_info.json`, and copies any referenced media into `~/Movies` (the app's sandbox can't see `/tmp`). One silent killer: clip ranges must be `{start, duration}`, not `{start, end}`; the latter collapses every clip to one frame with no error. The app's watcher will later re-register and re-encrypt the draft, which is normal.
Calling the app's own crypto functions is a cleaner approach than reverse-engineering the key, because it stays correct even if the key rotates—only the ABI and symbol names matter each upgrade.
The 50-byte threshold is a classic landmine for test-driven development; anyone building on this will need to pad inputs to avoid a confusing `out_of_range` exception.
The decision to isolate the dylib in a subprocess is pragmatic: a 170MB binary with unknown dependencies is too risky to load in-process, and the performance cost is negligible for writing a few files.
The silent failure on `{start, end}` is a stark reminder that CapCut's draft format has no schema validation—malformed fields degrade gracefully into unusable output, so automation must be paranoid about exact field semantics.