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

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


The following commit(s) were added to refs/heads/2_4_x-fixes by this push:
     new 7c3d942b9 WSS-726 Make 
EncryptedKeyProcessor.getAsymmetricDecryptedByte overridable (#617)
7c3d942b9 is described below

commit 7c3d942b95eabcc0503865d72bbe4881903f2d35
Author: gmextec <[email protected]>
AuthorDate: Fri May 29 16:59:10 2026 +0200

    WSS-726 Make EncryptedKeyProcessor.getAsymmetricDecryptedByte overridable 
(#617)
    
    Allow overriding EncryptedKeyProcessor#getAsymmetricDecryptedByte in order 
to customize Cipher init and decryption
    
    see https://issues.apache.org/jira/projects/WSS/issues/WSS-726
---
 .../wss4j/dom/processor/EncryptedKeyProcessor.java       | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git 
a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
 
b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
index 2edd4c924..6b3d3bde1 100644
--- 
a/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
+++ 
b/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
@@ -288,7 +288,19 @@ public class EncryptedKeyProcessor implements Processor {
         return X509Util.getSecretKey(keyInfoChildElement, algorithmURI, 
data.getCallbackHandler());
     }
 
-    private static byte[] getAsymmetricDecryptedBytes(
+    /**
+     * Initializes the cipher decrypting the encryptedEphemeralKey as 
indicated by the encryptedKeyTransportMethod
+     * @param data
+     * @param wsDocInfo
+     * @param encryptedKeyTransportMethod
+     * @param encryptedEphemeralKey
+     * @param refList
+     * @param encryptedKeyElement
+     * @param privateKey
+     * @return the decrypted key or, in case of an exception during the 
decryption, a randomKey
+     * @throws WSSecurityException
+     */
+    protected byte[] getAsymmetricDecryptedBytes(
         RequestData data,
         WSDocInfo wsDocInfo,
         String encryptedKeyTransportMethod,
@@ -373,7 +385,7 @@ public class EncryptedKeyProcessor implements Processor {
      * Generates a random secret key using the algorithm specified in the
      * first DataReference URI
      */
-    private static byte[] getRandomKey(Element refList, WSDocInfo wsDocInfo) 
throws WSSecurityException {
+    protected static byte[] getRandomKey(Element refList, WSDocInfo wsDocInfo) 
throws WSSecurityException {
         try {
             String alg = "AES";
             int size = 16;

Reply via email to