[
https://issues.apache.org/jira/browse/RAMPART-462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Lazarski resolved RAMPART-462.
-------------------------------------
Fix Version/s: 2.0.0
Resolution: Fixed
Fixed by GitHub PR #28, merged to master.
SymmetricBindingBuilder.setupEncryptedKey() now generates the session key from
the AlgorithmSuite's
encryption algorithm, falling back to AES-128 only when the suite has none.
Covered by the new testSymmBindingBasic256 test. Will ship in
Rampart 2.0.0.
> SymmetricBindingBuilder.setupEncryptedKey() always generates an AES-128
> session key regardless of the AlgorithmSuite's encryption algorithm
> -------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: RAMPART-462
> URL: https://issues.apache.org/jira/browse/RAMPART-462
> Project: Rampart
> Issue Type: Bug
> Components: rampart-core
> Reporter: Andreas Martens
> Priority: Major
> Fix For: 2.0.0
>
>
> *Problem*
> When a policy uses a {{SymmetricBinding}} whose {{ProtectionToken}} is an
> {{{}X509Token{}}}, the client generates the symmetric key in
> {{{}SymmetricBindingBuilder.setupEncryptedKey(){}}}. That method hardcodes
> {{{}KeyUtils.getKeyGenerator(WSConstants.AES_128){}}}.
> The key is then used to derive the signature and encrypt message parts. Its
> length therefore ignores the {{AlgorithmSuite}} in the policy.
> *Expected*
> The generated key should match the policy's {{sp:AlgorithmSuite}} encryption
> algorithm. For example, {{Basic256}} should give a 256-bit AES key, and
> {{TripleDes}} should give a 3DES key.
> *Actual*
> * The key is always 128-bit AES, which is either weaker than the policy
> requires or incompatible with it.
> * The suite's {{getEncryption()}} URI (for example
> {{{}http://www.w3.org/2001/04/xmlenc#aes256-cbc{}}}) is never consulted.
> * If the key generator fails, the code calls {{e.printStackTrace()}} and
> returns {{{}null{}}}. The error is not reported as a
> {{{}RampartException{}}}. This is existing behaviour that the patch keeps.
> *Steps to reproduce*
> # Configure a service and client with a {{SymmetricBinding}} using an
> {{X509Token}} protection token and an {{AlgorithmSuite}} such as {{Basic256}}
> or {{{}Basic192{}}}.
> # Send a request.
> # Inspect the message or the generated {{{}EncryptedKey{}}}. The session key
> is 16 bytes, not the 32 or 24 the suite requires.
> For the third step, you could instead log {{symmetricKey.getAlgorithm()}} and
> {{symmetricKey.getEncoded().length}} in a unit test.
> *Proposed fix*
> * Use {{rmd.getPolicyData().getAlgorithmSuite().getEncryption()}} to select
> the key generator.
> * Fall back to {{WSConstants.AES_128}} when it is null.
> Why now?
> WSS4J has tighter checking in more recent releases, I needed to pick this up
> to get a Kerberos fix, hence discovering this.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]