facho-signer: se usa autoconf
FossilOrigin-Name: 5a7e25376d54d22f8d955c9b6827785d2efd673fee9813b27f4ce39d4a3e8f7e
This commit is contained in:
parent
7181c004cb
commit
27ebbecc01
@ -1,17 +0,0 @@
|
|||||||
.PHONY: facho-signer
|
|
||||||
|
|
||||||
CC = gcc
|
|
||||||
|
|
||||||
CFLAGS = -Wall -Werror -std=gnu11
|
|
||||||
CFLAGS += $(shell pkg-config libxml-2.0 --cflags)
|
|
||||||
CFLAGS += $(shell pkg-config xmlsec1 --cflags)
|
|
||||||
CFLAGS += $(shell pkg-config xmlsec1-openssl --cflags)
|
|
||||||
CFLAGS += -Ixades
|
|
||||||
|
|
||||||
LDFLAGS = $(shell pkg-config libxml-2.0 --libs)
|
|
||||||
LDFLAGS += $(shell pkg-config xmlsec1 --libs)
|
|
||||||
LDFLAGS += $(shell pkg-config xmlsec1-openssl --libs)
|
|
||||||
LDFLAGS += xades/templates.c xades/xades.c
|
|
||||||
|
|
||||||
facho-signer: crypto.c facho-signer.c
|
|
||||||
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^
|
|
1
experimental/facho-signer/Makefile.am
Normal file
1
experimental/facho-signer/Makefile.am
Normal file
@ -0,0 +1 @@
|
|||||||
|
SUBDIRS = src
|
2
experimental/facho-signer/boostrap.sh
Normal file
2
experimental/facho-signer/boostrap.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
autoreconf --install
|
39
experimental/facho-signer/configure.ac
Normal file
39
experimental/facho-signer/configure.ac
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# -*- Autoconf -*-
|
||||||
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
|
AC_PREREQ([2.71])
|
||||||
|
AC_INIT([facho-signer], [0.0.1], [bit4bit@riseup.net])
|
||||||
|
AM_INIT_AUTOMAKE
|
||||||
|
AC_CONFIG_SRCDIR([src/facho_signer.c])
|
||||||
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
|
||||||
|
# Checks for programs.
|
||||||
|
AC_PROG_CC
|
||||||
|
|
||||||
|
# Checks for libraries.
|
||||||
|
|
||||||
|
# Checks for header files.
|
||||||
|
AC_CHECK_HEADERS([sys/time.h unistd.h])
|
||||||
|
|
||||||
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
|
|
||||||
|
# Checks for library functions.
|
||||||
|
AC_FUNC_MALLOC
|
||||||
|
AC_CHECK_FUNCS([clock_gettime gethrtime gettimeofday memset strdup])
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES([XMLSEC1], [xmlsec1-openssl])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([xmlsec-crypto-dynamic-loading],
|
||||||
|
AS_HELP_STRING([--enable-xmlsec-crypto-dynamic-loading],
|
||||||
|
[enable crypto xmlsec dynamic loading])
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "x$enable_xmlsec_crypto_dynamic_loading" == xyes; then
|
||||||
|
AC_DEFINE([XMLSEC_CRYPTO_DYNAMIC_LOADING], [1], [enable xmlsec crypto dynamic loading])
|
||||||
|
else
|
||||||
|
AC_DEFINE([XMLSEC_NO_CRYPTO_DYNAMIC_LOADING], [1], [disable xmlsec crypto dynamic loading])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([Makefile src/Makefile])
|
||||||
|
AC_OUTPUT
|
4
experimental/facho-signer/src/Makefile.am
Normal file
4
experimental/facho-signer/src/Makefile.am
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bin_PROGRAMS = facho_signer
|
||||||
|
facho_signer_SOURCES = xades/xmlsec1/xmltree.c xades/xmlsec1/errors.c xades/templates.c xades/xades.c facho_signer.c
|
||||||
|
facho_signer_CFLAGS = $(XMLSEC1_CFLAGS) -DXMLSEC_NOT_CRYPTO_DYNAMIC_LOADING
|
||||||
|
facho_signer_LDADD = $(XMLSEC1_LIBS)
|
11
experimental/facho-signer/src/README.md
Normal file
11
experimental/facho-signer/src/README.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# facho-signer
|
||||||
|
|
||||||
|
|
||||||
|
## guia
|
||||||
|
|
||||||
|
- http://xmlsoft.org/html/libxml-tree.html
|
||||||
|
- http://xmlsoft.org/html/libxml-xpath.html
|
||||||
|
- http://xmlsoft.org/examples/xpath1.c
|
||||||
|
- http://xmlsoft.org/tutorial/ar01s05.html
|
||||||
|
- https://www.aleksey.com/xmlsec/api/xmlsec-reference.html
|
||||||
|
- https://zakird.com/2013/10/13/certificate-parsing-with-openssl
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "config.h"
|
||||||
#include "xades/xades.h"
|
#include "xades/xades.h"
|
||||||
|
|
||||||
#include <xmlsec/xmlsec.h>
|
#include <xmlsec/xmlsec.h>
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "config.h"
|
||||||
#include "xades.h"
|
#include "xades.h"
|
||||||
|
|
||||||
#include <libxml/xpath.h>
|
#include <libxml/xpath.h>
|
||||||
@ -9,6 +10,15 @@
|
|||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
|
|
||||||
#include <xmlsec/buffer.h>
|
#include <xmlsec/buffer.h>
|
||||||
|
#include <xmlsec/app.h>
|
||||||
|
#include <xmlsec/transforms.h>
|
||||||
|
#include <xmlsec/keysdata.h>
|
||||||
|
|
||||||
|
#ifndef XMLSEC_CRYPTO_DYNAMIC_LOADING
|
||||||
|
#include <xmlsec/openssl/crypto.h>
|
||||||
|
#include <xmlsec/openssl/symbols.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <xmlsec/xmltree.h>
|
#include <xmlsec/xmltree.h>
|
||||||
#include <xmlsec/transforms.h>
|
#include <xmlsec/transforms.h>
|
||||||
#include <xmlsec/app.h>
|
|
||||||
#include <xmlsec/xmldsig.h>
|
#include <xmlsec/xmldsig.h>
|
||||||
#include <xmlsec/openssl/x509.h>
|
#include <xmlsec/openssl/x509.h>
|
||||||
#include <xmlsec/base64.h>
|
#include <xmlsec/base64.h>
|
259
experimental/facho-signer/src/xmlsec1/errors.c
Normal file
259
experimental/facho-signer/src/xmlsec1/errors.c
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
/*
|
||||||
|
* XML Security Library (http://www.aleksey.com/xmlsec).
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This is free software; see Copyright file in the source
|
||||||
|
* distribution for preciese wording.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* SECTION:errors
|
||||||
|
* @Short_description: Error reporting and logging functions.
|
||||||
|
* @Stability: Stable
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XMLSEC_PRIVATE 1
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <libxml/tree.h>
|
||||||
|
|
||||||
|
#include <xmlsec/xmlsec.h>
|
||||||
|
#include <xmlsec/xmltree.h>
|
||||||
|
#include <xmlsec/private.h>
|
||||||
|
#include <xmlsec/errors.h>
|
||||||
|
|
||||||
|
/* Must be bigger than fatal_error */
|
||||||
|
#define XMLSEC_ERRORS_BUFFER_SIZE 1024
|
||||||
|
|
||||||
|
/* Must fit into xmlChar[XMLSEC_ERRORS_BUFFER_SIZE] */
|
||||||
|
static const xmlChar fatal_error[] = "Can not format error message";
|
||||||
|
|
||||||
|
typedef struct _xmlSecErrorDescription xmlSecErrorDescription, *xmlSecErrorDescriptionPtr;
|
||||||
|
struct _xmlSecErrorDescription {
|
||||||
|
int errorCode;
|
||||||
|
const char* errorMsg;
|
||||||
|
};
|
||||||
|
|
||||||
|
static xmlSecErrorDescription xmlSecErrorsTable[XMLSEC_ERRORS_MAX_NUMBER + 1] = {
|
||||||
|
{ XMLSEC_ERRORS_R_XMLSEC_FAILED, "xmlsec library function failed" },
|
||||||
|
{ XMLSEC_ERRORS_R_MALLOC_FAILED, "malloc function failed" },
|
||||||
|
{ XMLSEC_ERRORS_R_STRDUP_FAILED, "strdup function failed" },
|
||||||
|
{ XMLSEC_ERRORS_R_CRYPTO_FAILED, "crypto library function failed" },
|
||||||
|
{ XMLSEC_ERRORS_R_XML_FAILED, "libxml2 library function failed" },
|
||||||
|
{ XMLSEC_ERRORS_R_XSLT_FAILED, "libxslt library function failed" },
|
||||||
|
{ XMLSEC_ERRORS_R_IO_FAILED, "io function failed" },
|
||||||
|
{ XMLSEC_ERRORS_R_DISABLED, "feature is disabled" },
|
||||||
|
{ XMLSEC_ERRORS_R_NOT_IMPLEMENTED, "feature is not implemented" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_CONFIG, "invalid configuration" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_SIZE, "invalid size" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_DATA, "invalid data" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_RESULT, "invalid result" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_TYPE, "invalid type" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_OPERATION, "invalid operation" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_STATUS, "invalid status" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_FORMAT, "invalid format" },
|
||||||
|
{ XMLSEC_ERRORS_R_DATA_NOT_MATCH, "data do not match" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_VERSION, "invalid version" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_NODE, "invalid node" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, "invalid node content" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE, "invalid node attribute" },
|
||||||
|
{ XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE, "missing node attribute" },
|
||||||
|
{ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, "node already present" },
|
||||||
|
{ XMLSEC_ERRORS_R_UNEXPECTED_NODE, "unexpected node" },
|
||||||
|
{ XMLSEC_ERRORS_R_NODE_NOT_FOUND, "node node found" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_TRANSFORM, "invalid transform" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY, "invalid transform key" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_URI_TYPE, "invalid URI type" },
|
||||||
|
{ XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED, "same document is required for transform" },
|
||||||
|
{ XMLSEC_ERRORS_R_TRANSFORM_DISABLED, "transform is disabled" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_KEY_DATA, "invalid key data" },
|
||||||
|
{ XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND, "key data is not found" },
|
||||||
|
{ XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST, "key data already exist" },
|
||||||
|
{ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE, "invalid key data size" },
|
||||||
|
{ XMLSEC_ERRORS_R_KEY_NOT_FOUND, "key is not found" },
|
||||||
|
{ XMLSEC_ERRORS_R_KEYDATA_DISABLED, "key data is disabled" },
|
||||||
|
{ XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL, "maximum key retrieval level" },
|
||||||
|
{ XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH,"key retrieval type mismatch" },
|
||||||
|
{ XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL, "maximum encrypted key level" },
|
||||||
|
{ XMLSEC_ERRORS_R_CERT_VERIFY_FAILED, "certificate verification failed" },
|
||||||
|
{ XMLSEC_ERRORS_R_CERT_NOT_FOUND, "certificate is not found" },
|
||||||
|
{ XMLSEC_ERRORS_R_CERT_REVOKED, "certificate is revoked" },
|
||||||
|
{ XMLSEC_ERRORS_R_CERT_ISSUER_FAILED, "certificate issuer check failed" },
|
||||||
|
{ XMLSEC_ERRORS_R_CERT_NOT_YET_VALID, "certificate is not yet valid" },
|
||||||
|
{ XMLSEC_ERRORS_R_CERT_HAS_EXPIRED, "certificate has expired" },
|
||||||
|
{ XMLSEC_ERRORS_R_DSIG_NO_REFERENCES, "Reference nodes are not found" },
|
||||||
|
{ XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE, "Reference verification failed" },
|
||||||
|
{ XMLSEC_ERRORS_R_ASSERTION, "assertion" },
|
||||||
|
{ 0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
static xmlSecErrorsCallback xmlSecErrorsClbk = xmlSecErrorsDefaultCallback;
|
||||||
|
static int xmlSecPrintErrorMessages = 1; /* whether the error messages will be printed immediately */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecErrorsInit:
|
||||||
|
*
|
||||||
|
* Initializes the errors reporting. It is called from #xmlSecInit function.
|
||||||
|
* and applications must not call this function directly.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlSecErrorsInit(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecErrorsShutdown:
|
||||||
|
*
|
||||||
|
* Cleanups the errors reporting. It is called from #xmlSecShutdown function.
|
||||||
|
* and applications must not call this function directly.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlSecErrorsShutdown(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecErrorsSetCallback:
|
||||||
|
* @callback: the new errors callback function.
|
||||||
|
*
|
||||||
|
* Sets the errors callback function to @callback that will be called
|
||||||
|
* every time an error occurs.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlSecErrorsSetCallback(xmlSecErrorsCallback callback) {
|
||||||
|
xmlSecErrorsClbk = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecErrorsDefaultCallback:
|
||||||
|
* @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.
|
||||||
|
* @msg: the additional error message.
|
||||||
|
*
|
||||||
|
* The default error reporting callback that utilizes LibXML
|
||||||
|
* error reporting #xmlGenericError function.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlSecErrorsDefaultCallback(const char* file, int line, const char* func,
|
||||||
|
const char* errorObject, const char* errorSubject,
|
||||||
|
int reason, const char* msg) {
|
||||||
|
if(xmlSecPrintErrorMessages) {
|
||||||
|
const char* error_msg = NULL;
|
||||||
|
xmlSecSize i;
|
||||||
|
|
||||||
|
for(i = 0; (i < XMLSEC_ERRORS_MAX_NUMBER) && (xmlSecErrorsGetMsg(i) != NULL); ++i) {
|
||||||
|
if(xmlSecErrorsGetCode(i) == reason) {
|
||||||
|
error_msg = xmlSecErrorsGetMsg(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"func=%s:file=%s:line=%d:obj=%s:subj=%s:error=%d:%s:%s\n",
|
||||||
|
(func != NULL) ? func : "unknown",
|
||||||
|
(file != NULL) ? file : "unknown",
|
||||||
|
line,
|
||||||
|
(errorObject != NULL) ? errorObject : "unknown",
|
||||||
|
(errorSubject != NULL) ? errorSubject : "unknown",
|
||||||
|
reason,
|
||||||
|
(error_msg != NULL) ? error_msg : "",
|
||||||
|
(msg != NULL) ? msg : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecErrorsDefaultCallbackEnableOutput:
|
||||||
|
* @enabled: the flag.
|
||||||
|
*
|
||||||
|
* Enables or disables calling LibXML2 callback from the default
|
||||||
|
* errors callback.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlSecErrorsDefaultCallbackEnableOutput(int enabled) {
|
||||||
|
xmlSecPrintErrorMessages = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecErrorsGetCode:
|
||||||
|
* @pos: the error position.
|
||||||
|
*
|
||||||
|
* Gets the known error code at position @pos.
|
||||||
|
*
|
||||||
|
* Returns: the known error code or 0 if @pos is greater than
|
||||||
|
* total number of known error codes.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xmlSecErrorsGetCode(xmlSecSize pos) {
|
||||||
|
/* could not use asserts here! */
|
||||||
|
if(pos < sizeof(xmlSecErrorsTable) / sizeof(xmlSecErrorsTable[0])) {
|
||||||
|
return(xmlSecErrorsTable[pos].errorCode);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecErrorsGetMsg:
|
||||||
|
* @pos: the error position.
|
||||||
|
*
|
||||||
|
* Gets the known error message at position @pos.
|
||||||
|
*
|
||||||
|
* Returns: the known error message or NULL if @pos is greater than
|
||||||
|
* total number of known error codes.
|
||||||
|
*/
|
||||||
|
const char*
|
||||||
|
xmlSecErrorsGetMsg(xmlSecSize pos) {
|
||||||
|
/* could not use asserts here! */
|
||||||
|
if(pos < sizeof(xmlSecErrorsTable) / sizeof(xmlSecErrorsTable[0])) {
|
||||||
|
return(xmlSecErrorsTable[pos].errorMsg);
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecError:
|
||||||
|
* @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.
|
||||||
|
*
|
||||||
|
* Reports an error to the default (#xmlSecErrorsDefaultCallback) or
|
||||||
|
* application specific callback installed using #xmlSecErrorsSetCallback
|
||||||
|
* function.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
xmlSecError(const char* file, int line, const char* func,
|
||||||
|
const char* errorObject, const char* errorSubject,
|
||||||
|
int reason, const char* msg, ...) {
|
||||||
|
if(xmlSecErrorsClbk != NULL) {
|
||||||
|
xmlChar error_msg[XMLSEC_ERRORS_BUFFER_SIZE];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if(msg != NULL) {
|
||||||
|
va_list va;
|
||||||
|
|
||||||
|
va_start(va, msg);
|
||||||
|
ret = xmlStrVPrintf(error_msg, sizeof(error_msg), msg, va);
|
||||||
|
if(ret < 0) {
|
||||||
|
/* Can't really report an error from an error callback */
|
||||||
|
memcpy(error_msg, fatal_error, sizeof(fatal_error));
|
||||||
|
}
|
||||||
|
error_msg[sizeof(error_msg) - 1] = '\0'; /* just in case */
|
||||||
|
va_end(va);
|
||||||
|
} else {
|
||||||
|
error_msg[0] = '\0';
|
||||||
|
}
|
||||||
|
xmlSecErrorsClbk(file, line, func, errorObject, errorSubject, reason, (char*)error_msg);
|
||||||
|
}
|
||||||
|
}
|
869
experimental/facho-signer/src/xmlsec1/errors_helpers.h
Normal file
869
experimental/facho-signer/src/xmlsec1/errors_helpers.h
Normal file
@ -0,0 +1,869 @@
|
|||||||
|
/*
|
||||||
|
* XML Security Library (http://www.aleksey.com/xmlsec).
|
||||||
|
*
|
||||||
|
* Internal header only used during the compilation,
|
||||||
|
*
|
||||||
|
* This is free software; see Copyright file in the source
|
||||||
|
* distribution for preciese wording.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XMLSEC_ERROR_HELPERS_H__
|
||||||
|
#define __XMLSEC_ERROR_HELPERS_H__
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <xmlsec/errors.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
*
|
||||||
|
* Error handling macros.
|
||||||
|
*
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInternalError:
|
||||||
|
* @errorFunction: the failed function name.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting internal XMLSec errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInternalError(errorFunction, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_XMLSEC_FAILED, \
|
||||||
|
XMLSEC_ERRORS_NO_MESSAGE \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInternalError2:
|
||||||
|
* @errorFunction: the failed function name.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @msg: the extra message.
|
||||||
|
* @param: the extra message param.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting internal XMLSec errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInternalError2(errorFunction, errorObject, msg, param) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_XMLSEC_FAILED, \
|
||||||
|
(msg), (param) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInternalError3:
|
||||||
|
* @errorFunction: the failed function name.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @msg: the extra message.
|
||||||
|
* @param1: the extra message param1.
|
||||||
|
* @param2: the extra message param2.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting internal XMLSec errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInternalError3(errorFunction, errorObject, msg, param1, param2) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_XMLSEC_FAILED, \
|
||||||
|
(msg), (param1), (param2) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInternalError4:
|
||||||
|
* @errorFunction: the failed function name.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @msg: the extra message.
|
||||||
|
* @param1: the extra message param1.
|
||||||
|
* @param2: the extra message param2.
|
||||||
|
* @param3: the extra message param3.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting internal XMLSec errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInternalError4(errorFunction, errorObject, msg, param1, param2, param3) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_XMLSEC_FAILED, \
|
||||||
|
(msg), (param1), (param2), (param3) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecMallocError:
|
||||||
|
* @allocSize: the failed allocation size.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting xmlMalloc() errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecMallocError(allocSize, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
"xmlMalloc", \
|
||||||
|
XMLSEC_ERRORS_R_MALLOC_FAILED, \
|
||||||
|
"size=%lu", (unsigned long)(allocSize) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecStrdupError:
|
||||||
|
* @str: the failed string.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting xmlStrdup() errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecStrdupError(str, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
"xmlStrdup", \
|
||||||
|
XMLSEC_ERRORS_R_STRDUP_FAILED, \
|
||||||
|
"size=%lu", (unsigned long)xmlStrlen(str) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecXmlError:
|
||||||
|
* @errorFunction: the failed function.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting generic XML errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecXmlError(errorFunction, errorObject) \
|
||||||
|
{ \
|
||||||
|
xmlErrorPtr error = xmlGetLastError(); \
|
||||||
|
int code = (error != NULL) ? error->code : 0; \
|
||||||
|
const char* message = (error != NULL) ? error->message : NULL; \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_XML_FAILED, \
|
||||||
|
"xml error: %lu: %s", \
|
||||||
|
(unsigned long)code, \
|
||||||
|
xmlSecErrorsSafeString(message) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecXmlError2:
|
||||||
|
* @errorFunction: the failed function.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @msg: the extra message.
|
||||||
|
* @param: the extra message param.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting generic XML errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecXmlError2(errorFunction, errorObject, msg, param) \
|
||||||
|
{ \
|
||||||
|
xmlErrorPtr error = xmlGetLastError(); \
|
||||||
|
int code = (error != NULL) ? error->code : 0; \
|
||||||
|
const char* message = (error != NULL) ? error->message : NULL; \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_XML_FAILED, \
|
||||||
|
msg "; xml error: %lu: %s", \
|
||||||
|
(param), \
|
||||||
|
(unsigned long)code, \
|
||||||
|
xmlSecErrorsSafeString(message) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecXmlParserError:
|
||||||
|
* @errorFunction: the failed function.
|
||||||
|
* @ctxt: the parser context.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting XML parser errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecXmlParserError(errorFunction, ctxt, errorObject) \
|
||||||
|
{ \
|
||||||
|
xmlErrorPtr error = xmlCtxtGetLastError(ctxt);\
|
||||||
|
int code = (error != NULL) ? error->code : 0; \
|
||||||
|
const char* message = (error != NULL) ? error->message : NULL; \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_XML_FAILED, \
|
||||||
|
"xml error: %lu: %s", \
|
||||||
|
(unsigned long)code, \
|
||||||
|
xmlSecErrorsSafeString(message) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecXmlParserError2:
|
||||||
|
* @errorFunction: the failed function.
|
||||||
|
* @ctxt: the parser context.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @msg: the extra message.
|
||||||
|
* @param: the extra message param.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting XML parser errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecXmlParserError2(errorFunction, ctxt, errorObject, msg, param) \
|
||||||
|
{ \
|
||||||
|
xmlErrorPtr error = xmlCtxtGetLastError(ctxt);\
|
||||||
|
int code = (error != NULL) ? error->code : 0; \
|
||||||
|
const char* message = (error != NULL) ? error->message : NULL; \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_XML_FAILED, \
|
||||||
|
msg "; xml error: %lu: %s", \
|
||||||
|
(param), \
|
||||||
|
(unsigned long)code, \
|
||||||
|
xmlSecErrorsSafeString(message) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecXsltError:
|
||||||
|
* @errorFunction: the failed function.
|
||||||
|
* @ctxt: the parser context.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting XSLT errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecXsltError(errorFunction, ctxt, errorObject) \
|
||||||
|
{ \
|
||||||
|
xmlErrorPtr error = xmlGetLastError(); \
|
||||||
|
int code = (error != NULL) ? error->code : 0; \
|
||||||
|
const char* message = (error != NULL) ? error->message : NULL; \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_XSLT_FAILED, \
|
||||||
|
"xslt error: %lu: %s", \
|
||||||
|
(unsigned long)code, \
|
||||||
|
xmlSecErrorsSafeString(message) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecIOError:
|
||||||
|
* @errorFunction: the failed function.
|
||||||
|
* @name: the filename, function name, uri, etc.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting IO errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecIOError(errorFunction, name, errorObject) \
|
||||||
|
{ \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_IO_FAILED, \
|
||||||
|
"name=\"%s\"; errno=%d", \
|
||||||
|
xmlSecErrorsSafeString(name), \
|
||||||
|
errno \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecNotImplementedError:
|
||||||
|
* @details: the additional details.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "not implemented" errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecNotImplementedError(details) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
NULL, \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_NOT_IMPLEMENTED, \
|
||||||
|
"details=%s", \
|
||||||
|
xmlSecErrorsSafeString(details) \
|
||||||
|
)
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidSizeError:
|
||||||
|
* @name: the name of the variable, parameter, etc.
|
||||||
|
* @actual: the actual value.
|
||||||
|
* @expected: the expected value.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid size" errors when
|
||||||
|
* we expect exact match.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidSizeError(name, actual, expected, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_SIZE, \
|
||||||
|
"invalid size for '%s': actual=%lu is not equal to expected=%lu", \
|
||||||
|
xmlSecErrorsSafeString(name), \
|
||||||
|
(unsigned long)(actual), \
|
||||||
|
(unsigned long)(expected) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidSizeLessThanError:
|
||||||
|
* @name: the name of the variable, parameter, etc.
|
||||||
|
* @actual: the actual value.
|
||||||
|
* @expected: the expected value.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid size" errors when
|
||||||
|
* we expect at least the expected size.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidSizeLessThanError(name, actual, expected, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_SIZE, \
|
||||||
|
"invalid size for '%s': actual=%lu is less than expected=%lu", \
|
||||||
|
xmlSecErrorsSafeString(name), \
|
||||||
|
(unsigned long)(actual), \
|
||||||
|
(unsigned long)(expected) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidSizeMoreThanError:
|
||||||
|
* @name: the name of the variable, parameter, etc.
|
||||||
|
* @actual: the actual value.
|
||||||
|
* @expected: the expected value.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid size" errors when
|
||||||
|
* we expect at most the expected size.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidSizeMoreThanError(name, actual, expected, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_NOT_IMPLEMENTED, \
|
||||||
|
"invalid size for '%s': actual=%lu is more than expected=%lu", \
|
||||||
|
xmlSecErrorsSafeString(name), \
|
||||||
|
(unsigned long)(actual), \
|
||||||
|
(unsigned long)(expected) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidSizeNotMultipleOfError:
|
||||||
|
* @name: the name of the variable, parameter, etc.
|
||||||
|
* @actual: the actual value.
|
||||||
|
* @divider: the expected divider.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid size" errors when
|
||||||
|
* we expect the size to be a multiple of the divider.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidSizeNotMultipleOfError(name, actual, divider, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_NOT_IMPLEMENTED, \
|
||||||
|
"invalid size for '%s': actual=%lu is not a multiple of %lu", \
|
||||||
|
xmlSecErrorsSafeString(name), \
|
||||||
|
(unsigned long)(actual), \
|
||||||
|
(unsigned long)(divider) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidSizeOtherError:
|
||||||
|
* @msg: the message about the error.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid size" errors when
|
||||||
|
* we expect exact match.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidSizeOtherError(msg, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_SIZE, \
|
||||||
|
"invalid size: %s", \
|
||||||
|
xmlSecErrorsSafeString(msg) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidDataError:
|
||||||
|
* @msg: the msg with explanation.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid data" errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidDataError(msg, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_DATA, \
|
||||||
|
"%s", \
|
||||||
|
xmlSecErrorsSafeString(msg) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidStringDataError:
|
||||||
|
* @name: the name of the variable, parameter, etc.
|
||||||
|
* @actual: the actual value as a string.
|
||||||
|
* @expected: the expected value(s) as a string.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid data" errors for string.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidStringDataError(name, actual, expected, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_DATA, \
|
||||||
|
"invalid data for '%s': actual='%s' and expected %s", \
|
||||||
|
xmlSecErrorsSafeString(name), \
|
||||||
|
xmlSecErrorsSafeString(actual), \
|
||||||
|
(expected) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidIntegerDataError:
|
||||||
|
* @name: the name of the variable, parameter, etc.
|
||||||
|
* @actual: the actual value as an integer.
|
||||||
|
* @expected: the expected value(s) as a string.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid data" errors for integers.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidIntegerDataError(name, actual, expected, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_DATA, \
|
||||||
|
"invalid data for '%s': actual=%ld and expected %s", \
|
||||||
|
xmlSecErrorsSafeString(name), \
|
||||||
|
(unsigned long)(actual), \
|
||||||
|
(expected) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidIntegerDataError2:
|
||||||
|
* @name1: the name of the first variable, parameter, etc.
|
||||||
|
* @actual1: the actual first value as an integer.
|
||||||
|
* @name2: the name of the second variable, parameter, etc.
|
||||||
|
* @actual2: the actual second value as an integer.
|
||||||
|
* @expected: the expected value(s) as a string.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid data" errors for integers.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidIntegerDataError2(name1, actual1, name2, actual2, expected, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_DATA, \
|
||||||
|
"invalid data: actual value '%s'=%ld, actual value '%s'=%ld and expected %s", \
|
||||||
|
xmlSecErrorsSafeString(name1), \
|
||||||
|
(unsigned long)(actual1), \
|
||||||
|
xmlSecErrorsSafeString(name2), \
|
||||||
|
(unsigned long)(actual2), \
|
||||||
|
(expected) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidTypeError:
|
||||||
|
* @msg: the msg with explanation.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid type" errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidTypeError(msg, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_TYPE, \
|
||||||
|
"%s", \
|
||||||
|
xmlSecErrorsSafeString(msg) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidStringTypeError:
|
||||||
|
* @name: the name of the variable, parameter, etc.
|
||||||
|
* @actual: the actual value as a string.
|
||||||
|
* @expected: the expected value(s) as a string.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid type" errors for string.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidStringTypeError(name, actual, expected, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_TYPE, \
|
||||||
|
"invalid type for '%s': actual='%s' and expected %s", \
|
||||||
|
xmlSecErrorsSafeString(name), \
|
||||||
|
xmlSecErrorsSafeString(actual), \
|
||||||
|
(expected) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidIntegerTypeError:
|
||||||
|
* @name: the name of the variable, parameter, etc.
|
||||||
|
* @actual: the actual value as an integer.
|
||||||
|
* @expected: the expected value(s) as a string.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid type" errors for integers.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidIntegerTypeError(name, actual, expected, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_TYPE, \
|
||||||
|
"invalid type for '%s': actual=%ld and expected %s", \
|
||||||
|
xmlSecErrorsSafeString(name), \
|
||||||
|
(unsigned long)(actual), \
|
||||||
|
(expected) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidIntegerTypeError2:
|
||||||
|
* @name1: the name of the first variable, parameter, etc.
|
||||||
|
* @actual1: the actual first value as an integer.
|
||||||
|
* @name2: the name of the second variable, parameter, etc.
|
||||||
|
* @actual2: the actual second value as an integer.
|
||||||
|
* @expected: the expected value(s) as a string.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid type" errors for integers.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidIntegerTypeError2(name1, actual1, name2, actual2, expected, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_TYPE, \
|
||||||
|
"invalid type: actual value '%s'=%ld, actual value '%s'=%ld and expected %s", \
|
||||||
|
xmlSecErrorsSafeString(name1), \
|
||||||
|
(unsigned long)(actual1), \
|
||||||
|
xmlSecErrorsSafeString(name2), \
|
||||||
|
(unsigned long)(actual2), \
|
||||||
|
(expected) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidNodeError:
|
||||||
|
* @actualNode: the actual node.
|
||||||
|
* @expectedNodeName: the expected node name.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting an invalid node errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidNodeError(actualNode, expectedNodeName, errorObject) \
|
||||||
|
{ \
|
||||||
|
const char* actualNodeName = xmlSecNodeGetName(actualNode); \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_NODE, \
|
||||||
|
"actual=%s; expected=%s", \
|
||||||
|
xmlSecErrorsSafeString(actualNodeName), \
|
||||||
|
xmlSecErrorsSafeString(expectedNodeName) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidNodeContentError:
|
||||||
|
* @node: the node.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @reason: the reason why node content is invalid.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting an invalid node content errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidNodeContentError(node, errorObject, reason) \
|
||||||
|
{ \
|
||||||
|
const char* nName = xmlSecNodeGetName(node); \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, \
|
||||||
|
"node=%s; reason=%s", \
|
||||||
|
xmlSecErrorsSafeString(nName), \
|
||||||
|
xmlSecErrorsSafeString(reason) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidNodeAttributeError:
|
||||||
|
* @node: the node.
|
||||||
|
* @attrName: the attribute name.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @reason: the reason why node content is invalid.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting an invalid node attribute errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidNodeAttributeError(node, attrName, errorObject, reason) \
|
||||||
|
{ \
|
||||||
|
const char* nName = xmlSecNodeGetName(node); \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE, \
|
||||||
|
"node=%s; attribute=%s; reason=%s",\
|
||||||
|
xmlSecErrorsSafeString(nName), \
|
||||||
|
xmlSecErrorsSafeString(attrName), \
|
||||||
|
xmlSecErrorsSafeString(reason) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecNodeAlreadyPresentError:
|
||||||
|
* @parent: the parent node.
|
||||||
|
* @nodeName: the node name.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting node already present errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecNodeAlreadyPresentError(parent, nodeName, errorObject) \
|
||||||
|
{ \
|
||||||
|
const char* pName = xmlSecNodeGetName(parent);\
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, \
|
||||||
|
"parent=%s; node=%s", \
|
||||||
|
xmlSecErrorsSafeString(pName), \
|
||||||
|
xmlSecErrorsSafeString(nodeName) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecUnexpectedNodeError:
|
||||||
|
* @node: the node.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting an invalid node errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecUnexpectedNodeError(node, errorObject) \
|
||||||
|
{ \
|
||||||
|
const char* nName = xmlSecNodeGetName(node); \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_UNEXPECTED_NODE, \
|
||||||
|
"node=%s", \
|
||||||
|
xmlSecErrorsSafeString(nName) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecNodeNotFoundError:
|
||||||
|
* @errorFunction: the failed function.
|
||||||
|
* @startNode: the search start node.
|
||||||
|
* @targetNodeName: the expected child node name.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting node not found errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecNodeNotFoundError(errorFunction, startNode, targetNodeName, errorObject) \
|
||||||
|
{ \
|
||||||
|
const char* startNodeName = xmlSecNodeGetName(startNode); \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
(errorFunction), \
|
||||||
|
XMLSEC_ERRORS_R_NODE_NOT_FOUND, \
|
||||||
|
"startNode=%s; target=%s", \
|
||||||
|
xmlSecErrorsSafeString(startNodeName), \
|
||||||
|
xmlSecErrorsSafeString(targetNodeName) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidTransfromError:
|
||||||
|
* @transform: the transform.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting an invalid transform errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidTransfromError(transform) \
|
||||||
|
{ \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)xmlSecTransformGetName(transform), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_TRANSFORM, \
|
||||||
|
XMLSEC_ERRORS_NO_MESSAGE \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidTransfromError2:
|
||||||
|
* @transform: the transform.
|
||||||
|
* @msg: the extra message.
|
||||||
|
* @param: the extra message param.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting an invalid transform errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidTransfromError2(transform, msg, param) \
|
||||||
|
{ \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)xmlSecTransformGetName(transform), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_TRANSFORM, \
|
||||||
|
(msg), (param) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidTransfromStatusError:
|
||||||
|
* @transform: the transform.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting an invalid transform status errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidTransfromStatusError(transform) \
|
||||||
|
{ \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)xmlSecTransformGetName(transform), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_STATUS, \
|
||||||
|
"transformStatus=%d", \
|
||||||
|
(int)((transform)->status) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidTransfromStatusError2:
|
||||||
|
* @transform: the transform.
|
||||||
|
* @msg: the extra message.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting an invalid transform status errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidTransfromStatusError2(transform, msg) \
|
||||||
|
{ \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)xmlSecTransformGetName(transform), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_STATUS, \
|
||||||
|
"transformStatus=%ld, msg=%s", \
|
||||||
|
(long int)((transform)->status), \
|
||||||
|
msg \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidKeyDataSizeError:
|
||||||
|
* @name: the name of the variable, parameter, etc.
|
||||||
|
* @actual: the actual value.
|
||||||
|
* @expected: the expected value(s).
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid keydata size" errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidKeyDataSizeError(actual, expected, errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE, \
|
||||||
|
"invalid key data size: actual=%ld and expected=%ld", \
|
||||||
|
(unsigned long)(actual), \
|
||||||
|
(unsigned long)(expected) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecInvalidZeroKeyDataSizeError:
|
||||||
|
* @name: the name of the variable, parameter, etc.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting "invalid keydata size" errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecInvalidZeroKeyDataSizeError(errorObject) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE, \
|
||||||
|
"invalid zero key data size" \
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecOtherError:
|
||||||
|
* @code: the error code.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @details: the error message.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting other XMLSec errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecOtherError(code, errorObject, details) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
(code), \
|
||||||
|
"details=%s", \
|
||||||
|
xmlSecErrorsSafeString(details) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecOtherError2:
|
||||||
|
* @code: the error code.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @msg: the extra message.
|
||||||
|
* @param: the extra message param.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting other XMLSec errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecOtherError2(code, errorObject, msg, param) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
(code), \
|
||||||
|
(msg), (param) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecOtherError3:
|
||||||
|
* @code: the error code.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @msg: the extra message.
|
||||||
|
* @param1: the extra message param.
|
||||||
|
* @param2: the extra message param.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting other XMLSec errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecOtherError3(code, errorObject, msg, param1, param2) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
(code), \
|
||||||
|
(msg), (param1), (param2) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecOtherError4:
|
||||||
|
* @code: the error code.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @msg: the extra message.
|
||||||
|
* @param1: the extra message param.
|
||||||
|
* @param2: the extra message param.
|
||||||
|
* @param3: the extra message param.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting other XMLSec errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecOtherError4(code, errorObject, msg, param1, param2, param3) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
(code), \
|
||||||
|
(msg), (param1), (param2), (param3) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSecOtherError5:
|
||||||
|
* @code: the error code.
|
||||||
|
* @errorObject: the error specific error object (e.g. transform, key data, etc).
|
||||||
|
* @msg: the extra message.
|
||||||
|
* @param1: the extra message param.
|
||||||
|
* @param2: the extra message param.
|
||||||
|
* @param3: the extra message param.
|
||||||
|
* @param4: the extra message param.
|
||||||
|
*
|
||||||
|
* Macro. The XMLSec library macro for reporting other XMLSec errors.
|
||||||
|
*/
|
||||||
|
#define xmlSecOtherError5(code, errorObject, msg, param1, param2, param3, param4) \
|
||||||
|
xmlSecError(XMLSEC_ERRORS_HERE, \
|
||||||
|
(const char*)(errorObject), \
|
||||||
|
NULL, \
|
||||||
|
(code), \
|
||||||
|
(msg), (param1), (param2), (param3), (param4) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* __XMLSEC_ERROR_HELPERS_H__ */
|
1950
experimental/facho-signer/src/xmlsec1/xmltree.c
Normal file
1950
experimental/facho-signer/src/xmlsec1/xmltree.c
Normal file
File diff suppressed because it is too large
Load Diff
200
experimental/facho-signer/src/xmlusigned.xml
Normal file
200
experimental/facho-signer/src/xmlusigned.xml
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Invoice xmlns="http://www.dian.gov.co/contratos/facturaelectronica/v1" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cdt="urn:DocumentInformation:names:specification:ubl:colombia:schema:xsd:DocumentInformationAggregateComponents-1" xmlns:clm54217="urn:un:unece:uncefact:codelist:specification:54217:2001" xmlns:clmIANAMIMEMediaType="urn:un:unece:uncefact:codelist:specification:IANAMIMEMediaType:2003" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sts="http://www.dian.gov.co/contratos/facturaelectronica/v1/Structures" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:sig="http://www.w3.org/2000/09/xmldsig#">
|
||||||
|
<ext:UBLExtensions>
|
||||||
|
<ext:UBLExtension>
|
||||||
|
<ext:ExtensionContent>
|
||||||
|
<sts:DianExtensions>
|
||||||
|
<sts:SoftwareSecurityCode schemeAgencyName="CO, DIAN (Dirección de Impuestos y Aduanas Nacionales)" schemeAgencyID="195">2bd9a18f23cf1188d36888d218e9b0c31df77aa00bc036eaeaa1619184054237eee56d2d8db4ecab0173f65f8dab7753</sts:SoftwareSecurityCode>
|
||||||
|
<sts:AuthorizationProvider>
|
||||||
|
<sts:AuthorizationProviderID schemeID="4" schemeName="31" schemeAgencyName="CO, DIAN (Dirección de Impuestos y Aduanas Nacionales)" schemeAgencyID="195">800197268</sts:AuthorizationProviderID>
|
||||||
|
</sts:AuthorizationProvider>
|
||||||
|
<sts:SoftwareProvider>
|
||||||
|
<sts:ProviderID schemeAgencyName="CO, DIAN (Dirección de Impuestos y Aduanas Nacionales)" schemeAgencyID="195" schemeID="5" schemaName="31">900579212</sts:ProviderID>
|
||||||
|
<sts:SoftwareID schemeAgencyName="CO, DIAN (Dirección de Impuestos y Aduanas Nacionales)" schemeAgencyID="195">01ab9caa-6838-461e-82fb-da44da36a084</sts:SoftwareID>
|
||||||
|
</sts:SoftwareProvider>
|
||||||
|
<sts:InvoiceSource>
|
||||||
|
<cbc:IdentificationCode>CO</cbc:IdentificationCode>
|
||||||
|
</sts:InvoiceSource>
|
||||||
|
<sts:InvoiceControl>
|
||||||
|
<sts:InvoiceAuthorization>fc8eac422eba16e22ffd8c6f94b3f40a6e38162c</sts:InvoiceAuthorization>
|
||||||
|
<sts:AuthorizationPeriod>
|
||||||
|
<cbc:StartDate>2019-01-19</cbc:StartDate>
|
||||||
|
<cbc:EndDate>2030-01-19</cbc:EndDate>
|
||||||
|
</sts:AuthorizationPeriod>
|
||||||
|
<sts:AuthorizedInvoices>
|
||||||
|
<sts:Prefix>SETP</sts:Prefix>
|
||||||
|
<sts:From>990000000</sts:From>
|
||||||
|
<sts:To>995000000</sts:To>
|
||||||
|
</sts:AuthorizedInvoices>
|
||||||
|
</sts:InvoiceControl>
|
||||||
|
</sts:DianExtensions>
|
||||||
|
</ext:ExtensionContent>
|
||||||
|
</ext:UBLExtension>
|
||||||
|
</ext:UBLExtensions>
|
||||||
|
<cbc:UBLVersionID>UBL 2.1</cbc:UBLVersionID>
|
||||||
|
<cbc:CustomizationID>10</cbc:CustomizationID>
|
||||||
|
<cbc:ProfileID>DIAN 2.1</cbc:ProfileID>
|
||||||
|
<cbc:ProfileExecutionID>2</cbc:ProfileExecutionID>
|
||||||
|
<cbc:ID>SETP990000001</cbc:ID>
|
||||||
|
<cbc:UUID schemeID="2" schemeName="CUFE-SHA384">50578625ce1fb2f6bb2bc57b22180d2763c8a868c4e62da72e0e43001f9c7f3459c81e2bf9324830175b1225af37e435</cbc:UUID>
|
||||||
|
<cbc:DocumentCurrencyCode>COP</cbc:DocumentCurrencyCode>
|
||||||
|
<cbc:IssueDate>2020-09-05</cbc:IssueDate>
|
||||||
|
<cbc:IssueTime>22:38:53-05:00</cbc:IssueTime>
|
||||||
|
<cbc:InvoiceTypeCode listAgencyID="195" listAgencyName="No matching global declaration available for the validation root" listURI="http://www.dian.gov.co">01</cbc:InvoiceTypeCode>
|
||||||
|
<cbc:LineCountNumeric>1</cbc:LineCountNumeric>
|
||||||
|
<cac:InvoicePeriod>
|
||||||
|
<cbc:StartDate>2020-09-05</cbc:StartDate>
|
||||||
|
<cbc:EndDate>2020-09-05</cbc:EndDate>
|
||||||
|
</cac:InvoicePeriod>
|
||||||
|
<cac:AccountingSupplierParty>
|
||||||
|
<cbc:AdditionalAccountID>1</cbc:AdditionalAccountID>
|
||||||
|
<cac:Party>
|
||||||
|
<cac:PartyName>
|
||||||
|
<cbc:Name>NEUROTEC TECNOLOGIA S.A.S</cbc:Name>
|
||||||
|
</cac:PartyName>
|
||||||
|
<cac:PhysicalLocation>
|
||||||
|
<cac:Address>
|
||||||
|
<cac:AddressLine>
|
||||||
|
<cbc:Line/>
|
||||||
|
</cac:AddressLine>
|
||||||
|
</cac:Address>
|
||||||
|
</cac:PhysicalLocation>
|
||||||
|
<cac:PartyLegalEntity>
|
||||||
|
<cbc:CompanyID schemeAgencyName="CO, DIAN (Dirección de Impuestos y Aduanas Nacionales)" schemeAgencyID="195" schemeID="5" schemeName="31">900579212</cbc:CompanyID>
|
||||||
|
<cbc:RegistrationName>NEUROTEC TECNOLOGIA S.A.S</cbc:RegistrationName>
|
||||||
|
<cac:RegistrationAddress>
|
||||||
|
<cbc:CityName/>
|
||||||
|
<cac:AddressLine>
|
||||||
|
<cbc:Line/>
|
||||||
|
</cac:AddressLine>
|
||||||
|
<cac:Country>
|
||||||
|
<cbc:IdentificationCode>CO</cbc:IdentificationCode>
|
||||||
|
<cbc:Name>COLOMBIA</cbc:Name>
|
||||||
|
</cac:Country>
|
||||||
|
</cac:RegistrationAddress>
|
||||||
|
</cac:PartyLegalEntity>
|
||||||
|
<cac:PartyTaxScheme>
|
||||||
|
<cbc:RegistrationName>NEUROTEC TECNOLOGIA S.A.S</cbc:RegistrationName>
|
||||||
|
<cbc:CompanyID schemeAgencyName="CO, DIAN (Dirección de Impuestos y Aduanas Nacionales)" schemeAgencyID="195" schemeID="5" schemeName="31">900579212</cbc:CompanyID>
|
||||||
|
<cbc:TaxLevelCode listName="48">O-07;O-09;O-14;O-48</cbc:TaxLevelCode>
|
||||||
|
<cac:TaxScheme/>
|
||||||
|
</cac:PartyTaxScheme>
|
||||||
|
<cac:Contact>
|
||||||
|
<cbc:ElectronicMail>sdds@sd.com</cbc:ElectronicMail>
|
||||||
|
</cac:Contact>
|
||||||
|
</cac:Party>
|
||||||
|
</cac:AccountingSupplierParty>
|
||||||
|
<cac:AccountingCustomerParty>
|
||||||
|
<cbc:AdditionalAccountID>2</cbc:AdditionalAccountID>
|
||||||
|
<cac:Party>
|
||||||
|
<cac:PartyName>
|
||||||
|
<cbc:Name>facho-customer</cbc:Name>
|
||||||
|
</cac:PartyName>
|
||||||
|
<cac:PhysicalLocation>
|
||||||
|
<cac:Address>
|
||||||
|
<cac:AddressLine>
|
||||||
|
<cbc:Line/>
|
||||||
|
</cac:AddressLine>
|
||||||
|
</cac:Address>
|
||||||
|
</cac:PhysicalLocation>
|
||||||
|
<cac:PartyTaxScheme>
|
||||||
|
<cbc:CompanyID schemeAgencyName="CO, DIAN (Dirección de Impuestos y Aduanas Nacionales)" schemeAgencyID="195" schemeID="" schemeName="13">43851425</cbc:CompanyID>
|
||||||
|
<cbc:RegistrationName>facho-customer</cbc:RegistrationName>
|
||||||
|
<cbc:TaxLevelCode>ZZ</cbc:TaxLevelCode>
|
||||||
|
<cac:TaxScheme/>
|
||||||
|
</cac:PartyTaxScheme>
|
||||||
|
<cac:PartyLegalEntity>
|
||||||
|
<cbc:RegistrationName>facho-customer</cbc:RegistrationName>
|
||||||
|
<cac:RegistrationAddress>
|
||||||
|
<cbc:CityName/>
|
||||||
|
<cac:AddressLine>
|
||||||
|
<cbc:Line/>
|
||||||
|
</cac:AddressLine>
|
||||||
|
<cac:Country>
|
||||||
|
<cbc:IdentificationCode>CO</cbc:IdentificationCode>
|
||||||
|
<cbc:Name>COLOMBIA</cbc:Name>
|
||||||
|
</cac:Country>
|
||||||
|
</cac:RegistrationAddress>
|
||||||
|
</cac:PartyLegalEntity>
|
||||||
|
</cac:Party>
|
||||||
|
</cac:AccountingCustomerParty>
|
||||||
|
<cac:LegalMonetaryTotal>
|
||||||
|
<cbc:LineExtensionAmount currencyID="COP">100.00</cbc:LineExtensionAmount>
|
||||||
|
<cbc:TaxExclusiveAmount currencyID="COP">100.00</cbc:TaxExclusiveAmount>
|
||||||
|
<cbc:TaxInclusiveAmount currencyID="COP">119.00</cbc:TaxInclusiveAmount>
|
||||||
|
<cbc:ChargeTotalAmount currencyID="COP">19.00</cbc:ChargeTotalAmount>
|
||||||
|
<cbc:PayableAmount currencyID="COP">119.00</cbc:PayableAmount>
|
||||||
|
</cac:LegalMonetaryTotal>
|
||||||
|
<cac:TaxTotal/>
|
||||||
|
<cac:TaxTotal>
|
||||||
|
<cac:TaxSubtotal>
|
||||||
|
<cac:TaxCategory>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>01</cbc:ID>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:TaxCategory>
|
||||||
|
</cac:TaxSubtotal>
|
||||||
|
<cbc:TaxAmount>19.00</cbc:TaxAmount>
|
||||||
|
</cac:TaxTotal>
|
||||||
|
<cac:TaxTotal>
|
||||||
|
<cac:TaxSubtotal>
|
||||||
|
<cac:TaxCategory>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>04</cbc:ID>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:TaxCategory>
|
||||||
|
</cac:TaxSubtotal>
|
||||||
|
<cbc:TaxAmount>0.00</cbc:TaxAmount>
|
||||||
|
</cac:TaxTotal>
|
||||||
|
<cac:TaxTotal>
|
||||||
|
<cac:TaxSubtotal>
|
||||||
|
<cac:TaxCategory>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>03</cbc:ID>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:TaxCategory>
|
||||||
|
</cac:TaxSubtotal>
|
||||||
|
<cbc:TaxAmount>0.00</cbc:TaxAmount>
|
||||||
|
</cac:TaxTotal>
|
||||||
|
<cac:InvoiceLine>
|
||||||
|
<cbc:ID>1</cbc:ID>
|
||||||
|
<cbc:InvoicedQuantity unitCode="NAR">1</cbc:InvoicedQuantity>
|
||||||
|
<cbc:LineExtensionAmount currencyID="COP">100.0</cbc:LineExtensionAmount>
|
||||||
|
<cac:TaxTotal>
|
||||||
|
<cbc:TaxAmount currencyID="COP">19.0</cbc:TaxAmount>
|
||||||
|
<cac:TaxSubtotal>
|
||||||
|
<cbc:TaxableAmount currencyID="COP">100.0</cbc:TaxableAmount>
|
||||||
|
<cbc:TaxAmount currencyID="COP">19.0</cbc:TaxAmount>
|
||||||
|
<cac:TaxCategory>
|
||||||
|
<cbc:Percent>19.0</cbc:Percent>
|
||||||
|
<cac:TaxScheme>
|
||||||
|
<cbc:ID>01</cbc:ID>
|
||||||
|
<cbc:Name>IVA</cbc:Name>
|
||||||
|
</cac:TaxScheme>
|
||||||
|
</cac:TaxCategory>
|
||||||
|
</cac:TaxSubtotal>
|
||||||
|
</cac:TaxTotal>
|
||||||
|
<cac:PricingReference>
|
||||||
|
<cac:AlternativeConditionPrice>
|
||||||
|
<cbc:PriceAmount currencyID="COP">100.0</cbc:PriceAmount>
|
||||||
|
<cbc:PriceTypeCode>01</cbc:PriceTypeCode>
|
||||||
|
<cbc:PriceType>x</cbc:PriceType>
|
||||||
|
</cac:AlternativeConditionPrice>
|
||||||
|
</cac:PricingReference>
|
||||||
|
<cac:Item>
|
||||||
|
<cbc:Description>test</cbc:Description>
|
||||||
|
<cac:StandardItemIdentification>
|
||||||
|
<cbc:ID>9999</cbc:ID>
|
||||||
|
</cac:StandardItemIdentification>
|
||||||
|
</cac:Item>
|
||||||
|
<cac:Price>
|
||||||
|
<cbc:PriceAmount currencyID="COP">100.0</cbc:PriceAmount>
|
||||||
|
</cac:Price>
|
||||||
|
</cac:InvoiceLine>
|
||||||
|
<cac:PaymentMeans>
|
||||||
|
<cbc:ID>1</cbc:ID>
|
||||||
|
<cbc:PaymentMeansCode>10</cbc:PaymentMeansCode>
|
||||||
|
<cbc:PaymentDueDate>2020-09-05</cbc:PaymentDueDate>
|
||||||
|
<cbc:PaymentID>1</cbc:PaymentID>
|
||||||
|
</cac:PaymentMeans>
|
||||||
|
</Invoice>
|
@ -1,7 +0,0 @@
|
|||||||
.PHONY: test
|
|
||||||
|
|
||||||
CC=gcc
|
|
||||||
|
|
||||||
test: xmlsec1/errors.c xmlsec1/xmltree.c templates.c xades_test.c
|
|
||||||
$(CC) -o $@ -Wall -Werror -std=gnu11 $(shell pkg-config libxml-2.0 --cflags --libs) $(shell pkg-config xmlsec1 --cflags --libs) $^
|
|
||||||
./test
|
|
Loading…
Reference in New Issue
Block a user