## xmlsec xmlsec — Utility functions. |

## Stability Level

Stable, unless otherwise indicated

## Functions

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

## Types and Values

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

## Description

## Functions

### XMLSEC_SIZE_BAD_CAST()

    #define XMLSEC_SIZE_BAD_CAST(val)               ((xmlSecSize)(val))

Bad cast to xmlSecSize. This macro is deprecated and will be removed in the future versions of LibXMLSec.

#### Parameters

val | the value to cast |

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

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

#### Returns

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

### xmlSecGetDefaultCrypto ()

    const xmlChar *
    xmlSecGetDefaultCrypto (void);

### xmlSecSetExternalEntityLoader ()

    void
    xmlSecSetExternalEntityLoader (xmlExternalEntityLoader Param1);

### 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

### 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

    #define xmlSecSize                              unsigned int

Size of something. Should be typedef instead of define but it will break ABI (todo).

### XMLSEC_SIZE_MAX

    #define XMLSEC_SIZE_MAX                         UINT_MAX

### XMLSEC_SIZE_FMT

    #define XMLSEC_SIZE_FMT                         "%u"

### XMLSEC_SIZE_MIN

    #define XMLSEC_SIZE_MIN                         ((xmlSecSize)0)

### xmlSecByte

    #define xmlSecByte                              unsigned char

One byte. Should be typedef instead of define but it will break ABI (todo).

### XMLSEC_CRYPTO

    #define XMLSEC_CRYPTO                          (xmlSecGetDefaultCrypto())

Macro. Deprecated. Defined for backward compatibility only. Do not use in your code and use `xmlSecGetDefaultCrypto()` function instead.

Returns the default crypto engine.

### XMLSEC_DEPRECATED

    #define XMLSEC_DEPRECATED __attribute__((deprecated))

### enum xmlSecCheckVersionMode

The xmlsec library version mode.

#### Members

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