xmlsec: XML Security Library Reference Manual

## xmlsec xmlsec — Utility functions. |

## Stability Level

Stable, unless otherwise indicated

## Functions

int | xmlSecInit ()
int | xmlSecShutdown ()
const xmlChar * | xmlSecGetDefaultCrypto ()
void | xmlSecSetExternalEntityLoader ()
xmlSecSize | xmlSecStrlen ()
#define | xmlSecCheckVersionExact
#define | xmlSecCheckVersion
int | xmlSecCheckVersionExt ()

## Types and Values

#define | XMLSEC_DEPRECATED
typedef | xmlSecPtr
#define | XMLSEC_SIZE_T_FMT
typedef | xmlSecSize
#define | XMLSEC_SIZE_MIN
#define | XMLSEC_SIZE_MAX
#define | XMLSEC_SIZE_FMT
typedef | xmlSecByte
enum | xmlSecCheckVersionMode

## Description

Various utility functions.

## Functions

### xmlSecInit ()

    int
    xmlSecInit (void);

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

#### Returns

0 on success or a negative value otherwise.

### xmlSecShutdown ()

    int
    xmlSecShutdown (void);

Clean ups the XML Security Library.

#### Returns

0 on success or a negative value otherwise.

### xmlSecGetDefaultCrypto ()

    const xmlChar *
    xmlSecGetDefaultCrypto (void);

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);

Wrapper for xmlSetExternalEntityLoader.

#### Parameters

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

### xmlSecStrlen ()

    xmlSecSize
    xmlSecStrlen (const xmlChar *str);

Calcaulates the lenght of the string.

#### Parameters

str | the string. |

#### Returns

the length of the string.

### xmlSecCheckVersionExact

    #define             xmlSecCheckVersionExact()

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

    #define             xmlSecCheckVersion()

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.

### xmlSecCheckVersionExt ()

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

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.

## Types and Values

### XMLSEC_DEPRECATED

    #define XMLSEC_DEPRECATED __attribute__((deprecated))

Marks function as deprecated.

### xmlSecPtr

    typedef void*                                   xmlSecPtr;

Void pointer.

### XMLSEC_SIZE_T_FMT

    #define XMLSEC_SIZE_T_FMT                      "%llu"

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

### xmlSecSize

    typedef size_t xmlSecSize;

Size of something.

### XMLSEC_SIZE_MIN

    #define XMLSEC_SIZE_MIN                         ((xmlSecSize)0)

### XMLSEC_SIZE_MAX

    #define XMLSEC_SIZE_MAX                         SIZE_MAX

### XMLSEC_SIZE_FMT

    #define XMLSEC_SIZE_FMT                         XMLSEC_SIZE_T_FMT

### xmlSecByte

    typedef unsigned char xmlSecByte;

One byte.

### enum xmlSecCheckVersionMode

The xmlsec library version mode.

#### Members

xmlSecCheckVersionExactMatch | the version should match exactly. |
xmlSecCheckVersionABICompatible | the version should be ABI compatible. |