[xmlsec] How to ...

Aleksey Sanin aleksey at aleksey.com
Tue May 9 07:14:08 PDT 2006

> I would like to set up the <env:Header><xenc:EncryptedKey> 
> <xenc:CipherData><xenc:CipherValue>  tag with the generated session key 
> . I cannot find any method to allow this.
> The "xmlSecTmplEncDataEnsureCipherValue" method works fine to add 
> <xenc:EncryptedKey> <xenc:CipherData><xenc:CipherValue> into the body, 
> but I cannot figure out on how to make it work for the header.


xmlSecTmplEncDataEnsureCipherValue() method has one parameter - pointer
to the parent EncryptedData or EncryptedKey node.


xmlSecTmplKeyInfoAddEncryptedKey () method also has first parameter -
pointer to the parent node.

Thus, get a pointer to  <env:Header> node and call
   enc_key_node = xmlSecTmplKeyInfoAddEncryptedKey(header_node, ...);

Finally, you don't need to use xmlsec template functions to create
the template. You can also do it manually by calling Libxml2 functions
or load template from a file, or ....



More information about the xmlsec mailing list