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


##########
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:
   OK I realise the problem here is the parent element is not a KeyInfo but a 
RecipientKeyInfo and the unmarshalling fails



-- 
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