Support private scalar-only imports on iOS - #134682
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
|
/azp help |
This comment was marked as resolved.
This comment was marked as resolved.
|
/azp list |
This comment was marked as outdated.
This comment was marked as outdated.
|
/azp run runtime-ioslike |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation follows existing Swift interop patterns and enables comprehensive existing ECDH, ECDSA, and HPKE coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Adds EC public-key derivation from a private scalar on Apple mobile platforms, enabling private-only ECDH/ECDSA and HPKE key imports.
Changes:
- Implements NIST P-256/P-384/P-521 derivation through CryptoKit.
- Adds managed Swift interop and native entry-point registration.
- Enables existing private-only key import tests on Apple mobile platforms.
| File | Description |
|---|---|
pal_swiftbindings.swift |
Derives public keys using CryptoKit. |
pal_swiftbindings.h |
Declares the Swift export. |
entrypoints.c |
Registers the native entry point. |
DefaultECDiffieHellmanProvider.Unix.cs |
Enables existing derivation tests. |
EccAppleCrypto.iOS.cs |
Integrates derivation into Apple-mobile key import. |
Interop.Ecc.cs |
Adds managed-to-Swift interop and error handling. |
bartonjs
left a comment
There was a problem hiding this comment.
The stackalloc size isn't a blocker, so signing off with the feedback. If we want to trim it, I'll sign off on that, too.
|
/azp run runtime-ioslike |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run runtime-ioslike |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/ba-g iOS failures are unrelated |
|
/backport to release/11.0 |
|
Started backporting to |
On iOS / tvOS / MacCatalyst, importing an EC key with only
dwould fail because it was not implemented. Previously it was not implemented because CryptoKit was not available to the platform. But now it is, so lets implement it.This matters for HPKE - right now most integration tests for HPKE are failing because HPKE depends on being able to import only the private scalar. This fixes all HPKE tests on mobile Apple platforms.