Skip to content

API XMLSec Core Errors

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

Error Reporting

API Group: xmlsec_core_errors

Error codes and error-reporting functions.

Error reporting and logging functions.

Macros

XMLSEC_ERRORS_R_XMLSEC_FAILED

Defined as: 1

Source: include/xmlsec/errors.h

An XMLSec function failed.


XMLSEC_ERRORS_R_MALLOC_FAILED

Defined as: 2

Source: include/xmlsec/errors.h

Failed to allocate memory error.


XMLSEC_ERRORS_R_STRDUP_FAILED

Defined as: 3

Source: include/xmlsec/errors.h

Failed to duplicate string error.


XMLSEC_ERRORS_R_CRYPTO_FAILED

Defined as: 4

Source: include/xmlsec/errors.h

Crypto (e.g. OpenSSL) function failed.


XMLSEC_ERRORS_R_XML_FAILED

Defined as: 5

Source: include/xmlsec/errors.h

LibXML function failed.


XMLSEC_ERRORS_R_XSLT_FAILED

Defined as: 6

Source: include/xmlsec/errors.h

LibXSLT function failed.


XMLSEC_ERRORS_R_IO_FAILED

Defined as: 7

Source: include/xmlsec/errors.h

IO operation failed.


XMLSEC_ERRORS_R_DISABLED

Defined as: 8

Source: include/xmlsec/errors.h

The feature is disabled during compilation.

The feature is disabled during compilation. Check './configure –help' for details on how to enable it.


XMLSEC_ERRORS_R_NOT_IMPLEMENTED

Defined as: 9

Source: include/xmlsec/errors.h

Feature is not implemented.


XMLSEC_ERRORS_R_INVALID_CONFIG

Defined as: 10

Source: include/xmlsec/errors.h

The configuration is invalid.


XMLSEC_ERRORS_R_INVALID_SIZE

Defined as: 11

Source: include/xmlsec/errors.h

Invalid size.


XMLSEC_ERRORS_R_INVALID_DATA

Defined as: 12

Source: include/xmlsec/errors.h

Invalid data.


XMLSEC_ERRORS_R_INVALID_RESULT

Defined as: 13

Source: include/xmlsec/errors.h

Invalid result.


XMLSEC_ERRORS_R_INVALID_TYPE

Defined as: 14

Source: include/xmlsec/errors.h

Invalid type.


XMLSEC_ERRORS_R_INVALID_OPERATION

Defined as: 15

Source: include/xmlsec/errors.h

Invalid operation.


XMLSEC_ERRORS_R_INVALID_STATUS

Defined as: 16

Source: include/xmlsec/errors.h

Invalid status.


XMLSEC_ERRORS_R_INVALID_FORMAT

Defined as: 17

Source: include/xmlsec/errors.h

Invalid format.


XMLSEC_ERRORS_R_DATA_NOT_MATCH

Defined as: 18

Source: include/xmlsec/errors.h

The data do not match our expectation.


XMLSEC_ERRORS_R_INVALID_VERSION

Defined as: 19

Source: include/xmlsec/errors.h

Version mismatch.


XMLSEC_ERRORS_R_INVALID_NODE

Defined as: 21

Source: include/xmlsec/errors.h

Invalid node.


XMLSEC_ERRORS_R_INVALID_NODE_CONTENT

Defined as: 22

Source: include/xmlsec/errors.h

Invalid node content.


XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE

Defined as: 23

Source: include/xmlsec/errors.h

Invalid node attribute.


XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE

Defined as: 25

Source: include/xmlsec/errors.h

Missing node attribute.


XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT

Defined as: 26

Source: include/xmlsec/errors.h

Node already present.


XMLSEC_ERRORS_R_UNEXPECTED_NODE

Defined as: 27

Source: include/xmlsec/errors.h

Unexpected node.


XMLSEC_ERRORS_R_NODE_NOT_FOUND

Defined as: 28

Source: include/xmlsec/errors.h

Node not found.


XMLSEC_ERRORS_R_INVALID_TRANSFORM

Defined as: 31

Source: include/xmlsec/errors.h

This transform is invalid.


XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY

Defined as: 32

Source: include/xmlsec/errors.h

Key is invalid for this transform.


XMLSEC_ERRORS_R_INVALID_URI_TYPE

Defined as: 33

Source: include/xmlsec/errors.h

Invalid URI type.


XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED

Defined as: 34

Source: include/xmlsec/errors.h

The transform requires the same document as context.

The transform requires the input document to be the same as context.


XMLSEC_ERRORS_R_TRANSFORM_DISABLED

Defined as: 35

Source: include/xmlsec/errors.h

The transform is disabled.


XMLSEC_ERRORS_R_INVALID_ALGORITHM

Defined as: 36

Source: include/xmlsec/errors.h

Invalid or unsupported algorithm.


XMLSEC_ERRORS_R_INVALID_KEY_DATA

