55
iOS Provisioning Profiles and Signing Certificates Andre Asselin

iOS Provisioning Profiles and Signing Certifications

Embed Size (px)

Citation preview

Page 1: iOS Provisioning Profiles and Signing Certifications

iOS Provisioning Profiles and Signing Certificates

Andre Asselin

Page 2: iOS Provisioning Profiles and Signing Certifications

2

Provisioning profiles, signing certificates, etc.All about iOS security

iOS security has two parts① Authentication

• Ensure an app is really the app it claims to be• Ability to identify which app is attempting to perform an

operation② Authorization

• Ensure only authorized apps can be installed/run on a device

• Ensure a particular app can perform only the operations it’s allowed to do

The big picture

Page 3: iOS Provisioning Profiles and Signing Certifications

3

Some Terms We’re Going to Use

Bundle ID Uniquely identifies an appApplication Service Something the app can do, such as in-app purchases or push

notificationsApp ID Associates 1 or more bundle IDs with application services under a

nameSigning certificate / Signing identity

A public-private key pair that identifies who signed an app, and verifies that the app hasn't been modified since it was signed

Device ID Uniquely identifies a deviceProvisioning profile Associates 1 app ID, 1 or more certificates, and 0 or more devices

under a nameTeam The people who have been added to a particular Apple Developer

Account

Page 4: iOS Provisioning Profiles and Signing Certifications

4

How These All Relate (UML)

Page 5: iOS Provisioning Profiles and Signing Certifications

Bundle ID and App ID: Identifying an App

Page 6: iOS Provisioning Profiles and Signing Certifications

6

Bundle ID

•A bundle ID uniquely identifies an app•Syntax

• Can contain only alphanumeric characters (A-Z, a-z, 0-9), hyphen (-), and period (.)

• Is case sensitive• Example: com.pointsource.example

•Entered into the Xcode project file for an iOS app

Page 7: iOS Provisioning Profiles and Signing Certifications

7

App ID

• An app ID associates 1 or more bundle IDs with application services

• The association is given a name• Created and maintained on the

Apple developer site

Page 8: iOS Provisioning Profiles and Signing Certifications

8

Examples of Application Services

Page 9: iOS Provisioning Profiles and Signing Certifications

9

Explicit and Wildcard App IDs

There are two types of App IDs

①Explicit App IDMatches a single specific bundle ID. Example: com.pointsource.example

②Wildcard App IDCan match multiple bundle IDs. Example: com.pointsource*

Page 10: iOS Provisioning Profiles and Signing Certifications

10

Why Not Always Use a Wildcard App ID?

• Some Application Services can not be associated with a Wildcard App ID, such as Push Notifications, Apple Pay, and In-app purchase

• You can not distribute an Enterprise App using a Wildcard App ID

• An Enterprise app (aka In-house or UniversalDistribution) is one created using the Apple Developer Enterprise Program that is usually distributed for use inside a company (see In House Provisioning Profile).

• Note: You can distribute an app via the App Store using a Wildcard App ID

Page 11: iOS Provisioning Profiles and Signing Certifications

11

Summarizing

• Explicit App ID is a kind of App ID• Wildcard App ID is a kind of App ID• App IDs have 0 or more Application Services associated with them

Page 12: iOS Provisioning Profiles and Signing Certifications

12

Further Notes

An Explicit App ID can not be deleted for an app that has been uploaded to iTunes Connect

Page 13: iOS Provisioning Profiles and Signing Certifications

Signing Certificates: Proving an App’s Identity

(Part 1)

Page 14: iOS Provisioning Profiles and Signing Certifications

14

Signing Certificates

Signing Certificates (also known as Signing Identity)

• Prove who signed an app• Verifies that an app wasn’t

tampered with after it was signed

Page 15: iOS Provisioning Profiles and Signing Certifications

15

Two Ways to Create a Signing Certificate

• You can use Xcode to create (or fix) a Signing Certificate in Preferences / Accounts

• You can create a Signing Certificate through the Member Center website

