Skip to content

Replace with Signed Package

Protection changes your artifact, which invalidates any code signature it had, and PyLocket does not sign your app. The Replace with Signed Package flow is how your signature reaches your customers: you sign the protected build with your own certificate (and on macOS notarize it), upload the signed copy back to PyLocket, and PyLocket stores it byte for byte and delivers that copy, signed by you.


When to use it

Use Replace with Signed Package after you have:

  1. Downloaded the protected build from PyLocket.
  2. Signed it with your own certificate (Apple Developer ID for macOS, Authenticode for Windows). See Code Signing.

You then upload the signed file in place of the protected one. PyLocket keeps the same build, license bindings, and download links; only the bytes customers receive change to your signed version.

Replace with Signed Package takes a macOS .app (including Briefcase) or a single-file Windows .exe. A Windows build uploaded as a folder (PyInstaller onedir, cx_Freeze) cannot be replaced with a signed copy yet, so the PyLocket Installer and Hub cannot install it.

In the default delivery mode, a newly protected build is served as soon as it is ready, before you sign it, and takes over from the signed copy of the previous build. To serve only signed copies, switch the app to serve released builds only and release each build after you upload its signed copy (see If your app serves only released builds).


How to replace a build

  1. Open the Developer Portal, go to your app, and open the Builds page.
  2. Find the protected build and choose Replace with Signed Package.
  3. Select your signed file:
    • Windows: the signed .exe.
    • macOS: the signed .app packaged as .app.zip, not a .dmg disk image or .pkg installer. If you distribute a DMG, copy the signed .app out of it and archive that (see the ditto commands below).
  4. Upload. PyLocket checks that the upload is a signed copy of that exact protected build (same code, only signature data differs) and swaps it in. It checks that a signature is present; it does not check your certificate or vouch for it.

It must be the same protected build, just signed

The check confirms your upload is the current protected build with a signature added, not a different or older binary. If you see a "does not appear to be a signed copy of the current protected build" message, you most likely selected an older file or a different binary. Re-download the current protected build, sign that exact file, and upload the result.

macOS: extract and re-archive with ditto, never a third-party archiver

A macOS app bundle only survives a round trip when both directions preserve symlinks, permissions, and every bundled file. Use Apple's built-in tools for both steps, from Terminal:

# 1. Extract the protected download
ditto -x -k Protected.app.zip extracted/

# 2. (sign and notarize the extracted .app)

# 3. Re-archive the signed app (keep the .app.zip name so the upload
#    carries the bundle signal)
ditto -c -k --keepParent YourApp.app YourApp.app.zip

Third-party archivers can silently drop package metadata folders (*.dist-info) from inside the bundle. So can some SIGNING tools: signing apps that "clean" a bundle before signing have been observed deleting *.dist-info directories outright. Those folders look inert but register your app's plugin loaders at runtime - an app missing them still launches and then fails only when the affected feature is used. PyLocket rejects a replacement that lost metadata the protected build carries; the error names the missing folders and repeats these commands.

Run this self-check twice - once right after extracting, and again AFTER signing, before you re-archive and upload:

find YourApp.app -name entry_points.txt

The list must be identical both times. If entries disappear after signing, your signing tool removed them. To recover, copy the real *.dist-info folders back from the extracted original into YourApp.app/Contents/Resources/, re-seal the top level of the bundle (codesign --force --options runtime --timestamp --entitlements entitlements.plist --sign "YOUR_ID" YourApp.app, without --deep: the nested signatures your tool already applied, and PyLocket's own Lamaute Labs signatures, stay as they are; entitlements.plist is the file from Code Signing, and the app needs it to load PyLocket's runtime library), re-run the check above, then notarize and re-archive. Also report the deletion to the signing tool's developers so it stops happening.

Copy the real folders, not just the shortcuts. Inside a macOS app bundle these folders exist as real directories under Contents/Resources/ with matching symbolic links under Contents/Frameworks/. A copy that brings back only the links leaves them pointing at nothing, which is the same as having no metadata at all.


Antivirus check of your signed package

When you replace a build, PyLocket looks up your signed package's SHA-256 hash on VirusTotal. A lookup sends only the hash, never the file. If VirusTotal already knows the package as malicious, the replacement is refused and your build keeps serving the version it had.

If the build you are replacing passed its antivirus check before you signed it, a malicious verdict on the signed macOS package means code was added after signing, and your account is suspended pending review; contact support to sort out a false positive. A detection that is only the packed-Python false positive many antivirus engines show, or one on a Windows package (whose signed copy is byte-for-byte your protected build plus the signature), is refused without suspending.

If VirusTotal has never seen the package, PyLocket does not upload it to VirusTotal by default: VirusTotal is a public service, and a file uploaded there can be downloaded by its subscribers. An app can be opted in to a full scan, in which PyLocket uploads the signed package to VirusTotal and checks the result after the replacement completes. To opt an app in, or out, contact support.

If your app's antivirus scanning is turned off entirely, not even the hash is looked up.


The "Ready - Signed" badge

Once a signed replacement is accepted, the build's status on the Builds page shows Ready - Signed with a lock icon, instead of the normal Ready. This is your at-a-glance confirmation that customers are downloading your signed package.

The badge does not change download links or license behavior. It does decide whether the PyLocket Installer and Hub will install the build: on Windows and macOS they refuse a build that does not show Ready - Signed, and they also check the signature on the customer's machine (on macOS, that Apple notarized the app). Direct downloads work either way.


Topic Link
Sign your app Code Signing
Distribute macOS apps Distributing macOS .app bundles
Distribute your app Distribute Your App