m_context.allowBrokenChain = true;
// XmlSec validate
- XmlSecSingleton::Instance().validate(m_context);
+ m_xmlSec.validate(m_context);
// Check reference of 'Object' tag - OID
m_data.setReference(m_context.referenceSet);
// XmlSec validate
if (uriList.size() == 0)
- XmlSecSingleton::Instance().validateNoHash(m_context);
+ m_xmlSec.validateNoHash(m_context);
else
- XmlSecSingleton::Instance().validatePartialHash(m_context, uriList);
+ m_xmlSec.validatePartialHash(m_context, uriList);
if (checkOcsp && Ocsp::check(m_data) == Ocsp::Result::REVOKED) {
LogError("Certificate is Revoked by OCSP server.");
bool checkObjectReferences(void);
PluginHandler m_pluginHandler;
+ XmlSec m_xmlSec;
};
} // namespace ValidationCore
#include <dpl/assert.h>
#include <dpl/log/log.h>
-#include <dpl/singleton_impl.h>
#include <vcore/XmlsecAdapter.h>
#define VCORE_ERRORS_BUFFER_SIZE 1024
-IMPLEMENT_SINGLETON(ValidationCore::XmlSec)
-
namespace {
struct FileWrapper {
LogDebug(buff);
}
-XmlSec::XmlSec()
- : m_initialized(false)
- , m_pList(nullptr)
+XmlSec::XmlSec() : m_pList(nullptr)
{
LIBXML_TEST_VERSION
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
ThrowMsg(Exception::InternalError,
"Xmlsec-crypto initialization failed.");
}
-
- m_initialized = true;
}
XmlSec::~XmlSec()
{
- if (m_initialized)
- return;
-
xmlSecCryptoShutdown();
xmlSecCryptoAppShutdown();
xmlSecShutdown();
xsltCleanupGlobals();
#endif
s_prefixPath.clear();
- m_initialized = false;
}
void XmlSec::validateFile(XmlSecContext &context, xmlSecKeysMngrPtr mngrPtr)
Assert(!!context.certificatePtr || !context.certificatePath.empty());
xmlSecErrorsSetCallback(LogDebugPrint);
- if (!m_initialized)
- ThrowMsg(Exception::InternalError, "XmlSec is not initialized");
-
std::unique_ptr<xmlSecKeysMngr, std::function<void(xmlSecKeysMngrPtr)>>
mngrPtr(xmlSecKeysMngrCreate(), xmlSecKeysMngrDestroy);
#include <xmlsec/keysmngr.h>
#include <dpl/exception.h>
-#include <dpl/singleton.h>
#include <vcore/Certificate.h>
#include <vcore/SignatureData.h>
};
ValidateMode m_mode;
- bool m_initialized;
const std::list<std::string> *m_pList;
void loadDERCertificateMemory(XmlSecContext &context, xmlSecKeysMngrPtr mngr);
static void fileExtractPrefix(XmlSecContext &context);
};
-typedef VcoreDPL::Singleton<XmlSec> XmlSecSingleton;
-
} // namespace ValidationCore