Skip to content

API XMLSec Core Helpers

Aleksey Sanin edited this page Jun 22, 2026 · 5 revisions

XML Security Init/Shutdown

API Group: xmlsec_core_helpers

Library initialisation, shutdown, configuration, and other helper functions and macros.

Utility functions. Various utility functions.

Macros

XMLSEC_DEPRECATED

Defined as: __attribute__((deprecated))

Source: include/xmlsec/xmlsec.h

Marks function as deprecated.


XMLSEC_SIZE_T_FMT

Defined as: "%zu"

Source: include/xmlsec/xmlsec.h

The printf format specifier for size_t.

The only reason we need this is that MinGW doesn't recognize "%zu" despite the fact that MSVC runtime supports it for 10+ years.


XMLSEC_SIZE_MIN

Defined as: ((xmlSecSize)0)

Source: include/xmlsec/xmlsec.h

The minimum value of xmlSecSize (0).


XMLSEC_SIZE_MAX

Defined as: SIZE_MAX

Source: include/xmlsec/xmlsec.h

The maximum value of xmlSecSize.


XMLSEC_SIZE_FMT

Defined as: XMLSEC_SIZE_T_FMT

Source: include/xmlsec/xmlsec.h

The printf format specifier for xmlSecSize.


xmlSecCheckVersionExact

Defined as: xmlSecCheckVersionExt(XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR, xmlSecCheckVersionExactMatch)

Source: include/xmlsec/xmlsec.h

Checks if loaded library version exactly matches.

Macro. Returns 1 if the loaded xmlsec library version exactly matches the one used to compile the caller, 0 if it does not or a negative value if an error occurs.


xmlSecCheckVersion

Defined as: xmlSecCheckVersionExt(XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR, xmlSecCheckVersionABICompatible)

Source: include/xmlsec/xmlsec.h

Checks if loaded library version is ABI compatible.

Macro. Returns 1 if the loaded xmlsec library version ABI compatible with the one used to compile the caller, 0 if it does not or a negative value if an error occurs.


Typedefs

xmlSecPtr

typedef void* xmlSecPtr;

Source: include/xmlsec/xmlsec.h

Void pointer.


xmlSecSize

typedef size_t xmlSecSize;

Source: include/xmlsec/xmlsec.h

Size of something.


xmlSecByte

typedef unsigned char xmlSecByte;

Source: include/xmlsec/xmlsec.h

One byte.


Enumerations

xmlSecCheckVersionMode

Source: include/xmlsec/xmlsec.h

The xmlsec library version mode.

Value Initializer Description
xmlSecCheckVersionExactMatch = 0
xmlSecCheckVersionABICompatible ``

Functions

xmlSecInit

int xmlSecInit(void);

Source: include/xmlsec/xmlsec.h

Initializes XML Security Library.

Initializes XML Security Library. The depended libraries (LibXML and LibXSLT) must be initialized before.

Note: The application SHOULD NOT initialize the XML Security Library more than once per process.

Returns: 0 on success or a negative value otherwise.


xmlSecShutdown

int xmlSecShutdown(void);

Source: include/xmlsec/xmlsec.h

Clean ups the XML Security Library.

Clean ups the XML Security Library.

Note: Once this function has been called it might be impossible to reinitialise the library correctly.

Returns: 0 on success or a negative value otherwise.


xmlSecGetDefaultCrypto

const xmlChar * xmlSecGetDefaultCrypto(void);

Source: include/xmlsec/xmlsec.h

Gets the default crypto engine for the XML Security Library.

Gets the default crypto engine ("openssl", "nss", etc.) for the XML Security Library.

Returns: the default crypto engine ("openssl", "nss", etc.).


xmlSecSetExternalEntityLoader

void xmlSecSetExternalEntityLoader(xmlExternalEntityLoader entityLoader);

Source: include/xmlsec/xmlsec.h

Wrapper for xmlSetExternalEntityLoader.

Parameters:

  • entityLoader — the new entity resolver function, or NULL to restore libxml2's default handler

xmlSecStrlen

xmlSecSize xmlSecStrlen(const xmlChar *str);

Source: include/xmlsec/xmlsec.h

Calculates the length of the string.

Parameters:

  • str — the string.

Returns: the length of the string.


xmlSecCheckVersionExt

int xmlSecCheckVersionExt(int major, int minor, int subminor, xmlSecCheckVersionMode mode);

Source: include/xmlsec/xmlsec.h

Checks if the loaded version of xmlsec library could be used.

Parameters:

  • major — the major version number.
  • minor — the minor version number.
  • subminor — the subminor version number.
  • mode — the version check mode.

Returns: 1 if the loaded xmlsec library version is OK to use 0 if it is not or a negative value if an error occurs.


Clone this wiki locally