[xmlsec] Load hmac key for signature

Aleksey Sanin aleksey at aleksey.com
Fri Oct 8 16:00:05 PDT 2004


Creating HMAC key in xmlsec:
------------------------------

xmlSecKeyPtr CreateHmacKey(const xmlSecByte * buf, xmlSecSize size)
{
   xmlSecKeyPtr key;
   xmlSecKeyDataPtr key_data;
   int ret;

   key = xmlSecKeyCreate();
   if(!key) {
     return (NULL);
   }

   key_data = xmlSecKeyEnsureData(key, xmlSecKeyDataHmacId);
   if(!key_data) {
     xmlSecKeyDestroy(key);
     return (NULL);
   }

   ret = xmlSecOpenSSLKeyDataHmacSet(key_data, buf, size);
   if(ret < 0) {
     xmlSecKeyDestroy(key);
     return (NULL);
   }

   return (key);
}

------------------------------


Best,
Aleksey






More information about the xmlsec mailing list