[xmlsec] Load hmac key for signature

Aleksey Sanin aleksey at aleksey.com
Sat Oct 9 12:12:12 PDT 2004


Ops... Sorry for mistake. This is the correct function:

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

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

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

   ret = xmlSecKeySetValue(key, key_data);
   if(ret < 0) {
     xmlSecKeyDataDestroy(key_data);
     xmlSecKeyDestroy(key);
     return (NULL);
   }

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

   return (key);
}

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


Aleksey




More information about the xmlsec mailing list