Skip to content

RAMPART-462: Use AlgorithmSuite encryption algorithm for symmetric key generation - #28

Merged
robertlazarski merged 2 commits into
apache:masterfrom
andreas-ibm:RAMPART-462
Nov 12, 2026
Merged

robertlazarski merged 2 commits into
apache:masterfrom
andreas-ibm:RAMPART-462

Conversation

@andreas-ibm

Copy link
Copy Markdown
Contributor

SymmetricBindingBuilder.setupEncryptedKey() always generated an AES-128 session key
(KeyUtils.getKeyGenerator(WSConstants.AES_128)), regardless of the encryption
algorithm in the policy's sp:AlgorithmSuite.

It now asks the policy's AlgorithmSuite for its encryption algorithm
(getEncryption()), and falls back to AES-128 if that is null.

Fixes https://issues.apache.org/jira/browse/RAMPART-462

  • Only the key generator selection in setupEncryptedKey() changes. Error handling is
    unchanged (the existing printStackTrace() / return null on WSSecurityException
    is left as-is to keep this PR minimal).
  • For suites that already use AES-128 (e.g. Basic128) behaviour is identical.
  • For other suites (e.g. Basic256, Basic192, TripleDes) the generated key now
    matches the policy instead of being 128-bit AES.

@robertlazarski
robertlazarski merged commit b078936 into apache:master Nov 12, 2026
@robertlazarski

Copy link
Copy Markdown
Contributor

Thanks, merged. Verified locally: the new test fails on master with a 16-byte key and passes with the fix, and the rest of the rampart-tests module is green. The change matches what AsymmetricBindingBuilder already does with the
suite's encryption algorithm, so the two builders are now consistent. This will be in 2.0.0.

@andreas-ibm

andreas-ibm commented Nov 13, 2026 via email

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants