Code Signing & Match
appitool match implements Git-backed encrypted storage for Apple signing assets and Android keystores, providing binary and encryption parity with Fastlane Match.
How Match Works
- Clone Git Storage (
GitStorage): Clones the target Git repository branch (shallow clone when inreadonly/syncmode) into a temporary directory under~/.appitool/match/<UUID>and cleans it up indefer. Authenticates HTTPS URLs via token injection and SSH URLs (git@.../ssh://...) viaGIT_SSH_COMMANDusing a temporary0600key file resolved fromMATCH_GIT_TOKEN(file path, raw PEM, or Base64), cleaned up on exit. If the requested branch does not yet exist on the remote,appitoolcreates an isolated orphan branch (matching Fastlane Match behavior). - Decrypt Assets (
MatchEncryption): Decrypts certificates, provisioning profiles, and Android keystores in-place usingMATCH_PASSWORD. - Sync / Prune / Nuke / Add:
- iOS: Validates certificates and profiles against Apple Developer Portal (when App Store Connect API credentials are supplied), creates missing/expired assets when writable, imports
.p12certificates into a dedicated macOS Keychain, and installs.mobileprovision/.provisionprofilefiles for Xcode. - Android: Resolves
<packageName>.keystore(or.jks/.p12) and<packageName>.jsoncredential metadata, or encrypts and pushes a keystore when adding (match android sync -k) or creating one (match android create, which generates a PKCS#12 keystore withoutkeytooland never replaces an existing one).
- iOS: Validates certificates and profiles against Apple Developer Portal (when App Store Connect API credentials are supplied), creates missing/expired assets when writable, imports
- Re-encrypt & Push: Encrypts modified assets using Match V2 (
AES-256-GCM), commits with-c commit.gpgsign=falseso global signing configs never prompt interactively, and pushes changes back to the remote Git repository.
Encryption Compatibility (V1 & V2)
MatchEncryption supports both Fastlane Match encryption formats:
| Format | Header Prefix | Algorithm | Key Derivation | Behavior |
|---|---|---|---|---|
| V2 (Default for writes) | match_encrypted_v2__ | AES-256-GCM (Base64-encoded, 64-char lines) | PBKDF2-HMAC-SHA256 (10,000 iterations, 8-byte random salt, 24-byte AAD) | Used for all newly encrypted files |
| V1 (Legacy read support) | Salted__ | AES-256-CBC (Base64-encoded) | OpenSSL EVP_BytesToKey (MD5, SHA-256) or PBKDF2-HMAC-SHA256 fallback | Supported seamlessly during decryption |
Git Repository Structure
text
<match-git-repo>/
├── certs/
│ ├── development/
│ │ ├── <CERT_ID>.cer
│ │ └── <CERT_ID>.p12
│ ├── distribution/ # Used by both 'appstore' and 'adhoc'
│ │ ├── <CERT_ID>.cer
│ │ └── <CERT_ID>.p12
│ ├── enterprise/
│ └── developer_id/
├── profiles/
│ ├── development/
│ │ └── Development_<bundleId>[_tvos|_catalyst].mobileprovision
│ ├── adhoc/
│ │ └── AdHoc_<bundleId>[_tvos|_catalyst].mobileprovision
│ ├── appstore/
│ │ └── AppStore_<bundleId>[_tvos|_catalyst].mobileprovision
│ ├── enterprise/
│ │ └── InHouse_<bundleId>.mobileprovision
│ └── developer_id/
│ └── DeveloperID_<bundleId>.provisionprofile
└── android/
├── release/
│ ├── <packageName>.keystore
│ └── <packageName>.json
└── debug/
├── <packageName>.keystore
└── <packageName>.jsonWildcard Profile Matching (iOS)
When searching for a profile matching <bundleId>, MatchRunner looks for:
- Exact match (
<Prefix>_<bundleId><suffix>.<ext>) - Partial wildcard matches (
com.example.*, selecting the longest/most specific prefix) - Global wildcard match (
*)
macOS Keychain & Xcode Installation
- Keychain Isolation (
KeychainManager):- Defaults to
appitool(~/Library/Keychains/appitool.keychain-db) with passwordappipass, customizable viaMATCH_KEYCHAIN_NAMEandMATCH_KEYCHAIN_PASSWORD(or--keychain-name/--keychain-password). - Automatically creates the keychain if missing, unlocks it, clears auto-lock timeouts (
set-keychain-settings), and adds it to the user's keychain search list.
- Defaults to
- Provisioning Profile Path (
ProfileInstaller):- Installs profiles into
~/Library/Developer/Xcode/UserData/Provisioning Profiles/<UUID>.mobileprovision(or.provisionprofilefor macOS/Catalyst).
- Installs profiles into
- Fastlane-Compatible Metadata:
- Generates
MatchResult.envVariablesentries (sigh_<bundleId>_<type>,_uuid,_profile-path,_profile-name,_team-id).
- Generates
Read-Only Mode Semantics
Notice the difference between standalone appitool match ios sync and appitool flow:
appitool match ios sync:--readonlydefaults tofalse(can create certificates/profiles on Apple Developer Portal if credentials are provided). Pass--readonlyfor CI read-only sync.appitool flow ios:MatchOptionsdefaultsreadonlytotrueunlessMATCH_READONLY=falseis explicitly set in the environment (and--dry-runalways forcesreadonly: true).
