I’m filling out the WINTRUST_CATALOG_INFO structure. I’ve calculated the hash for a file and found the catalog file to use.
There’s one member I don’t know how to fill out though:
pcwszMemberTag
Tag of a member file to be verified.
Most of the example code for this I’ve seen around on the internet seems to turn the file hash into a hex-encoded version of itself, and pass that as the member tag. I’m not sure why that would be though.
Tags exist because file names are not reliable.
pcwszMemberTagcorresponds to what has been set aspwszReferenceTagwhen the member was added to the catalog (using the CryptCATPutMemberInfo function for example).To be really compliant with how the API is supposed to work, I think you’re supposed to get the member information first, before you can fully setup WINTRUST_CATALOG_INFO. To determine member information, you must use the CryptCATEnumerateMember function (there is also a CryptCATGetMemberInfo function but you can’t use it – chicken and egg issue – you don’t have the tag) and determine what member you are interested in by any way you want (using other CRYPTCATMEMBER structure fields)
Using an hexadecimal representation of the hash of a file for the reference tag is common usage (MakeCat probably does it so it looks like the standard), but I don’t think it’s mandatory at all – the Java stuff in the other answer is not using this convention (see also this link: RE: CryptCATGetMemberInfo samples with a Microsoft guy answer.)