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

coheigea pushed a commit to branch 3_0_x-fixes
in repository https://gitbox.apache.org/repos/asf/ws-wss4j.git


The following commit(s) were added to refs/heads/3_0_x-fixes by this push:
     new 30dbb57e2 WSS-716 DigestMethod is written for key EncryptionMethod 
AES-KW (#433)
30dbb57e2 is described below

commit 30dbb57e239afd79e835068c3f16d67ef62727a0
Author: beth-soptim <46046993+beth-sop...@users.noreply.github.com>
AuthorDate: Tue Feb 4 11:30:39 2025 +0100

    WSS-716 DigestMethod is written for key EncryptionMethod AES-KW (#433)
    
    * WSS-716 DigestMethod is written for key EncryptionMethod AES-KW
    
    * Fix for KEYTRANSPORT_RSAOAEP
---
 .../src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
 
b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
index 0a739a8fd..204c311a4 100644
--- 
a/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
+++ 
b/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
@@ -731,7 +731,8 @@ public class WSSecEncryptedKey extends WSSecBase {
             doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + 
":EncryptionMethod");
         encryptionMethod.setAttributeNS(null, "Algorithm", keyTransportAlgo);
 
-        if (digestAlgo != null) {
+        if ((WSConstants.KEYTRANSPORT_RSAOAEP_XENC11.equals(keyEncAlgo) || 
WSConstants.KEYTRANSPORT_RSAOAEP.equals(
+                keyEncAlgo)) && digestAlgo != null) {
             Element digestElement =
                 XMLUtils.createElementInSignatureSpace(doc, 
Constants._TAG_DIGESTMETHOD);
             digestElement.setAttributeNS(null, "Algorithm", digestAlgo);

Reply via email to