← Provisioning profiles
Profile·Guide
All tools

Provisioning profiles

Every iOS app that isn't from the App Store carries embedded.mobileprovision: Apple's permission for that app to run, listing who may sign it, on which devices, with which entitlements, until when. The tool reads it in your browser; the code is two libraries you can reuse.

Contents

  1. The format
  2. What to look at
  3. The ProvisioningProfile library
  4. The CMS library

1The format

A profile is an XML property list wrapped in a CMS (PKCS#7) SignedData structure signed by Apple. The plist holds:

2What to look at

3The ProvisioningProfile library

lib/mobileprovision.js is a JavaScript module with no user interface. It exports ProvisioningProfile, a class whose instances are opened profiles; it imports lib/cms.js and lib/plist.js itself. Use lib/x509.js (X509Certificate) to read the certificates it returns. Reading the plist inside needs the browser's DOMParser (a page, not a worker).

import { ProvisioningProfile } from "../lib/mobileprovision.js";
import { X509Certificate } from "../lib/x509.js";

const info = ProvisioningProfile.read(bytes);
console.log(info.profile.Name, info.profile.ExpirationDate, info.distribution, info.debuggable);
const developer = new X509Certificate(info.developerCertificates[0]);
Method / propertyWhat it is
ProvisioningProfile.read(bytes), new ProvisioningProfile(bytes)Opens a profile (a Uint8Array or an ArrayBuffer); throws when it isn't a signed plist.
profileThe plist as plain values (Plist.decode): dates are Dates, data is Uint8Array.
xmlThe plist's text.
appIdentifierEntitlements["application-identifier"], or null.
developerCertificatesDER certificates allowed to sign apps with the profile.
signingCertificatesDER certificates of the chain that signed the profile.
distribution"enterprise", "ad hoc or development" (it lists devices) or "App Store".
debuggableget-task-allow is true.

4The CMS library

lib/cms.js exports SignedData, which reads CMS / PKCS#7 SignedData, also used by APK v1 signatures (META-INF/*.RSA), Mach-O code signatures and .p7b bundles. It reads the structure; it doesn't verify signatures.

import { SignedData } from "../lib/cms.js";

const signed = SignedData.read(bytes);
console.log(signed.certificates.length, signed.content && signed.content.length);
Method / propertyWhat it is
SignedData.read(bytes), new SignedData(bytes)Reads a ContentInfo holding SignedData (a Uint8Array or an ArrayBuffer); throws for anything else.
SignedData.OID{ data, signedData }: the two content type OIDs.
contentTypeThe signed content's OID (1.2.840.113549.1.7.1 is plain data).
contentThe signed bytes, or null for a detached signature.
certificatesThe included certificates (DER), in file order.
digestAlgorithmsOIDs.
signers[{ version, issuer, serial, subjectKeyId, digestAlgorithm, signatureAlgorithm, signedAttributes, signedAttributesDer, signature }]. issuer is the DER of the issuer's name; signedAttributes are [{ type, values }] and signedAttributesDer the bytes the signature covers.