You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2020/11/11 08:06:12 UTC

[santuario-xml-security-java] branch master updated: Changing signature of XMLCipher.getInstance methods with Serializers to avoid conflict

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/santuario-xml-security-java.git


The following commit(s) were added to refs/heads/master by this push:
     new adf090f  Changing signature of XMLCipher.getInstance methods with Serializers to avoid conflict
adf090f is described below

commit adf090fa87fac1a7af672e46f52ee943b568080b
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Nov 11 07:52:57 2020 +0000

    Changing signature of XMLCipher.getInstance methods with Serializers to avoid conflict
---
 src/main/java/org/apache/xml/security/encryption/XMLCipher.java   | 8 ++++----
 .../xml/security/test/dom/encryption/SignedEncryptedTest.java     | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/xml/security/encryption/XMLCipher.java b/src/main/java/org/apache/xml/security/encryption/XMLCipher.java
index e0bacba..ebda4eb 100644
--- a/src/main/java/org/apache/xml/security/encryption/XMLCipher.java
+++ b/src/main/java/org/apache/xml/security/encryption/XMLCipher.java
@@ -436,12 +436,12 @@ public class XMLCipher {
      * encrypts the document.
      * <p>
      *
-     * @param transformation    the name of the transformation
      * @param serializer        A custom Serializer instance
+     * @param transformation    the name of the transformation
      * @return the XMLCipher
      * @throws XMLEncryptionException
      */
-    public static XMLCipher getInstance(String transformation, Serializer serializer) throws XMLEncryptionException {
+    public static XMLCipher getInstance(Serializer serializer, String transformation) throws XMLEncryptionException {
         LOG.debug("Getting XMLCipher with transformation");
         validateTransformation(transformation);
         return new XMLCipher(transformation, null, null, serializer);
@@ -564,15 +564,15 @@ public class XMLCipher {
      * the document with the specified Serializer before it encrypts the document.
      * <p>
      *
+     * @param serializer        A custom serializer instance to use
      * @param transformation    the name of the transformation
      * @param provider          the JCE provider that supplies the transformation
-     * @param serializer        A custom serializer instance to use
      * @param digestMethod      An optional digestMethod to use
      * @return the XMLCipher
      * @throws XMLEncryptionException
      */
     public static XMLCipher getProviderInstance(
-        String transformation, String provider, Serializer serializer, String digestMethod
+        Serializer serializer, String transformation, String provider, String digestMethod
     ) throws XMLEncryptionException {
         LOG.debug("Getting XMLCipher with transformation, provider and c14n algorithm");
         if (null == provider) {
diff --git a/src/test/java/org/apache/xml/security/test/dom/encryption/SignedEncryptedTest.java b/src/test/java/org/apache/xml/security/test/dom/encryption/SignedEncryptedTest.java
index e350648..53f07f6 100644
--- a/src/test/java/org/apache/xml/security/test/dom/encryption/SignedEncryptedTest.java
+++ b/src/test/java/org/apache/xml/security/test/dom/encryption/SignedEncryptedTest.java
@@ -145,13 +145,13 @@ public class SignedEncryptedTest {
 
         XMLCipher deCipher = null;
         if (useDocumentSerializer) {
-            deCipher = XMLCipher.getInstance(XMLCipher.AES_128, new DocumentSerializer(true));
+            deCipher = XMLCipher.getInstance(new DocumentSerializer(true), XMLCipher.AES_128);
         } else {
             TransformSerializer serializer = new TransformSerializer(true);
             Field f = serializer.getClass().getDeclaredField("transformerFactory");
             f.setAccessible(true);
             f.set(serializer, transformerFactory);
-            deCipher = XMLCipher.getInstance(XMLCipher.AES_128, serializer);
+            deCipher = XMLCipher.getInstance(serializer, XMLCipher.AES_128);
         }
         deCipher.init(XMLCipher.DECRYPT_MODE, secretKey);
         deCipher.doFinal(document, element, true);