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 2023/07/18 09:30:09 UTC

[santuario-xml-security-java] branch 2.3.x-fixes updated (ec946928 -> 948883f8)

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

coheigea pushed a change to branch 2.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/santuario-xml-security-java.git


    from ec946928 Updating BouncyCastle to 1.75
     new b62255b9 Enabled checking for missing @Override annotation (#187)
     new 7ccbd19a Using correct class to access static members (#188)
     new 96dc9646 Updated ComparableType class (#190)
     new 948883f8 Added javadoc to XMLParser and notice about not closing the input stream in JavaUtils (#189)

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/codeql/santuario.qls                        |  2 --
 .../org/apache/xml/security/parser/XMLParser.java   |  9 +++++++++
 .../xml/security/stax/config/XIncludeHandler.java   |  2 +-
 .../xml/security/stax/ext/ComparableType.java       | 10 +++++++---
 .../xml/security/stax/ext/OutboundXMLSec.java       |  6 +++---
 .../xml/security/stax/ext/XMLSecurityUtils.java     | 21 +++++++++++----------
 .../impl/algorithms/SignatureAlgorithmFactory.java  |  8 ++++----
 .../input/AbstractDecryptInputProcessor.java        |  8 ++++----
 ...tractSignatureReferenceVerifyInputProcessor.java |  6 +++---
 .../input/XMLEncryptedKeyInputHandler.java          | 14 +++++++-------
 .../processor/output/XMLEncryptOutputProcessor.java |  8 ++++----
 .../org/apache/xml/security/utils/JavaUtils.java    |  2 +-
 12 files changed, 54 insertions(+), 42 deletions(-)


[santuario-xml-security-java] 03/04: Updated ComparableType class (#190)

Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 96dc96468c8e967d303041f582f95a3246b0c08b
Author: David Matějček <da...@omnifish.ee>
AuthorDate: Tue Jul 18 11:01:48 2023 +0200

    Updated ComparableType class (#190)
    
    - Concrete generics
    - added javadoc
    - added null-check
    
    Signed-off-by: David Matějček <da...@omnifish.ee>
---
 .../java/org/apache/xml/security/stax/ext/ComparableType.java  | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/xml/security/stax/ext/ComparableType.java b/src/main/java/org/apache/xml/security/stax/ext/ComparableType.java
index f23a49dd..e45f67c7 100644
--- a/src/main/java/org/apache/xml/security/stax/ext/ComparableType.java
+++ b/src/main/java/org/apache/xml/security/stax/ext/ComparableType.java
@@ -18,15 +18,19 @@
  */
 package org.apache.xml.security.stax.ext;
 
+import java.util.Objects;
 
 /**
+ * Two comparable types are compared by their name.
+ *
+ * @param <T> Compatible class type.
 */
-public abstract class ComparableType<T extends ComparableType> implements Comparable<T> {
+public abstract class ComparableType<T extends ComparableType<T>> implements Comparable<T> {
 
-    private String name;
+    private final String name;
 
     public ComparableType(String name) {
-        this.name = name;
+        this.name = Objects.requireNonNull(name, "name");
     }
 
     public String getName() {


[santuario-xml-security-java] 02/04: Using correct class to access static members (#188)

Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7ccbd19a17b92a7f23c2bfbb06a091b06b0403d6
Author: David Matějček <da...@omnifish.ee>
AuthorDate: Tue Jul 18 09:12:28 2023 +0200

    Using correct class to access static members (#188)
    
    - Members were accessed using classes extending the real member owner
    - Eclipse cleanup
    
    Signed-off-by: David Matějček <da...@omnifish.ee>
---
 .../xml/security/stax/config/XIncludeHandler.java   |  2 +-
 .../xml/security/stax/ext/OutboundXMLSec.java       |  6 +++---
 .../xml/security/stax/ext/XMLSecurityUtils.java     | 21 +++++++++++----------
 .../impl/algorithms/SignatureAlgorithmFactory.java  |  8 ++++----
 .../input/AbstractDecryptInputProcessor.java        |  8 ++++----
 ...tractSignatureReferenceVerifyInputProcessor.java |  6 +++---
 .../input/XMLEncryptedKeyInputHandler.java          | 14 +++++++-------
 .../processor/output/XMLEncryptOutputProcessor.java |  8 ++++----
 8 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/src/main/java/org/apache/xml/security/stax/config/XIncludeHandler.java b/src/main/java/org/apache/xml/security/stax/config/XIncludeHandler.java
index 7c6fdbe2..348dc008 100644
--- a/src/main/java/org/apache/xml/security/stax/config/XIncludeHandler.java
+++ b/src/main/java/org/apache/xml/security/stax/config/XIncludeHandler.java
@@ -156,7 +156,7 @@ public class XIncludeHandler extends DefaultHandler {
                 DOMResult domResult = new DOMResult();
                 try {
                     XMLReader xmlReader = XMLReaderFactory.createXMLReader();
-                    SAXTransformerFactory saxTransformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+                    SAXTransformerFactory saxTransformerFactory = (SAXTransformerFactory) TransformerFactory.newInstance();
                     saxTransformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
                     try {
                         saxTransformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
diff --git a/src/main/java/org/apache/xml/security/stax/ext/OutboundXMLSec.java b/src/main/java/org/apache/xml/security/stax/ext/OutboundXMLSec.java
index d7392a93..05bdd11b 100644
--- a/src/main/java/org/apache/xml/security/stax/ext/OutboundXMLSec.java
+++ b/src/main/java/org/apache/xml/security/stax/ext/OutboundXMLSec.java
@@ -29,8 +29,8 @@ import java.util.List;
 import javax.crypto.KeyGenerator;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.xml.security.algorithms.JCEMapper;
 import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.config.JCEAlgorithmMapper;
 import org.apache.xml.security.stax.impl.DocumentContextImpl;
 import org.apache.xml.security.stax.impl.OutboundSecurityContextImpl;
 import org.apache.xml.security.stax.impl.OutputProcessorChainImpl;
@@ -245,7 +245,7 @@ public class OutboundXMLSec {
             }
             // If none is configured then generate one
             String keyAlgorithm =
-                JCEAlgorithmMapper.getJCEKeyAlgorithmFromURI(securityProperties.getEncryptionSymAlgorithm());
+                JCEMapper.getJCEKeyAlgorithmFromURI(securityProperties.getEncryptionSymAlgorithm());
             KeyGenerator keyGen;
             try {
                 keyGen = KeyGenerator.getInstance(keyAlgorithm);
@@ -256,7 +256,7 @@ public class OutboundXMLSec {
             //whereas bouncy castle expects the block size of 128 or 192 bits
             if (keyAlgorithm.contains("AES")) {
                 int keyLength =
-                    JCEAlgorithmMapper.getKeyLengthFromURI(securityProperties.getEncryptionSymAlgorithm());
+                    JCEMapper.getKeyLengthFromURI(securityProperties.getEncryptionSymAlgorithm());
                 keyGen.init(keyLength);
             }
 
diff --git a/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityUtils.java b/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityUtils.java
index 0836c850..ec8a7db0 100644
--- a/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityUtils.java
+++ b/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityUtils.java
@@ -40,6 +40,7 @@ import javax.crypto.spec.SecretKeySpec;
 import javax.xml.XMLConstants;
 import javax.xml.bind.JAXBElement;
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
@@ -103,25 +104,25 @@ public class XMLSecurityUtils {
         int eventType = xmlSecEvent.getEventType();
 
         switch (eventType) {
-            case XMLSecEvent.START_ELEMENT:
+            case XMLStreamConstants.START_ELEMENT:
                 return "START_ELEMENT";
-            case XMLSecEvent.END_ELEMENT:
+            case XMLStreamConstants.END_ELEMENT:
                 return "END_ELEMENT";
-            case XMLSecEvent.PROCESSING_INSTRUCTION:
+            case XMLStreamConstants.PROCESSING_INSTRUCTION:
                 return "PROCESSING_INSTRUCTION";
-            case XMLSecEvent.CHARACTERS:
+            case XMLStreamConstants.CHARACTERS:
                 return "CHARACTERS";
-            case XMLSecEvent.COMMENT:
+            case XMLStreamConstants.COMMENT:
                 return "COMMENT";
-            case XMLSecEvent.START_DOCUMENT:
+            case XMLStreamConstants.START_DOCUMENT:
                 return "START_DOCUMENT";
-            case XMLSecEvent.END_DOCUMENT:
+            case XMLStreamConstants.END_DOCUMENT:
                 return "END_DOCUMENT";
-            case XMLSecEvent.ATTRIBUTE:
+            case XMLStreamConstants.ATTRIBUTE:
                 return "ATTRIBUTE";
-            case XMLSecEvent.DTD:
+            case XMLStreamConstants.DTD:
                 return "DTD";
-            case XMLSecEvent.NAMESPACE:
+            case XMLStreamConstants.NAMESPACE:
                 return "NAMESPACE";
             default:
                 throw new IllegalArgumentException("Illegal XMLSecEvent received: " + eventType);
diff --git a/src/main/java/org/apache/xml/security/stax/impl/algorithms/SignatureAlgorithmFactory.java b/src/main/java/org/apache/xml/security/stax/impl/algorithms/SignatureAlgorithmFactory.java
index e48aafca..d8d29663 100644
--- a/src/main/java/org/apache/xml/security/stax/impl/algorithms/SignatureAlgorithmFactory.java
+++ b/src/main/java/org/apache/xml/security/stax/impl/algorithms/SignatureAlgorithmFactory.java
@@ -21,8 +21,8 @@ package org.apache.xml.security.stax.impl.algorithms;
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchProviderException;
 
+import org.apache.xml.security.algorithms.JCEMapper;
 import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.config.JCEAlgorithmMapper;
 
 /**
  */
@@ -41,13 +41,13 @@ public final class SignatureAlgorithmFactory {
     }
 
     public SignatureAlgorithm getSignatureAlgorithm(String algoURI) throws XMLSecurityException, NoSuchProviderException, NoSuchAlgorithmException {
-        String algorithmClass = JCEAlgorithmMapper.getAlgorithmClassFromURI(algoURI);
+        String algorithmClass = JCEMapper.getAlgorithmClassFromURI(algoURI);
         if (algorithmClass == null) {
             throw new XMLSecurityException("algorithms.NoSuchMap",
                                            new Object[] {algoURI});
         }
-        String jceName = JCEAlgorithmMapper.translateURItoJCEID(algoURI);
-        String jceProvider = JCEAlgorithmMapper.getJCEProviderFromURI(algoURI);
+        String jceName = JCEMapper.translateURItoJCEID(algoURI);
+        String jceProvider = JCEMapper.getJCEProviderFromURI(algoURI);
         if ("MAC".equalsIgnoreCase(algorithmClass)) {
             return new HMACSignatureAlgorithm(jceName, jceProvider);
         } else if ("Signature".equalsIgnoreCase(algorithmClass)) {
diff --git a/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java b/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java
index 7950bdcf..95bac537 100644
--- a/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java
+++ b/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java
@@ -55,6 +55,7 @@ import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.events.Attribute;
 
 import org.apache.commons.codec.binary.Base64OutputStream;
+import org.apache.xml.security.algorithms.JCEMapper;
 import org.apache.xml.security.binding.xmldsig.KeyInfoType;
 import org.apache.xml.security.binding.xmlenc.EncryptedDataType;
 import org.apache.xml.security.binding.xmlenc.EncryptedKeyType;
@@ -63,7 +64,6 @@ import org.apache.xml.security.binding.xmlenc.ReferenceType;
 import org.apache.xml.security.binding.xop.Include;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.config.ConfigurationProperties;
-import org.apache.xml.security.stax.config.JCEAlgorithmMapper;
 import org.apache.xml.security.stax.ext.AbstractInputProcessor;
 import org.apache.xml.security.stax.ext.InboundSecurityContext;
 import org.apache.xml.security.stax.ext.InputProcessorChain;
@@ -235,7 +235,7 @@ public abstract class AbstractDecryptInputProcessor extends AbstractInputProcess
                 handleSecurityToken(inboundSecurityToken, inputProcessorChain.getSecurityContext(), encryptedDataType);
 
                 final String algorithmURI = encryptedDataType.getEncryptionMethod().getAlgorithm();
-                final int ivLength = JCEAlgorithmMapper.getIVLengthFromURI(algorithmURI) / 8;
+                final int ivLength = JCEMapper.getIVLengthFromURI(algorithmURI) / 8;
                 Cipher symCipher = getCipher(algorithmURI);
 
                 if (encryptedDataType.getCipherData().getCipherReference() != null) {
@@ -438,8 +438,8 @@ public abstract class AbstractDecryptInputProcessor extends AbstractInputProcess
     private Cipher getCipher(String algorithmURI) throws XMLSecurityException {
         Cipher symCipher;
         try {
-            String jceName = JCEAlgorithmMapper.translateURItoJCEID(algorithmURI);
-            String jceProvider = JCEAlgorithmMapper.getJCEProviderFromURI(algorithmURI);
+            String jceName = JCEMapper.translateURItoJCEID(algorithmURI);
+            String jceProvider = JCEMapper.getJCEProviderFromURI(algorithmURI);
             if (jceName == null) {
                 throw new XMLSecurityException("algorithms.NoSuchMap",
                                                new Object[] {algorithmURI});
diff --git a/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureReferenceVerifyInputProcessor.java b/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureReferenceVerifyInputProcessor.java
index 58982259..233dcc4b 100644
--- a/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureReferenceVerifyInputProcessor.java
+++ b/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureReferenceVerifyInputProcessor.java
@@ -38,13 +38,13 @@ import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 
+import org.apache.xml.security.algorithms.JCEMapper;
 import org.apache.xml.security.binding.excc14n.InclusiveNamespaces;
 import org.apache.xml.security.binding.xmldsig.ReferenceType;
 import org.apache.xml.security.binding.xmldsig.SignatureType;
 import org.apache.xml.security.binding.xmldsig.TransformType;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.config.ConfigurationProperties;
-import org.apache.xml.security.stax.config.JCEAlgorithmMapper;
 import org.apache.xml.security.stax.config.ResourceResolverMapper;
 import org.apache.xml.security.stax.ext.AbstractInputProcessor;
 import org.apache.xml.security.stax.ext.InboundSecurityContext;
@@ -297,8 +297,8 @@ public abstract class AbstractSignatureReferenceVerifyInputProcessor extends Abs
             throws XMLSecurityException {
 
         String digestMethodAlgorithm = referenceType.getDigestMethod().getAlgorithm();
-        String jceName = JCEAlgorithmMapper.translateURItoJCEID(digestMethodAlgorithm);
-        String jceProvider = JCEAlgorithmMapper.getJCEProviderFromURI(digestMethodAlgorithm);
+        String jceName = JCEMapper.translateURItoJCEID(digestMethodAlgorithm);
+        String jceProvider = JCEMapper.getJCEProviderFromURI(digestMethodAlgorithm);
         if (jceName == null) {
             throw new XMLSecurityException("algorithms.NoSuchMap",
                                            new Object[] {digestMethodAlgorithm});
diff --git a/src/main/java/org/apache/xml/security/stax/impl/processor/input/XMLEncryptedKeyInputHandler.java b/src/main/java/org/apache/xml/security/stax/impl/processor/input/XMLEncryptedKeyInputHandler.java
index 944db66f..a119116c 100644
--- a/src/main/java/org/apache/xml/security/stax/impl/processor/input/XMLEncryptedKeyInputHandler.java
+++ b/src/main/java/org/apache/xml/security/stax/impl/processor/input/XMLEncryptedKeyInputHandler.java
@@ -35,6 +35,7 @@ import javax.crypto.spec.PSource;
 import javax.crypto.spec.SecretKeySpec;
 import javax.xml.bind.JAXBElement;
 
+import org.apache.xml.security.algorithms.JCEMapper;
 import org.apache.xml.security.binding.xmldsig.DigestMethodType;
 import org.apache.xml.security.binding.xmldsig.KeyInfoType;
 import org.apache.xml.security.binding.xmlenc.CipherValueType;
@@ -42,7 +43,6 @@ import org.apache.xml.security.binding.xmlenc.EncryptedKeyType;
 import org.apache.xml.security.binding.xmlenc11.MGFType;
 import org.apache.xml.security.binding.xop.Include;
 import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.config.JCEAlgorithmMapper;
 import org.apache.xml.security.stax.ext.AbstractInputSecurityHeaderHandler;
 import org.apache.xml.security.stax.ext.InboundSecurityContext;
 import org.apache.xml.security.stax.ext.InputProcessorChain;
@@ -123,7 +123,7 @@ public class XMLEncryptedKeyInputHandler extends AbstractInputSecurityHeaderHand
                             return key;
                         }
 
-                        String algoFamily = JCEAlgorithmMapper.getJCEKeyAlgorithmFromURI(algorithmURI);
+                        String algoFamily = JCEMapper.getJCEKeyAlgorithmFromURI(algorithmURI);
                         key = new SecretKeySpec(getSecret(this, correlationID, algorithmURI), algoFamily);
                         setSecretKey(algorithmURI, key);
                         return key;
@@ -169,8 +169,8 @@ public class XMLEncryptedKeyInputHandler extends AbstractInputSecurityHeaderHand
                         if (algorithmURI == null) {
                             throw new XMLSecurityException("stax.encryption.noEncAlgo");
                         }
-                        String jceName = JCEAlgorithmMapper.translateURItoJCEID(algorithmURI);
-                        String jceProvider = JCEAlgorithmMapper.getJCEProviderFromURI(algorithmURI);
+                        String jceName = JCEMapper.translateURItoJCEID(algorithmURI);
+                        String jceProvider = JCEMapper.getJCEProviderFromURI(algorithmURI);
                         if (jceName == null) {
                             throw new XMLSecurityException("algorithms.NoSuchMap",
                                                            new Object[] {algorithmURI});
@@ -205,7 +205,7 @@ public class XMLEncryptedKeyInputHandler extends AbstractInputSecurityHeaderHand
                                     algorithmSuiteSecurityEvent.setCorrelationID(correlationID);
                                     inboundSecurityContext.registerSecurityEvent(algorithmSuiteSecurityEvent);
 
-                                    jceDigestAlgorithm = JCEAlgorithmMapper.translateURItoJCEID(digestMethodType.getAlgorithm());
+                                    jceDigestAlgorithm = JCEMapper.translateURItoJCEID(digestMethodType.getAlgorithm());
                                 }
 
                                 PSource.PSpecified pSource = PSource.PSpecified.DEFAULT;
@@ -219,7 +219,7 @@ public class XMLEncryptedKeyInputHandler extends AbstractInputSecurityHeaderHand
                                 final MGFType mgfType =
                                         XMLSecurityUtils.getQNameType(encryptedKeyType.getEncryptionMethod().getContent(), XMLSecurityConstants.TAG_xenc11_MGF);
                                 if (mgfType != null) {
-                                    String jceMGFAlgorithm = JCEAlgorithmMapper.translateURItoJCEID(mgfType.getAlgorithm());
+                                    String jceMGFAlgorithm = JCEMapper.translateURItoJCEID(mgfType.getAlgorithm());
                                     mgfParameterSpec = new MGF1ParameterSpec(jceMGFAlgorithm);
                                 }
                                 OAEPParameterSpec oaepParameterSpec = new OAEPParameterSpec(jceDigestAlgorithm, "MGF1", mgfParameterSpec, pSource);
@@ -254,7 +254,7 @@ public class XMLEncryptedKeyInputHandler extends AbstractInputSecurityHeaderHand
                             LOG.warn("Unwrapping of the encrypted key failed with error: " + e.getMessage() + ". " +
                                     "Generating a faked one to mitigate timing attacks.");
 
-                            int keyLength = JCEAlgorithmMapper.getKeyLengthFromURI(symmetricAlgorithmURI);
+                            int keyLength = JCEMapper.getKeyLengthFromURI(symmetricAlgorithmURI);
                             this.decryptedKey = XMLSecurityConstants.generateBytes(keyLength / 8);
                             return this.decryptedKey;
                         }
diff --git a/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLEncryptOutputProcessor.java b/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLEncryptOutputProcessor.java
index 1f73cf06..1e23a8b1 100644
--- a/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLEncryptOutputProcessor.java
+++ b/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLEncryptOutputProcessor.java
@@ -37,8 +37,8 @@ import javax.crypto.spec.PSource;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 
+import org.apache.xml.security.algorithms.JCEMapper;
 import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.config.JCEAlgorithmMapper;
 import org.apache.xml.security.stax.ext.OutputProcessorChain;
 import org.apache.xml.security.stax.ext.SecurePart;
 import org.apache.xml.security.stax.ext.XMLSecurityConstants;
@@ -189,7 +189,7 @@ public class XMLEncryptOutputProcessor extends AbstractEncryptOutputProcessor {
                         createStartElementAndOutputAsEvent(outputProcessorChain, XMLSecurityConstants.TAG_xenc_CipherValue, false, null);
 
                         //encrypt the symmetric session key with the public key from the receiver:
-                        String jceid = JCEAlgorithmMapper.translateURItoJCEID(encryptionKeyTransportAlgorithm);
+                        String jceid = JCEMapper.translateURItoJCEID(encryptionKeyTransportAlgorithm);
                         if (jceid == null) {
                             throw new XMLSecurityException("algorithms.NoSuchMap",
                                                            new Object[] {encryptionKeyTransportAlgorithm});
@@ -204,7 +204,7 @@ public class XMLEncryptOutputProcessor extends AbstractEncryptOutputProcessor {
 
                                 String jceDigestAlgorithm = "SHA-1";
                                 if (encryptionKeyTransportDigestAlgorithm != null) {
-                                    jceDigestAlgorithm = JCEAlgorithmMapper.translateURItoJCEID(encryptionKeyTransportDigestAlgorithm);
+                                    jceDigestAlgorithm = JCEMapper.translateURItoJCEID(encryptionKeyTransportDigestAlgorithm);
                                 }
 
                                 PSource.PSpecified pSource = PSource.PSpecified.DEFAULT;
@@ -215,7 +215,7 @@ public class XMLEncryptOutputProcessor extends AbstractEncryptOutputProcessor {
 
                                 MGF1ParameterSpec mgfParameterSpec = new MGF1ParameterSpec("SHA-1");
                                 if (encryptionKeyTransportMGFAlgorithm != null) {
-                                    String jceMGFAlgorithm = JCEAlgorithmMapper.translateURItoJCEID(encryptionKeyTransportMGFAlgorithm);
+                                    String jceMGFAlgorithm = JCEMapper.translateURItoJCEID(encryptionKeyTransportMGFAlgorithm);
                                     mgfParameterSpec = new MGF1ParameterSpec(jceMGFAlgorithm);
                                 }
                                 algorithmParameterSpec = new OAEPParameterSpec(jceDigestAlgorithm, "MGF1", mgfParameterSpec, pSource);


[santuario-xml-security-java] 04/04: Added javadoc to XMLParser and notice about not closing the input stream in JavaUtils (#189)

Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 948883f80b930db5c1cc19300f15a3cda02ca5ce
Author: David Matějček <da...@omnifish.ee>
AuthorDate: Tue Jul 18 11:02:02 2023 +0200

    Added javadoc to XMLParser and notice about not closing the input stream in JavaUtils (#189)
    
    * JavaUtils: Added javadoc that the method doesn't close the input
    
    * Added javadoc to XMLParser
    
    Signed-off-by: David Matějček <da...@omnifish.ee>
    
    ---------
    
    Signed-off-by: David Matějček <da...@omnifish.ee>
---
 src/main/java/org/apache/xml/security/parser/XMLParser.java | 9 +++++++++
 src/main/java/org/apache/xml/security/utils/JavaUtils.java  | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/xml/security/parser/XMLParser.java b/src/main/java/org/apache/xml/security/parser/XMLParser.java
index 6987e0ba..5afaf90e 100644
--- a/src/main/java/org/apache/xml/security/parser/XMLParser.java
+++ b/src/main/java/org/apache/xml/security/parser/XMLParser.java
@@ -27,6 +27,15 @@ import org.w3c.dom.Document;
  */
 public interface XMLParser {
 
+    /**
+     * Parses a document from the input stream.
+     * Caller is responsible for closing the stream.
+     *
+     * @param inputStream
+     * @param disallowDocTypeDeclarations
+     * @return {@link Document}
+     * @throws XMLParserException
+     */
     Document parse(InputStream inputStream, boolean disallowDocTypeDeclarations) throws XMLParserException;
 
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/xml/security/utils/JavaUtils.java b/src/main/java/org/apache/xml/security/utils/JavaUtils.java
index e1273fc3..a8cc118b 100644
--- a/src/main/java/org/apache/xml/security/utils/JavaUtils.java
+++ b/src/main/java/org/apache/xml/security/utils/JavaUtils.java
@@ -91,7 +91,7 @@ public final class JavaUtils {
 
     /**
      * This method reads all bytes from the given InputStream till EOF and
-     * returns them as a byte array.
+     * returns them as a byte array. The method doesn't close the input stream.
      *
      * @param inputStream
      * @return the bytes read from the stream


[santuario-xml-security-java] 01/04: Enabled checking for missing @Override annotation (#187)

Posted by co...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b62255b91a6e2d60b692d15e72f1a552efbe71a8
Author: David Matějček <da...@omnifish.ee>
AuthorDate: Tue Jul 18 09:02:48 2023 +0200

    Enabled checking for missing @Override annotation (#187)
    
    Signed-off-by: David Matějček <da...@omnifish.ee>
---
 .github/codeql/santuario.qls | 2 --
 1 file changed, 2 deletions(-)

diff --git a/.github/codeql/santuario.qls b/.github/codeql/santuario.qls
index 2f8140a8..2a69e4f7 100644
--- a/.github/codeql/santuario.qls
+++ b/.github/codeql/santuario.qls
@@ -1,5 +1,3 @@
 - import: codeql-suites/java-security-and-quality.qls
   from: codeql-java
-- exclude:
-    id: java/missing-override-annotation