XWingFfiAlgo class final
X-Wing hybrid post-quantum/traditional KEM (IANA HPKE KEM id 0x647A)
backed by OpenSSL 3 via Dart FFI.
See XWingPureDartAlgo for which document to cite and why.
X-Wing has no native OpenSSL primitive, so this composes MlKem768FfiAlgo
(ML-KEM-768) and X25519FfiAlgo (X25519). The seed expansion (SHAKE-256),
the shared-secret combiner (SHA3-256) and the byte layouts are the
package-internal XWingCore, shared with XWingPureDartAlgo, so public
keys, ciphertexts and shared secrets are fully interoperable between the
FFI and pure-Dart backends. This backend is still checked against the
published 0x647A vectors in its own right — the working group's JSON is
the independent oracle, and interop tests alone would pass with both
backends wrong in the same way.
Unlike XWingPureDartAlgo, there is no derandomized encapsulation: OpenSSL's
ML-KEM encapsulation does not accept external randomness, so draft test
vectors are verified against the pure-Dart backend instead.
Prefer AtPqc.xWing, which auto-resolves to this backend when libcrypto supports ML-KEM-768 and falls back to pure-Dart otherwise. Construct via XWingFfiAlgo.fromLib only to pin a specific DynamicLibrary (e.g. loaded via tryLoadLibCrypto).
- Implemented types
- Mixed-in types
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- kemSeedDescription → String
-
How a wrong-length diagnostic names this backend's seed, e.g.
an X-Wing seedoran ML-KEM-768 seed (d || z).no setteroverride - kemSeedLength → int
-
This backend's seed length in bytes. Feeds newSeed and
keyPairFromSeed; not part of the caller-facing contract.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
decapsulate(
Uint8List secretKey, Uint8List ciphertext) → Future< Uint8List> -
Recover the shared secret from
ciphertextusingsecretKey.override -
encapsulate(
Uint8List publicKey) → Future< ({Uint8List ciphertext, Uint8List sharedSecret})> -
Encapsulate a fresh shared secret against
publicKey.override -
generateKeyPair(
[Uint8List? seed]) → Future< ({Uint8List publicKey, Uint8List secretKey})> -
Generate an X-Wing key pair.
override
-
keyPairFromSeed(
Uint8List seed) → FutureOr< ({Uint8List publicKey, Uint8List secretKey})> -
Deterministically regenerate the key pair that
seedproduces.inherited -
keyPairFromValidatedSeed(
Uint8List seed) → Future< ({Uint8List publicKey, Uint8List secretKey})> -
Unlike MlKem768FfiAlgo, this backend's secret key is the seed itself
rather than an OpenSSL handle, so a key recovered through
keyPairFromSeed does survive a restart.
override
-
newSeed(
) → Uint8List -
A fresh seed drawn from a secure random source, of whatever length this
backend's keyPairFromSeed takes.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- ciphertextLength → const int
- publicKeyLength → const int
- seedLength → const int