Defined as: 41

Source: include/xmlsec/errors.h

Key data is invalid.


XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND

Defined as: 42

Source: include/xmlsec/errors.h

Key data is not found.


XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST

Defined as: 43

Source: include/xmlsec/errors.h

The key data already exists.


XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE

Defined as: 44

Source: include/xmlsec/errors.h

Invalid key size.


XMLSEC_ERRORS_R_KEY_NOT_FOUND

Defined as: 45

Source: include/xmlsec/errors.h

Key not found.


XMLSEC_ERRORS_R_KEYDATA_DISABLED

Defined as: 46

Source: include/xmlsec/errors.h

The key data type is disabled.


XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL

Defined as: 51

Source: include/xmlsec/errors.h

Max allowed retrievals level reached.


XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH

Defined as: 52

Source: include/xmlsec/errors.h

Key data type mismatch in dsig:RetrievalMethod node.

The retrieved key data type does not match the one specified in the dsig:RetrievalMethod/ node.


XMLSEC_ERRORS_R_MAX_KEYINFOREFERENCE_LEVEL

Defined as: 51

Source: include/xmlsec/errors.h

Max allowed KeyInfoReference level reached.


XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL

Defined as: 61

Source: include/xmlsec/errors.h

Max EncryptedKey level reached.


XMLSEC_ERRORS_R_CERT_VERIFY_FAILED

Defined as: 71

Source: include/xmlsec/errors.h

Certificate verification failed.


XMLSEC_ERRORS_R_CERT_NOT_FOUND

Defined as: 72

Source: include/xmlsec/errors.h

Requested certificate is not found.


XMLSEC_ERRORS_R_CERT_REVOKED

Defined as: 73

Source: include/xmlsec/errors.h

The certificate is revoked.


XMLSEC_ERRORS_R_CERT_ISSUER_FAILED

Defined as: 74

Source: include/xmlsec/errors.h

Failed to get certificate issuer.


XMLSEC_ERRORS_R_CERT_NOT_YET_VALID

Defined as: 75

Source: include/xmlsec/errors.h

"Not valid before" verification failed.


XMLSEC_ERRORS_R_CERT_HAS_EXPIRED

Defined as: 76

Source: include/xmlsec/errors.h

"Not valid after" verification failed.


XMLSEC_ERRORS_R_CRL_VERIFY_FAILED

Defined as: 77

Source: include/xmlsec/errors.h

CRL verification failed.


XMLSEC_ERRORS_R_CRL_NOT_YET_VALID

Defined as: 78

Source: include/xmlsec/errors.h

"Last update" CRL verification failed.


XMLSEC_ERRORS_R_CRL_HAS_EXPIRED

Defined as: 79

Source: include/xmlsec/errors.h

"Next update" verification failed.


XMLSEC_ERRORS_R_DSIG_NO_REFERENCES

Defined as: 81

Source: include/xmlsec/errors.h

The dsig:Reference/ nodes not found.


XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE

Defined as: 82

Source: include/xmlsec/errors.h

The dsig:Reference/ validation failed.


XMLSEC_ERRORS_R_ASSERTION

Defined as: 100

Source: include/xmlsec/errors.h

Invalid assertion.


XMLSEC_ERROR_R_CAST_IMPOSSIBLE

Defined as: 101

Source: include/xmlsec/errors.h

Impossible to cast from one type to another.


XMLSEC_ERRORS_MAX_NUMBER

Defined as: 256

Source: include/xmlsec/errors.h

The maximum xmlsec errors number.


__XMLSEC_FUNCTION__

Defined as: __func__

Source: include/xmlsec/errors.h

The current function name (compiler-specific).


XMLSEC_ERRORS_HERE

Defined as: __FILE__,__LINE__,__XMLSEC_FUNCTION__

Source: include/xmlsec/errors.h

The macro specifying the error location (file, line, function) for xmlSecError().

defined(XMLSEC_FUNCTION)

The macro that specifies the location (file, line and function) for the xmlSecError() function.


XMLSEC_ERRORS_PRINTF_ATTRIBUTE

Defined as: __attribute__ ((format (printf, 7, 8)))

Source: include/xmlsec/errors.h

Printf-style format-string attribute for xmlSecError() (GCC/Clang only).

Printf-style format-string attribute for the xmlSecError() function (GCC/Clang only; empty on other compilers).


xmlSecErrorsSafeString

Defined as: (((str) != NULL) ? ((const char*)(str)) : (const char*)"NULL")

Source: include/xmlsec/errors.h

Macro. Returns str if it is not NULL or pointer to "NULL" otherwise.

Parameters:

  • str — the string.

XMLSEC_ERRORS_NO_MESSAGE

Defined as: " "

Source: include/xmlsec/errors.h

Empty error message " ".


xmlSecAssert

