Skip to content
Mobileintermediate

What is code signing?

Updated Nov 30, 20264 min readBased on official documentation
What is code signing?

In short

Code signing is a way to prove who built an app and that its contents have not changed since. The developer signs the app with a digital certificate, and the operating system checks that signature before running it. On Apple platforms, signing is required for apps to run and for distribution through the App Store or to other users.

What code signing does

Code signing attaches a digital signature to a piece of software. The signature is made with a private key that only the developer holds. The matching public certificate is available to anyone who needs to check the signature.

Two things are proven by a valid signature. First, the app came from the owner of the certificate. Second, the files in the app have not been changed since the signature was made. If someone edits even one byte, the check fails and the system can refuse to open the app.

On Apple platforms this check is built into the system. macOS, iOS, iPadOS, and other Apple systems verify signatures before they run code, so signing is not optional for most software you want to ship.

The main pieces

Apple's documentation groups the parts of signing into a few ideas. You will meet these names often, so it helps to know them early.

  • A signing certificate is issued by Apple through your developer account. It says that a specific developer or company is allowed to sign code.
  • A certificate signing request is the file you create on your own computer to ask for a certificate. It contains your public key, while the private key stays on your machine.
  • A provisioning profile links together your app's identifier, the certificate or certificates allowed to sign it, and in some cases a list of devices. It tells the system that this app is allowed to run in a given setting.
  • Entitlements are permissions that an app declares, such as access to iCloud, push notifications, or other system features. The app can only use the features its entitlements list and the signing setup allows.

You do not need to memorize every term at once. Most of the time, Xcode manages these pieces for you when automatic signing is enabled.

How it works in practice

When you build an app for distribution, the build tool uses your private key to sign the app bundle. The signature covers the code, resources, and metadata inside the bundle. The provisioning profile is embedded so the system can check that the app matches what was approved.

When a user opens the app, the system checks the signature against the certificate chain that Apple issued. It also checks that the entitlements in the app match the profile. If any of these checks fail, the app will not launch or will not install.

For Mac software distributed outside the Mac App Store, Apple also expects developers to use a Developer ID certificate and to notarize the app. Notarization is a separate review step that Apple runs on the signed software. Details of notarization and the trusted execution checks that follow are covered in separate documentation.

Common mistakes

Developers new to signing run into the same few problems again and again.

  • Expired certificates. A certificate has a limited life. When it expires, builds signed with it stop being accepted until you create a new one.
  • Mismatched identifiers. If the app's bundle identifier does not match the one in the provisioning profile, the build fails or the app will not install.
  • Missing entitlements. If you turn on a capability in your code but not in the developer portal, or the other way around, the app may crash or the feature may not work.
  • Lost private keys. If the private key for a certificate is lost, you cannot sign with that certificate. You need to revoke it and create a new one, which can affect existing users of older builds.

If you see a signing error, check these items first. Apple's forum posts on signing problems describe many of these cases in detail.

When to care about signing

You need signing as soon as you want to run an app on a real device outside your own development setup, or submit an app to the App Store. Even during development, Xcode signs your builds so that they can run on a test device.

Signing also matters for teams. Certificates and profiles can be shared among developers, and a build server can sign on behalf of the team. Apple's documentation describes cloud signing as one option for distributing apps without managing every certificate on each machine.

If you already automate releases, you may use a tool such as fastlane to handle signing steps. Our guide to fastlane explains how such automation fits into a release pipeline. Signing also affects how apps receive push notifications, because that feature needs a matching entitlement and profile. Our page on push notifications covers that side of the picture.

Where to learn more

Apple's official code signing documentation is the best starting point for the current rules. It includes reference tables of certificate types and capabilities, and it links to technotes that explain provisioning profiles in detail. Read the parts that match your platform, because iOS and macOS handle some details differently.

FAQ

Do I need code signing to test an app on my own iPhone?

Yes, in practice. Xcode signs test builds so that the system will install them on a device. Automatic signing usually handles this when you sign in with your developer account.

What happens if my signing certificate expires?

Apps signed with an expired certificate stop being accepted for new installs and updates. You need to create a new certificate, sign the app again, and submit a new build.

Is code signing the same as encryption?

No. Signing proves who made the software and that it has not changed. It does not hide the contents of the app from anyone who has it.

Can I sign an app on any computer?

Signing requires your private key and certificate, so you need access to them on the machine doing the build. Teams often share certificates through a secure process or use a cloud signing service.

Sources

This page is based on the official documentation below. Read it for full detail.

Code signing — official documentation ↗
blozhikDeveloper news from across the web, explained. Every story links to its original sources.