[xmlsec] creating a ds:KeyInfo object

Smith Baylor sbaylor at gmail.com
Tue Dec 28 15:57:03 PST 2004


All that I am trying to do is:
1.  Load the cert file
2.  Write the public key X509Data into a newly created KeyInfo Object

I don't want an entire Signature object with ds:Signature node.  Are
there any examples of how to write a custom KeyData Object?

I still cannot still understand what is wrong with this:
xmlSecKeyInfoNodeWrite(cur, key, keyInfoCtx)
where xmlSecKeyPtr key = xmlSecKeyCreate(); xmlNodePtr cur = NULL;

-- Smith

-------- more code --------

  if (xmlSecCryptoAppKeyCertLoad(key,
                                    cert_file,
                                    xmlSecKeyDataFormatPem) < 0) {
     printf("ERROR\n");
  }
     myKeyInfo =  xmlNewNode(NULL, BAD_CAST "KeyInfo");

       /* <dsig:KeyInfo/> node */
       cur = xmlSecAddChild(myKeyInfo,
                            xmlSecNodeKeyInfo,
                            xmlSecDSigNs);
       if ( xmlSecKeyInfoNodeWrite(cur,
                                   key,
                                   keyInfoCtx) < 0)
         {
           printf("ERROR: writing KeyInfo Node\n");
         }



On Tue, 28 Dec 2004 15:39:05 -0800, Aleksey Sanin <aleksey at aleksey.com> wrote:
> xmlsec tries to load the key from xml file and fails because
> it is not one xmlsec expects (public versus private). Not sure
> why your want to put stuff in KeyInfo by yourself but there are
> two options:
> 1) Write and register in xmlsec a custom KeyData object that
> would put your stuff in.
> 2) Do signature *with empty* KeyInfo element and write your stuff
> in *after* the signature.
> 
> 
> Aleksey
>



More information about the xmlsec mailing list