coheigea commented on code in PR #418:
URL: https://github.com/apache/ws-wss4j/pull/418#discussion_r1935348462


##########
ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java:
##########
@@ -276,27 +275,42 @@ private CertificateResult getPublicKey(Element 
keyValueElement, RequestData data
             X509Certificate[] certs = 
getCertificatesFromX509Data(keyValueElement, data);
             builder.certificates(certs);
             if (certs == null || certs.length == 0) {
-                XMLSignatureFactory signatureFactory;
-                if (provider == null) {
-                    // Try to install the Santuario Provider - fall back to 
the JDK provider if this does
-                    // not work
-                    try {
-                        signatureFactory = 
XMLSignatureFactory.getInstance("DOM", "ApacheXMLDSig");
-                    } catch (NoSuchProviderException ex) {
-                        signatureFactory = 
XMLSignatureFactory.getInstance("DOM");
-                    }
-                } else {
-                    signatureFactory = XMLSignatureFactory.getInstance("DOM", 
provider);
-                }
-
-                PublicKey publicKey = X509Util.parseKeyValue((Element) 
keyValueElement.getParentNode(),
-                        signatureFactory);
+                PublicKey publicKey = 
getPublicKeyFromKeyValue(keyValueElement);

Review Comment:
   But the keyInfoFactory is used to actually do the unmarshalling in 
https://github.com/apache/ws-wss4j/blob/21a82b005fe70553698e295c310a660497375bbf/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/X509Util.java#L152
   and one of the existing unit tests in EncryptionTest hits this code and 
finds the PublicKey successfully?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org
For additional commands, e-mail: dev-h...@ws.apache.org

Reply via email to