Defined as: if(!( p ) ) { \ xmlSecError(XMLSEC_ERRORS_HERE, \ NULL, \ #p, \ XMLSEC_ERRORS_R_ASSERTION, \ XMLSEC_ERRORS_NO_MESSAGE); \ return; \ }

Source: include/xmlsec/errors.h

Macro. Verifies that is true and calls return() otherwise.

Parameters:

  • p — the expression.

xmlSecAssert2

Defined as: if(!( p ) ) { \ xmlSecError(XMLSEC_ERRORS_HERE, \ NULL, \ #p, \ XMLSEC_ERRORS_R_ASSERTION, \ XMLSEC_ERRORS_NO_MESSAGE); \ return(ret); \ }

Source: include/xmlsec/errors.h

Macro. Verifies that is true and calls return(ret) otherwise.

Parameters:

  • p — the expression.
  • ret — the return value.

Typedefs

xmlSecErrorsCallback

typedef void(* xmlSecErrorsCallback) (const char *file, int line, const char *func, const char *errorObject, const char *errorSubject, int reason, const char *msg))(const char *file, int line, const char *func, const char *errorObject, const char *errorSubject, int reason, const char *msg);

Source: include/xmlsec/errors.h

The errors reporting callback function.

Parameters:

  • line — the error location line number (LINE macro).
  • func — the error location function name (func macro).
  • errorObject — the error specific error object (e.g. transform, key data, etc).
  • errorSubject — the error specific error subject.
  • reason — the error code.
  • msg — the additional error message.

Functions

xmlSecErrorsInit

void xmlSecErrorsInit(void);

Source: include/xmlsec/errors.h

Initializes the errors reporting.

Initializes the errors reporting. It is called from xmlSecInit function. and applications must not call this function directly.


xmlSecErrorsShutdown

void xmlSecErrorsShutdown(void);

Source: include/xmlsec/errors.h

Cleanups the errors reporting.

Cleanups the errors reporting. It is called from xmlSecShutdown function. and applications must not call this function directly.


xmlSecErrorsSetCallback

void xmlSecErrorsSetCallback(xmlSecErrorsCallback callback);

Source: include/xmlsec/errors.h

Sets the errors callback function.

Sets the errors callback function to callback that will be called every time an error occurs.

Parameters:

  • callback — the new errors callback function.

xmlSecErrorsDefaultCallback

void xmlSecErrorsDefaultCallback(const char *file, int line, const char *func, const char *errorObject, const char *errorSubject, int reason, const char *msg);

Source: include/xmlsec/errors.h

The default error reporting callback using LibXML.

The default error reporting callback that utilizes LibXML error reporting xmlGenericError function.

Parameters:

  • file — the error location file name (FILE macro).
  • line — the error location line number (LINE macro).
  • func — the error location function name (FUNCTION macro).
  • errorObject — the error specific error object
  • errorSubject — the error specific error subject.
  • reason — the error code.S
  • msg — the additional error message.

xmlSecErrorsDefaultCallbackEnableOutput

void xmlSecErrorsDefaultCallbackEnableOutput(int enabled);

Source: include/xmlsec/errors.h

Enables or disables output from the default errors callback.

Enables or disables calling LibXML2 callback from the default errors callback.

Parameters:

  • enabled — the flag.

xmlSecErrorsGetCode

int xmlSecErrorsGetCode(xmlSecSize pos);

Source: include/xmlsec/errors.h

Gets the known error code at position pos.

Parameters:

  • pos — the error position.

Returns: the known error code or 0 if pos is greater than total number of known error codes.


xmlSecErrorsGetMsg

const char * xmlSecErrorsGetMsg(xmlSecSize pos);

Source: include/xmlsec/errors.h

Gets the known error message at position pos.

Parameters:

  • pos — the error position.

Returns: the known error message or NULL if pos is greater than total number of known error codes.


xmlSecErrorsPrintCryptoLibraryLogOnExitSet

void xmlSecErrorsPrintCryptoLibraryLogOnExitSet(int enabled);

Source: include/xmlsec/errors.h

Enables or disables the crypto library error log dump on exit.

Enables or disables the crypto library error log dump on exit (only supported by OpenSSL).

Parameters:

  • enabled — the flag

xmlSecError

void xmlSecError(const char *file, int line, const char *func, const char *errorObject, const char *errorSubject, int reason, const char *msg,...) XMLSEC_ERRORS_PRINTF_ATTRIBUTE;

Source: include/xmlsec/errors.h

Reports an error to the error callback.

Reports an error to the default (xmlSecErrorsDefaultCallback) or application specific callback installed using xmlSecErrorsSetCallback function.

Parameters:

  • file — the error location filename (FILE).
  • line — the error location line number (LINE).
  • func — the error location function (FUNCTION).
  • errorObject — the error specific error object (e.g. transform, key data, etc).
  • errorSubject — the error specific error subject (e.g. failed function name).
  • reason — the error code.
  • msg — the error message in printf format.
  • ... — the parameters for the msg.

Clone this wiki locally