Uploaded image for project: 'Santuario'
  1. Santuario
  2. SANTUARIO-227

impossible to subclass XMLCipher

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • Java
    • Security Level: Public (Public issues, viewable by everyone)
    • None
    • Operating System: Windows NT
      Platform: PC
    • 49465

    Description

      Created an attachment (id=25614)
      source code patch and new junit

      The constructor of XMLCipher is private which makes it impossible to subclass XMLCipher. Furthermore, much of the work to construct the XMLCipher instance is located in the getInstance() or getProviderInstance() methods. That would force a subclass to duplicate that code once again.

      The goal of this effort is to experiment with per KeyInfo KeyResolvers to resolve the Key Encryption Key dynamically based on the EncryptedKey/KeyInfo carried in the message. The junit in attachment shows how to achieve it through subclassing. This might not be the most obvious use of the API, but at least it proves that it can be done. It has the advantage that none of the API changes are controversial.

      The solution involves:

      • Making the XMLCipher constructor protected. Callers must still call one of the getInstance() or getProviderInstance() methods.
      • pushing all the construction code in getInstance() and getProviderInstance() into the real constructor.
      • relaxing the requirement that provider must not be null. Passing null for the provider in getProviderInstance() gives the same result as using the equivalent getInstance() method.
      • Adding createKeyInfo() and createEncryptedKeyResolver() factory methods in XMLCipher.
      • Changing XMLCipher to use the new factory methods when creating internal KeyInfo or EncryptedKeyResolver objects.
      • Adding the method createXMLCipher() to EncryptedKeyResolver.
      • Also added some test to @return keywords that were empty in XMLCipher

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--diff.txt
          44 kB
          Clement Pellerin

        Issue Links

          Activity

            People

              Unassigned Unassigned
              clement_pellerin@ibi.com Clement Pellerin
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: