Santuario
  1. Santuario
  2. SANTUARIO-301

Missing KeyInfo element when encrypting multiple elements

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Java 1.4.6, Java 1.5.1
    • Fix Version/s: Java 1.4.7, Java 1.5.2
    • Component/s: Java
    • Security Level: Public (Public issues, viewable by everyone)
    • Labels:
      None

      Description

      When encrypting multiple elements using the same XMLCipher, the KeyInfo that was attached to the EncryptedData only appears on the last encrypted element. This is because EncryptedDataImpl.toElement() calls getKeyInfo().getElement() which always returns the same KeyInfo Element. When the KeyInfo is added to the latest EncryptedData, it is reparented and therefore disappears from the previous EncryptedData.

      1. TestBug.java
        2 kB
        Clement Pellerin
      2. TestBug.java
        2 kB
        Clement Pellerin

        Activity

        Hide
        Colm O hEigeartaigh added a comment -

        Within the next couple of months.

        Colm.

        Show
        Colm O hEigeartaigh added a comment - Within the next couple of months. Colm.
        Hide
        Paul Park added a comment -

        Approximately, when can we expect 1.4.7 to be released?

        Show
        Paul Park added a comment - Approximately, when can we expect 1.4.7 to be released?
        Hide
        Colm O hEigeartaigh added a comment -

        What version of ant are you using? "ant test" works fine for me with 1.8.2.

        Colm.

        Show
        Colm O hEigeartaigh added a comment - What version of ant are you using? "ant test" works fine for me with 1.8.2. Colm.
        Hide
        Clement Pellerin added a comment -

        Cloning the KeyInfo element is the solution I had in mind.

        Show
        Clement Pellerin added a comment - Cloning the KeyInfo element is the solution I had in mind.
        Hide
        Clement Pellerin added a comment -

        I resubmitted the same test case but if you look closely, it is just a simplified version of EncryptContentTest already in the test suite.
        The things that were changed are the addition of a second <user> element to encrypt and the declaration of a KeyInfo.
        I would have updated the test case myself, but for some reason, when I run ant test, it cannot find any test case in any of the test files.
        Would you happen to know what could cause that?

        Show
        Clement Pellerin added a comment - I resubmitted the same test case but if you look closely, it is just a simplified version of EncryptContentTest already in the test suite. The things that were changed are the addition of a second <user> element to encrypt and the declaration of a KeyInfo. I would have updated the test case myself, but for some reason, when I run ant test, it cannot find any test case in any of the test files. Would you happen to know what could cause that?
        Hide
        Clement Pellerin added a comment - - edited

        Resubmitted TestBug.java to include the ASF license.

        Show
        Clement Pellerin added a comment - - edited Resubmitted TestBug.java to include the ASF license.
        Hide
        Colm O hEigeartaigh added a comment -

        Could you resubmit the test-case granting ASF a license to include it?

        If I clone the Keyinfo Element in EncryptedDataImpl the test-case works as expected - are you happy with this fix?

        Colm.

        Show
        Colm O hEigeartaigh added a comment - Could you resubmit the test-case granting ASF a license to include it? If I clone the Keyinfo Element in EncryptedDataImpl the test-case works as expected - are you happy with this fix? Colm.
        Hide
        Clement Pellerin added a comment -

        The attached sample shows how to reproduce the problem. Notice in the output that the KeyInfo element only appears within the last EncryptedData element.

        Show
        Clement Pellerin added a comment - The attached sample shows how to reproduce the problem. Notice in the output that the KeyInfo element only appears within the last EncryptedData element.

          People

          • Assignee:
            Colm O hEigeartaigh
            Reporter:
            Clement Pellerin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development