Monday, September 9, 2013

XML Encryption support in Apache Camel 2.12.0

Apache Camel supports using XML Encryption (and decryption) in your Camel routes via the XML Security Data Format. I have contributed some additions to this component for the recent 2.12.0 release that may be of interest to existing or new users.

1) Upgrade to Apache Santuario 1.5.5

The Apache Santuario (XML Security for Java) dependency has been upgraded from 1.5.1 to 1.5.5. In addition, "secure validation" is now enabled by default. This property imposes some restrictions on acceptable XML Encryption Elements to limit potential attacks (although it applies more to XML Signature). See here for more information.

2) Switch to using RSA-OAEP as the Asymmetric Key Cipher algorithm

From Apache Camel 2.12.0, the default Asymmetric Key Cipher algorithm is now the RSA-OAEP algorithm. Previously it was RSA v1.5, which is vulnerable to attack. In addition, requests that use RSA v1.5 will be rejected by default, unless RSA v1.5 has been explicitly configured as the key cipher algorithm.

3) Support for some XML Encryption 1.1 algorithms

Support has been added for some XML Encryption 1.1 algorithms. Essentially this means the following:
  • You can now use "" as the Key Cipher Algorithm.
  • You can specify a stronger value for the digest algorithm when using RSA-OAEP. For example, you can use "" instead of the default SHA-1 algorithm.
  • Support has been added for "gcm" symmetric cipher modes. For example, you can now set "" as the "xmlCipherAlgorithm" parameter.
  • Support has been added for MGF algorithms with stronger digest algorithms. For example, you can define "" for the "mgfAlgorithm" configuration parameter.