Anti-AIClone

Log date · Mon

Does an iOS app need re-signing after hardening?

Published on · Updated

Usually yes. We changed one byte in a signed sample, verified the failure, and explain iOS distribution signing and device checks.

Does hardening an iOS app require signing again?

Usually, yes. If hardening changes signed code or resources, the original signature no longer describes the modified content. In our own sample, verification passed, failed after a one-byte change, and passed after signing again. A passing signature check establishes only the checks performed; distribution configuration and functionality need separate acceptance tests.

The results at a glance
QuestionFinding
Original signed fileVerification passed.
One byte changedVerification failed.
Signed againThe new signature verified.
Ready to distribute on iOS?Not established; this used a macOS ad hoc signature.

Sample and scope

On 2026-11-11 we compiled our own small C program with Apple clang 21.0.0 on macOS 27.2 and Xcode 27.2, then signed and checked it with codesign. This is a standalone macOS Mach-O, not an iOS app; Apple-credential signing, IPA export and device installation were not executed.

The program contains one copy of the string SIGNING-SAMPLE-A. The script compiles and signs it, then changes its final A to B; it asserts that the string occurs once and reports the offset and byte count. This compares states of the same file, rather than two separate builds.

From the transcript; after re-signing, the passing signature is the new one.
== verify original ==
sample: valid on disk
sample: satisfies its Designated Requirement
== change one byte ==
offset=1199 A->B changed_bytes=1
== verify changed ==
sample: invalid signature (code or signature have been modified)
In architecture: arm64
verification failed as expected
== sign changed and verify ==
sample: replacing existing signature
sample: valid on disk
sample: satisfies its Designated Requirement

Re-signing does not restore the old signature. It creates signature information for the changed file. Both states can pass their respective checks without having identical bytes or proving that the change was intended. Record hashes for the hardening input, output and final delivery artifact so build records point to the exact object accepted.

What codesign displays

We ran codesign -dv --verbose=4 on both passing states. These consecutive fields are from the first output and describe this standalone sample, not a template for every app.

Selected fields from the original sample, copied verbatim.
Page size=16384
CDHash=c2a602b8dd3767c1010e87bd59a5cfde8fe755b1
Signature=adhoc
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none

The displayed page size is 16,384 bytes; the signature is adhoc, with no TeamIdentifier, sealed resources or bound Info.plist. This is a standalone executable, not an app bundle with resources and extensions. The CDHash changed to 2c156cc037ea6288fdec0468d3ef9f55ecb2d2d7 after signing again. It identifies signature information and should not be treated as a general hash of the entire file.

Displaying signature information and verifying it are separate operations: -dv displays, while --verify checks. Apple cautions against treating signature internals as a stable API and recommends using the system tools to inspect them. [2] A valid signature also does not mean code is confidential, business logic is correct, or a distribution channel has authorized the app.

What iOS distribution signing needs

iOS executable code requires signing with an Apple-issued certificate; codesign --sign - in our sample is an ad hoc signature, not an ad hoc provisioning profile for distribution to registered devices. [1] The latter authorizes a distribution configuration with a certificate, App ID and designated devices; the sample signature cannot substitute for it.

Apple explains that a provisioning profile connects who can sign, the app, where and when it can run, and its entitlement authorization. [2] For registered-device distribution, prepare a matching App ID, distribution certificate with public and private keys, registered devices and the appropriate profile; Xcode can manage profiles with automatic signing. [4] Check each extension’s identifier and entitlements as well as the main app, so a working main bundle does not hide an extension configuration error.

An App Store Connect upload requires an app record with an explicit App ID. A manually created App Store profile contains one distribution certificate; Xcode can manage distribution profiles with automatic signing. [3] Apple checks signing and provisioning and re-signs during App Store distribution. [2] The artifact accepted before upload and the one ultimately downloaded by users are therefore at different stages of the release process.

Keep the signing private key in a controlled build environment, limit access and retain signing records. Finish every step that changes code or resources before producing a candidate with the team’s chosen Xcode signing and export workflow. If content changes afterwards, build or sign again and repeat acceptance checks.

Recommendations by situation

The following are engineering recommendations, not distribution outcomes measured by this experiment. Treat signature checks, channel authorization and runtime behavior as separate acceptance steps with their own evidence.

Recommendations by release situation
QuestionFinding
Hardening changes executable codeSign after transformation and verify the final candidate.
App has extensions or frameworksInventory nested components, identifiers and entitlements; check and test each.
Registered-device testingUse matching distribution configuration and registered devices; install and run on them.
Preparing an App Store uploadCheck App ID, certificate, profile and archive; validate through Xcode’s channel workflow.

Do more than check that the main screen launches. List scenarios to pass before and after hardening, such as launching extensions, accessing app-group data, notifications and keychain access, then record results on target devices. A signature can be valid while a permissions mismatch appears only in a particular feature or extension.

Signing order belongs in the build design too. Process and sign nested code before completing the outer app signature; if an inner component is replaced afterwards, check the outer bundle again. Keep a build record for each component, especially where an extension and the main app use different entitlements. Do not assume that one bulk operation applied the appropriate configuration everywhere. Inspect each item in the candidate, and if you find a mismatch, produce and test the complete deliverable again. Record which build and configuration produced the result so a later release can repeat the same checks.

Check your own app

On a Mac, run the following read-only commands on a final .app you are authorized to inspect, replacing the path with your exported or archived app. The first displays signing details; the second checks the main bundle and nested code. If verification fails, retain the full error and identify the component; displayed information is not a passing result.

Example commands for your own app; replace the path. Not executed on an iOS app.
codesign -dv --verbose=4 "path/to/YourApp.app"
codesign --verify --deep --strict --verbose=2 "path/to/YourApp.app"

Also inspect each extension’s signing details and entitlements separately and compare them with the team configuration and channel requirements. Save the build number, artifact hash, verification output, device and OS version, and functional test results. When a later change occurs, this makes it clear which checks must be repeated. Do not copy profiles or signing private keys into public logs.

On failure, first confirm which build was checked, then compare the last modification, nested components, certificate and profile. After a fix, produce a new candidate rather than checking off an old log. Complete acceptance with the actual release workflow and target devices, and ensure the checked build is the one intended for delivery.

Your checklist

  • Record hashes of the hardening input, output and final artifact.
  • Sign after all code and resource changes.
  • Check identifiers, entitlements and profiles for the app and extensions.
  • Verify the final bundle and retain the full result.
  • Test extensions, notifications and data access on target devices.

Primary sources

All sources and reproduction status ↗