[xmlsec] comparing keys for equality

Mikolaj Habryn dichro at rcpt.to
Thu Dec 16 03:17:23 PST 2004


This is something of a ridiculously simple question, but I just can't
work out how to do it.

How do I compare xmlSecKeys to see if they're the same key?

I have an XML document which contains ds:KeyInfos signed with
ds:Signatures. I extract the keys from all of the KeyInfos in the
document and signatures with this function applied to each ds:KeyInfo
node:

void extractKey(xmlSecKeyPtr key, xmlNodePtr node) {
  xmlSecKeyInfoCtxPtr keyInfo;

  keyInfo = xmlSecKeyInfoCtxCreate(NULL);
  assert(keyInfo);
  assert(!xmlSecKeyInfoNodeRead(node, key, keyInfo));
  xmlSecKeyInfoCtxDestroy(keyInfo);
}

and then I need to construct a signature chain, but, obviously, I need
to be able to compare the various keys! I've tried poking around with
the key->value element and the various functions that use it, but even
the debug functions complain about various things.

I can't see any function to do xmlSecKeyCmp(xmlSecKeyPtr key1,
xmlSecKeyPtr key2); have I missed one somewhere?

m.




More information about the xmlsec mailing list