Repository navigation
feat(bindings): expose X-Wing post-quantum KEM in all wrappers - #423
Open
Sébastien Duquette (sduquette-devolutions) wants to merge 2 commits into
Open
Sébastien Duquette (sduquette-devolutions) wants to merge 2 commits into
Sébastien Duquette (sduquette-devolutions) wants to merge 2 commits into
Conversation
Sébastien Duquette (sduquette-devolutions)
added this pull request to stack #424
November 2, 2026 19:11
Expose the X-Wing hybrid KEM (ML-KEM-768 + X25519) added to the Rust core (SEC-15167) through every binding. This is opt-in: the default key and ciphertext versions are unchanged. - FFI: GenerateKeyPairWithVersion, GenerateKeyPairPrivateSize, GenerateKeyPairPublicSize, Encapsulate, EncapsulateSize, Decapsulate. Existing signatures are unchanged. EncryptAsymmetricSize accepts V3 and EncryptAsymmetric returns InvalidOutputLength instead of panicking on a buffer size mismatch. - uniffi (Python, Kotlin, Swift): generateKeypair(version), encryptAsymmetric(..., version), encapsulate, decapsulate, EncapsulationResult. - WASM: encapsulate, decapsulate, EncapsulationResult. - C#: KeyVersion / KeyEncapsulationVersion enums, CipherTextVersion.V3, DataType.EncapsulatedKey, GenerateKeyPair(KeyVersion) overload, Encapsulate / Decapsulate. - CLI: generate-keypair --version, encapsulate, decapsulate. - Fuzz: key_encapsulation targets. - Angular demo: X-Wing key generation, V3 encryption, encapsulate and decapsulate, and inspector support. - Conformity vectors replicated in the Python, WASM, C#, Kotlin and Swift test suites. The Kotlin and Swift tests have not been run locally. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sébastien Duquette (sduquette-devolutions)
force-pushed
the
feat/pq-xwing-bindings
branch
from
November 2, 2026 20:47
76b1131 to
c338a13
Compare
Sébastien Duquette (sduquette-devolutions)
requested a balanced review from Copilot
November 2, 2026 21:54
Copilot started reviewing on behalf of
Sébastien Duquette (sduquette-devolutions)
November 2, 2026 21:55
There was a problem hiding this comment.
🟡 Changes recommended
The new post-quantum tests are excluded from the C# CI projects, and the algorithm and ciphertext-version selectors lack accessible names.
2 open issues
What changed in this PR
Exposes the Rust core’s opt-in X-Wing hybrid key encapsulation through the bindings, CLI, and Angular demo while preserving existing default key and ciphertext versions.
Changes:
- Adds versioned key generation and encapsulation APIs across wrappers, plus FFI buffer-length protection.
- Extends the demo with X-Wing operations and payload inspection.
- Adds cross-language conformity tests, fuzz targets, and changelog entries.
| File | Description |
|---|---|
wrappers/wasm/tests/tests/post-quantum.ts |
Adds X-Wing round-trip and conformity tests. |
wrappers/wasm/tests/package.json |
Registers the post-quantum test suite. |
wrappers/wasm/demo/src/app/service/encryption.inner.service.ts |
Exposes encapsulation APIs to the demo. |
wrappers/wasm/demo/src/app/inspect/inspect.component.ts |
Recognizes X-Wing keys, V3 ciphertexts, and encapsulated keys. |
wrappers/wasm/demo/src/app/asymmetric/asymmetric.component.ts |
Implements algorithm selection and encapsulation actions. |
wrappers/wasm/demo/src/app/asymmetric/asymmetric.component.html |
Adds X-Wing controls and result fields. |
wrappers/swift/DevolutionsCryptoSwift/Tests/DevolutionsCryptoSwiftTests/PostQuantumTests.swift |
Adds Swift post-quantum tests and vectors. |
wrappers/python/tests/post_quantum.py |
Adds Python post-quantum tests and vectors. |
wrappers/kotlin/lib/src/test/kotlin/org/devolutions/crypto/PostQuantumTest.kt |
Adds Kotlin post-quantum tests and vectors. |
wrappers/csharp/tests/unit-tests/PostQuantum.cs |
Adds C# post-quantum tests and vectors. |
wrappers/csharp/src/Native.Core.cs |
Declares native imports for the new APIs. |
wrappers/csharp/src/Managed.cs |
Adds versioned key generation and encapsulation methods. |
wrappers/csharp/src/Enums.cs |
Defines post-quantum versions and data type. |
wrappers/csharp/src/EncapsulationResult.cs |
Holds the encapsulated key and shared secret. |
uniffi/devolutions-crypto-uniffi/src/lib.rs |
Exports encapsulation bindings and version enum. |
uniffi/devolutions-crypto-uniffi/src/key_encapsulation.rs |
Implements UniFFI encapsulation operations. |
src/wasm.rs |
Exposes encapsulation operations and results to JavaScript. |
python/CHANGELOG.md |
Documents Python X-Wing support. |
fuzz/fuzz_targets/key_encapsulation/encapsulated_key_deserialization.rs |
Fuzzes encapsulated-key parsing. |
fuzz/fuzz_targets/key_encapsulation/encapsulate.rs |
Fuzzes encapsulation inputs. |
fuzz/fuzz_targets/key_encapsulation/decapsulate.rs |
Fuzzes decapsulation inputs. |
fuzz/Cargo.toml |
Registers the three encapsulation fuzz targets. |
ffi/src/lib.rs |
Adds versioned key and encapsulation APIs, V3 sizing, and tests. |
cli/src/main.rs |
Adds key-version selection and encapsulation commands. |
CHANGELOG.md |
Documents X-Wing availability across wrappers. |
Review effort: Balanced
- Link PostQuantum.cs into the dotnet-core, android and iOS C# test projects so the post-quantum tests run in CI against the built nupkg. - Associate the algorithm and ciphertext-version selectors in the Angular demo with their labels (for/id). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sébastien Duquette (sduquette-devolutions)
marked this pull request as ready for review
November 3, 2026 15:16
This branch has not been deployed
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.

Expose the X-Wing hybrid KEM (ML-KEM-768 + X25519) added to the Rust core
(SEC-15167) through every binding. This is opt-in: the default key and
ciphertext versions are unchanged.
GenerateKeyPairPublicSize, Encapsulate, EncapsulateSize, Decapsulate.
Existing signatures are unchanged. EncryptAsymmetricSize accepts V3 and
EncryptAsymmetric returns InvalidOutputLength instead of panicking on a
buffer size mismatch.
encryptAsymmetric(..., version), encapsulate, decapsulate,
EncapsulationResult.
DataType.EncapsulatedKey, GenerateKeyPair(KeyVersion) overload,
Encapsulate / Decapsulate.
decapsulate, and inspector support.
test suites.
Stack created with GitHub Stacks CLI • Give Feedback 💬