• First create a certificate signing request using Keychain access / Certificate

assistant / Request a Certificate from a Certificate Authority…

• Upload the signing request file

• Download the newly generated certificate

Page 16: iOS Provisioning Profiles and Signing Certifications

16

Creating a Signing Certificate via Xcode

Page 17: iOS Provisioning Profiles and Signing Certifications

17

Creating a Signing Certificate via Keychain Access

Page 18: iOS Provisioning Profiles and Signing Certifications

Device ID:Identifying a Device

Page 19: iOS Provisioning Profiles and Signing Certifications

19

UDID

• Every iOS device has an ID that uniquely identifies it• UDID (Unique Device Identifier)

• You can add up to 100 devices per type to an Apple developer account per year• The types are: Apple TV, Apple Watch, iPad, iPhone, iPod Touch

• UDIDs are managed through Member Center• During the year your account is active, any devices that are removed will still use one of

the 100 slots• When you renew your account, the slots for removed devices will be freed up, and you

can replace them with different devices• (Jumping ahead) Devices can be added to a development or ad-hoc Provisioning Profile

to allow an app built with that Provisioning Profile to be installed/run on those devices

Page 20: iOS Provisioning Profiles and Signing Certifications

20

Retrieving UDID via iTunes

Page 21: iOS Provisioning Profiles and Signing Certifications

21

Retrieving UDID via iTunes

Page 22: iOS Provisioning Profiles and Signing Certifications

App Distribution and Provisioning Profiles

Page 23: iOS Provisioning Profiles and Signing Certifications

23

App Distribution

• Apple controls which apps are allowed to be installed on an iOS device by using the information from a Provisioning Profile that is embedded in the app

• Provisioning Profiles ensure• Only apps authorized for a particular iOS device can be installed/run on

that device• A debugger can’t be attached to apps built in release mode

Page 24: iOS Provisioning Profiles and Signing Certifications

24

App Distribution Use Cases

The world

Page 25: iOS Provisioning Profiles and Signing Certifications

25

App Distribution Use Cases

The world

Development Profile

Ad-Hoc Profile In-House Profile

App Store Profile

Page 26: iOS Provisioning Profiles and Signing Certifications

26

How Provisioning Profiles Relate to Apple Developer Accounts

• Two types of Apple Developer accounts• Apple Developer Program• Apple Developer Enterprise Program

• The difference between them is which types of Provisioning Profiles are allowed on each

Page 27: iOS Provisioning Profiles and Signing Certifications

27

Provisioning Profiles Allowed on Apple Accounts

Apple Developer Program

Apple DeveloperEnterprise Program

Development ✓ ✓Ad-hoc ✓ ✓App Store ✓ ✕In-house ✕ ✓

Page 28: iOS Provisioning Profiles and Signing Certifications

28

Provisioning Profiles

• A Provisioning Profile associates• Exactly 1 App ID• 1 or more Signing Certificates• 0 or more Device IDs (UDIDs)

• Provisioning Profiles are created and maintained on Member Center• The association is given a friendly name, but is uniquely identified by a

UUID• You can have multiple provisioning profiles with the same name and

different UUIDs (although this will be confusing)

Page 29: iOS Provisioning Profiles and Signing Certifications

29

Relationship Between Provisioning Profile Types

Page 30: iOS Provisioning Profiles and Signing Certifications

30

Development Provisioning Profile

• Used to allow a developer to install an app on a device during development

• Allows debugging the app

• Contains 1 or more Development Signing Certificates and 1 or more device IDs (UDIDs)

Page 31: iOS Provisioning Profiles and Signing Certifications

31

Team Provisioning Profile

• A Team Provisioning Profile is a kind of development Provisioning Profile.• Xcode’s attempt to make Provisioning Profiles user friendly during

development• Allows any app developed by a team to be signed by any team member and

installed on any team device• Examples: "iOS Team Provisioning Profile:*", "iOS Team Provisioning

Profile:com.pointsource.example"• Xcode updates the team Provisioning Profile whenever you register a device,

