You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Brent Putman (Jira)" <ji...@apache.org> on 2024/04/03 01:11:00 UTC

[jira] [Created] (SANTUARIO-616) ClassCastException regression in XMLCipher related to new KeyAgreement support

Brent Putman created SANTUARIO-616:
--------------------------------------

             Summary: ClassCastException regression in XMLCipher related to new KeyAgreement support
                 Key: SANTUARIO-616
                 URL: https://issues.apache.org/jira/browse/SANTUARIO-616
             Project: Santuario
          Issue Type: Bug
          Components: Java
    Affects Versions: Java 4.0.2, Java 3.0.4
         Environment: Java 17
            Reporter: Brent Putman
            Assignee: Colm O hEigeartaigh


The 3.0.4 release (and I assume also the corresponding 4.0.x release, but I can't test that) introduced a regression inĀ  {{XMLCipher}} related to the new support for ECDH and {{{}AgreementMethod{}}}.

The code in {{XMLCipher#getAlgorithmParameters(EncryptedKey)}} seems to implicitly assume that if there are {{AgreementMethod}} elements present in the KeyInfo, that it needs to actually "do" key agreement, so it unconditionally casts the supplied input {{Key}} to {{PrivateKey}} (assuming it is an {{{}ECPrivateKey{}}}, for example).

This assumption doesn't hold, because the caller may have already performed the key agreement op independently on the {{KeyInfo}} data, and has inited {{XMLCipher}} with the resulting {{{}SecretKey{}}}. OpenSAML implemented ECDH (and DH classic) support several years ago using this approach.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)