Class CmceAlgorithm
Classic McEliece (CMCE) algorithm adapter
Integrates the Bouncy Castle PQC CMCE primitives into the ZeroEcho SPI. This algorithm publishes:
- KEM capabilities:
ENCAPSULATEusing a recipientPublicKey.DECAPSULATEusing aPrivateKey.
- Agreement capability implemented via a KEM-backed adapter:
- Initiator: constructs an agreement context that encapsulates to the peer public key.
- Responder: constructs an agreement context that decapsulates with the local private key.
- Asymmetric key builders:
- Key generation from
CmceKeyGenSpecvariants. - Public key import from X.509 bytes.
- Private key import from PKCS#8 bytes.
- Key generation from
Provider requirement: the Bouncy Castle provider must be
registered under the standard name "BC" before use.
Usage example:
// Register BC once at startup.
Security.addProvider(new BouncyCastleProvider());
// Obtain contexts using the CMCE algorithm id.
CmceAlgorithm alg = new CmceAlgorithm();
// Generate a key pair with a chosen CMCE variant.
KeyPair kp = alg.asymmetricKeyPairGenerator(CmceKeyGenSpec.class)
.generateKeyPair(CmceKeyGenSpec.mceliece8192128f());
// Create a KEM encapsulation context with the recipient public key.
KemContext enc = alg.createContext(KeyUsage.ENCAPSULATE, kp.getPublic(), VoidSpec.INSTANCE);
// Create an agreement initiator context backed by CMCE KEM.
MessageAgreementContext initiator =
alg.createContext(KeyUsage.AGREEMENT, kp.getPublic(), VoidSpec.INSTANCE);
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs and registers CMCE capabilities and key builders. -
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
-
CmceAlgorithm
public CmceAlgorithm()Constructs and registers CMCE capabilities and key builders.This constructor registers:
- KEM roles for
ENCAPSULATEandDECAPSULATE. - Agreement role wired through a KEM-backed initiator/responder adapter.
- Asymmetric key builder for
CmceKeyGenSpec(generation), X.509 public key import, and PKCS#8 private key import.
The algorithm id is
"CMCE", the display name is"Classic McEliece (CMCE)", and the provider name is taken from the Bouncy Castle provider. - KEM roles for
-
-
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
-