create a development Signing Certificate, or modify the Bundle ID through Xcode• Changes made using Member Center don't automatically update team

Provisioning Profiles• To select the Team Provisioning Profile in Xcode, select "Automatic" for the

Provisioning Profile under Code Signing

Page 32: iOS Provisioning Profiles and Signing Certifications

32

Team Provisioning Profile (2)

• Contains:• A wildcard App ID that matches all your team's apps or an explicit App ID

that matches a single app.• All devices associated with the team.• All development Signing Certificate associated with the team.

• Wildcard vs explicit App ID• If your app can use a wildcard App ID during development, Xcode creates a

team Provisioning Profile containing a wildcard App ID• If you add an Application Service that requires an explicit App ID, Xcode

creates an explicit App ID and a corresponding team Provisioning Profile• You are not allowed to edit a team Provisioning Profile on Member Center

Page 33: iOS Provisioning Profiles and Signing Certifications

33

Distribution Provisioning Profile

• Debugging is disabled

• Has exactly 1 Distribution Signing Certificate

• Three types of Distribution Provisioning Profiles: App Store, Ad hoc, In House

Page 34: iOS Provisioning Profiles and Signing Certifications

34

App Store Provisioning Profile

• Allows distributing an app to an unlimited number of devices through the App Store

• Has no device IDs (UDIDs) associated with it

• Available only in the Apple Developer Program (vs Apple Developer Enterprise Program)

Page 35: iOS Provisioning Profiles and Signing Certifications

35

In House Provisioning Profile

• Allows distributing an app to an unlimited number of devices outside of the App Store. For example: distributed on an internal company website.

• Also known as iOS Universal Distribution in Member Center

• Has no device IDs (UDIDs) associated with it

• Available only in the Apple Developer Enterprise Program (vs Apple Developer Program)

Page 36: iOS Provisioning Profiles and Signing Certifications

36

In House Provisioning Profile (2)

Note: Apps distributed with an in house Provisioning Profile will not run until the user clicks to trust the developer.

• An error message will display saying the developer is not trusted

• On iOS 9, to trust the app, go to Settings / General / Profile / <Company Name>, and select "Trust <Company Name>"

Page 37: iOS Provisioning Profiles and Signing Certifications

37

Ad Hoc Provisioning Profile

• Allows your app to be installed on designated devices• Example use case: distribution to QA for testing

• Contains 1 or more device IDs (UDIDs)• Can be distributed and installed though iTunes, the X Code

organizer or though the web

Page 38: iOS Provisioning Profiles and Signing Certifications

38

Ad Hoc Provisioning Profile (2)

Note: Like the In-House Provisioning Profile, apps distributed using an ad hoc Provisioning Profile created on an Apple Developer Enterprise Program account (vs Apple Developer Program) will not run until the user clicks to trust the developer.

• An error message will display saying the developer is not trusted

• On iOS 9, to trust the app, go to Settings / General / Profile / <Company Name>, and select "Trust <Company Name>"

Page 39: iOS Provisioning Profiles and Signing Certifications

39

Expiration and Invalidation

• Provisioning profiles expire after one year• Provisioning profiles become invalid on Member Center if

• Its App ID is deleted• It contains a Signing Certificate that has been revoked• It contains a device ID (UDID) that has been disabled

Page 40: iOS Provisioning Profiles and Signing Certifications

40

Provisioning Profiles are Copied and Cached

Copied to Embedded in

Page 41: iOS Provisioning Profiles and Signing Certifications

41

Regeneration

• Because Provisioning Profiles are copied and cached, when a Provisioning Profile is invalidated on Member Center, it does not affect anybody who previously downloaded it to their Mac, nor any apps already built with it

• For example: You may still run your app on a disabled device if an app is built with an older version of the Provisioning Profile that still contains that device’s UDID

• When a Provisioning Profile is regenerated, it generates a whole new profile, with a new UUID

• The old Provisioning Profile is unaffected and can still be used, unless it’s expired

