[xmlsec] creating a ds:KeyInfo object

Smith Baylor sbaylor at gmail.com
Thu Dec 30 18:22:48 PST 2004

I still have some problems.

I am able to do:	
cur = xmlSecAddChild(MyNode,  
                                  xmlSecNodeKeyInfo,  xmlSecDSigNs);

xmlSecKeyInfoNodeWrite(cur, key, keyInfoCtx)

I then dump the key
	      xmlSecKeyDebugXmlDump(key, stdout);
and I get:

<RSAKeyValue size="2048" />
<List size="1">
=== X509 Certificate
==== Subject Name: /C=US/ST=California/O=XML Security Library
(http://www.aleksey.com/xmlsec)/OU=Examples RSA Certificate/CN=Aleksey
Sanin/emailAddress=xmlsec at aleksey.com
==== Issuer Name: /C=US/ST=California/L=Sunnyvale/O=XML Security
Library (http://www.aleksey.com/xmlsec)/OU=Root Certificate/CN=Aleksey
Sanin/emailAddress=xmlsec at aleksey.com
==== Issuer Serial: 5

How can I get this infor to the X509Certificate in X509Data?

<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">

Thanks very much


On Tue, 28 Dec 2004 16:03:20 -0800, Aleksey Sanin <aleksey at aleksey.com> wrote:
> Oh, I see what are you tryng to do. OK, this is simple.
> xmlSecKeyInfoNodeWrite() writes key data into KeyInfo
> node according to the template in the KeyInfo node.
> For example, if you want to write only key name,
> you create template like this:
>         <KeyInfo>
>                 <KeyName/>
>         </>
> If you want to write key name and certificate info,
> you create template like this:
>         <KeyInfo>
>                 <KeyName/>
>                 <X509Data/>
>         </>
> and so on. From the code in your prev message, it seems
> that your KeyInfo template is an empty KeyInfo node. Thus
> the output is also an empty KeyInfo node.
> And you got this assert in xmlSecKeyDebugXmlDump function
> because the key structure you have is not valid. It does not
> have the key value itself.
> Aleksey
> Smith Baylor wrote:
> > 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;
> >

More information about the xmlsec mailing list