Add saved p12 certificate reuse for provisioning#206
Open
stephancill wants to merge 3 commits intoxtool-org:mainfrom
Open
Add saved p12 certificate reuse for provisioning#206stephancill wants to merge 3 commits intoxtool-org:mainfrom
stephancill wants to merge 3 commits intoxtool-org:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was running into certificate creation issues when running
xtool devHowever, I noticed that Xcode was able to create a new provisioning certificate without any issues so I used a coding agent to implement importing an existing certificate to be used instead of generating a new one at login time. Hoping this helps anyone else with the same issue.
AI generated description of the changes below:
Summary
xtool auth login --signing-p12 ... --signing-p12-password ..., copying the certificate into xtool-managed storage for reuse.xtool devandxtool install) before attempting Apple certificate creation.opensslkey extraction fallback with native PKCS#12 private key extraction inCXKit, removing reliance on an external OpenSSL CLI binary at runtime.xtool auth statusand document the new auth/certificate workflow in installation and first-app docs.Motivation
Users with existing Apple Development certificates can hit Apple API
409 ENTITY_ERRORconflicts when xtool always attempts to create new certificates. Saving and reusing a known-good.p12cert/key pair avoids unnecessary certificate creation and makes provisioning deterministic across machines.Implementation Notes
XTLSavedSigningP12PathXTLSavedSigningP12Passwordauth loginnow optionally copies the provided.p12into xtool config storage and saves its password.SigningInfofrom saved.p12first (including stale/expired cached-signing-info paths), and only falls back to cert creation when reuse is not possible.CXKit:PKCS12_parse)User-Facing Changes
auth loginoptions:--signing-p12--signing-p12-passwordxtool auth statusnow reports saved signing cert state (configured/path/file presence/password presence, and cert summary when readable).Documentation/xtool.docc/Installation-macOS.mdDocumentation/xtool.docc/Installation-Linux.mdDocumentation/xtool.docc/First-app.tutorialTesting
swift build(repo root)xtool devsuccessful end-to-end on physical device with saved.p12cert.xtool devwith restricted PATH (/usr/bin:/bin:/usr/sbin:/sbin) and confirming successful provision/sign/install.