How to verify an XML digital signature in Cocoa?
I have a C# application that uses XML digital signatures to sign license files. I've used the standard Microsoft approach described here.
I'm porting the application to the MAC and need to verify the signature. My general question is how best to do this?
This is what I've done:
I've used ma开发者_C百科cport to install Aleksey's xmlsec1 library.
Used the Chilkat library to convert my XML public key to a PEM file
Chilkat.PublicKey pubKey = new Chilkat.PublicKey(); pubKey.LoadXml(publicKeyXml); pubKey.SaveOpenSslPemFile("publicKey.pem");
Compiled and ran the alekseys sample program. See (http://www.aleksey.com/xmlsec/api/xmlsec-verify-with-key.html) to verify an XML dsig.
Result: my license files fail to validate. The call to xmlSecDSigCtxVerify fails with status=unknown. Now for my specific question: What can I do next?
Geoff
The solution was to define below:
\#define XMLSEC_NO_SIZE_T
before including any of the xmlsec header files. Otherwise the type xmlSecSize will be defined differently to when the program was built on the Mac and the xmlSecDSigCtx structure will appear corrupted to the library. See xmlsec.h for more details.
精彩评论