[xmlsec] How to encrypt only some Subnodes?

Aleksey Sanin aleksey at aleksey.com
Fri Aug 10 12:47:44 PDT 2007

I think you already canceled your question but ... :)

You simply create the necessary template "subtree" encryption
and then specify that this "subtree" should replace the content
of the subtree you want to encrypt. There are examples of doing
this in the sources tarball and on the website.


Martin Salo wrote:
> Hello Mailinglist,
> I'm analysing encrypt2.c.
> In the beginning of function encrypt_file() were the encryption nodes created. It seems that function xmlSecTmplEncDataCreate() creates an EncryptedData node on the root, followed by some other functions that creates CipherValue and KeyInfo. But what can I do if I only want to encrypt 2 or 3 subnodes and not the whole document?
> If I look through the section xmltree, I see functions like xmlSecFindNode(). In this way I can go through the xml document to find the nodes I want to encrypt. But how can I add the encryption nodes on this position? (Function xmlSecTmplEncDataCreate() doese not offer a parameter xmlNodePtr_TargetNode to specify the place where the encryption should start.)
> Regards
> Martin

More information about the xmlsec mailing list