Class XWingAlgorithm
CryptoAlgorithm for the X-Wing hybrid
post-quantum key encapsulation mechanism.
Overview
X-Wing combines X25519 (classical Diffie–Hellman over Curve25519) and ML-KEM-768 (post-quantum lattice-based KEM) into a single hybrid KEM per draft-connolly-cfrg-xwing-kem. It provides security if either component is secure, offering a smooth migration path to post-quantum cryptography.
Implementation
Because BouncyCastle 1.86 has no JCA provider binding for X-Wing, this
implementation uses the low-level BC API (pqc.crypto.xwing.*)
directly. Key pairs are generated by XWingKeyPairGenerator and
wrapped in package-private XWingPublicKey / XWingPrivateKey
holders for use within the ZeroEcho context model.
Capabilities
KeyUsage.ENCAPSULATE: generates a fresh shared secret and its encapsulation from a recipientPublicKey.KeyUsage.DECAPSULATE: recovers the shared secret from an encapsulated ciphertext using aPrivateKey.KeyUsage.AGREEMENT(message-style): KEM adapter for initiator/responder flows using the above KEM operations.
Key generation
X-Wing has no selectable parameters. Use XWingKeyGenSpec.DEFAULT as the
key generation spec. The private key is stored as its 32-byte seed; the
public key is stored as its raw encoding.
Thread-safety
XWingAlgorithm instances are immutable and safe to share. Created
KemContext objects are not thread-safe.
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates and wires the X-Wing algorithm with all its capabilities and the key-pair generator. -
Method Summary
Modifier and TypeMethodDescriptionList<ParameterSetDescriptor<? extends AlgorithmKeySpec>> Returns the discoverable parameter sets (or parameterized templates) supported by this algorithm.Methods inherited from class AbstractCryptoAlgorithm
capabilityMethods inherited from class CryptoAlgorithm
addCapability, asymmetricKeyPairGenerator, bindContext, createContext, displayName, id, keyOperations, listCapabilities, priority, privateKeyImporter, providerName, publicKeyImporter, registerAsymmetricKeyPairGenerator, registerPrivateKeyImporter, registerPublicKeyImporter, registerSymmetricKeyGenerator, registerSymmetricKeyImporter, requiresStatefulSigning, roles, supports, symmetricKeyGenerator, symmetricKeyImporter
-
Constructor Details
-
XWingAlgorithm
public XWingAlgorithm()Creates and wires the X-Wing algorithm with all its capabilities and the key-pair generator.
-
-
Method Details
-
parameterSets
Description copied from class:CryptoAlgorithmReturns the discoverable parameter sets (or parameterized templates) supported by this algorithm.Callers (UIs, provisioning tools, policy engines) use this list to present users with valid, named key-generation options without prior knowledge of the concrete algorithm. Each entry is either a pre-built
ParameterSetDescriptor.Concrete(ready spec) or aParameterSetDescriptor.Template(user-supplied arguments produce the spec).The default implementation returns an empty list. Algorithms with finite, enumerable parameter sets should override this method. Overrides must return immutable lists in stable order, with unique nonblank descriptor identifiers. Registry loading validates a snapshot; external providers remain responsible for maintaining the contract on subsequent calls. Implementations may use
ParameterSetDescriptor.snapshot(List)to validate and copy their list.- Overrides:
parameterSetsin classCryptoAlgorithm- Returns:
- immutable list of parameter set descriptors; never
null
-