You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Martin Vich <vi...@gmail.com> on 2014/10/14 11:52:35 UTC
how to add EncryptionProperty with custom value into encrypted xml ?
Hi,
it seems that adding EncryptionProperty value into xml is little bit
tricky. I am working with 2.0.2 xmlsec (Java implementation). Take a look
on Encrypter class in samples
(org.apache.xml.security.samples.encryption.Enrypter).
In main method I tried to add encryptionProperty into encryptedData
variable like this :
Element elem = XMLUtils.createElementInEncryptionSpace(
doc, EncryptionConstants._TAG_ENCRYPTIONPROPERTIES
);
elem.setTextContent("here should be sha1 hash of encryption key");
EncryptionProperties eps = xmlCipher.createEncryptionProperties();
EncryptionProperty ep = xmlCipher.createEncryptionProperty();
ep.addEncryptionInformation(elem);
eps.addEncryptionProperty(ep);
EncryptedData encData = xmlCipher.getEncryptedData();
encData.setEncryptionProperties(eps);
...all i get as a output is empty EncryptionProperty tag without any value
inside. Is my inicialization of element and usage of xmlsec API correct ?
Regards,
Martin
Re: how to add EncryptionProperty with custom value into encrypted
xml ?
Posted by Colm O hEigeartaigh <co...@apache.org>.
Hi Martin,
It appears that this feature was not supported until now. I've added a JIRA
(+ fix):
https://issues.apache.org/jira/browse/SANTUARIO-403
http://svn.apache.org/viewvc?view=revision&revision=r1631978
Colm.
On Tue, Oct 14, 2014 at 10:52 AM, Martin Vich <vi...@gmail.com> wrote:
> Hi,
>
> it seems that adding EncryptionProperty value into xml is little bit
> tricky. I am working with 2.0.2 xmlsec (Java implementation). Take a look
> on Encrypter class in samples
> (org.apache.xml.security.samples.encryption.Enrypter).
>
> In main method I tried to add encryptionProperty into encryptedData
> variable like this :
>
> Element elem = XMLUtils.createElementInEncryptionSpace(
> doc, EncryptionConstants._TAG_ENCRYPTIONPROPERTIES
> );
> elem.setTextContent("here should be sha1 hash of encryption key");
>
> EncryptionProperties eps = xmlCipher.createEncryptionProperties();
> EncryptionProperty ep = xmlCipher.createEncryptionProperty();
> ep.addEncryptionInformation(elem);
> eps.addEncryptionProperty(ep);
>
> EncryptedData encData = xmlCipher.getEncryptedData();
> encData.setEncryptionProperties(eps);
>
> ...all i get as a output is empty EncryptionProperty tag without any value
> inside. Is my inicialization of element and usage of xmlsec API correct ?
>
> Regards,
> Martin
>
>
>
--
Colm O hEigeartaigh
Talend Community Coder
http://coders.talend.com