[API Proposal]: Add support for X-Wing
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Background and motivation
Migrating from X25119 to [X-Wing hybrid post-quantum KEM](https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/) is a logical step for security conscious projects. Since [MLKem](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.mlkem?view=net-11.0) and [X25519](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.x25519diffiehellman?view=net-11.0) are part of the framework, everything is given to implement the API for X-Wing. Also it would support the adaptation of X-Wing.
### API Proposal
```csharp
namespace System.Security.Cryptography;
public static class XWing
{
public const int DecapsulationKeySizeInBytes = 32;
public const int EncapsulationKeySizeInBytes = 1216;
public const int CiphertextSizeInBytes = 1120;
public const int SharedSecretSizeInBytes = 32;
public static bool IsSupported { get; }
public static (byte[] DecapsulationKey, byte[] EncapsulationKey) GenerateKeyPair();
public static (byte[] SharedSecret, byte[] Ciphertext) Encapsulate(ReadOnlySpan encapsulationKey)
public static byte[] Decapsulate(ReadOnlySpan ciphertext, ReadOnlySpan decapsulationKey)
}
```
### API Usage
```csharp
// Step 1
(byte[] DecapsulationKey, byte[] EncapsulationKey) = XWing.GenerateKeyPair();
// Step 2
(byte[] EncapsulatedSecret, byte[] Ciphertext) = XWing.Encapsulate(EncapsulationKey);
// Step 3
byte[] decapsulatedSecret = XWing.Decapsulate(Ciphertext, DecapsulationKey);
```
### Alternative Designs
_No response_
### Risks
_No response_
Contributor guide
Research direction
Start by reviewing the proposed XWing API alongside the existing MLKem and X25519 framework APIs. Determine the implementation and validation work needed for key generation, encapsulation, and decapsulation; done means the framework exposes the proposed API with interoperable X-Wing support.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cryptography, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100