santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Vich <vichmar...@gmail.com>
Subject how to add EncryptionProperty with custom value into encrypted xml ?
Date Tue, 14 Oct 2014 09:52:35 GMT
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

Mime
View raw message