#include <xmlsec/dl.h>
#include <xmlsec/app.h>
#include <xmlsec/crypto.h>
+#include "compose.hpp"
using std::string;
using std::list;
throw MiscError ("could not create signature context");
}
- signature_context->signKey = xmlSecCryptoAppKeyLoad (_key.string().c_str(), xmlSecKeyDataFormatPem, 0, 0, 0);
+ signature_context->signKey = xmlSecCryptoAppKeyLoadMemory (
+ reinterpret_cast<const unsigned char *> (_key.c_str()), _key.size(), xmlSecKeyDataFormatPem, 0, 0, 0
+ );
+
if (signature_context->signKey == 0) {
throw FileError ("could not load private key file", _key, 0);
}
throw MiscError ("could not set key name");
}
- if (xmlSecDSigCtxSign (signature_context, parent->cobj ()) < 0) {
- throw MiscError ("could not sign");
+ int const r = xmlSecDSigCtxSign (signature_context, parent->cobj ());
+ if (r < 0) {
+ throw MiscError (String::compose ("could not sign (%1)", r));
}
xmlSecDSigCtxDestroy (signature_context);