PQC Algorithms
Since Camel 4.12
Only producer is supported
The PQC component supports signing and verifying payload using Post Quantum Cryptography algorithms, as well as key lifecycle management for Post-Quantum cryptographic keys.
Features
-
Digital Signatures - Sign and verify data using NIST-standardized and experimental PQC signature algorithms
-
Key Encapsulation - Generate and extract shared secrets using Key Encapsulation Mechanisms (KEM)
-
Key Lifecycle Management - Generate, rotate, expire, revoke, and manage PQC keys
-
Multiple Implementations - File-based and in-memory key storage options
-
Key Export/Import - Convert keys between PEM, DER, PKCS8, and X.509 formats
Prerequisites
URI Format
pqc://label[?options]
You can append query options to the URI in the following format:
?options=value&option2=value&…
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The PQC Algorithms component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
Component configuration. | PQCConfiguration | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Required The operation to perform. Enum values:
| PQCOperations | ||
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | |
The classical key agreement algorithm of the hybrid key encapsulation operations. When classicalKeyAgreement is not set, the KeyAgreement is created for it: ECDH for the ECDH values, X25519 or X448. The curve is the one of classicalKeyPair; only X25519 and ECDH_P256 with keyEncapsulationAlgorithm MLKEM get a default key pair. Enum values:
| String | ||
Autowired The classical javax.crypto.KeyAgreement of the hybrid key encapsulation operations. When not set, the producer creates one for classicalKEMAlgorithm. | KeyAgreement | ||
Autowired The classical key pair of the hybrid operations: an EC, EdDSA or RSA key pair for hybridSign and hybridVerify, an EC or XDH key pair for the hybrid key encapsulation operations. | KeyPair | ||
The classical signature algorithm of hybridSign and hybridVerify. When classicalSigner is not set, the Signature is created for it: SHA256withECDSA, SHA384withECDSA and SHA512withECDSA for the ECDSA values, Ed25519 and Ed448, and SHA256withRSA, SHA384withRSA and SHA512withRSA for the RSA values. The curve or RSA key size is the one of classicalKeyPair; only ECDSA_P256 and ED25519 with signatureAlgorithm MLDSA get a default key pair. Enum values:
| String | ||
Autowired The classical java.security.Signature of hybridSign and hybridVerify. When not set, the producer creates one for classicalSignatureAlgorithm. | Signature | ||
The HKDF (RFC 5869) variant that combines the classical and the PQC shared secrets into the secret key of the hybrid key encapsulation operations. Both sides must use the same value. Enum values:
| HKDF-SHA256 | String | |
The PQC key encapsulation mechanism (KEM). When keyGenerator is not set, the KeyGenerator is created for this algorithm, and when neither keyPair, keyStore nor keyPairAlias is set, a default key pair of this algorithm is generated in memory and shared by the endpoints of the JVM that use the same algorithm. KYBER creates ML-KEM keys, as MLKEM does. CMCE is deprecated. Enum values:
| String | ||
Autowired The javax.crypto.KeyGenerator of the key encapsulation operations, and of the PQC part of the hybrid ones. When not set, the producer creates one for keyEncapsulationAlgorithm. A configured instance is shared by the exchanges, which then use it one at a time. | KeyGenerator | ||
Autowired The KeyLifecycleManager that stores the keys and their metadata. Required by the key lifecycle operations (generateKeyPair, exportKey, importKey, rotateKey, getKeyMetadata, listKeys, expireKey, revokeKey and deleteKeyState). The signing operations use it to record the usage of the key named in the CamelPQCKeyId header, and to store the state of a stateful key. | KeyLifecycleManager | ||
Autowired The key pair of the signature and key encapsulation operations (the PQC key pair of the hybrid ones): the private key signs and decapsulates, the public key verifies and encapsulates. The exportKey, getRemainingSignatures and getKeyState operations use it too. When neither this option, keyStore nor keyPairAlias is set, a default key pair is generated in memory for signatureAlgorithm or keyEncapsulationAlgorithm. | KeyPair | ||
The alias of the entry in keyStore that holds the key pair. | String | ||
How often the key rotation scheduler checks the keys, when keyRotationSchedulerEnabled is true. Must be positive. The first check runs one interval after the component starts. | 3600000 | long | |
When the scheduler is enabled, rotate keys older than this age. The age is compared in whole days. If not set, age is not used as a rotation signal. | long | ||
When the scheduler is enabled, rotate keys whose recorded usage count reaches this value. The usage count of a key grows with each sign and hybridSign operation that names it in the CamelPQCKeyId header. 0 disables usage-based rotation. | 0 | long | |
Whether to start a background scheduler that rotates the keys of the keyLifecycleManager set on the component, which is then required. On each check it rotates the ACTIVE and PENDING_ROTATION keys that reach keyRotationMaxAge or keyRotationMaxUsage, or whose metadata marks them for rotation. | false | boolean | |
Autowired A loaded java.security.KeyStore to read the key pair from: the private key and the certificate (for the public key) of the keyPairAlias entry. Used only when keyPairAlias and keyStorePassword are set too, and then it takes precedence over keyPair. | KeyStore | ||
The password of the private key of the keyPairAlias entry in keyStore. | String | ||
The NIST parameter set (security level) to use for the configured signature or key encapsulation algorithm, using the BouncyCastle parameter-set names: for example ML-DSA-44, ML-DSA-65 or ML-DSA-87 for MLDSA, and ML-KEM-512, ML-KEM-768 or ML-KEM-1024 for MLKEM. Names are case-insensitive and the underscore form (ml_dsa_87) is accepted as an alias. When set, the key material is generated with this parameter set instead of the algorithm default. Not supported for the stateful signature algorithms (XMSS, XMSSMT, LMS, HSS) nor for the hybrid operations: for those, register a KeyPair bean in the registry instead. | String | ||
The PQC signature algorithm. When signer is not set, the Signature is created for this algorithm, and when neither keyPair, keyStore nor keyPairAlias is set, a default key pair of this algorithm is generated in memory and shared by the endpoints of the JVM that use the same algorithm. DILITHIUM and SPHINCSPLUS create ML-DSA and SLH-DSA keys, as MLDSA and SLHDSA do. Enum values:
| String | ||
Autowired The java.security.Signature of the sign and verify operations, and of the PQC part of hybridSign and hybridVerify. When not set, the producer creates one for signatureAlgorithm. A configured instance is shared by the exchanges, which then use it one at a time. | Signature | ||
The warning threshold for stateful key exhaustion as a fraction of total signatures (0.0 to 1.0). When the remaining signatures for a stateful key (XMSS, XMSSMT, LMS/HSS) drop to this fraction of the total capacity or below, a WARN is logged on signing and the producer health check reports a warning. When remaining signatures reach zero, an exception is thrown to prevent key reuse. Set to 0 to disable warnings. | 0.1 | double | |
Whether the extractSecretKeyFromEncapsulation and hybridExtractSecretKeyFromEncapsulation operations set the extracted secret key in the CamelPQCSecretKey header instead of the message body. | false | boolean | |
Whether to enforce key status checks before cryptographic operations. When enabled, REVOKED keys are rejected for all operations, EXPIRED keys are rejected for signing/encapsulation but allowed for verification/extraction, and DEPRECATED keys produce a warning but still function. Requires a KeyLifecycleManager and a CamelPQCKeyId header to be set. | true | boolean | |
The symmetric algorithm of the secret key that the key encapsulation operations derive from the shared secret, such as AES. Required by the key encapsulation operations and their hybrid forms. Enum values:
| String | ||
The length in bits of the secret key that the key encapsulation operations derive from the shared secret. It must be a length that symmetricKeyAlgorithm accepts: the fixed-size ciphers, such as SEED and SM4, only accept 128, and GOST3412-2015 and CHACHA7539 only accept 256. The default of 256 keeps the strength of the shared secret the KEM produces. | 256 | int | |
Used for enabling or disabling all consumer based health checks from this component. | true | boolean | |
Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true. | true | boolean | |
Whether to sign with a stateful key (XMSS, XMSSMT, LMS/HSS) that the configured KeyLifecycleManager cannot claim for this process alone. These are one-time-signature schemes: when two processes load the same key from a shared store, both sign from the same index and the key is broken. Only enable it when something outside Camel guarantees a single signer. | false | boolean |
Endpoint Options
The PQC Algorithms endpoint is configured using URI syntax:
pqc:label
With the following path and query parameters:
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The operation to perform. Enum values:
| PQCOperations | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The classical key agreement algorithm of the hybrid key encapsulation operations. When classicalKeyAgreement is not set, the KeyAgreement is created for it: ECDH for the ECDH values, X25519 or X448. The curve is the one of classicalKeyPair; only X25519 and ECDH_P256 with keyEncapsulationAlgorithm MLKEM get a default key pair. Enum values:
| String | ||
Autowired The classical javax.crypto.KeyAgreement of the hybrid key encapsulation operations. When not set, the producer creates one for classicalKEMAlgorithm. | KeyAgreement | ||
Autowired The classical key pair of the hybrid operations: an EC, EdDSA or RSA key pair for hybridSign and hybridVerify, an EC or XDH key pair for the hybrid key encapsulation operations. | KeyPair | ||
The classical signature algorithm of hybridSign and hybridVerify. When classicalSigner is not set, the Signature is created for it: SHA256withECDSA, SHA384withECDSA and SHA512withECDSA for the ECDSA values, Ed25519 and Ed448, and SHA256withRSA, SHA384withRSA and SHA512withRSA for the RSA values. The curve or RSA key size is the one of classicalKeyPair; only ECDSA_P256 and ED25519 with signatureAlgorithm MLDSA get a default key pair. Enum values:
| String | ||
Autowired The classical java.security.Signature of hybridSign and hybridVerify. When not set, the producer creates one for classicalSignatureAlgorithm. | Signature | ||
The HKDF (RFC 5869) variant that combines the classical and the PQC shared secrets into the secret key of the hybrid key encapsulation operations. Both sides must use the same value. Enum values:
| HKDF-SHA256 | String | |
The PQC key encapsulation mechanism (KEM). When keyGenerator is not set, the KeyGenerator is created for this algorithm, and when neither keyPair, keyStore nor keyPairAlias is set, a default key pair of this algorithm is generated in memory and shared by the endpoints of the JVM that use the same algorithm. KYBER creates ML-KEM keys, as MLKEM does. CMCE is deprecated. Enum values:
| String | ||
Autowired The javax.crypto.KeyGenerator of the key encapsulation operations, and of the PQC part of the hybrid ones. When not set, the producer creates one for keyEncapsulationAlgorithm. A configured instance is shared by the exchanges, which then use it one at a time. | KeyGenerator | ||
Autowired The KeyLifecycleManager that stores the keys and their metadata. Required by the key lifecycle operations (generateKeyPair, exportKey, importKey, rotateKey, getKeyMetadata, listKeys, expireKey, revokeKey and deleteKeyState). The signing operations use it to record the usage of the key named in the CamelPQCKeyId header, and to store the state of a stateful key. | KeyLifecycleManager | ||
Autowired The key pair of the signature and key encapsulation operations (the PQC key pair of the hybrid ones): the private key signs and decapsulates, the public key verifies and encapsulates. The exportKey, getRemainingSignatures and getKeyState operations use it too. When neither this option, keyStore nor keyPairAlias is set, a default key pair is generated in memory for signatureAlgorithm or keyEncapsulationAlgorithm. | KeyPair | ||
The alias of the entry in keyStore that holds the key pair. | String | ||
Autowired A loaded java.security.KeyStore to read the key pair from: the private key and the certificate (for the public key) of the keyPairAlias entry. Used only when keyPairAlias and keyStorePassword are set too, and then it takes precedence over keyPair. | KeyStore | ||
The password of the private key of the keyPairAlias entry in keyStore. | String | ||
The NIST parameter set (security level) to use for the configured signature or key encapsulation algorithm, using the BouncyCastle parameter-set names: for example ML-DSA-44, ML-DSA-65 or ML-DSA-87 for MLDSA, and ML-KEM-512, ML-KEM-768 or ML-KEM-1024 for MLKEM. Names are case-insensitive and the underscore form (ml_dsa_87) is accepted as an alias. When set, the key material is generated with this parameter set instead of the algorithm default. Not supported for the stateful signature algorithms (XMSS, XMSSMT, LMS, HSS) nor for the hybrid operations: for those, register a KeyPair bean in the registry instead. | String | ||
The PQC signature algorithm. When signer is not set, the Signature is created for this algorithm, and when neither keyPair, keyStore nor keyPairAlias is set, a default key pair of this algorithm is generated in memory and shared by the endpoints of the JVM that use the same algorithm. DILITHIUM and SPHINCSPLUS create ML-DSA and SLH-DSA keys, as MLDSA and SLHDSA do. Enum values:
| String | ||
Autowired The java.security.Signature of the sign and verify operations, and of the PQC part of hybridSign and hybridVerify. When not set, the producer creates one for signatureAlgorithm. A configured instance is shared by the exchanges, which then use it one at a time. | Signature | ||
The warning threshold for stateful key exhaustion as a fraction of total signatures (0.0 to 1.0). When the remaining signatures for a stateful key (XMSS, XMSSMT, LMS/HSS) drop to this fraction of the total capacity or below, a WARN is logged on signing and the producer health check reports a warning. When remaining signatures reach zero, an exception is thrown to prevent key reuse. Set to 0 to disable warnings. | 0.1 | double | |
Whether the extractSecretKeyFromEncapsulation and hybridExtractSecretKeyFromEncapsulation operations set the extracted secret key in the CamelPQCSecretKey header instead of the message body. | false | boolean | |
Whether to enforce key status checks before cryptographic operations. When enabled, REVOKED keys are rejected for all operations, EXPIRED keys are rejected for signing/encapsulation but allowed for verification/extraction, and DEPRECATED keys produce a warning but still function. Requires a KeyLifecycleManager and a CamelPQCKeyId header to be set. | true | boolean | |
The symmetric algorithm of the secret key that the key encapsulation operations derive from the shared secret, such as AES. Required by the key encapsulation operations and their hybrid forms. Enum values:
| String | ||
The length in bits of the secret key that the key encapsulation operations derive from the shared secret. It must be a length that symmetricKeyAlgorithm accepts: the fixed-size ciphers, such as SEED and SM4, only accept 128, and GOST3412-2015 and CHACHA7539 only accept 256. The default of 256 keeps the strength of the shared secret the KEM produces. | 256 | int | |
Whether to sign with a stateful key (XMSS, XMSSMT, LMS/HSS) that the configured KeyLifecycleManager cannot claim for this process alone. These are one-time-signature schemes: when two processes load the same key from a shared store, both sign from the same index and the key is broken. Only enable it when something outside Camel guarantees a single signer. | false | boolean |
Message Headers
The PQC Algorithms component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
| Constant: | The operation we want to perform. It must be one the endpoint holds the key material for: an override crossing between the signature and the key encapsulation operations is rejected. Enum values:
| PQCOperations | |
| Constant: | The signature of the message body: set by sign, read by verify. | String | |
CamelPQCVerification (producer) Constant: | Whether the signature matches the message body: set by verify and hybridVerify. | Boolean | |
| Constant: | The secret key extracted by extractSecretKeyFromEncapsulation or hybridExtractSecretKeyFromEncapsulation, when storeExtractedSecretKeyAsHeader is enabled. | SecretKey | |
CamelPQCRemainingSignatures (producer) Constant: | The number of signatures left in the stateful key (XMSS, XMSSMT, LMS/HSS) of the endpoint: set by getRemainingSignatures. | Long | |
| Constant: | The state of the stateful key of the endpoint (algorithm, index and remaining signatures): set by getKeyState. | StatefulKeyState | |
| Constant: | The ID of the key in the keyLifecycleManager. Required by generateKeyPair, rotateKey (the key to rotate), getKeyMetadata, expireKey, revokeKey and deleteKeyState. With the signing operations it names the key whose usage is recorded. | String | |
| Constant: | The key ID of the new key, for the rotateKey operation. Required by that operation, which rotates the key held under CamelPQCKeyId into this one. | String | |
| Constant: | The key pair returned by generateKeyPair, importKey and rotateKey. | KeyPair | |
| Constant: | The format of the key for exportKey and importKey: PEM, DER, PKCS8 or X509. Defaults to DER. | String | |
CamelPQCExportedKey (producer) Constant: | The key exported by exportKey: the public key of the endpoint key pair, also with its private key when CamelPQCIncludePrivate is true. | byte[] | |
CamelPQCKeyMetadata (producer) Constant: | The metadata of the key named in CamelPQCKeyId: set by getKeyMetadata. | KeyMetadata | |
| Constant: | The metadata of all the keys of the keyLifecycleManager: set by listKeys. | List | |
| Constant: | The algorithm of the key, such as MLDSA or MLKEM (a signatureAlgorithm or keyEncapsulationAlgorithm value). Required by generateKeyPair, importKey and rotateKey. | String | |
CamelPQCIncludePrivate (producer) Constant: | Whether exportKey exports the private key too. Defaults to false. | Boolean | |
CamelPQCRevocationReason (producer) Constant: | The reason that revokeKey records with the revoked key. | String | |
CamelPQCHybridSignature (producer) Constant: | The hybrid signature, which holds both the classical and the PQC signature: set by hybridSign, read by hybridVerify. | byte[] | |
CamelPQCClassicalSignature (producer) Constant: | The classical signature component of a hybrid signature. | byte[] | |
CamelPQCPqcSignature (producer) Constant: | The PQC signature component of a hybrid signature. | byte[] | |
CamelPQCClassicalEncapsulation (producer) Constant: | The classical encapsulation component of a hybrid KEM. | byte[] | |
CamelPQCPqcEncapsulation (producer) Constant: | The PQC encapsulation component of a hybrid KEM. | byte[] | |
CamelPQCHybridSecretKey (producer) Constant: | The secret key combined from the classical and the PQC shared secrets: set by hybridGenerateSecretKeyEncapsulation and hybridExtractSecretKeyEncapsulation, read by hybridExtractSecretKeyFromEncapsulation, which falls back to the message body. | SecretKey | |
CamelPQCHybridEncapsulation (producer) Constant: | The hybrid encapsulation, which holds both the classical and the PQC encapsulation: set by hybridGenerateSecretKeyEncapsulation, read by hybridExtractSecretKeyEncapsulation. | byte[] | |
CamelPQCHybridVerification (producer) Constant: | The verification result of hybrid signature (both must pass). | Boolean |
Message Body
The message body at each side of the PQC Algorithms component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Producer input |
| The payload of sign, verify, hybridSign and hybridVerify: bytes or a stream as they are, text as UTF-8; another body is signed as its text, so marshal it first. extractSecretKeyEncapsulation and extractSecretKeyFromEncapsulation take the SecretKey carrier returned by generateSecretKeyEncapsulation, and importKey the key as bytes, or as text for PEM. The other operations do not use the body.
|
Producer output |
| Unchanged for the signature and key operations, which set their results in headers, such as CamelPQCSignature and CamelPQCVerification. generateSecretKeyEncapsulation and extractSecretKeyEncapsulation give a SecretKey with the encapsulation carried by its runtime BC implementation; the other key encapsulation operations give a SecretKey; with storeExtractedSecretKeyAsHeader=true the key is in the CamelPQCSecretKey header instead.
|
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Supported Algorithms
The component supports the following algorithms for signature and verification.
Standardized and implemented
-
ML-DSA
-
SLH-DSA
-
LMS
-
HSS (Hierarchical Signature System)
-
XMSS
-
XMSSMT (XMSS Multi-Tree)
Experimental and non-standardized
-
Dilithium
-
Falcon
-
SNOVA
-
MAYO
-
SPHINCS+
DILITHIUM and SPHINCSPLUS are kept for backward compatibility: they generate ML-DSA and SLH-DSA keys, the standardized versions of these algorithms. |
Parameter Sets (NIST Security Levels)
By default each algorithm uses a fixed parameter set - for example ML-DSA-65 for MLDSA and ML-KEM-512 for MLKEM. Use the parameterSpec option to select a different NIST parameter set (security level); the key material is then generated with that parameter set instead of the algorithm default.
from("direct:sign")
.to("pqc:sign?operation=sign&signatureAlgorithm=MLDSA¶meterSpec=ML-DSA-87")
.to("pqc:verify?operation=verify&signatureAlgorithm=MLDSA¶meterSpec=ML-DSA-87"); Endpoints configured with the same algorithm and parameterSpec share the same generated key, so a sign/verify endpoint pair works out of the box - exactly as with the default key material.
Values are the BouncyCastle parameter-set names, resolved case-insensitively. The underscore form used by the BouncyCastle constants (ml_dsa_87) is accepted as an alias of the canonical name (ML-DSA-87).
| Algorithm | Parameter sets |
|---|---|
|
|
|
|
|
|
|
|
|
|
| The |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The parameterSpec option is also honoured by the generateKeyPair lifecycle operation, which then generates the key at the configured security level.
parameterSpec is not supported for the stateful hash-based signature algorithms (XMSS, XMSSMT, LMS, HSS) nor for the hybrid operations: those either have no name-addressable BouncyCastle parameter set, or pair a fixed classical key set with a matching PQC key set. For those, register a KeyPair bean in the registry instead. |
Supported Operations
The component supports the following operations:
Signature Operations:
-
sign - Sign data using a PQC signature algorithm
-
verify - Verify a signature
Key Encapsulation Operations:
-
generateSecretKeyEncapsulation - Generate a secret key and encapsulate it
-
extractSecretKeyEncapsulation - Extract the encapsulation
-
extractSecretKeyFromEncapsulation - Extract the secret key from encapsulation
Hybrid Operations (classical + post-quantum):
-
hybridSign - Create a hybrid signature combining a classical and a PQC signature
-
hybridVerify - Verify a hybrid signature (both components must be valid)
-
hybridGenerateSecretKeyEncapsulation - Generate a hybrid encapsulation and shared secret
-
hybridExtractSecretKeyEncapsulation - Extract the shared secret from a hybrid encapsulation
-
hybridExtractSecretKeyFromEncapsulation - Extract the secret key from a hybrid encapsulation
See PQC Hybrid Cryptography for configuration details and examples.
Key Lifecycle Operations:
-
generateKeyPair - Generate a new PQC key pair
-
exportKey - Export a key to PEM, DER, PKCS8, or X.509 format
-
importKey - Import a key from bytes
-
rotateKey - Rotate a key and deprecate the old one
-
getKeyMetadata - Get metadata for a key
-
listKeys - List all keys with metadata
-
expireKey - Mark a key as expired
-
revokeKey - Revoke a compromised key
See PQC Key Lifecycle Management for full details.
Metrics
When Micrometer is on the classpath and a MeterRegistry bean is available in the Camel registry, the PQC producer records metrics automatically. Micrometer is an optional dependency: without it (or without a MeterRegistry) no metrics are emitted and there is no runtime overhead.
| Meter | Type | Description |
|---|---|---|
| Counter | Number of PQC operations performed, tagged by |
| Gauge | Remaining signatures for a stateful signature key (XMSS, XMSSMT, LMS, HSS), tagged by |
To enable the metrics, add camel-micrometer (or Micrometer directly) to your application and bind a MeterRegistry in the registry - for example a SimpleMeterRegistry, or the registry provided by Spring Boot or Quarkus.
Sub-Pages
The PQC component documentation is split into focused sub-pages:
-
Key Lifecycle Management - Key generation, storage, rotation, expiration, revocation, and format conversion with FileBasedKeyLifecycleManager, InMemoryKeyLifecycleManager, HashiCorp Vault, AWS Secrets Manager, and Azure Key Vault implementations
-
Hybrid Cryptography - Combining classical and post-quantum algorithms for defense-in-depth, including wire format v2
-
PQC DataFormat - DataFormat for quantum-resistant encryption/decryption using KEM
Bouncy Castle Runtime Compatibility
camel-pqc uses the JCA services advertised by the Bouncy Castle (BC) and Bouncy Castle PQC (BCPQC) providers. Provider selection is service- and algorithm-specific; an algorithm is not assumed to be available from BCPQC just because it is a post-quantum algorithm. The provider is resolved at runtime from the providers visible to the application.
The Bouncy Castle version selected by an application or platform dependency manager can differ from the version used to compile Camel. Keep the runtime Bouncy Castle artifacts aligned to one release and validate that release in the target deployment. The Camel compatibility tests currently cover Bouncy Castle 1.86 and 1.87. A scheduled CI check also tests the latest stable release; it is an early-warning compatibility check and does not automatically change Camel’s pinned dependency or by itself constitute a supported-version guarantee.
KEM API boundary
On the Java 21 baseline, camel-pqc prefers a provider’s KeyGenerator service when both KeyGenerator and KEM are advertised. This preserves the established KEMGenerateSpec / KEMExtractSpec derivation behavior on Bouncy Castle 1.86 and keeps the data format interoperable with applications that explicitly configure a KeyGenerator. The standard javax.crypto.KEM API is used when the selected provider does not advertise a KeyGenerator service; this supports KEM-only JCA providers. The standard KEM.Encapsulated result carries both the SecretKey and its encapsulation. Algorithms without either service fail with a provider-specific diagnostic.
BouncyCastleKemSupport isolates the provider-specific handling needed by the KEM fallback. It resolves BC parameter specifications from the selected provider’s class loader and preserves the SecretKeyWithEncapsulation runtime carrier when that class is available, so routes that use getEncapsulation() continue to work. Bouncy Castle API use is kept in typed support code and checked by the PQC production import-fence test; production code does not use reflective API access.
Stateful-key compatibility
Bouncy Castle 1.87 moved the LMS/HSS and XMSS/XMSSMT JCA parameter specifications and key interfaces to the newer org.bouncycastle.jcajce packages. Earlier releases expose the corresponding types under org.bouncycastle.pqc.jcajce.
BouncyCastlePqcCompatibility contains typed access paths for these API layouts. At runtime it checks which API is available, selects the matching access path, and caches that selection. It does not choose an implementation by comparing a provider version string, and it does not use reflection or ServiceLoader to load version-specific adapters.
This compatibility path is used for stateful LMS, HSS, XMSS and XMSSMT key handling. Ordinary non-stateful signing does not need to query the stateful-key compatibility support. The compatibility implementation is part of camel-pqc; applications do not need to add separate BC compatibility adapter artifacts.
Runtime dependency alignment
A platform BOM, including a Quarkus BOM, may select a Bouncy Castle runtime version that differs from Camel’s compile-time dependency. Keep the related Bouncy Castle artifacts aligned to one release, and test the exact runtime version selected by the application. Avoid packaging multiple Bouncy Castle versions in separate application or plugin class loaders.
Quarkus BOM and native-image integration
The Camel Quarkus PQC runtime extension depends on camel-pqc and camel-quarkus-support-bouncycastle. The Bouncy Castle support module brings in bcprov-jdk18on and bcpkix-jdk18on; their versions are managed by the Quarkus dependency platform.
The Quarkus Bouncy Castle support extension registers the security provider during static initialization. When a provider is not already registered, it uses the thread context class loader to load the configured BC provider. The PQC deployment processor requests registration of the BCPQC provider and contributes native-image security provider and reflection metadata for the PQC provider classes.
The support extension also reuses an already registered BC or BCFIPS provider instead of unconditionally registering another copy. Keep the Bouncy Castle artifacts aligned with the versions selected by the Quarkus BOM.
The Camel compatibility workflow exercises the component against the tested Bouncy Castle versions and checks cross-version KEM interoperability. This component-level matrix is useful for validating a dependency override, but it does not replace testing the application in its target runtime, including JVM or native deployment where applicable.
Bouncy Castle 1.87 upgrade considerations
-
HQC: Bouncy Castle 1.87 implements the HQC specification published on 12 October 2026. HQC keys and ciphertexts created by earlier Bouncy Castle releases are not compatible with the 1.87 implementation. Regenerate affected HQC key pairs and distribute the new public keys to communicating peers. Do not assume that old HQC ciphertexts can be decrypted by the new provider.
-
NTRU, NTRU LPRime and SNTRU Prime: Bouncy Castle 1.87 applies the default KDF-3/SHA-256 derivation in these JCA KEM services. With the default JCA KEM specifications, Bouncy Castle 1.86 returned the mechanism secret directly, while 1.87 derives the requested AES key. A key and ciphertext may still be decoded across these releases, but the resulting AES key is different. Ensure both communicating applications use compatible KDF behavior; do not assume that successful decapsulation alone proves that the derived application key is equal.
-
LMS/HSS and XMSS/XMSSMT: Bouncy Castle 1.87 moves the relevant JCA parameter specifications and key interfaces to the newer packages.
camel-pqchandles the old and new public JCA API layouts internally. Applications that directly import Bouncy Castle types should review their own imports when upgrading Bouncy Castle. -
CMCE: Bouncy Castle deprecated Classic McEliece in 1.87.
camel-pqcretains its existingCMCEalgorithm entry for compatibility; deprecation does not mean that the component has silently removed it. For new deployments, evaluate standardized ML-KEM instead.
A Bouncy Castle upgrade must still be reviewed and tested before being adopted. The compatibility workflow checks provider availability, the component test suite, and cross-version KEM vectors; it does not rewrite stored keys, ciphertexts, or application data during an upgrade.
Signature and Verification
The component expects to find a KeyPair and a Signature Objects in to the Camel Registry.
In case the KeyPair and the Signature Objects are not in the registry, it will provide two instances of the Objects with default implementation.
This will be true for standardized algorithms and for experimental ones.
| To combine a classical signature (ECDSA, Ed25519, RSA) with a PQC signature for defense-in-depth during the post-quantum transition, use the hybrid signature operations described in Hybrid Cryptography. |
The sign and verify operations stream the message body. A byte[] or InputStream body is fed to the signature in chunks without being materialised as a String, so large payloads (files, large messages) can be signed and verified without loading them fully into memory. A java.io.File or java.nio.file.Path body, and a file from a file consumer (a GenericFile body), is read the same way from the file, so the signature covers the bytes of the file. When the body is a re-readable StreamCache (for example with stream caching enabled) it is reset after reading so downstream processors still see the payload. A String (or any CharSequence) body is encoded as UTF-8 so that signing and verifying agree regardless of the JVM default charset. Any other body that has a binary type converter (for example a java.nio.ByteBuffer, a java.io.ByteArrayOutputStream, a Netty ByteBuf or a Vert.x Buffer) is signed over those bytes. A body with no binary representation (for example a Map or a POJO) is rejected with an InvalidPayloadException; convert it to a String, byte[] or other binary type earlier in the route. The hybridSign and hybridVerify operations handle the body types the same way, but read the whole body into memory. |
Examples
All signature algorithms follow the same route pattern. Below is a complete example using ML-DSA, followed by a reference table for the other algorithms.
ML-DSA (complete example)
-
Java
-
XML
-
YAML
from("direct:sign").to("pqc:sign?operation=sign").to("mock:sign").to("pqc:verify?operation=verify")
.to("mock:verify"); <route>
<from uri="direct:sign"/>
<to uri="pqc:sign?operation=sign"/>
<to uri="mock:sign"/>
<to uri="pqc:verify?operation=verify"/>
<to uri="mock:verify"/>
</route> - route:
from:
uri: direct:sign
steps:
- to:
uri: pqc:sign
parameters:
operation: sign
- to:
uri: mock:sign
- to:
uri: pqc:verify
parameters:
operation: verify
- to:
uri: mock:verify With the following beans registered in the Registry
@BindToRegistry("Keypair")
public KeyPair setKeyPair() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException {
KeyPairGenerator kpGen = KeyPairGenerator.getInstance(
PQCSignatureAlgorithms.MLDSA.getAlgorithm(),
PQCSignatureAlgorithms.MLDSA.getBcProvider("KeyPairGenerator"));
kpGen.initialize(PQCParameterSpecResolver.resolve("MLDSA", "ML-DSA-65"));
KeyPair kp = kpGen.generateKeyPair();
return kp;
}
@BindToRegistry("Signer")
public Signature getSigner() throws NoSuchAlgorithmException {
Signature mlDsa = Signature.getInstance(PQCSignatureAlgorithms.MLDSA.getAlgorithm(),
PQCSignatureAlgorithms.MLDSA.getBcProvider("Signature"));
return mlDsa;
} This could be done even without the Registry beans, by specifying the signatureAlgorithm parameter in the following way
-
Java
-
XML
-
YAML
from("direct:sign").to("pqc:sign?operation=sign&signatureAlgorithm=MLDSA").to("mock:sign")
.to("pqc:verify?operation=verify&signatureAlgorithm=MLDSA")
.to("mock:verify"); <route>
<from uri="direct:sign"/>
<to uri="pqc:sign?operation=sign&signatureAlgorithm=MLDSA"/>
<to uri="mock:sign"/>
<to uri="pqc:verify?operation=verify&signatureAlgorithm=MLDSA"/>
<to uri="mock:verify"/>
</route> - route:
from:
uri: direct:sign
steps:
- to:
uri: pqc:sign
parameters:
operation: sign
signatureAlgorithm: MLDSA
- to:
uri: mock:sign
- to:
uri: pqc:verify
parameters:
operation: verify
signatureAlgorithm: MLDSA
- to:
uri: mock:verify With this approach the component will use the class org.apache.camel.component.pqc.crypto.PQCDefaultMLDSAMaterial, which will create the Signature and KeyPair objects to be used.
The Spec used for the KeyPair will be, in this case, ML-DSA-65.
Other Signature Algorithms
All other signature algorithms follow the exact same route pattern shown above for ML-DSA. The only differences are the algorithm name, the bean registration parameters, and the default material class. Use the following reference table:
| Algorithm | signatureAlgorithm param | JCA Algorithm Name | Provider | Default Parameter Spec | Material Class |
|---|---|---|---|---|---|
SLH-DSA |
| SLH-DSA | BC | SLH-DSA-SHA2-128S |
|
LMS |
| LMS | BC | LMS-SHA256-N32-H5 / SHA256-N32-W1 (OTS) |
|
XMSS |
| XMSS | BCPQC | Tree height 10, SHA-256 |
|
XMSSMT |
| XMSSMT | BCPQC | XMSSMT-SHA2-20d2-256 |
|
HSS |
| LMS | BC | LMS-SHA256-N32-H5 / SHA256-N32-W2 (OTS), 2 levels |
|
Dilithium |
| ML-DSA | BC | ML-DSA-87 |
|
Falcon |
| Falcon | BCPQC | falcon_512 |
|
SPHINCS+ |
| SLH-DSA | BC | SLH-DSA-SHA2-128S |
|
To use any algorithm, set signatureAlgorithm in the URI (e.g., signatureAlgorithm=SLHDSA). Alternatively, register a KeyPair and Signature in the registry using the JCA Algorithm Name and Provider from the table above.
Key Encapsulation and Extraction
In Post Quantum Cryptography it has been introduced the concept of Key Encapsulation Algorithm.
In this context there are three entities to consider:
-
A key generation algorithm which generates a public key and a private key (a keypair).
-
An encapsulation algorithm which takes as input a public key, and outputs a shared secret value and an "encapsulation" (a ciphertext) of this secret value.
-
A decapsulation algorithm which takes as input the encapsulation and the private key, and outputs the shared secret value.
In the component we are supporting the three phases in generateSecretKeyEncapsulation, extractSecretKeyEncapsulation and extractSecretKeyFromEncapsulation
The KEM Algorithm supported are the following:
Standardized and implemented
-
ML-KEM
Experimental and non-standardized
-
BIKE
-
CMCE (deprecated: Classic McEliece is believed to be unsafe to use, and will be removed in a future release)
-
HQC
-
FRODO
-
SABER
-
NTRU
-
NTRULPRime
-
SNTRUPrime
-
Kyber
The component expects to find a KeyGenerator and a KeyPair in to the Camel Registry.
In case the KeyPair and the KeyGenerator Objects are not in the registry, it will provide two instances of the Objects with default implementation.
A KEM KeyGenerator, like the classical KeyAgreement of the hybrid KEM operations, keeps state from its init call until the call that returns the result, and is not thread-safe. When the producer creates the instance itself, it uses a new one for every exchange. A configured instance (a registry bean, which is autowired into every pqc endpoint, or the default material) is shared, so each operation holds its lock from init to the result and concurrent exchanges that use it run one at a time. Registering a KeyGenerator bean is optional: without one the producer creates its own from keyEncapsulationAlgorithm. |
This will be true for standardized algorithms and for experimental ones.
| To combine a classical key agreement (X25519, ECDH) with a PQC KEM (ML-KEM) for defense-in-depth, use the hybrid KEM operations described in Hybrid Cryptography. |
A possible flow of the operation could be the following:
ML-KEM Example
-
Java
-
XML
-
YAML
from("direct:encapsulate").to("pqc:keyenc?operation=generateSecretKeyEncapsulation&symmetricKeyAlgorithm=AES")
.to("mock:encapsulate")
.to("pqc:keyenc?operation=extractSecretKeyEncapsulation&symmetricKeyAlgorithm=AES").to("mock:extract"); <route>
<from uri="direct:encapsulate"/>
<to uri="pqc:keyenc?operation=generateSecretKeyEncapsulation&symmetricKeyAlgorithm=AES"/>
<to uri="mock:encapsulate"/>
<to uri="pqc:keyenc?operation=extractSecretKeyEncapsulation&symmetricKeyAlgorithm=AES"/>
<to uri="mock:extract"/>
</route> - route:
from:
uri: direct:encapsulate
steps:
- to:
uri: pqc:keyenc
parameters:
operation: generateSecretKeyEncapsulation
symmetricKeyAlgorithm: AES
- to:
uri: mock:encapsulate
- to:
uri: pqc:keyenc
parameters:
operation: extractSecretKeyEncapsulation
symmetricKeyAlgorithm: AES
- to:
uri: mock:extract With the following beans registered in the Registry
@BindToRegistry("Keypair")
public KeyPair setKeyPair() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException {
KeyPairGenerator kpg = KeyPairGenerator.getInstance(PQCKeyEncapsulationAlgorithms.MLKEM.getAlgorithm(),
PQCKeyEncapsulationAlgorithms.MLKEM.getBcProvider("KeyPairGenerator"));
kpg.initialize(PQCParameterSpecResolver.resolve("MLKEM", "ML-KEM-512"), new SecureRandom());
KeyPair kp = kpg.generateKeyPair();
return kp;
}
@BindToRegistry("KeyGenerator")
public KeyGenerator setKeyGenerator()
throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException {
KeyGenerator kg = KeyGenerator.getInstance(PQCKeyEncapsulationAlgorithms.MLKEM.getAlgorithm(),
PQCKeyEncapsulationAlgorithms.MLKEM.getBcProvider("KeyGenerator"));
return kg;
} This could be done even without the Registry beans, by specifying the symmetricKeyAlgorithm and keyEncapsulationAlgorithm parameters in the following way
-
Java
-
XML
-
YAML
from("direct:encapsulate").to(
"pqc:keyenc?operation=generateSecretKeyEncapsulation&symmetricKeyAlgorithm=AES&keyEncapsulationAlgorithm=MLKEM")
.to("mock:encapsulate")
.to("pqc:keyenc?operation=extractSecretKeyEncapsulation&symmetricKeyAlgorithm=AES&keyEncapsulationAlgorithm=MLKEM")
.to("mock:extract"); <route>
<from uri="direct:encapsulate"/>
<to uri="pqc:keyenc?operation=generateSecretKeyEncapsulation&symmetricKeyAlgorithm=AES&keyEncapsulationAlgorithm=MLKEM"/>
<to uri="mock:encapsulate"/>
<to uri="pqc:keyenc?operation=extractSecretKeyEncapsulation&symmetricKeyAlgorithm=AES&keyEncapsulationAlgorithm=MLKEM"/>
<to uri="mock:extract"/>
</route> - route:
from:
uri: direct:encapsulate
steps:
- to:
uri: pqc:keyenc
parameters:
operation: generateSecretKeyEncapsulation
symmetricKeyAlgorithm: AES
keyEncapsulationAlgorithm: MLKEM
- to:
uri: mock:encapsulate
- to:
uri: pqc:keyenc
parameters:
operation: extractSecretKeyEncapsulation
symmetricKeyAlgorithm: AES
keyEncapsulationAlgorithm: MLKEM
- to:
uri: mock:extract With this approach the component will use the class org.apache.camel.component.pqc.crypto.kem.PQCDefaultMLKEMMaterial, which will create the KeyGenerator and KeyPair objects to be used.
The Spec used for the KeyPair will be, in this case, ML-KEM-512.
Extract Secret Key from Encapsulation for downstream usage
Once you have the encapsulation you’re able to decapsulate the secret key by using private key.
All of this could be done to use the secret key coming from the encapsulation in the downstream route.
As example you could use the secret key to dynamically instruct the CryptoDataFormat to use it, like in the following route.
CryptoDataFormat cryptoFormat = new CryptoDataFormat("AES", null);
from("direct:encapsulate")
.to("pqc:keyenc?operation=generateSecretKeyEncapsulation&symmetricKeyAlgorithm=AES")
.to("mock:encapsulate")
.to("pqc:keyenc?operation=extractSecretKeyEncapsulation&symmetricKeyAlgorithm=AES")
.to("pqc:keyenc?operation=extractSecretKeyFromEncapsulation&symmetricKeyAlgorithm=AES")
.setHeader(CryptoDataFormat.KEY, body())
.setBody(constant("Hello"))
.marshal(cryptoFormat)
.log("Encrypted ${body}")
.to("mock:encrypted")
.unmarshal(cryptoFormat)
.log("Unencrypted ${body}")
.to("mock:unencrypted"); This could be used to generate a secret key, protect it through Encapsulation and KEM approach and re-use it once extracted.
| For a simplified approach to KEM-based encryption, consider using the PQC DataFormat which handles all KEM operations internally with a single marshal/unmarshal call. |