You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Clement Pellerin (Commented) (JIRA)" <ji...@apache.org> on 2012/03/26 18:56:28 UTC
[jira] [Commented] (SANTUARIO-227) impossible to subclass XMLCipher
[ https://issues.apache.org/jira/browse/SANTUARIO-227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13238554#comment-13238554 ]
Clement Pellerin commented on SANTUARIO-227:
--------------------------------------------
I think it is intentional that XMLCipher cannot be subclassed. This is similar to KeyStore which would not normally be subclassed.
The problem with the EncryptedKeyResolver is a duplicate of SANTUARIO-305.
I recommend this bug be closed at the same time SANTUARIO-305 is fixed.
> impossible to subclass XMLCipher
> --------------------------------
>
> Key: SANTUARIO-227
> URL: https://issues.apache.org/jira/browse/SANTUARIO-227
> Project: Santuario
> Issue Type: Bug
> Components: Java
> Environment: Operating System: Windows NT
> Platform: PC
> Reporter: Clement Pellerin
> Attachments: diff.txt
>
>
> 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
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira