Code signing
It is the way to ensure the authenticity of executable code (app). Using code signing, the operating system can know whether or not the app is altered by other developers (or malicious softwares) while in transit. It uses Public Key Cryptography and Hashing algorithm. The app's developer creates a hash value of the program and encrypts it with a private key. The encrypted hash and a public key are embedded with the app and sent to the users. When the users launch the app, the OS implicitly decrypts the hash with the embedded public key and compare it with its computed hash value. If they are not equal, the app was altered. Note that one public key can be used with only one private key.The sender's or developer's digital certificate contains a public key and other identifying information such as a person's name, a company name, a domain name, and a postal address. The certificate is used to verify that the app is really sent by its developer. The OS verifies the certificate with the trusted Authority (for example, Apple). You can find more details here.
Provisioning
Provisioning is the process of preparing and configuring your app to run on a device and which services your app can access. The provisioning profile is downloaded from your developer account and embedded in the app's bundle. The whole bundle is code-signed. Before the app launches, the OS install the provisioning profile on your device. If the information in the provisioning profile does not match certain criteria, the app won't launch. You can find more details here.Code signing and provisioning are done in Xcode using the following steps:
1. You must have an Apple developer account, which can be created with Apple ID.2. Create signing identity and provisioning profile (find more details here)
- Open your project in Xcode and select your project in Project Navigator
- From General tab, fill in information under Identity section.
3. Connect your device to your Mac machine. From Product menu, select Destination then your device's name. After that, press Command + R to run the project. The app will start on your device.