This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.22.x by this push:
new 71393a746e9e [backport camel-4.22.x] CAMEL-24716: camel-xmlsecurity -
accept constant names as aliases for cipher algorithm URIs (#26486)
71393a746e9e is described below
commit 71393a746e9e26478cc5c8af96ba2adb3a88f107
Author: Guillaume Nodet - AI Bot <[email protected]>
AuthorDate: Mon Sep 21 16:01:37 2026 +0200
[backport camel-4.22.x] CAMEL-24716: camel-xmlsecurity - accept constant
names as aliases for cipher algorithm URIs (#26486)
* [backport camel-4.22.x] CAMEL-24716: camel-xmlsecurity - accept constant
names as aliases for cipher algorithm URIs
* fix: resolve algorithm names lazily at crypto call-sites, not eagerly in
setters
Resolving constant names (e.g. AES_256_GCM) to W3C URIs in setters caused
a serialization regression: the generated ModelWriter compares getters
against
the constant-name defaults (e.g. "AES_256_GCM") to decide whether to
suppress
the attribute. After eager resolution, getters always returned URIs, so the
equality check never matched and all four algorithm attributes were written
unconditionally, breaking round-trip serialization.
Fix: remove resolveAlgorithm() from the four setters so getters return what
was set. Add private resolvedXxx() helpers that apply resolveAlgorithm()
lazily
and use those helpers at every actual crypto call-site (marshal/unmarshal
path).
This is Option A from the review: resolve lazily at use-site.
* fix: remove stale getter assertions from test (lazy resolution backport)
In this backport the four algorithm setters are plain assignments;
resolution
from constant names to W3C URIs happens lazily at crypto call-sites via the
private resolvedXxx() helpers. The assertEquals(XMLCipher.XYZ,
df.getXyzAlgorithm()) assertions were copied from the main-branch test where
eager resolution was used, and they fail here because the getter returns the
original constant name (e.g. "AES_256_GCM"), not the URI.
Drop the getter assertions in favour of comments explaining the design.
The end-to-end encrypt/decrypt exercises at the bottom of each test method
already validate that lazy resolution works correctly at actual crypto
call-sites.
* nit: fix stray '+' literal in log messages
* fix: apply Spotless formatting (split long condition lines)
---------
Co-authored-by: gnodet-bot <[email protected]>
Co-authored-by: Guillaume Nodet <[email protected]>
Co-authored-by: gnodet <[email protected]>
---
.../camel/catalog/dataformats/xmlSecurity.json | 2 +-
.../apache/camel/catalog/models/xmlSecurity.json | 2 +-
.../apache/camel/catalog/schemas/camel-spring.xsd | 2 +-
.../apache/camel/catalog/schemas/camel-xml-io.xsd | 2 +-
.../camel/catalog/schemas/camelYamlDsl-model.json | 2 +-
.../camel/dataformat/xmlsecurity/xmlSecurity.json | 2 +-
.../xmlsecurity/XMLSecurityDataFormat.java | 139 ++++++++----
.../xmlsecurity/XmlSecurityConstantNameTest.java | 233 +++++++++++++++++++++
.../apache/camel/model/dataformat/xmlSecurity.json | 2 +-
.../model/dataformat/XMLSecurityDataFormat.java | 2 +-
.../apache/camel/java/out/JavaDslModelWriter.java | 2 +-
.../java/org/apache/camel/xml/out/ModelWriter.java | 2 +-
.../org/apache/camel/yaml/out/YamlModelWriter.java | 2 +-
.../dsl/yaml/deserializers/ModelDeserializers.java | 2 +-
.../resources/schema/camelYamlDsl-canonical.json | 2 +-
.../resources/schema/camelYamlDsl-model.json | 2 +-
.../generated/resources/schema/camelYamlDsl.json | 2 +-
17 files changed, 352 insertions(+), 50 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/xmlSecurity.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/xmlSecurity.json
index e0778cb58743..23229c87fc6c 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/xmlSecurity.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/xmlSecurity.json
@@ -17,7 +17,7 @@
},
"properties": {
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group":
"common", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
id of this node" },
- "xmlCipherAlgorithm": { "index": 1, "kind": "attribute", "displayName":
"Xml Cipher Algorithm", "group": "common", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "TRIPLEDES", "AES_128",
"AES_128_GCM", "AES_192", "AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128",
"CAMELLIA_128", "CAMELLIA_192", "CAMELLIA_256" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "AES-256-GCM",
"description": "The cipher algorithm to be used for en [...]
+ "xmlCipherAlgorithm": { "index": 1, "kind": "attribute", "displayName":
"Xml Cipher Algorithm", "group": "common", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "TRIPLEDES", "AES_128",
"AES_128_GCM", "AES_192", "AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128",
"CAMELLIA_128", "CAMELLIA_192", "CAMELLIA_256" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "AES_256_GCM",
"description": "The cipher algorithm to be used for en [...]
"passPhrase": { "index": 2, "kind": "attribute", "displayName": "Pass
Phrase", "group": "common", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A String used as passPhrase to encrypt\/decrypt content." },
"passPhraseByte": { "index": 3, "kind": "attribute", "displayName": "Pass
Phrase Byte", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "byte[]", "deprecated": false, "autowired":
false, "secret": false, "description": "A byte used as passPhrase to
encrypt\/decrypt content." },
"secureTag": { "index": 4, "kind": "attribute", "displayName": "Secure
Tag", "group": "common", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "The XPath reference to the XML Element selected for
encryption\/decryption. If no tag is specified, the entire payload is
encrypted\/decrypted." },
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/xmlSecurity.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/xmlSecurity.json
index 6ed63ef5b03f..1a4b815308f1 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/xmlSecurity.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/xmlSecurity.json
@@ -14,7 +14,7 @@
},
"properties": {
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group":
"common", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
id of this node" },
- "xmlCipherAlgorithm": { "index": 1, "kind": "attribute", "displayName":
"Xml Cipher Algorithm", "group": "common", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "TRIPLEDES", "AES_128",
"AES_128_GCM", "AES_192", "AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128",
"CAMELLIA_128", "CAMELLIA_192", "CAMELLIA_256" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "AES-256-GCM",
"description": "The cipher algorithm to be used for en [...]
+ "xmlCipherAlgorithm": { "index": 1, "kind": "attribute", "displayName":
"Xml Cipher Algorithm", "group": "common", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "TRIPLEDES", "AES_128",
"AES_128_GCM", "AES_192", "AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128",
"CAMELLIA_128", "CAMELLIA_192", "CAMELLIA_256" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "AES_256_GCM",
"description": "The cipher algorithm to be used for en [...]
"passPhrase": { "index": 2, "kind": "attribute", "displayName": "Pass
Phrase", "group": "common", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A String used as passPhrase to encrypt\/decrypt content." },
"passPhraseByte": { "index": 3, "kind": "attribute", "displayName": "Pass
Phrase Byte", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "byte[]", "deprecated": false, "autowired":
false, "secret": false, "description": "A byte used as passPhrase to
encrypt\/decrypt content." },
"secureTag": { "index": 4, "kind": "attribute", "displayName": "Secure
Tag", "group": "common", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "The XPath reference to the XML Element selected for
encryption\/decryption. If no tag is specified, the entire payload is
encrypted\/decrypted." },
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index c1b2dfa8424e..75fc05c4d209 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -10296,7 +10296,7 @@ The escape character. Default value: \
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-The cipher algorithm to be used for encryption/decryption of the XML message
content. Default value: AES-256-GCM
+The cipher algorithm to be used for encryption/decryption of the XML message
content. Default value: AES_256_GCM
]]>
</xs:documentation>
</xs:annotation>
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
index b4276303a0f2..860dd40a84c8 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
@@ -9418,7 +9418,7 @@ The escape character. Default value: \
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-The cipher algorithm to be used for encryption/decryption of the XML message
content. Default value: AES-256-GCM
+The cipher algorithm to be used for encryption/decryption of the XML message
content. Default value: AES_256_GCM
]]>
</xs:documentation>
</xs:annotation>
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
index 3c0a20d447df..8e31679beaad 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
@@ -13735,7 +13735,7 @@
"enum" : [ "TRIPLEDES", "AES_128", "AES_128_GCM", "AES_192",
"AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128", "CAMELLIA_128",
"CAMELLIA_192", "CAMELLIA_256" ],
"description" : "The cipher algorithm to be used for
encryption/decryption of the XML message content.",
"title" : "Xml Cipher Algorithm",
- "default" : "AES-256-GCM"
+ "default" : "AES_256_GCM"
} ]
},
"yAML" : {
diff --git
a/components/camel-xmlsecurity/src/generated/resources/META-INF/org/apache/camel/dataformat/xmlsecurity/xmlSecurity.json
b/components/camel-xmlsecurity/src/generated/resources/META-INF/org/apache/camel/dataformat/xmlsecurity/xmlSecurity.json
index e0778cb58743..23229c87fc6c 100644
---
a/components/camel-xmlsecurity/src/generated/resources/META-INF/org/apache/camel/dataformat/xmlsecurity/xmlSecurity.json
+++
b/components/camel-xmlsecurity/src/generated/resources/META-INF/org/apache/camel/dataformat/xmlsecurity/xmlSecurity.json
@@ -17,7 +17,7 @@
},
"properties": {
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group":
"common", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
id of this node" },
- "xmlCipherAlgorithm": { "index": 1, "kind": "attribute", "displayName":
"Xml Cipher Algorithm", "group": "common", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "TRIPLEDES", "AES_128",
"AES_128_GCM", "AES_192", "AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128",
"CAMELLIA_128", "CAMELLIA_192", "CAMELLIA_256" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "AES-256-GCM",
"description": "The cipher algorithm to be used for en [...]
+ "xmlCipherAlgorithm": { "index": 1, "kind": "attribute", "displayName":
"Xml Cipher Algorithm", "group": "common", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "TRIPLEDES", "AES_128",
"AES_128_GCM", "AES_192", "AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128",
"CAMELLIA_128", "CAMELLIA_192", "CAMELLIA_256" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "AES_256_GCM",
"description": "The cipher algorithm to be used for en [...]
"passPhrase": { "index": 2, "kind": "attribute", "displayName": "Pass
Phrase", "group": "common", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A String used as passPhrase to encrypt\/decrypt content." },
"passPhraseByte": { "index": 3, "kind": "attribute", "displayName": "Pass
Phrase Byte", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "byte[]", "deprecated": false, "autowired":
false, "secret": false, "description": "A byte used as passPhrase to
encrypt\/decrypt content." },
"secureTag": { "index": 4, "kind": "attribute", "displayName": "Secure
Tag", "group": "common", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "The XPath reference to the XML Element selected for
encryption\/decryption. If no tag is specified, the entire payload is
encrypted\/decrypted." },
diff --git
a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
index 89b5b739786b..d49891116b3e 100644
---
a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
+++
b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
@@ -73,6 +73,73 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
private static final Logger LOG =
LoggerFactory.getLogger(XMLSecurityDataFormat.class);
+ /**
+ * Maps the Java constant names exposed in the model (e.g. {@code
"AES_256_GCM"}, {@code "RSA_OAEP"},
+ * {@code "SHA1"}, {@code "MGF1_SHA1"}) to the W3C algorithm URIs expected
by {@link XMLCipher#getInstance(String)}.
+ * A value that is already a URI (i.e. not present in the map) is passed
through unchanged, so existing routes that
+ * use URIs directly continue to work.
+ */
+ private static final Map<String, String> ALGORITHM_NAME_TO_URI;
+
+ static {
+ ALGORITHM_NAME_TO_URI = Map.ofEntries(
+ // XMLCipher data-encryption algorithms
+ Map.entry("TRIPLEDES", XMLCipher.TRIPLEDES),
+ Map.entry("AES_128", XMLCipher.AES_128),
+ Map.entry("AES_128_GCM", XMLCipher.AES_128_GCM),
+ Map.entry("AES_192", XMLCipher.AES_192),
+ Map.entry("AES_192_GCM", XMLCipher.AES_192_GCM),
+ Map.entry("AES_256", XMLCipher.AES_256),
+ Map.entry("AES_256_GCM", XMLCipher.AES_256_GCM),
+ Map.entry("SEED_128", XMLCipher.SEED_128),
+ Map.entry("CAMELLIA_128", XMLCipher.CAMELLIA_128),
+ Map.entry("CAMELLIA_192", XMLCipher.CAMELLIA_192),
+ Map.entry("CAMELLIA_256", XMLCipher.CAMELLIA_256),
+ // XMLCipher key-encryption algorithms
+ Map.entry("RSA_v1dot5", XMLCipher.RSA_v1dot5),
+ Map.entry("RSA_OAEP", XMLCipher.RSA_OAEP),
+ Map.entry("RSA_OAEP_11", XMLCipher.RSA_OAEP_11),
+ // Digest algorithms (used with RSA-OAEP)
+ Map.entry("SHA1", XMLCipher.SHA1),
+ Map.entry("SHA256", XMLCipher.SHA256),
+ Map.entry("SHA512", XMLCipher.SHA512),
+ // MGF algorithms (used with RSA-OAEP)
+ Map.entry("MGF1_SHA1", EncryptionConstants.MGF1_SHA1),
+ Map.entry("MGF1_SHA256", EncryptionConstants.MGF1_SHA256),
+ Map.entry("MGF1_SHA512", EncryptionConstants.MGF1_SHA512));
+ }
+
+ /**
+ * Resolves a constant name (e.g. {@code "AES_256_GCM"}) to its W3C URI.
If the value is already a URI or
+ * {@code null}, it is returned unchanged.
+ */
+ static String resolveAlgorithm(String nameOrUri) {
+ if (nameOrUri == null) {
+ return null;
+ }
+ return ALGORITHM_NAME_TO_URI.getOrDefault(nameOrUri, nameOrUri);
+ }
+
+ /** Returns the resolved (W3C URI) form of {@link #xmlCipherAlgorithm} for
use in crypto operations. */
+ private String resolvedXmlCipherAlgorithm() {
+ return resolveAlgorithm(xmlCipherAlgorithm);
+ }
+
+ /** Returns the resolved (W3C URI) form of {@link #keyCipherAlgorithm} for
use in crypto operations. */
+ private String resolvedKeyCipherAlgorithm() {
+ return resolveAlgorithm(keyCipherAlgorithm);
+ }
+
+ /** Returns the resolved (W3C URI) form of {@link #digestAlgorithm} for
use in crypto operations. */
+ private String resolvedDigestAlgorithm() {
+ return resolveAlgorithm(digestAlgorithm);
+ }
+
+ /** Returns the resolved (W3C URI) form of {@link #mgfAlgorithm} for use
in crypto operations. */
+ private String resolvedMgfAlgorithm() {
+ return resolveAlgorithm(mgfAlgorithm);
+ }
+
private String xmlCipherAlgorithm;
private String keyCipherAlgorithm;
@@ -287,8 +354,9 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
Document document =
exchange.getContext().getTypeConverter().convertTo(Document.class, exchange,
is);
if (null != keyCipherAlgorithm
- && (keyCipherAlgorithm.equals(XMLCipher.RSA_v1dot5) ||
keyCipherAlgorithm.equals(XMLCipher.RSA_OAEP)
- || keyCipherAlgorithm.equals(XMLCipher.RSA_OAEP_11))) {
+ && (resolvedKeyCipherAlgorithm().equals(XMLCipher.RSA_v1dot5)
+ ||
resolvedKeyCipherAlgorithm().equals(XMLCipher.RSA_OAEP)
+ ||
resolvedKeyCipherAlgorithm().equals(XMLCipher.RSA_OAEP_11))) {
encryptAsymmetric(exchange, document, stream);
} else if (null != recipientKeyAlias) {
encryptAsymmetric(exchange, document, stream);
@@ -334,9 +402,9 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
XMLCipher keyCipher;
if (null != this.getKeyCipherAlgorithm()) {
- keyCipher = XMLCipher.getInstance(this.getKeyCipherAlgorithm(),
null, digestAlgorithm);
+ keyCipher = XMLCipher.getInstance(resolvedKeyCipherAlgorithm(),
null, resolvedDigestAlgorithm());
} else {
- keyCipher = XMLCipher.getInstance(XMLCipher.RSA_OAEP, null,
digestAlgorithm);
+ keyCipher = XMLCipher.getInstance(XMLCipher.RSA_OAEP, null,
resolvedDigestAlgorithm());
}
keyCipher.init(XMLCipher.WRAP_MODE, keyEncryptionKey);
@@ -353,13 +421,13 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
private void encryptSymmetric(Exchange exchange, Document document,
OutputStream stream) throws Exception {
SecretKey keyEncryptionKey;
SecretKey dataEncryptionKey;
- if (xmlCipherAlgorithm.equals(XMLCipher.TRIPLEDES)) {
+ if (resolvedXmlCipherAlgorithm().equals(XMLCipher.TRIPLEDES)) {
keyEncryptionKey = generateKeyEncryptionKey("DESede");
dataEncryptionKey = generateDataEncryptionKey();
- } else if (xmlCipherAlgorithm.equals(XMLCipher.SEED_128)) {
+ } else if (resolvedXmlCipherAlgorithm().equals(XMLCipher.SEED_128)) {
keyEncryptionKey = generateKeyEncryptionKey("SEED");
dataEncryptionKey = generateDataEncryptionKey();
- } else if (xmlCipherAlgorithm.contains("camellia")) {
+ } else if (resolvedXmlCipherAlgorithm().contains("camellia")) {
keyEncryptionKey = generateKeyEncryptionKey("CAMELLIA");
dataEncryptionKey = generateDataEncryptionKey();
} else {
@@ -416,7 +484,7 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
Exchange exchange, Document document, OutputStream stream, Key
dataEncryptionKey,
XMLCipher keyCipher, Key keyEncryptionKey)
throws Exception {
- XMLCipher xmlCipher = XMLCipher.getInstance(xmlCipherAlgorithm);
+ XMLCipher xmlCipher =
XMLCipher.getInstance(resolvedXmlCipherAlgorithm());
xmlCipher.init(XMLCipher.ENCRYPT_MODE, dataEncryptionKey);
if (secureTag.equalsIgnoreCase("")) {
@@ -464,8 +532,9 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
}
if (null != keyCipherAlgorithm
- && (keyCipherAlgorithm.equals(XMLCipher.RSA_v1dot5) ||
keyCipherAlgorithm.equals(XMLCipher.RSA_OAEP)
- || keyCipherAlgorithm.equals(XMLCipher.RSA_OAEP_11))) {
+ && (resolvedKeyCipherAlgorithm().equals(XMLCipher.RSA_v1dot5)
+ ||
resolvedKeyCipherAlgorithm().equals(XMLCipher.RSA_OAEP)
+ ||
resolvedKeyCipherAlgorithm().equals(XMLCipher.RSA_OAEP_11))) {
return decodeWithAsymmetricKey(exchange, encodedDocument);
} else {
LOG.debug("No (known) asymmetric keyCipherAlgorithm specified.
Attempting to "
@@ -476,7 +545,7 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
private Object decodeWithSymmetricKey(Exchange exchange, Document
encodedDocument) throws Exception {
SecretKey keyEncryptionKey;
- if (xmlCipherAlgorithm.equals(XMLCipher.TRIPLEDES)) {
+ if (resolvedXmlCipherAlgorithm().equals(XMLCipher.TRIPLEDES)) {
keyEncryptionKey = generateKeyEncryptionKey("DESede");
} else {
keyEncryptionKey = generateKeyEncryptionKey("AES");
@@ -630,23 +699,23 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
private SecretKey generateDataEncryptionKey() throws Exception {
KeyGenerator keyGenerator = null;
- if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.TRIPLEDES)) {
+ if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.TRIPLEDES)) {
keyGenerator = KeyGenerator.getInstance("DESede");
} else {
keyGenerator = KeyGenerator.getInstance("AES");
- if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_128)
- ||
xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_128_GCM)
- || xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.SEED_128)
- ||
xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.CAMELLIA_128)) {
+ if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_128)
+ ||
resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_128_GCM)
+ ||
resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.SEED_128)
+ ||
resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.CAMELLIA_128)) {
keyGenerator.init(128);
- } else if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_192)
- ||
xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_192_GCM)
- ||
xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.CAMELLIA_192)) {
+ } else if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_192)
+ ||
resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_192_GCM)
+ ||
resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.CAMELLIA_192)) {
keyGenerator.init(192);
- } else if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_256)
- ||
xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_256_GCM)
- ||
xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.CAMELLIA_256)) {
+ } else if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_256)
+ ||
resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_256_GCM)
+ ||
resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.CAMELLIA_256)) {
keyGenerator.init(256);
}
}
@@ -659,7 +728,7 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
Key keyEncryptionKey)
throws XMLEncryptionException {
- EncryptedKey encryptedKey = keyCipher.encryptKey(document,
dataEncryptionkey, mgfAlgorithm, null);
+ EncryptedKey encryptedKey = keyCipher.encryptKey(document,
dataEncryptionkey, resolvedMgfAlgorithm(), null);
if (addKeyValueForEncryptedKey && keyEncryptionKey instanceof
PublicKey) {
KeyInfo keyInfo = new KeyInfo(document);
keyInfo.add((PublicKey) keyEncryptionKey);
@@ -674,24 +743,24 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
private String generateXmlCipherAlgorithmKeyWrap() {
String algorithmKeyWrap = null;
- if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.TRIPLEDES)) {
+ if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.TRIPLEDES)) {
algorithmKeyWrap = XMLCipher.TRIPLEDES_KeyWrap;
- } else if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_128)
- || xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_128_GCM))
{
+ } else if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_128)
+ ||
resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_128_GCM)) {
algorithmKeyWrap = XMLCipher.AES_128_KeyWrap;
- } else if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_192)
- || xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_192_GCM))
{
+ } else if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_192)
+ ||
resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_192_GCM)) {
algorithmKeyWrap = XMLCipher.AES_192_KeyWrap;
- } else if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_256)
- || xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.AES_256_GCM))
{
+ } else if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_256)
+ ||
resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.AES_256_GCM)) {
algorithmKeyWrap = XMLCipher.AES_256_KeyWrap;
- } else if (xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.SEED_128)) {
+ } else if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.SEED_128)) {
algorithmKeyWrap = XMLCipher.SEED_128_KeyWrap;
- } else if
(xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.CAMELLIA_128)) {
+ } else if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.CAMELLIA_128)) {
algorithmKeyWrap = XMLCipher.CAMELLIA_128_KeyWrap;
- } else if
(xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.CAMELLIA_192)) {
+ } else if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.CAMELLIA_192)) {
algorithmKeyWrap = XMLCipher.CAMELLIA_192_KeyWrap;
- } else if
(xmlCipherAlgorithm.equalsIgnoreCase(XMLCipher.CAMELLIA_256)) {
+ } else if
(resolvedXmlCipherAlgorithm().equalsIgnoreCase(XMLCipher.CAMELLIA_256)) {
algorithmKeyWrap = XMLCipher.CAMELLIA_256_KeyWrap;
}
@@ -700,7 +769,7 @@ public class XMLSecurityDataFormat extends ServiceSupport
implements DataFormat,
// Check to see if the asymmetric key transport algorithm is allowed
private void checkEncryptionAlgorithm(Key keyEncryptionKey, Element
parentElement) throws Exception {
- if (XMLCipher.RSA_v1dot5.equals(keyCipherAlgorithm)
+ if (XMLCipher.RSA_v1dot5.equals(resolvedKeyCipherAlgorithm())
|| keyCipherAlgorithm == null
|| !(keyEncryptionKey instanceof PrivateKey)) {
// This only applies for Asymmetric Encryption
diff --git
a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XmlSecurityConstantNameTest.java
b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XmlSecurityConstantNameTest.java
new file mode 100644
index 000000000000..412c8ee5e27a
--- /dev/null
+++
b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XmlSecurityConstantNameTest.java
@@ -0,0 +1,233 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.xmlsecurity;
+
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.converter.jaxp.XmlConverter;
+import org.apache.camel.support.jsse.KeyStoreParameters;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.apache.xml.security.encryption.XMLCipher;
+import org.apache.xml.security.utils.EncryptionConstants;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * Verifies that the Java constant names exposed by the model's {@code
@Metadata(enums=...)} annotations (e.g.
+ * {@code "AES_256_GCM"}, {@code "RSA_OAEP"}, {@code "SHA256"}, {@code
"MGF1_SHA256"}) are accepted by
+ * {@link XMLSecurityDataFormat} at runtime as aliases for the corresponding
W3C URIs.
+ *
+ * <p>
+ * Before the fix, passing a constant name to {@link
XMLSecurityDataFormat#setXmlCipherAlgorithm(String)} would store it
+ * verbatim and then cause {@code XMLCipher.getInstance("AES_256_GCM")} to
throw
+ * {@code XMLEncryptionException: Null or empty transformation}, because
XMLCipher only understands URIs.
+ */
+class XmlSecurityConstantNameTest extends CamelTestSupport {
+
+ TestHelper xmlsecTestHelper = new TestHelper();
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Override
+ public void doPostSetup() {
+ context.getGlobalOptions().put(XmlConverter.OUTPUT_PROPERTIES_PREFIX +
javax.xml.transform.OutputKeys.ENCODING,
+ "UTF-8");
+ }
+
+ // -- resolveAlgorithm unit tests
-------------------------------------------------------
+
+ @Test
+ void resolveAlgorithmReturnsMappedUri() {
+ assertEquals(XMLCipher.AES_256_GCM,
XMLSecurityDataFormat.resolveAlgorithm("AES_256_GCM"));
+ assertEquals(XMLCipher.AES_128_GCM,
XMLSecurityDataFormat.resolveAlgorithm("AES_128_GCM"));
+ assertEquals(XMLCipher.AES_128,
XMLSecurityDataFormat.resolveAlgorithm("AES_128"));
+ assertEquals(XMLCipher.AES_192,
XMLSecurityDataFormat.resolveAlgorithm("AES_192"));
+ assertEquals(XMLCipher.TRIPLEDES,
XMLSecurityDataFormat.resolveAlgorithm("TRIPLEDES"));
+ assertEquals(XMLCipher.SEED_128,
XMLSecurityDataFormat.resolveAlgorithm("SEED_128"));
+ assertEquals(XMLCipher.CAMELLIA_128,
XMLSecurityDataFormat.resolveAlgorithm("CAMELLIA_128"));
+ assertEquals(XMLCipher.RSA_v1dot5,
XMLSecurityDataFormat.resolveAlgorithm("RSA_v1dot5"));
+ assertEquals(XMLCipher.RSA_OAEP,
XMLSecurityDataFormat.resolveAlgorithm("RSA_OAEP"));
+ assertEquals(XMLCipher.RSA_OAEP_11,
XMLSecurityDataFormat.resolveAlgorithm("RSA_OAEP_11"));
+ assertEquals(XMLCipher.SHA1,
XMLSecurityDataFormat.resolveAlgorithm("SHA1"));
+ assertEquals(XMLCipher.SHA256,
XMLSecurityDataFormat.resolveAlgorithm("SHA256"));
+ assertEquals(XMLCipher.SHA512,
XMLSecurityDataFormat.resolveAlgorithm("SHA512"));
+ assertEquals(EncryptionConstants.MGF1_SHA1,
XMLSecurityDataFormat.resolveAlgorithm("MGF1_SHA1"));
+ assertEquals(EncryptionConstants.MGF1_SHA256,
XMLSecurityDataFormat.resolveAlgorithm("MGF1_SHA256"));
+ assertEquals(EncryptionConstants.MGF1_SHA512,
XMLSecurityDataFormat.resolveAlgorithm("MGF1_SHA512"));
+ }
+
+ @Test
+ void resolveAlgorithmPassesThroughUri() {
+ // raw W3C URIs must pass through unchanged so existing routes keep
working
+ assertEquals(XMLCipher.AES_256_GCM,
XMLSecurityDataFormat.resolveAlgorithm(XMLCipher.AES_256_GCM));
+ assertEquals(XMLCipher.RSA_OAEP,
XMLSecurityDataFormat.resolveAlgorithm(XMLCipher.RSA_OAEP));
+ assertEquals(XMLCipher.SHA256,
XMLSecurityDataFormat.resolveAlgorithm(XMLCipher.SHA256));
+ }
+
+ @Test
+ void resolveAlgorithmHandlesNull() {
+ assertEquals(null, XMLSecurityDataFormat.resolveAlgorithm(null));
+ }
+
+ // -- end-to-end encrypt/decrypt tests using constant names
----------------------------
+
+ /**
+ * Symmetric AES-256-GCM using the constant name "AES_256_GCM" (the YAML
DSL schema value).
+ */
+ @Test
+ void testAES256GCMByConstantName() throws Exception {
+ KeyGenerator keygen = KeyGenerator.getInstance("AES");
+ keygen.init(256);
+ SecretKey key = keygen.generateKey();
+
+ XMLSecurityDataFormat df = new XMLSecurityDataFormat();
+ df.setPassPhrase(key.getEncoded());
+ df.setSecureTagContents(true);
+ df.setSecureTag("//cheesesites/italy/cheese");
+ // Use the constant name, not the URI
+ df.setXmlCipherAlgorithm("AES_256_GCM");
+ // In this backport the setter is a plain assignment; resolution
happens lazily at crypto
+ // call-sites via the private resolvedXxx() helpers. The
encrypt/decrypt at the end of
+ // this method is the real functional validation.
+
+ context.addRoutes(new RouteBuilder() {
+ public void configure() {
+ from("direct:start")
+ .marshal(df).to("mock:encrypted")
+ .log("Body: ${body}")
+ .unmarshal(df).to("mock:decrypted");
+ }
+ });
+ xmlsecTestHelper.testDecryption(context);
+ }
+
+ /**
+ * Symmetric AES-128 using the constant name "AES_128".
+ */
+ @Test
+ void testAES128ByConstantName() throws Exception {
+ KeyGenerator keygen = KeyGenerator.getInstance("AES");
+ keygen.init(128);
+ SecretKey key = keygen.generateKey();
+
+ XMLSecurityDataFormat df = new XMLSecurityDataFormat();
+ df.setPassPhrase(key.getEncoded());
+ df.setSecureTagContents(true);
+ df.setSecureTag("//cheesesites/italy/cheese");
+ df.setXmlCipherAlgorithm("AES_128");
+ // Lazy resolution — getter returns the constant name; functional
validation is below.
+
+ context.addRoutes(new RouteBuilder() {
+ public void configure() {
+ from("direct:start")
+ .marshal(df).to("mock:encrypted")
+ .log("Body: ${body}")
+ .unmarshal(df).to("mock:decrypted");
+ }
+ });
+ xmlsecTestHelper.testDecryption(context);
+ }
+
+ /**
+ * Asymmetric RSA-OAEP using the constant names "RSA_OAEP" and "AES_128".
+ */
+ @Test
+ void testRSAOAEPByConstantName() throws Exception {
+ XMLSecurityDataFormat sendingDataFormat = new XMLSecurityDataFormat();
+ sendingDataFormat.setSecureTagContents(true);
+ sendingDataFormat.setSecureTag("//cheesesites/italy/cheese");
+ sendingDataFormat.setXmlCipherAlgorithm("AES_128"); // constant
name
+ sendingDataFormat.setKeyCipherAlgorithm("RSA_OAEP"); // constant
name
+ sendingDataFormat.setRecipientKeyAlias("recipient");
+ // Lazy resolution — getters return constant names; functional
validation is the encrypt/decrypt below.
+
+ KeyStoreParameters tsParameters = new KeyStoreParameters();
+ tsParameters.setPassword("password");
+ tsParameters.setResource("sender.truststore");
+ sendingDataFormat.setKeyOrTrustStoreParameters(tsParameters);
+
+ XMLSecurityDataFormat receivingDataFormat = new
XMLSecurityDataFormat();
+ receivingDataFormat.setKeyCipherAlgorithm("RSA_OAEP"); // constant
name
+ receivingDataFormat.setRecipientKeyAlias("recipient");
+ receivingDataFormat.setSecureTag("//cheesesites/italy/cheese");
+ // Lazy resolution — getter returns constant name; functional
validation is the encrypt/decrypt below.
+
+ KeyStoreParameters ksParameters = new KeyStoreParameters();
+ ksParameters.setPassword("password");
+ ksParameters.setResource("recipient.keystore");
+ receivingDataFormat.setKeyOrTrustStoreParameters(ksParameters);
+
+ context.addRoutes(new RouteBuilder() {
+ public void configure() {
+ from("direct:start")
+ .marshal(sendingDataFormat).to("mock:encrypted")
+ .log("Body: ${body}")
+ .unmarshal(receivingDataFormat).to("mock:decrypted");
+ }
+ });
+ xmlsecTestHelper.testDecryption(context);
+ }
+
+ /**
+ * Asymmetric RSA-OAEP-11 with SHA-256 digest and MGF1-SHA-256, all
specified as constant names.
+ */
+ @Test
+ void testRSAOAEP11WithDigestAndMGFByConstantName() throws Exception {
+ XMLSecurityDataFormat sendingDataFormat = new XMLSecurityDataFormat();
+ sendingDataFormat.setSecureTagContents(true);
+ sendingDataFormat.setSecureTag("//cheesesites/italy/cheese");
+ sendingDataFormat.setXmlCipherAlgorithm("AES_128"); // constant
name
+ sendingDataFormat.setKeyCipherAlgorithm("RSA_OAEP_11"); // constant
name
+ sendingDataFormat.setDigestAlgorithm("SHA256"); // constant
name
+ sendingDataFormat.setMgfAlgorithm("MGF1_SHA256"); // constant
name
+ sendingDataFormat.setRecipientKeyAlias("recipient");
+ // Lazy resolution — getters return constant names; functional
validation is the encrypt/decrypt below.
+
+ KeyStoreParameters tsParameters = new KeyStoreParameters();
+ tsParameters.setPassword("password");
+ tsParameters.setResource("sender.truststore");
+ sendingDataFormat.setKeyOrTrustStoreParameters(tsParameters);
+
+ XMLSecurityDataFormat receivingDataFormat = new
XMLSecurityDataFormat();
+ receivingDataFormat.setKeyCipherAlgorithm("RSA_OAEP_11");
+ receivingDataFormat.setDigestAlgorithm("SHA256");
+ receivingDataFormat.setMgfAlgorithm("MGF1_SHA256");
+ receivingDataFormat.setRecipientKeyAlias("recipient");
+ receivingDataFormat.setSecureTag("//cheesesites/italy/cheese");
+
+ KeyStoreParameters ksParameters = new KeyStoreParameters();
+ ksParameters.setPassword("password");
+ ksParameters.setResource("recipient.keystore");
+ receivingDataFormat.setKeyOrTrustStoreParameters(ksParameters);
+
+ context.addRoutes(new RouteBuilder() {
+ public void configure() {
+ from("direct:start")
+ .marshal(sendingDataFormat).to("mock:encrypted")
+ .log("Body: ${body}")
+ .unmarshal(receivingDataFormat).to("mock:decrypted");
+ }
+ });
+ xmlsecTestHelper.testDecryption(context);
+ }
+}
diff --git
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/xmlSecurity.json
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/xmlSecurity.json
index 6ed63ef5b03f..1a4b815308f1 100644
---
a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/xmlSecurity.json
+++
b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/xmlSecurity.json
@@ -14,7 +14,7 @@
},
"properties": {
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group":
"common", "required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "description": "The
id of this node" },
- "xmlCipherAlgorithm": { "index": 1, "kind": "attribute", "displayName":
"Xml Cipher Algorithm", "group": "common", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "TRIPLEDES", "AES_128",
"AES_128_GCM", "AES_192", "AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128",
"CAMELLIA_128", "CAMELLIA_192", "CAMELLIA_256" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "AES-256-GCM",
"description": "The cipher algorithm to be used for en [...]
+ "xmlCipherAlgorithm": { "index": 1, "kind": "attribute", "displayName":
"Xml Cipher Algorithm", "group": "common", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "TRIPLEDES", "AES_128",
"AES_128_GCM", "AES_192", "AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128",
"CAMELLIA_128", "CAMELLIA_192", "CAMELLIA_256" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "AES_256_GCM",
"description": "The cipher algorithm to be used for en [...]
"passPhrase": { "index": 2, "kind": "attribute", "displayName": "Pass
Phrase", "group": "common", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "A String used as passPhrase to encrypt\/decrypt content." },
"passPhraseByte": { "index": 3, "kind": "attribute", "displayName": "Pass
Phrase Byte", "group": "advanced", "label": "advanced", "required": false,
"type": "string", "javaType": "byte[]", "deprecated": false, "autowired":
false, "secret": false, "description": "A byte used as passPhrase to
encrypt\/decrypt content." },
"secureTag": { "index": 4, "kind": "attribute", "displayName": "Secure
Tag", "group": "common", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "The XPath reference to the XML Element selected for
encryption\/decryption. If no tag is specified, the entire payload is
encrypted\/decrypted." },
diff --git
a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
index 41d1fadfe306..a46a176d1860 100644
---
a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
+++
b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
@@ -47,7 +47,7 @@ public class XMLSecurityDataFormat extends
DataFormatDefinition implements Names
private Map<String, String> namespaces;
@XmlAttribute
- @Metadata(defaultValue = "AES-256-GCM",
+ @Metadata(defaultValue = "AES_256_GCM",
enums =
"TRIPLEDES,AES_128,AES_128_GCM,AES_192,AES_192_GCM,AES_256,AES_256_GCM,SEED_128,CAMELLIA_128,CAMELLIA_192,CAMELLIA_256",
description = "The cipher algorithm to be used for
encryption/decryption of the XML message content.")
private String xmlCipherAlgorithm;
diff --git
a/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
b/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
index a28dd656ffda..aa86751550ed 100644
---
a/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
+++
b/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
@@ -3331,7 +3331,7 @@ public class JavaDslModelWriter extends
JavaDslModelWriterSupport {
protected void doWriteXMLSecurityDataFormat(StringBuilder sb,
XMLSecurityDataFormat def) {
doWriteIdentifiedTypeAttributes(sb, def);
doWriteAttribute(sb, "namespace", def.getNamespaceRef(), null);
- doWriteAttribute(sb, "xmlCipherAlgorithm",
def.getXmlCipherAlgorithm(), "AES-256-GCM");
+ doWriteAttribute(sb, "xmlCipherAlgorithm",
def.getXmlCipherAlgorithm(), "AES_256_GCM");
doWriteAttribute(sb, "passPhrase", def.getPassPhrase(), null);
doWriteAttribute(sb, "passPhraseByte",
toString(def.getPassPhraseByte()), null);
doWriteAttribute(sb, "secureTag", def.getSecureTag(), null);
diff --git
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index 8001700b045e..040cacfecdad 100644
---
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -2742,7 +2742,7 @@ public class ModelWriter extends BaseWriter {
startElement(name);
doWriteIdentifiedTypeAttributes(def);
doWriteAttribute("namespace", def.getNamespaceRef(), null);
- doWriteAttribute("xmlCipherAlgorithm", def.getXmlCipherAlgorithm(),
"AES-256-GCM");
+ doWriteAttribute("xmlCipherAlgorithm", def.getXmlCipherAlgorithm(),
"AES_256_GCM");
doWriteAttribute("passPhrase", def.getPassPhrase(), null);
doWriteAttribute("passPhraseByte", toString(def.getPassPhraseByte()),
null);
doWriteAttribute("secureTag", def.getSecureTag(), null);
diff --git
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
index c7a7a1fe772e..c7aef4342955 100644
---
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
+++
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
@@ -2740,7 +2740,7 @@ public class YamlModelWriter extends
YamlModelWriterSupport {
JsonObject jo = new JsonObject();
doWriteIdentifiedTypeAttributes(jo, def);
doWriteAttribute(jo, "namespace", def.getNamespaceRef(), null);
- doWriteAttribute(jo, "xmlCipherAlgorithm",
def.getXmlCipherAlgorithm(), "AES-256-GCM");
+ doWriteAttribute(jo, "xmlCipherAlgorithm",
def.getXmlCipherAlgorithm(), "AES_256_GCM");
doWriteAttribute(jo, "passPhrase", def.getPassPhrase(), null);
doWriteAttribute(jo, "passPhraseByte",
toString(def.getPassPhraseByte()), null);
doWriteAttribute(jo, "secureTag", def.getSecureTag(), null);
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index 284797ce4880..7e49e693e2fc 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -20687,7 +20687,7 @@ public final class ModelDeserializers extends
YamlDeserializerSupport {
@YamlProperty(name = "recipientKeyAlias", type = "string",
description = "The key alias to be used when retrieving the recipient's public
or private key from a KeyStore when performing asymmetric key encryption or
decryption.", displayName = "Recipient Key Alias"),
@YamlProperty(name = "secureTag", type = "string",
description = "The XPath reference to the XML Element selected for
encryption/decryption. If no tag is specified, the entire payload is
encrypted/decrypted.", displayName = "Secure Tag"),
@YamlProperty(name = "secureTagContents", type =
"boolean", defaultValue = "false", description = "A boolean value to specify
whether the XML Element is to be encrypted or the contents of the XML Element.
false = Element Level, true = Element Content Level.", displayName = "Secure
Tag Contents"),
- @YamlProperty(name = "xmlCipherAlgorithm", type =
"enum:TRIPLEDES,AES_128,AES_128_GCM,AES_192,AES_192_GCM,AES_256,AES_256_GCM,SEED_128,CAMELLIA_128,CAMELLIA_192,CAMELLIA_256",
defaultValue = "AES-256-GCM", description = "The cipher algorithm to be used
for encryption/decryption of the XML message content.", displayName = "Xml
Cipher Algorithm")
+ @YamlProperty(name = "xmlCipherAlgorithm", type =
"enum:TRIPLEDES,AES_128,AES_128_GCM,AES_192,AES_192_GCM,AES_256,AES_256_GCM,SEED_128,CAMELLIA_128,CAMELLIA_192,CAMELLIA_256",
defaultValue = "AES_256_GCM", description = "The cipher algorithm to be used
for encryption/decryption of the XML message content.", displayName = "Xml
Cipher Algorithm")
}
)
public static class XMLSecurityDataFormatDeserializer extends
YamlDeserializerBase<XMLSecurityDataFormat> {
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
index 10e5cd32ecfd..d695eeef6ea7 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
@@ -8933,7 +8933,7 @@
"type" : "string",
"title" : "Xml Cipher Algorithm",
"description" : "The cipher algorithm to be used for
encryption/decryption of the XML message content.",
- "default" : "AES-256-GCM",
+ "default" : "AES_256_GCM",
"enum" : [ "TRIPLEDES", "AES_128", "AES_128_GCM", "AES_192",
"AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128", "CAMELLIA_128",
"CAMELLIA_192", "CAMELLIA_256" ]
}
}
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
index 3c0a20d447df..8e31679beaad 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
@@ -13735,7 +13735,7 @@
"enum" : [ "TRIPLEDES", "AES_128", "AES_128_GCM", "AES_192",
"AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128", "CAMELLIA_128",
"CAMELLIA_192", "CAMELLIA_256" ],
"description" : "The cipher algorithm to be used for
encryption/decryption of the XML message content.",
"title" : "Xml Cipher Algorithm",
- "default" : "AES-256-GCM"
+ "default" : "AES_256_GCM"
} ]
},
"yAML" : {
diff --git
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index 507fb684b93c..713ecdef4a8d 100644
---
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
+++
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
@@ -12363,7 +12363,7 @@
"type" : "string",
"title" : "Xml Cipher Algorithm",
"description" : "The cipher algorithm to be used for
encryption/decryption of the XML message content.",
- "default" : "AES-256-GCM",
+ "default" : "AES_256_GCM",
"enum" : [ "TRIPLEDES", "AES_128", "AES_128_GCM", "AES_192",
"AES_192_GCM", "AES_256", "AES_256_GCM", "SEED_128", "CAMELLIA_128",
"CAMELLIA_192", "CAMELLIA_256" ]
}
}