I'm currently working on a project in Swift where I need to digitally sign a PDF file. I have the following resources available:
Private Key stored in the iOS Keychain with a tag. Public Key also stored in the iOS Keychain with a tag. A valid certificate stored as a PEM string. I need to digitally sign a PDF file with the above keys and certificate, but I'm struggling to find a clear and straightforward example or guidance on how to achieve this in Swift.
Specifically, I’m looking for help with:
Creating the digital signature using the private key and certificate. Embedding this signature into the PDF file. Any considerations I should be aware of regarding the format of the signed PDF (e.g., CMS, PKCS7, etc.). If anyone has experience with digitally signing PDFs in Swift, I would greatly appreciate your guidance or code examples.
Thank you in advance!
Signing Certificates
RSS for tagA signing certificate is a digital identity used for code signing during the build and archive process.
Posts under Signing Certificates tag
110 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
From my developer account, when I generate CSR and submit for certificate generation private key not available and loaded into keychain
I have a bizzare issue with my Apple TV that is shown as "iPod" in Apple developer portal. It's correctly visible in Xcode as Apple TV, but when I add it to developer portal it says "iPod".
The problem is since it's there as an iPod I can't use it to my provisioning profile to build on the device
Anyone has any idea how this can be solved?
[Edited by Moderator]
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags:
Provisioning Profiles
Signing Certificates
Code Signing
I created a fairplay.cer file using the below commands :
openssl genrsa -out private_key.pem 1024
openssl req -new -key private_key.pem -out request.csr
Here, I manually entered the Country, Organization, etc.
I was supposed to use the below commands to make the same :
openssl genrsa -aes256 -out privatekey.pem 1024
opensslreq-new-sha1-keyprivatekey.pem-outcertreq.csr-subj
"/CN=SubjectName /OU=OrganizationalUnit /O=Organization /C=US"
Owing to this, I am unable to create a .p12 file through Keychain Access. I thus want to generate a new fairplay.cer file for Fairplay 4.x. I want to revoke the certificate in order to generate a new one (as it has a limit of 1 certificate for Fairplay)
Requesting developer support from Apple. Have raised multiple requests over the past 4 days.
When clicking Upload for the CSR file, there is no APNS certificate available for download.
Instead, the portal redirects to https://www.apple.com/filenotfound
MDM Push Certificates are critical for the operation of managed devices, if they expire, all devices will have to be reenrolled creating a catastrophic event for all the customers devices.
Please review and given how critical this service for renewing certificates is for your customers, please also make sure it is always available without downtimes.
Let me know if you need more details,
Thank you,
Sergio
I would like to code sign an app or installer with an RSA 4096-bit code signing certificate.
I created a CSR using RSA4096bit and ECC in Mac Keychain Access, but I was unable to use that CSR to create a code signing certificate on the Apple Developer site.
How do I issue an RSA4096-bit or ECC code signing certificate?
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags:
Signing Certificates
Code Signing
When I upload the app to testflight, I get the following error: "Provisioning profile failed qualification. Profile doesn't include the selected signing certificate.". I have regenerated the profile. I have cleared cache, deleted profile and certificate and imported it back to xcode. Any ideas?
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
Provisioning Profiles
TestFlight
Signing Certificates
Hi everyone!
We use to have an intel Mac machine where we generate the Developer ID Installer & Application certs for signing and notarization process. This process works sweet.
Now, we move from an intel to a m1 Mac machine, where we want to do the same process as before. I had try two different approaches, but ending up with the same result.
I export the cert with the private key from my intel to the m1 machine, but when I try to sign, I get: Invalid signature. (Not sure what this error means in this case as everything works on the intel machine. I am guessing the cipher for creating either the private key or the signature differs between the architecture)
I try to generate new certs for this m1 machine, but I get the following error: You already have a current Developer ID installer certificate or a pending certificate request. I try with the same account, but also with a different account. In both cases got the same error.
I create a ticket for apple, where they said to expect a reply between one and two business days, but no luck yet.
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags:
Signing Certificates
Code Signing
I'm trying to sign a build coming from a gitlab runner, but for some reason security find-identity is yielding no results during the pipeline.
Hitting the runner via SSH shows the results as I would expect, as well as VNCing into the runner and using the terminal.
whoami on all 3 shows the same result
My current attempt is to build the keychain on the fly so that I can ensure I have access to the identity, and it succeeds in building the keychain and importing the certs, but find-identity still shows zero results in the pipeline.
- security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
- security list-keychains -d user -s "$KEYCHAIN_PATH" "/Users/######/Library/Keychains/login.keychain-db" "/Library/Keychains/System.keychain"
- security set-keychain-settings "$KEYCHAIN_PATH"
- security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
- security import "$SIGNING_KEY_DECODED" -P "$P12_PASSWORD" -A -f pkcs12 -k $KEYCHAIN_PATH -T "/usr/bin/codesign"
- > # escape :
CERT_IDENTITY="##########"
security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASSWORD" -D "$CERT_IDENTITY" -t private "$KEYCHAIN_PATH"
- echo $(security find-identity)
The echo at the end returns the following:
Policy: X.509 Basic
Matching identities
0 identities found
Valid identities only
0 valid identities found
Running the same command via ssh/terminal over VNC after the build fails returns the following:
Policy: X.509 Basic
Matching identities
1) C6......A2 "iPhone Distribution: ###########"
1 identities found
Valid identities only
1) C6......A2 "iPhone Distribution: ###########"
1 valid identities found
Which suggests that the keychain creation and certificate import is working as expected.
I'm not ruling out the possibility of this being an issue on gitlab's end, but this has been working historically, and only really stopped working since we've updated to Sonoma (we're on 14.7.1 now). We have an active runner on Ventura 13.6.1 that's working still.
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags:
Developer Tools
Security
Signing Certificates
Platforms: Ventura and Big Sur
Steps to Reproduce:
Create new application and installer CSRs with keypairs
Generate new certificates in Apple web portal
Repackage certificates as .p12 using exported private keys since they are not referenced in keychain app by default.
Import certificates into MacOS Keychain
Set certificate access to "Always Trust" for all certificate uses
Sign binary fails using "codesign --force --sign "
Sign installer package succeeds using "productsign --sign
Additional Info:
The private keys ware initially not recognized by the Keychain application resulting a certificate without a private key "leaf" beneath them. To resolve it I exported the private key and repackaged certificate as a .p12 file.
Both certificates appear "good" when evaluated for code signing
The installer certificate shows an intermediate and root while the application certificate does not
Repackaging as .p12 with expected intermediate and root did not resolve the issue
Installing all available intermediates and roots from Apple did not resolve the issue
Signing a test app with XCode succeeds
In production, we sign using CMake so we need to be able to sign code from the command line with codesign.
Hi
After I added iCloud container and iCloud documents my UITests can't run anymore what is this problem and how can I solve it?
Thanks!
As of Nov 25, 2024, Xcode 16.1 won't recognize an App Store provisional profile as Eligible so you cannot select the provisional profile for signing. Which means you cannot archive it for upload to Apple. Setting it to manual or automatic signing does not help. Even going to the dev site and making new, fresh provisional profiles did not work. rebooting xcode did not work. rebooting the computer did not work.
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags:
Signing Certificates
Code Signing
I recently added a new target for Apple Watch, which works fine on the simulator. However, I wasn't able to run it on real Apple watches.
First, I don't see it in the list of devices, even after I click "trust" and connect to my Mac over charging cable.
Second, I've always used automatic code signing, and everything seems OK here.
Third, I also tried distributing it over TestFlight, but that build doesn't appear in the TF. I restarted my phone and relaunched the TF app.
So, when I install the app to my iPhone over the cable, the watch app doesn't appear on Apple watches. Then, If I go to watch app and install my app manual (I see it at the bottom with the "install" button), it fails with the error "This app cannot be installed because its integrity could not be verified.".
Also, there's an icon on the Apple watch, but it shows the same error when I click it.
I unpaired and paired it again, but it didn't help. Also, I tried another pair of phones, and the same thing happened. I use an AppStore account (not enterprise), and the main app works fine.
Is there a way how to fix it?
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
WatchKit
TestFlight
Signing Certificates
Code Signing
I am attempting to build a package for distribution. It is not clear how to fix the profile. Can someone point me some documentation that may help me resolve this?
Xcode 14 and later requires a DriverKit development profile enabled for iOS and macOS. Visit the developer website to create or download a DriverKit profile.
Hi all,
I‘m using the certificates API in order to create a development certificate. I want to create a Jenkins job that will give employees an option to create a certificate without giving them admin rights.
I’m creating a new certificate without any issues.
When I try to create another certificate with a different CSR (for a diff user) I get an error that a certificate already exists.
Is it limited to create only one certificate per API key??
Thanks!
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect API
Tags:
App Store Connect API
Signing Certificates
Hi all,
I'm using xcode 13.2.1. I go to Product>Archive. The app builds and creates an archive, but there's no data for "version, identifier, type, team, architecture, etc." It's just creating a "generic xcode archive."
When I go to "distribute content" it doesn't give the typical distribution methods like "App store Connect, Adhoc, Enterprise, or Development."
What am I doing wrong?
Thank you,
Thomas
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags:
Signing Certificates
Organizer Window
What should I do when my Development or App Store certificates in my developer account under Certificates, Identifiers & Profiles are almost expired or when the certificates are already expired?
What should I do so that I can still use the certificates?
What happens when the certificates expire and when I already have an application in the App Store?
Topic:
App Store Distribution & Marketing
SubTopic:
General
Tags:
Provisioning Profiles
Signing Certificates
What certificate does Xcode cloud use when distribute apps to App Store?
Since cloud managed certs can't be downloaded, how to get its public key for the f..king recordation in China?
Topic:
Developer Tools & Services
SubTopic:
Xcode Cloud
Tags:
Signing Certificates
App Store Connect
I've updated Xcode to 16.1, then I've created a new provisioning profile in developer.apple.com, successfully built and signed my application. It was on monday, 2024-11-04.
Two or three days later I was asked to add more devices and I had to create a new profile. I've noticed a new feature to control profile's name (yeah, cool!), had to accept new agreements. Then, have created a new profile, downloaded it, but could not add it with double-click to Xcode or import to Keychain Access - "Failed to install one or more provisioning profiles on the device". And whatever I tried, I couldn't register any new profiles since. Therefore, my app cannot be signed and tested anymore.
This is quite weird as nothing has changed on the system throughout the week.
Is this a known issue or is there any fix for that?
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags:
Developer Tools
Xcode
Provisioning Profiles
Signing Certificates
Hi,
I'm trying to ssh into another machine, copy an app into that machine and codesign it using my "Dev ID Application" certificate, then copy it back to my original machine.
I'm getting the "errSecInternalComponent" error when running codesign.
This is the bash script I'm running:
ssh ${REMOTE_SERVER} "security -v unlock-keychain -p <REDACTED> /Users/<REDACTED>/Library/keychains/login.keychain-db"
ssh ${REMOTE_SERVER} "codesign -vvv --deep --force --verify --verbose --timestamp --options runtime --sign \"Developer ID Application: <REDACTED>\" \"/tmp/$BUILD_ID/ui-app/<APP_NAME>.app\""
ssh ${REMOTE_SERVER} "codesign -dv --verbose=4 /tmp/$BUILD_ID/ui-app/<APP_NAME>.app"
I've tried to follow all the available info found online, managed to sign it successfully through the machine's UI, set the ACL of the private key to ALLOW ALL, restarted the keychain service, tried with the system keychain, approved all pop ups through the UI.
Still with no luck through the SSH session.
Any help would be greatly appreciated.
Thanks!