• Xcode will only automatically regenerate team Provisioning Profiles. It will not automatically regenerate distribution Provisioning Profiles or custom development Provisioning Profiles.

Page 42: iOS Provisioning Profiles and Signing Certifications

42

Further Notes

• Stored in Member Center and cached locally in "~/Library/MobileDevice/Provisioning\ Profiles”

• Filename in "~/Library/MobileDevice/Provisioning\ Profiles" will be <UUID>.mobileprovision.

Page 43: iOS Provisioning Profiles and Signing Certifications

Signing Certificates(Part 2)

Page 44: iOS Provisioning Profiles and Signing Certifications

44

Two Types of Signing Certificates

Page 45: iOS Provisioning Profiles and Signing Certifications

45

Development Signing Certificate

• Used in a development Provisioning Profile• Allows debugging apps• Identifies a person on your team• Can be created by a team member• Limit of 1 iOS development Signing Certificate per team member• Contains the person's name. Example: iPhone Developer:

Wendy Jones

Page 46: iOS Provisioning Profiles and Signing Certifications

46

Distribution Signing Certificate

• Also known as Production Certificate (on Member Center)• Used in a Distribution Provisioning Profile (Ad hoc, In House, and App Store)• Identifies the team

• Owned by the team— shared by multiple team members who have permission to distribute apps

• Contains the team name. Example: iPhone Distribution: PointSource, LLC• Can only be created by a team agent or admin• Limit of 2 distribution Signing Certificates active at the same time; each is

independent from the other• The second certificate is intended to provide an overlapping period during

which you can update your apps before the first certificate expires

Page 47: iOS Provisioning Profiles and Signing Certifications

47

Expiration

• Apple Developer Program Signing Certificates expire after 1 year

• Apple Developer Enterprise Program Signing Certificates expire after 3 years

Page 48: iOS Provisioning Profiles and Signing Certifications

48

Revoking

• If you revoke a Signing Certificate, any Provisioning Profile that contains that certificate becomes invalid

• Revoking a distribution Signing Certificate doesn’t affect your development Signing Certificates or development Provisioning Profiles

• Similarly, revoking a development Signing Certificate doesn't affect your distribution Signing Certificates or distribution Provisioning Profiles

• Revoking a Signing Certificate doesn't affect apps that you've submitted to the App store nor does it affect your ability to update them

• This is because Apple re-signs apps before distributing to customers

Page 49: iOS Provisioning Profiles and Signing Certifications

49

Regeneration is Not Allowed

• Signing Certificates can not be recreated / regenerated. If a certificate expires or is revoked, a new one must be created.

• If Xcode detects an issue with a Signing Certificate, it displays an appropriate action in Accounts preferences.

• If Xcode displays a Create button, the Signing Certificate doesn't exist in

Member Center or on your Mac.

• If Xcode displays a Reset button, the Signing Certificate is not usable on

your Mac—for example, it is missing the private key. If you click the Reset

button, Xcode revokes and re-creates the corresponding certificate.

Page 50: iOS Provisioning Profiles and Signing Certifications

50

Aside: Using PKI for Signatures

Key Generation Signing and Verification

Page 51: iOS Provisioning Profiles and Signing Certifications

51

The Private Key Only Exists on the Mac that Created the Key

Key and certificate creation

Page 52: iOS Provisioning Profiles and Signing Certifications

52

What You’ll see in Keychain Access

Certificate only– no

private key

Certificate and private

key

Page 53: iOS Provisioning Profiles and Signing Certifications

53

You can move your Signing Certificates (including the private keys) from one Mac to another and back them up by exporting a Developer Profile (not to be confused with a Development Provisioning Profile) from the Accounts tab in Xcode's preferences.

Setting Up a New Mac

Page 54: iOS Provisioning Profiles and Signing Certifications

54

Note that resources such as images and nib files aren't signed; therefore, a change to these files doesn't invalidate the signature

Further Notes

Page 55: iOS Provisioning Profiles and Signing Certifications

Thank you

www.PointSource.com 55