[xmlsec] Empty KeyValue element after a call to xmlSecKeyInfoNodeWrite()

Nicolas Clapies nclapies at entrouvert.com
Thu Oct 13 06:52:37 PDT 2005


Here is a sample of my code :
         xmlDoc *doc;
         xmlNode *key_info_node;
         xmlSecKey *public_key;
         xmlSecKeyInfoCtx *ctx;

         public_key = lasso_provider_get_public_key(lasso_provider);

         doc = xmlSecCreateTree("KeyInfo", LASSO_DS_HREF);
         key_info_node = xmlDocGetRootElement(doc);
         xmlSecAddChild(key_info_node, "KeyValue", LASSO_DS_HREF);

         ctx = xmlSecKeyInfoCtxCreate(NULL);
         xmlSecKeyInfoCtxInitialize(ctx, NULL);
         ctx->mode = xmlSecKeyInfoModeWrite;

         xmlSecKeyDebugXmlDump(public_key, stdout);

         xmlSecKeyInfoNodeWrite(key_info_node, public_key, ctx);

the dump of my template before the call of xmlSecKeyInfoNodeWrite() is :
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyValue/>
</KeyInfo>

the dump of my template after the call of xmlSecKeyInfoNodeWrite() is :
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyValue>
<RSAKeyValue/>
</KeyValue>
</KeyInfo>

The dump from xmlSecKeyDebugXmlDump is :
<KeyInfo>
<KeyMethod>RSAKeyValue</KeyMethod>
<KeyType>Public
</KeyType>
<RSAKeyValue size="2048" />
</KeyInfo>

Nicolas.

On Oct 12, 2005, at 6:30 PM, Aleksey Sanin wrote:

> Make sure that you template look like this:
>
>   <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
>     <KeyValue>
>     </KeyValue>
>   </KeyInfo>
>
> Aleksey
>




More information about the xmlsec mailing list