This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-wss4j.git
The following commit(s) were added to refs/heads/master by this push:
new 3da873c18 WSS-726 Make
EncryptedKeyProcessor.getAsymmetricDecryptedByte overridable (#616)
3da873c18 is described below
commit 3da873c18ab584cd7e4dced1c3f348cb0f259a1c
Author: gmextec <[email protected]>
AuthorDate: Fri May 29 13:50:58 2026 +0200
WSS-726 Make EncryptedKeyProcessor.getAsymmetricDecryptedByte overridable
(#616)
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 87b8f2b19..046a18543 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
@@ -341,7 +341,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,
@@ -508,7 +520,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;