-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of X509 certificate APIs on iOS #49289
Comments
Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @GrabYourPitchforks Issue DetailsIssues #47533 and #47910 track APIs that are missing from Apple Crypto interop on iOS. When I started removing the managed part of the Interop APIs from iOS build of System.Security.Cryptography.X509Certificates I realised I'd basically end up with a useless assembly that throws PlatformNotSupportedException for everything. The underlying reason is that iOS doesn't have the macOS keychain API and even the most basic X509 manipulation relies on a working export which is implemented through this API and hence not available. To make it at least marginally working the following things probably need to be done:
This should probably be analysed by someone who is more familiar with the API surface on the Apple side. It also looks like enumerating any certificate store, including the trusted root certificates, seems impossible on iOS.
|
If I recall correctly, all the stuff about temporary keychains is because "copy to keychain" (for X509Store.Add) on a keychainless certificate actually modifies the live object, which made some later operations get weird (which almost certainly means tests failed). So this may mean that things just have to work differently between iOS and macOS. If SecPKCS12Import doesn't automatically add things to the default keychain and its SecIdentityRef values work fine across the test suite, then great. (Seems like PKCS7 collection importing is still missing, though). |
Very likely yes. Certainly the iOS code has to use different APIs to work at all so that's a time investment that has to be made regardless of the situation on macOS. We can try to see how the iOS-compatible code would behave on macOS later and evaluate whether there's any way to enable more sharing. On macOS there's an additional
Yep, it is. I am currently looking to establish at least parity with what Xamarin/Mono used to provide which, quite honestly, was not much. |
After #51926 is merged the functional changes for S.S.C.Algorithms are basically done. There's still some work with marking few APIs with unsupported attributes, etc. I started looking into S.S.C.X509Certificates again and I am leaning towards a completely separate PAL implementation on the managed side:
|
First attempts seem promising. My first draft with lot of stubbed places passed around 65% of the unit tests. I will look more into it over the next couple of days. |
On macOS PKCS7 APIs actually exist - |
Issues #47533 and #47910 track APIs that are missing from Apple Crypto interop on iOS. When I started removing the managed part of the Interop APIs from iOS build of System.Security.Cryptography.X509Certificates I realised I'd basically end up with a useless assembly that throws PlatformNotSupportedException for everything. The underlying reason is that iOS doesn't have the macOS keychain API and even the most basic X509 manipulation relies on a working export which is implemented through this API and hence not available. To make it at least marginally working the following things probably need to be done:
SecCertificateCopyData
API and expose it asAppleCryptoNative_X509GetRawData
SecCertificateCreateWithData
/SecPKCS12Import
API instead of temporary keychainsThis should probably be analysed by someone who is more familiar with the API surface on the Apple side. It also looks like enumerating any certificate store, including the trusted root certificates, seems impossible on iOS.
The text was updated successfully, but these errors were encountered: