diff options
Diffstat (limited to 'include')
67 files changed, 1833 insertions, 604 deletions
diff --git a/include/xmlsec/Makefile.am b/include/xmlsec/Makefile.am index b82495d7..50785170 100644 --- a/include/xmlsec/Makefile.am +++ b/include/xmlsec/Makefile.am @@ -24,7 +24,6 @@ xmlsecinc_HEADERS = \ nodeset.h \ parser.h \ private.h \ - soap.h \ strings.h \ templates.h \ transforms.h \ @@ -36,6 +35,10 @@ xmlsecinc_HEADERS = \ xmltree.h \ $(NULL) +if XMLSEC_ENABLE_SOAP +xmlsecinc_HEADERS += soap.h +endif + remove-old-headers: @if test "x$(DESTDIR)" = "x" && test -d "$(includedir)/xmlsec"; then \ echo "----------------------------------------------------------------------"; \ diff --git a/include/xmlsec/app.h b/include/xmlsec/app.h index 7b8e510b..97f7d3db 100644 --- a/include/xmlsec/app.h +++ b/include/xmlsec/app.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * @@ -16,10 +16,6 @@ #error To use dynamic crypto engines loading define XMLSEC_CRYPTO_DYNAMIC_LOADING #endif /* !defined(IN_XMLSEC) && !defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <libxml/xmlIO.h> @@ -30,6 +26,10 @@ extern "C" { #include <xmlsec/transforms.h> #include <xmlsec/dl.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /********************************************************************** * * Crypto Init/shutdown @@ -162,6 +162,27 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes192CbcGetKlass #define xmlSecTransformAes256CbcId xmlSecTransformAes256CbcGetKlass() XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes256CbcGetKlass(void); /** +* xmlSecTransformAes128GcmId: +* +* The AES128 GCM cipher transform klass. +*/ +#define xmlSecTransformAes128GcmId xmlSecTransformAes128GcmGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes128GcmGetKlass(void); +/** +* xmlSecTransformAes192GcmId: +* +* The AES192 GCM cipher transform klass. +*/ +#define xmlSecTransformAes192GcmId xmlSecTransformAes192GcmGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes192GcmGetKlass(void); +/** +* xmlSecTransformAes256GcmId: +* +* The AES256 GCM cipher transform klass. +*/ +#define xmlSecTransformAes256GcmId xmlSecTransformAes256GcmGetKlass() +XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes256GcmGetKlass(void); +/** * xmlSecTransformKWAes128Id: * * The AES 128 key wrap transform klass. diff --git a/include/xmlsec/base64.h b/include/xmlsec/base64.h index a40c4528..7e13862f 100644 --- a/include/xmlsec/base64.h +++ b/include/xmlsec/base64.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Base64 encode/decode transform and utility functions. @@ -11,15 +11,15 @@ #ifndef __XMLSEC_BASE64_H__ #define __XMLSEC_BASE64_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <xmlsec/xmlsec.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** * XMLSEC_BASE64_LINESIZE: * diff --git a/include/xmlsec/bn.h b/include/xmlsec/bn.h index 616919b3..aba1cf6f 100644 --- a/include/xmlsec/bn.h +++ b/include/xmlsec/bn.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Simple Big Numbers processing. @@ -11,14 +11,14 @@ #ifndef __XMLSEC_BN_H__ #define __XMLSEC_BN_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <xmlsec/xmlsec.h> #include <xmlsec/buffer.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef xmlSecBuffer xmlSecBn, *xmlSecBnPtr; diff --git a/include/xmlsec/buffer.h b/include/xmlsec/buffer.h index 4d8c739c..d942c868 100644 --- a/include/xmlsec/buffer.h +++ b/include/xmlsec/buffer.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Memory buffer. @@ -11,13 +11,13 @@ #ifndef __XMLSEC_BUFFER_H__ #define __XMLSEC_BUFFER_H__ +#include <libxml/tree.h> +#include <xmlsec/xmlsec.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include <libxml/tree.h> -#include <xmlsec/xmlsec.h> - typedef struct _xmlSecBuffer xmlSecBuffer, *xmlSecBufferPtr; diff --git a/include/xmlsec/crypto.h b/include/xmlsec/crypto.h index 75d92d04..8f138396 100644 --- a/include/xmlsec/crypto.h +++ b/include/xmlsec/crypto.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Crypto engine selection. @@ -11,10 +11,6 @@ #ifndef __XMLSEC_CRYPTO_H__ #define __XMLSEC_CRYPTO_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <xmlsec/xmlsec.h> /* include nothing if we compile xmlsec library itself */ @@ -40,6 +36,12 @@ extern "C" { #include <xmlsec/mscrypto/x509.h> #include <xmlsec/mscrypto/symbols.h> #else /* XMLSEC_CRYPTO_MSCRYPTO */ +#ifdef XMLSEC_CRYPTO_MSCNG +#include <xmlsec/mscng/app.h> +#include <xmlsec/mscng/crypto.h> +#include <xmlsec/mscng/x509.h> +#include <xmlsec/mscng/symbols.h> +#else /* XMLSEC_CRYPTO_MSCNG */ #ifdef XMLSEC_CRYPTO_NSS #include <xmlsec/nss/app.h> #include <xmlsec/nss/crypto.h> @@ -60,6 +62,7 @@ extern "C" { #endif /* XMLSEC_CRYPTO_GCRYPT */ #endif /* XMLSEC_CRYPTO_GNUTLS */ #endif /* XMLSEC_CRYPTO_NSS */ +#endif /* XMLSEC_CRYPTO_MSCNG */ #endif /* XMLSEC_CRYPTO_MSCRYPTO */ #endif /* XMLSEC_CRYPTO_OPENSSL */ #endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */ @@ -67,9 +70,5 @@ extern "C" { #endif /* IN_XMLSEC_CRYPTO */ #endif /* IN_XMLSEC */ -#ifdef __cplusplus -} -#endif /* __cplusplus */ - #endif /* __XMLSEC_CRYPTO_H__ */ diff --git a/include/xmlsec/dl.h b/include/xmlsec/dl.h index e04f4f95..4992c754 100644 --- a/include/xmlsec/dl.h +++ b/include/xmlsec/dl.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * @@ -10,6 +10,19 @@ #ifndef __XMLSEC_DL_H__ #define __XMLSEC_DL_H__ +#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING + +#include <libxml/tree.h> +#include <libxml/xmlIO.h> + +#include <xmlsec/xmlsec.h> +#include <xmlsec/keysdata.h> +#include <xmlsec/keys.h> +#include <xmlsec/keysmngr.h> +#include <xmlsec/transforms.h> + +#endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */ + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -22,15 +35,6 @@ XMLSEC_EXPORT int xmlSecCryptoDLFunctionsRegisterK #ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING -#include <libxml/tree.h> -#include <libxml/xmlIO.h> - -#include <xmlsec/xmlsec.h> -#include <xmlsec/keysdata.h> -#include <xmlsec/keys.h> -#include <xmlsec/keysmngr.h> -#include <xmlsec/transforms.h> - /**************************************************************************** * * Dynamic load functions diff --git a/include/xmlsec/errors.h b/include/xmlsec/errors.h index 32ac2fec..a7b35c8e 100644 --- a/include/xmlsec/errors.h +++ b/include/xmlsec/errors.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Error codes and error reporting functions. @@ -23,7 +23,7 @@ extern "C" { /** * XMLSEC_ERRORS_R_XMLSEC_FAILED: * - * An XMLSec function failed (error subject is the failed function). + * An XMLSec function failed. */ #define XMLSEC_ERRORS_R_XMLSEC_FAILED 1 @@ -44,21 +44,21 @@ extern "C" { /** * XMLSEC_ERRORS_R_CRYPTO_FAILED: * - * Crypto (OpenSSL) function failed (error subject is the failed function). + * Crypto (e.g. OpenSSL) function failed. */ #define XMLSEC_ERRORS_R_CRYPTO_FAILED 4 /** * XMLSEC_ERRORS_R_XML_FAILED: * - * LibXML function failed (error subject is the failed function). + * LibXML function failed. */ #define XMLSEC_ERRORS_R_XML_FAILED 5 /** * XMLSEC_ERRORS_R_XSLT_FAILED: * - * LibXSLT function failed (error subject is the failed function). + * LibXSLT function failed. */ #define XMLSEC_ERRORS_R_XSLT_FAILED 6 @@ -86,6 +86,13 @@ extern "C" { #define XMLSEC_ERRORS_R_NOT_IMPLEMENTED 9 /** + * XMLSEC_ERRORS_R_INVALID_CONFIG: + * + * The configuration is invalid. + */ +#define XMLSEC_ERRORS_R_INVALID_CONFIG 10 + +/** * XMLSEC_ERRORS_R_INVALID_SIZE: * * Invalid size. @@ -142,30 +149,37 @@ extern "C" { #define XMLSEC_ERRORS_R_DATA_NOT_MATCH 18 /** + * XMLSEC_ERRORS_R_INVALID_VERSION: + * + * Version mismatch. + */ +#define XMLSEC_ERRORS_R_INVALID_VERSION 19 + +/** * XMLSEC_ERRORS_R_INVALID_NODE: * - * Invalid node (error subject is the node name). + * Invalid node. */ #define XMLSEC_ERRORS_R_INVALID_NODE 21 /** * XMLSEC_ERRORS_R_INVALID_NODE_CONTENT: * - * Invalid node content (error subject is the node name). + * Invalid node content. */ #define XMLSEC_ERRORS_R_INVALID_NODE_CONTENT 22 /** * XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE: * - * Invalid node attribute (error subject is the node name). + * Invalid node attribute. */ #define XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE 23 /** * XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE: * - * Missing node attribute (error subject is the node name). + * Missing node attribute. */ #define XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE 25 @@ -179,21 +193,21 @@ extern "C" { /** * XMLSEC_ERRORS_R_UNEXPECTED_NODE: * - * Unexpected node (error subject is the node name). + * Unexpected node. */ #define XMLSEC_ERRORS_R_UNEXPECTED_NODE 27 /** * XMLSEC_ERRORS_R_NODE_NOT_FOUND: * - * Node not found (error subject is the required node name). + * Node not found. */ #define XMLSEC_ERRORS_R_NODE_NOT_FOUND 28 /** * XMLSEC_ERRORS_R_INVALID_TRANSFORM: * - * This transform is invlaid here. + * This transform is invalid. */ #define XMLSEC_ERRORS_R_INVALID_TRANSFORM 31 @@ -235,7 +249,7 @@ extern "C" { /** * XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND: * - * Data is not found (error subject is the data name). + * Data is not found. */ #define XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND 42 @@ -435,7 +449,7 @@ XMLSEC_EXPORT const char* xmlSecErrorsGetMsg (xmlSecSize pos) * Macro. Returns @str if it is not NULL or pointer to "NULL" otherwise. */ #define xmlSecErrorsSafeString(str) \ - (((str) != NULL) ? ((char*)(str)) : (char*)"NULL") + (((str) != NULL) ? ((const char*)(str)) : (const char*)"NULL") /** * XMLSEC_ERRORS_NO_MESSAGE: @@ -453,8 +467,6 @@ XMLSEC_EXPORT void xmlSecError (const char* file, int reason, const char* msg, ...) XMLSEC_ERRORS_PRINTF_ATTRIBUTE; - - /********************************************************************** * * Assertions @@ -494,7 +506,6 @@ XMLSEC_EXPORT void xmlSecError (const char* file, } - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/xmlsec/exports.h b/include/xmlsec/exports.h index a2abf3fc..c6ed95bb 100644 --- a/include/xmlsec/exports.h +++ b/include/xmlsec/exports.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Export macro declarations for Win32 platform. diff --git a/include/xmlsec/gcrypt/app.h b/include/xmlsec/gcrypt/app.h index 20bd78e3..bb3baad1 100644 --- a/include/xmlsec/gcrypt/app.h +++ b/include/xmlsec/gcrypt/app.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,15 +9,15 @@ #ifndef __XMLSEC_GCRYPT_APP_H__ #define __XMLSEC_GCRYPT_APP_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <xmlsec/xmlsec.h> #include <xmlsec/keys.h> #include <xmlsec/keysmngr.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /******************************************************************** * * Init/shutdown diff --git a/include/xmlsec/gcrypt/crypto.h b/include/xmlsec/gcrypt/crypto.h index 1035ea3a..645a3548 100644 --- a/include/xmlsec/gcrypt/crypto.h +++ b/include/xmlsec/gcrypt/crypto.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,15 +9,17 @@ #ifndef __XMLSEC_GCRYPT_CRYPTO_H__ #define __XMLSEC_GCRYPT_CRYPTO_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <xmlsec/xmlsec.h> #include <xmlsec/keys.h> #include <xmlsec/transforms.h> #include <xmlsec/dl.h> +#include <gcrypt.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_gcrypt(void); /******************************************************************** @@ -151,7 +153,6 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGCryptTransformKWDes3GetKlass(void) * *******************************************************************/ #ifndef XMLSEC_NO_DSA -#include <gcrypt.h> /** * xmlSecGCryptKeyDataDsaId: @@ -281,7 +282,6 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGCryptTransformHmacSha512GetKlass(v * *******************************************************************/ #ifndef XMLSEC_NO_RSA -#include <gcrypt.h> /** * xmlSecGCryptKeyDataRsaId: diff --git a/include/xmlsec/gcrypt/symbols.h b/include/xmlsec/gcrypt/symbols.h index 371efd32..d011e659 100644 --- a/include/xmlsec/gcrypt/symbols.h +++ b/include/xmlsec/gcrypt/symbols.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. diff --git a/include/xmlsec/gnutls/app.h b/include/xmlsec/gnutls/app.h index c579a348..05e9a5b5 100644 --- a/include/xmlsec/gnutls/app.h +++ b/include/xmlsec/gnutls/app.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,15 +9,15 @@ #ifndef __XMLSEC_GNUTLS_APP_H__ #define __XMLSEC_GNUTLS_APP_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <xmlsec/xmlsec.h> #include <xmlsec/keys.h> #include <xmlsec/keysmngr.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /******************************************************************** * * Init/shutdown diff --git a/include/xmlsec/gnutls/crypto.h b/include/xmlsec/gnutls/crypto.h index f0e07c6f..fa9dbbcf 100644 --- a/include/xmlsec/gnutls/crypto.h +++ b/include/xmlsec/gnutls/crypto.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,14 +9,21 @@ #ifndef __XMLSEC_GNUTLS_CRYPTO_H__ #define __XMLSEC_GNUTLS_CRYPTO_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <xmlsec/xmlsec.h> #include <xmlsec/keys.h> #include <xmlsec/transforms.h> #include <xmlsec/dl.h> +#include <gnutls/gnutls.h> +#ifndef XMLSEC_NO_DSA +#include <gnutls/x509.h> +#endif /* XMLSEC_NO_DSA */ +#ifndef XMLSEC_NO_RSA +#include <gnutls/x509.h> +#endif /* XMLSEC_NO_RSA */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_gnutls(void); @@ -152,9 +159,6 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformKWDes3GetKlass(void) *******************************************************************/ #ifndef XMLSEC_NO_DSA -#include <gnutls/gnutls.h> -#include <gnutls/x509.h> - /** * xmlSecGnuTLSKeyDataDsaId: * @@ -284,9 +288,6 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformHmacSha512GetKlass(v *******************************************************************/ #ifndef XMLSEC_NO_RSA -#include <gnutls/gnutls.h> -#include <gnutls/x509.h> - /** * xmlSecGnuTLSKeyDataRsaId: * diff --git a/include/xmlsec/gnutls/symbols.h b/include/xmlsec/gnutls/symbols.h index cd654372..5c4a7261 100644 --- a/include/xmlsec/gnutls/symbols.h +++ b/include/xmlsec/gnutls/symbols.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. diff --git a/include/xmlsec/gnutls/x509.h b/include/xmlsec/gnutls/x509.h index e00bf751..d90d28d4 100644 --- a/include/xmlsec/gnutls/x509.h +++ b/include/xmlsec/gnutls/x509.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,10 +9,6 @@ #ifndef __XMLSEC_GNUTLS_X509_H__ #define __XMLSEC_GNUTLS_X509_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #ifndef XMLSEC_NO_X509 #include <gnutls/gnutls.h> @@ -22,6 +18,9 @@ extern "C" { #include <xmlsec/keys.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ /************************************************************************** * @@ -101,10 +100,10 @@ XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSX509StoreAdoptCert (xmlSecK -#endif /* XMLSEC_NO_X509 */ - #ifdef __cplusplus } #endif /* __cplusplus */ +#endif /* XMLSEC_NO_X509 */ + #endif /* __XMLSEC_GNUTLS_X509_H__ */ diff --git a/include/xmlsec/io.h b/include/xmlsec/io.h index 3e9757f8..246d0c72 100644 --- a/include/xmlsec/io.h +++ b/include/xmlsec/io.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Input uri transform and utility functions. @@ -11,16 +11,16 @@ #ifndef __XMLSEC_IO_H__ #define __XMLSEC_IO_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <libxml/xmlIO.h> #include <xmlsec/xmlsec.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + XMLSEC_EXPORT int xmlSecIOInit (void); XMLSEC_EXPORT void xmlSecIOShutdown (void); XMLSEC_EXPORT void xmlSecIOCleanupCallbacks (void); diff --git a/include/xmlsec/keyinfo.h b/include/xmlsec/keyinfo.h index b2f24d17..1f79284d 100644 --- a/include/xmlsec/keyinfo.h +++ b/include/xmlsec/keyinfo.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * <dsig:KeyInfo> element processing @@ -12,10 +12,6 @@ #ifndef __XMLSEC_KEYINFO_H__ #define __XMLSEC_KEYINFO_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <time.h> #include <libxml/tree.h> @@ -26,6 +22,10 @@ extern "C" { #include <xmlsec/keys.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /**************************************************************************** * * High-level functions @@ -155,17 +155,6 @@ typedef enum { #define XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS 0x00004000 /** - * XMLSEC_KEYINFO_FLAGS_SKIP_VERIFY_CHAIN: - * - * If the flag is set then we wont stop document validation - * on certificate chain error. Instead of stopping validation - * we'll just set flag XMLSEC_KEYINFO_ERROR_FLAGS_BROKEN_CHAIN - * as flags2 value. - */ -#define XMLSEC_KEYINFO_FLAGS_ALLOW_BROKEN_CHAIN 0x00008000 -#define XMLSEC_KEYINFO_ERROR_FLAGS_BROKEN_CHAIN 0x00000001 - -/** * xmlSecKeyInfoCtx: * @userData: the pointer to user data (xmlsec and xmlsec-crypto * never touch this). diff --git a/include/xmlsec/keys.h b/include/xmlsec/keys.h index 13b37df8..f673128a 100644 --- a/include/xmlsec/keys.h +++ b/include/xmlsec/keys.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Keys. @@ -11,16 +11,15 @@ #ifndef __XMLSEC_KEYS_H__ #define __XMLSEC_KEYS_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <time.h> #include <xmlsec/xmlsec.h> #include <xmlsec/list.h> #include <xmlsec/keysdata.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ /** * xmlSecKeyUsage: @@ -32,29 +31,28 @@ typedef unsigned int xmlSecKeyUsage; /** * xmlSecKeyUsageSign: * - * Key can be used in any way. - + * Key for signing. */ #define xmlSecKeyUsageSign 0x00000001 /** * xmlSecKeyUsageVerify: * - * Key for signing. + * Key for signature verification. */ #define xmlSecKeyUsageVerify 0x00000002 /** * xmlSecKeyUsageEncrypt: * - * Key for signature verification. + * An encryption key. */ #define xmlSecKeyUsageEncrypt 0x00000004 /** * xmlSecKeyUsageDecrypt: * - * An encryption key. + * A decryption key. */ #define xmlSecKeyUsageDecrypt 0x00000008 @@ -68,7 +66,7 @@ typedef unsigned int xmlSecKeyUsage; /** * xmlSecKeyUsageAny: * - * A decryption key. + * Key can be used in any way. */ #define xmlSecKeyUsageAny 0xFFFFFFFF diff --git a/include/xmlsec/keysdata.h b/include/xmlsec/keysdata.h index f833a27e..10639aa1 100644 --- a/include/xmlsec/keysdata.h +++ b/include/xmlsec/keysdata.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Key data. @@ -11,16 +11,16 @@ #ifndef __XMLSEC_KEYSDATA_H__ #define __XMLSEC_KEYSDATA_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <xmlsec/xmlsec.h> #include <xmlsec/buffer.h> #include <xmlsec/list.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /**************************************************************************** * * Forward declarations @@ -137,7 +137,7 @@ typedef unsigned int xmlSecKeyDataUsage; /** * xmlSecKeyDataType: * - * The key data type (public/private, session/permanet, etc.). + * The key data type (public/private, session/permanent, etc.). */ typedef unsigned int xmlSecKeyDataType; @@ -378,7 +378,7 @@ typedef int (*xmlSecKeyDataInitMethod) (xmlSecKeyDataPt /** * xmlSecKeyDataDuplicateMethod: * @dst: the pointer to destination key data. - * @src: the poiniter to source key data. + * @src: the pointer to source key data. * * Key data specific duplication (copy) method. * @@ -829,6 +829,10 @@ struct _xmlSecKeyDataStoreKlass { #define xmlSecKeyDataStorePtrListId xmlSecKeyDataStorePtrListGetKlass() XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataStorePtrListGetKlass (void); +#ifdef XMLSEC_PRIVATE +XMLSEC_EXPORT void xmlSecImportSetPersistKey (void); +XMLSEC_EXPORT int xmlSecImportGetPersistKey (void); +#endif #ifdef __cplusplus } diff --git a/include/xmlsec/keysmngr.h b/include/xmlsec/keysmngr.h index ed0250df..de49d8ed 100644 --- a/include/xmlsec/keysmngr.h +++ b/include/xmlsec/keysmngr.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Keys Manager @@ -11,16 +11,16 @@ #ifndef __XMLSEC_KEYSMGMR_H__ #define __XMLSEC_KEYSMGMR_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <xmlsec/xmlsec.h> #include <xmlsec/list.h> #include <xmlsec/keys.h> #include <xmlsec/keysdata.h> #include <xmlsec/keyinfo.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef const struct _xmlSecKeyKlass xmlSecKeyKlass, *xmlSecKeyId; typedef const struct _xmlSecKeyStoreKlass xmlSecKeyStoreKlass, diff --git a/include/xmlsec/list.h b/include/xmlsec/list.h index e976402e..46adc8d2 100644 --- a/include/xmlsec/list.h +++ b/include/xmlsec/list.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * List of pointers. @@ -11,13 +11,13 @@ #ifndef __XMLSEC_LIST_H__ #define __XMLSEC_LIST_H__ +#include <xmlsec/xmlsec.h> +#include <xmlsec/buffer.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include <xmlsec/xmlsec.h> -#include <xmlsec/buffer.h> - typedef const struct _xmlSecPtrListKlass xmlSecPtrListKlass, *xmlSecPtrListId; typedef struct _xmlSecPtrList xmlSecPtrList, @@ -147,7 +147,7 @@ typedef void (*xmlSecPtrDebugDumpItemMethod) (xmlSecPtr ptr, /** * xmlSecPtrListKlass: * @name: the list klass name. - * @duplicateItem: the duplciate item method. + * @duplicateItem: the duplicate item method. * @destroyItem: the destroy item method. * @debugDumpItem: the debug dump item method. * @debugXmlDumpItem: the debug dump item in xml format method. diff --git a/include/xmlsec/membuf.h b/include/xmlsec/membuf.h index 0eab2062..c5959c44 100644 --- a/include/xmlsec/membuf.h +++ b/include/xmlsec/membuf.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Memory buffer transform @@ -11,16 +11,16 @@ #ifndef __XMLSEC_MEMBUF_H__ #define __XMLSEC_MEMBUF_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <xmlsec/xmlsec.h> #include <xmlsec/buffer.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /******************************************************************** * * Memory Buffer transform diff --git a/include/xmlsec/mscng/Makefile.am b/include/xmlsec/mscng/Makefile.am new file mode 100644 index 00000000..3f366cd8 --- /dev/null +++ b/include/xmlsec/mscng/Makefile.am @@ -0,0 +1,16 @@ +NULL = + +xmlsecmscngincdir = $(includedir)/xmlsec1/xmlsec/mscng + +xmlsecmscnginc_HEADERS = \ +app.h \ +certkeys.h \ +crypto.h \ +keysstore.h \ +symbols.h \ +x509.h \ +$(NULL) + +install-exec-hook: + $(mkinstalldirs) $(DESTDIR)$(xmlsecmscngincdir) + diff --git a/include/xmlsec/mscng/app.h b/include/xmlsec/mscng/app.h new file mode 100644 index 00000000..f1fbf6f8 --- /dev/null +++ b/include/xmlsec/mscng/app.h @@ -0,0 +1,100 @@ +/* + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2018 Miklos Vajna. All Rights Reserved. + */ +#ifndef __XMLSEC_MSCNG_APP_H__ +#define __XMLSEC_MSCNG_APP_H__ + +#include <windows.h> + +#include <xmlsec/xmlsec.h> +#include <xmlsec/keys.h> +#include <xmlsec/keysmngr.h> +#include <xmlsec/transforms.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/******************************************************************** + * + * Init/shutdown + * + ********************************************************************/ +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppInit (const char* config); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppShutdown (void); +XMLSEC_CRYPTO_EXPORT LPCTSTR xmlSecMSCngAppGetCertStoreName (void); + +/******************************************************************** + * + * Keys Manager + * + ********************************************************************/ +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, + xmlSecKeyPtr key); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr, + const char* uri); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr, + const char* filename, + xmlSecKeyDataType type); +#ifndef XMLSEC_NO_X509 +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr, + const char *filename, + xmlSecKeyDataFormat format, + xmlSecKeyDataType type); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppKeysMngrCertLoadMemory (xmlSecKeysMngrPtr mngr, + const xmlSecByte *data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format, + xmlSecKeyDataType type); +#endif /* XMLSEC_NO_X509 */ + + +/******************************************************************** + * + * Keys + * + ********************************************************************/ +XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCngAppKeyLoad (const char *filename, + xmlSecKeyDataFormat format, + const char *pwd, + void *pwdCallback, + void* pwdCallbackCtx); +XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCngAppKeyLoadMemory (const xmlSecByte *data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format, + const char *pwd, + void *pwdCallback, + void* pwdCallbackCtx); +#ifndef XMLSEC_NO_X509 +XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCngAppPkcs12Load (const char *filename, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); +XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCngAppPkcs12LoadMemory (const xmlSecByte *data, + xmlSecSize dataSize, + const char *pwd, + void* pwdCallback, + void* pwdCallbackCtx); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppKeyCertLoad (xmlSecKeyPtr key, + const char* filename, + xmlSecKeyDataFormat format); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngAppKeyCertLoadMemory (xmlSecKeyPtr key, + const xmlSecByte *data, + xmlSecSize dataSize, + xmlSecKeyDataFormat format); +#endif /* XMLSEC_NO_X509 */ + +XMLSEC_CRYPTO_EXPORT void* xmlSecMSCngAppGetDefaultPwdCallback (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_MSCNG_APP_H__ */ + diff --git a/include/xmlsec/mscng/certkeys.h b/include/xmlsec/mscng/certkeys.h new file mode 100644 index 00000000..16461088 --- /dev/null +++ b/include/xmlsec/mscng/certkeys.h @@ -0,0 +1,33 @@ +/* + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2018 Miklos Vajna. All Rights Reserved. + */ +#ifndef __XMLSEC_MSCNG_CERTKEYS_H__ +#define __XMLSEC_MSCNG_CERTKEYS_H__ + +#include <windows.h> + +#include <xmlsec/xmlsec.h> +#include <xmlsec/keys.h> +#include <xmlsec/transforms.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecMSCngCertAdopt (PCCERT_CONTEXT pCert, + xmlSecKeyDataType type); +XMLSEC_CRYPTO_EXPORT BCRYPT_KEY_HANDLE xmlSecMSCngKeyDataGetPubKey (xmlSecKeyDataPtr data); +XMLSEC_CRYPTO_EXPORT NCRYPT_KEY_HANDLE xmlSecMSCngKeyDataGetPrivKey(xmlSecKeyDataPtr data); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_MSCNG_PCCERT_CONTEXT_H__ */ + + diff --git a/include/xmlsec/mscng/crypto.h b/include/xmlsec/mscng/crypto.h new file mode 100644 index 00000000..c8afa792 --- /dev/null +++ b/include/xmlsec/mscng/crypto.h @@ -0,0 +1,515 @@ +/* + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2018 Miklos Vajna. All Rights Reserved. + */ +#ifndef __XMLSEC_MSCNG_CRYPTO_H__ +#define __XMLSEC_MSCNG_CRYPTO_H__ + +#include <windows.h> + +#include <xmlsec/xmlsec.h> +#include <xmlsec/keys.h> +#include <xmlsec/transforms.h> +#include <xmlsec/dl.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_mscng(void); + +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT LPTSTR xmlSecMSCngConvertUtf8ToTstr(const xmlChar* str); +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT LPWSTR xmlSecMSCngConvertUtf8ToUnicode(const xmlChar* str); +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT xmlChar* xmlSecMSCngConvertTstrToUtf8(LPCTSTR str); +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT xmlChar* xmlSecMSCngConvertUnicodeToUtf8(LPCWSTR str); + + +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size); + +/******************************************************************** + * + * Init shutdown + * + ********************************************************************/ +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngInit (void); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngShutdown (void); + +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngKeysMngrInit (xmlSecKeysMngrPtr mngr); + +/******************************************************************** + * + * DSA transforms + * + *******************************************************************/ +#ifndef XMLSEC_NO_DSA + +/** + * xmlSecMSCngKeyDataDsaId: + * + * The DSA key klass. + */ +#define xmlSecMSCngKeyDataDsaId \ + xmlSecMSCngKeyDataDsaGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCngKeyDataDsaGetKlass(void); + +#ifndef XMLSEC_NO_SHA1 +/** + * xmlSecMSCngTransformDsaSha1Id: + * + * The DSA-SHA1 signature transform klass. + */ +#define xmlSecMSCngTransformDsaSha1Id \ + xmlSecMSCngTransformDsaSha1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformDsaSha1GetKlass(void); +#endif /* XMLSEC_NO_SHA1 */ + +#endif /* XMLSEC_NO_DSA */ + +/******************************************************************** + * + * RSA transforms + * + *******************************************************************/ +#ifndef XMLSEC_NO_RSA + +/** + * xmlSecMSCngKeyDataRsaId: + * + * The RSA key klass. + */ +#define xmlSecMSCngKeyDataRsaId \ + xmlSecMSCngKeyDataRsaGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCngKeyDataRsaGetKlass(void); + +#ifndef XMLSEC_NO_MD5 +/** + * xmlSecMSCngTransformRsaMd5Id: + * + * The RSA-MD5 signature transform klass. + */ +#define xmlSecMSCngTransformRsaMd5Id \ + xmlSecMSCngTransformRsaMd5GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformRsaMd5GetKlass(void); +#endif /* XMLSEC_NO_MD5 */ + +#ifndef XMLSEC_NO_SHA1 +/** + * xmlSecMSCngTransformRsaSha1Id: + * + * The RSA-SHA1 signature transform klass. + */ +#define xmlSecMSCngTransformRsaSha1Id \ + xmlSecMSCngTransformRsaSha1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformRsaSha1GetKlass(void); +#endif /* XMLSEC_NO_SHA1 */ + +#ifndef XMLSEC_NO_SHA256 +/** + * xmlSecMSCngTransformRsaSha256Id: + * + * The RSA-SHA256 signature transform klass. + */ +#define xmlSecMSCngTransformRsaSha256Id \ + xmlSecMSCngTransformRsaSha256GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformRsaSha256GetKlass(void); +#endif /* XMLSEC_NO_SHA256 */ + +#ifndef XMLSEC_NO_SHA384 +/** + * xmlSecMSCngTransformRsaSha384Id: + * + * The RSA-SHA384 signature transform klass. + */ +#define xmlSecMSCngTransformRsaSha384Id \ + xmlSecMSCngTransformRsaSha384GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformRsaSha384GetKlass(void); +#endif /* XMLSEC_NO_SHA384 */ + +#ifndef XMLSEC_NO_SHA512 +/** + * xmlSecMSCngTransformRsaSha512Id: + * + * The RSA-SHA512 signature transform klass. + */ +#define xmlSecMSCngTransformRsaSha512Id \ + xmlSecMSCngTransformRsaSha512GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformRsaSha512GetKlass(void); +#endif /* XMLSEC_NO_SHA512 */ + +/** + * xmlSecMSCngTransformRsaPkcs1Id: + * + * The RSA PKCS1 key transport transform klass. + */ +#define xmlSecMSCngTransformRsaPkcs1Id \ + xmlSecMSCngTransformRsaPkcs1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformRsaPkcs1GetKlass(void); + +/** + * xmlSecMSCngTransformRsaOaepId: + * + * The RSA OAEP key transport transform klass. + */ +#define xmlSecMSCngTransformRsaOaepId \ + xmlSecMSCngTransformRsaOaepGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformRsaOaepGetKlass(void); + +#endif /* XMLSEC_NO_RSA */ + +/******************************************************************** + * + * ECDSA transforms + * + *******************************************************************/ +#ifndef XMLSEC_NO_ECDSA + +/** + * xmlSecMSCngKeyDataEcdsaId: + * + * The ECDSA key klass. + */ +#define xmlSecMSCngKeyDataEcdsaId \ + xmlSecMSCngKeyDataEcdsaGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCngKeyDataEcdsaGetKlass(void); + +#ifndef XMLSEC_NO_SHA1 +/** + * xmlSecMSCngTransformEcdsaSha1Id: + * + * The ECDSA-SHA1 signature transform klass. + */ +#define xmlSecMSCngTransformEcdsaSha1Id \ + xmlSecMSCngTransformEcdsaSha1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformEcdsaSha1GetKlass(void); +#endif /* XMLSEC_NO_SHA1 */ + +#ifndef XMLSEC_NO_SHA256 +/** + * xmlSecMSCngTransformEcdsaSha256Id: + * + * The ECDSA-SHA256 signature transform klass. + */ +#define xmlSecMSCngTransformEcdsaSha256Id \ + xmlSecMSCngTransformEcdsaSha256GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformEcdsaSha256GetKlass(void); +#endif /* XMLSEC_NO_SHA256 */ + +#ifndef XMLSEC_NO_SHA384 +/** + * xmlSecMSCngTransformEcdsaSha384Id: + * + * The ECDSA-SHA384 signature transform klass. + */ +#define xmlSecMSCngTransformEcdsaSha384Id \ + xmlSecMSCngTransformEcdsaSha384GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformEcdsaSha384GetKlass(void); +#endif /* XMLSEC_NO_SHA384 */ + +#ifndef XMLSEC_NO_SHA512 +/** + * xmlSecMSCngTransformEcdsaSha512Id: + * + * The ECDSA-SHA512 signature transform klass. + */ +#define xmlSecMSCngTransformEcdsaSha512Id \ + xmlSecMSCngTransformEcdsaSha512GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformEcdsaSha512GetKlass(void); +#endif /* XMLSEC_NO_SHA512 */ + +#endif /* XMLSEC_NO_ECDSA */ + +/******************************************************************** + * + * DES transform + * + *******************************************************************/ +#ifndef XMLSEC_NO_DES + +/** + * xmlSecMSCngKeyDataDesId: + * + * The DES key data klass. + */ +#define xmlSecMSCngKeyDataDesId \ + xmlSecMSCngKeyDataDesGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCngKeyDataDesGetKlass(void); + +/** + * xmlSecMSCngTransformDes3CbcId: + * + * The DES3 CBC cipher transform klass. + */ +#define xmlSecMSCngTransformDes3CbcId \ + xmlSecMSCngTransformDes3CbcGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformDes3CbcGetKlass(void); + +/** + * xmlSecMSCngTransformKWDes3Id: + * + * The DES3 KW transform klass. + */ +#define xmlSecMSCngTransformKWDes3Id \ + xmlSecMSCngTransformKWDes3GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformKWDes3GetKlass(void); + +#endif /* XMLSEC_NO_DES */ + +/******************************************************************** + * + * HMAC transforms + * + *******************************************************************/ +#ifndef XMLSEC_NO_HMAC + +/** + * xmlSecMSCngKeyDataHmacId: + * + * The HMAC key klass. + */ +#define xmlSecMSCngKeyDataHmacId \ + xmlSecMSCngKeyDataHmacGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCngKeyDataHmacGetKlass(void); + +#ifndef XMLSEC_NO_MD5 +/** + * xmlSecMSCngTransformHmacMd5Id: + * + * The HMAC-MD5 signature transform klass. + */ +#define xmlSecMSCngTransformHmacMd5Id \ + xmlSecMSCngTransformHmacMd5GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformHmacMd5GetKlass(void); +#endif /* XMLSEC_NO_MD5 */ + +#ifndef XMLSEC_NO_SHA1 +/** + * xmlSecMSCngTransformHmacSha1Id: + * + * The HMAC-SHA1 signature transform klass. + */ +#define xmlSecMSCngTransformHmacSha1Id \ + xmlSecMSCngTransformHmacSha1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformHmacSha1GetKlass(void); +#endif /* XMLSEC_NO_SHA1 */ + +#ifndef XMLSEC_NO_SHA256 +/** + * xmlSecMSCngTransformHmacSha256Id: + * + * The HMAC-SHA256 signature transform klass. + */ +#define xmlSecMSCngTransformHmacSha256Id \ + xmlSecMSCngTransformHmacSha256GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformHmacSha256GetKlass(void); +#endif /* XMLSEC_NO_SHA256 */ + +#ifndef XMLSEC_NO_SHA384 +/** + * xmlSecMSCngTransformHmacSha384Id: + * + * The HMAC-SHA384 signature transform klass. + */ +#define xmlSecMSCngTransformHmacSha384Id \ + xmlSecMSCngTransformHmacSha384GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformHmacSha384GetKlass(void); +#endif /* XMLSEC_NO_SHA384 */ + +#ifndef XMLSEC_NO_SHA512 +/** + * xmlSecMSCngTransformHmacSha512Id: + * + * The HMAC-SHA512 signature transform klass. + */ +#define xmlSecMSCngTransformHmacSha512Id \ + xmlSecMSCngTransformHmacSha512GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformHmacSha512GetKlass(void); +#endif /* XMLSEC_NO_SHA512 */ + +#endif /* XMLSEC_NO_HMAC */ + +/******************************************************************** + * + * MD5 transform + * + *******************************************************************/ +#ifndef XMLSEC_NO_MD5 +/** + * xmlSecMSCngTransformMd5Id: + * + * The MD5 digest transform klass. + */ +#define xmlSecMSCngTransformMd5Id \ + xmlSecMSCngTransformMd5GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformMd5GetKlass(void); +#endif /* XMLSEC_NO_MD5 */ + +/******************************************************************** + * + * SHA1 transform + * + *******************************************************************/ +#ifndef XMLSEC_NO_SHA1 +/** + * xmlSecMSCngTransformSha1Id: + * + * The SHA1 digest transform klass. + */ +#define xmlSecMSCngTransformSha1Id \ + xmlSecMSCngTransformSha1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformSha1GetKlass(void); +#endif /* XMLSEC_NO_SHA1 */ + +/******************************************************************** + * + * SHA256 transform + * + *******************************************************************/ +#ifndef XMLSEC_NO_SHA256 +/** + * xmlSecMSCngTransformSha256Id: + * + * The SHA256 digest transform klass. + */ +#define xmlSecMSCngTransformSha256Id \ + xmlSecMSCngTransformSha256GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformSha256GetKlass(void); +#endif /* XMLSEC_NO_SHA256 */ + +/******************************************************************** + * + * SHA384 transform + * + *******************************************************************/ +#ifndef XMLSEC_NO_SHA384 +/** + * xmlSecMSCngTransformSha384Id: + * + * The SHA384 digest transform klass. + */ +#define xmlSecMSCngTransformSha384Id \ + xmlSecMSCngTransformSha384GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformSha384GetKlass(void); +#endif /* XMLSEC_NO_SHA384 */ + +/******************************************************************** + * + * SHA512 transform + * + *******************************************************************/ +#ifndef XMLSEC_NO_SHA512 +/** + * xmlSecMSCngTransformSha512Id: + * + * The SHA512 digest transform klass. + */ +#define xmlSecMSCngTransformSha512Id \ + xmlSecMSCngTransformSha512GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformSha512GetKlass(void); +#endif /* XMLSEC_NO_SHA512 */ + +/******************************************************************** + * + * AES transforms + * + *******************************************************************/ +#ifndef XMLSEC_NO_AES +/** + * xmlSecMSCngKeyDataAesId: + * + * The AES key data klass. + */ +#define xmlSecMSCngKeyDataAesId \ + xmlSecMSCngKeyDataAesGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCngKeyDataAesGetKlass(void); + +/** + * xmlSecMSCngTransformAes128CbcId: + * + * The AES128 CBC cipher transform klass. + */ +#define xmlSecMSCngTransformAes128CbcId \ + xmlSecMSCngTransformAes128CbcGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformAes128CbcGetKlass(void); + +/** + * xmlSecMSCngTransformAes192CbcId: + * + * The AES192 CBC cipher transform klass. + */ +#define xmlSecMSCngTransformAes192CbcId \ + xmlSecMSCngTransformAes192CbcGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformAes192CbcGetKlass(void); + +/** + * xmlSecMSCngTransformAes256CbcId: + * + * The AES256 CBC cipher transform klass. + */ +#define xmlSecMSCngTransformAes256CbcId \ + xmlSecMSCngTransformAes256CbcGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformAes256CbcGetKlass(void); + +/** + * xmlSecMSCngTransformAes128GcmId: + * + * The AES128 GCM cipher transform klass. + */ +#define xmlSecMSCngTransformAes128GcmId \ + xmlSecMSCngTransformAes128GcmGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformAes128GcmGetKlass(void); + +/** + * xmlSecMSCngTransformAes192GcmId: + * + * The AES192 GCM cipher transform klass. + */ +#define xmlSecMSCngTransformAes192GcmId \ + xmlSecMSCngTransformAes192GcmGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformAes192GcmGetKlass(void); + +/** + * xmlSecMSCngTransformAes256GcmId: + * + * The AES256 GCM cipher transform klass. + */ +#define xmlSecMSCngTransformAes256GcmId \ + xmlSecMSCngTransformAes256GcmGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformAes256GcmGetKlass(void); + +/** + * xmlSecMSCngTransformKWAes128Id: + * + * The AES 128 key wrap transform klass. + */ +#define xmlSecMSCngTransformKWAes128Id \ + xmlSecMSCngTransformKWAes128GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformKWAes128GetKlass(void); + +/** + * xmlSecMSCngTransformKWAes192Id: + * + * The AES 192 key wrap transform klass. + */ +#define xmlSecMSCngTransformKWAes192Id \ + xmlSecMSCngTransformKWAes192GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformKWAes192GetKlass(void); + +/** + * xmlSecMSCngTransformKWAes256Id: + * + * The AES 256 key wrap transform klass. + */ +#define xmlSecMSCngTransformKWAes256Id \ + xmlSecMSCngTransformKWAes256GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCngTransformKWAes256GetKlass(void); +#endif /* XMLSEC_NO_AES */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_MSCNG_CRYPTO_H__ */ diff --git a/include/xmlsec/mscng/keysstore.h b/include/xmlsec/mscng/keysstore.h new file mode 100644 index 00000000..20a4eb13 --- /dev/null +++ b/include/xmlsec/mscng/keysstore.h @@ -0,0 +1,41 @@ +/* + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2018 Miklos Vajna. All Rights Reserved. + */ +#ifndef __XMLSEC_MSCNG_KEYSSTORE_H__ +#define __XMLSEC_MSCNG_KEYSSTORE_H__ + +#include <xmlsec/xmlsec.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * xmlSecMSCngKeysStoreId: + * + * A MSCng keys store klass id. + */ +#define xmlSecMSCngKeysStoreId xmlSecMSCngKeysStoreGetKlass() + +XMLSEC_CRYPTO_EXPORT xmlSecKeyStoreId xmlSecMSCngKeysStoreGetKlass(void); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngKeysStoreAdoptKey(xmlSecKeyStorePtr store, + xmlSecKeyPtr key); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngKeysStoreLoad (xmlSecKeyStorePtr store, + const char *uri, + xmlSecKeysMngrPtr keysMngr); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngKeysStoreSave (xmlSecKeyStorePtr store, + const char *filename, + xmlSecKeyDataType type); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_MSCNG_PCCERT_CONTEXT_H__ */ + + diff --git a/include/xmlsec/mscng/symbols.h b/include/xmlsec/mscng/symbols.h new file mode 100644 index 00000000..07fc0ef1 --- /dev/null +++ b/include/xmlsec/mscng/symbols.h @@ -0,0 +1,125 @@ +/* + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2018 Miklos Vajna. All Rights Reserved. + */ +#ifndef __XMLSEC_MSCNG_SYMBOLS_H__ +#define __XMLSEC_MSCNG_SYMBOLS_H__ + +#if !defined(IN_XMLSEC) && defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) +#error To disable dynamic loading of xmlsec-crypto libraries undefine XMLSEC_CRYPTO_DYNAMIC_LOADING +#endif /* !defined(IN_XMLSEC) && defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifdef XMLSEC_CRYPTO_MSCNG + +/******************************************************************** + * + * Crypto Init/shutdown + * + ********************************************************************/ +#define xmlSecCryptoInit xmlSecMSCngInit +#define xmlSecCryptoShutdown xmlSecMSCngShutdown + +#define xmlSecCryptoKeysMngrInit xmlSecMSCngKeysMngrInit + +/******************************************************************** + * + * Key data ids + * + ********************************************************************/ +#define xmlSecKeyDataAesId xmlSecMSCngKeyDataAesId +#define xmlSecKeyDataDesId xmlSecMSCngKeyDataDesId +#define xmlSecKeyDataDsaId xmlSecMSCngKeyDataDsaId +#define xmlSecKeyDataEcdsaId xmlSecMSCngKeyDataEcdsaId +#define xmlSecKeyDataHmacId xmlSecMSCngKeyDataHmacId +#define xmlSecKeyDataRsaId xmlSecMSCngKeyDataRsaId +#define xmlSecKeyDataX509Id xmlSecMSCngKeyDataX509Id +#define xmlSecKeyDataRawX509CertId xmlSecMSCngKeyDataRawX509CertId + +/******************************************************************** + * + * Key data store ids + * + ********************************************************************/ +#define xmlSecX509StoreId xmlSecMSCngX509StoreId + +/******************************************************************** + * + * Crypto transforms ids + * + ********************************************************************/ +#define xmlSecTransformAes128CbcId xmlSecMSCngTransformAes128CbcId +#define xmlSecTransformAes192CbcId xmlSecMSCngTransformAes192CbcId +#define xmlSecTransformAes256CbcId xmlSecMSCngTransformAes256CbcId +#define xmlSecTransformAes128GcmId xmlSecMSCngTransformAes128GcmId +#define xmlSecTransformAes192GcmId xmlSecMSCngTransformAes192GcmId +#define xmlSecTransformAes256GcmId xmlSecMSCngTransformAes256GcmId +#define xmlSecTransformKWAes128Id xmlSecMSCngTransformKWAes128Id +#define xmlSecTransformKWAes192Id xmlSecMSCngTransformKWAes192Id +#define xmlSecTransformKWAes256Id xmlSecMSCngTransformKWAes256Id +#define xmlSecTransformDes3CbcId xmlSecMSCngTransformDes3CbcId +#define xmlSecTransformKWDes3Id xmlSecMSCngTransformKWDes3Id +#define xmlSecTransformDsaSha1Id xmlSecMSCngTransformDsaSha1Id +#define xmlSecTransformDsaSha256Id xmlSecMSCngTransformDsaSha256Id +#define xmlSecTransformEcdsaSha1Id xmlSecMSCngTransformEcdsaSha1Id +#define xmlSecTransformEcdsaSha224Id xmlSecMSCngTransformEcdsaSha224Id +#define xmlSecTransformEcdsaSha256Id xmlSecMSCngTransformEcdsaSha256Id +#define xmlSecTransformEcdsaSha384Id xmlSecMSCngTransformEcdsaSha384Id +#define xmlSecTransformEcdsaSha512Id xmlSecMSCngTransformEcdsaSha512Id +#define xmlSecTransformHmacMd5Id xmlSecMSCngTransformHmacMd5Id +#define xmlSecTransformHmacRipemd160Id xmlSecMSCngTransformHmacRipemd160Id +#define xmlSecTransformHmacSha1Id xmlSecMSCngTransformHmacSha1Id +#define xmlSecTransformHmacSha224Id xmlSecMSCngTransformHmacSha224Id +#define xmlSecTransformHmacSha256Id xmlSecMSCngTransformHmacSha256Id +#define xmlSecTransformHmacSha384Id xmlSecMSCngTransformHmacSha384Id +#define xmlSecTransformHmacSha512Id xmlSecMSCngTransformHmacSha512Id +#define xmlSecTransformMd5Id xmlSecMSCngTransformMd5Id +#define xmlSecTransformRipemd160Id xmlSecMSCngTransformRipemd160Id +#define xmlSecTransformRsaSha1Id xmlSecMSCngTransformRsaSha1Id +#define xmlSecTransformRsaSha224Id xmlSecMSCngTransformRsaSha224Id +#define xmlSecTransformRsaSha256Id xmlSecMSCngTransformRsaSha256Id +#define xmlSecTransformRsaSha384Id xmlSecMSCngTransformRsaSha384Id +#define xmlSecTransformRsaSha512Id xmlSecMSCngTransformRsaSha512Id +#define xmlSecTransformRsaPkcs1Id xmlSecMSCngTransformRsaPkcs1Id +#define xmlSecTransformRsaOaepId xmlSecMSCngTransformRsaOaepId +#define xmlSecTransformSha1Id xmlSecMSCngTransformSha1Id +#define xmlSecTransformSha224Id xmlSecMSCngTransformSha224Id +#define xmlSecTransformSha256Id xmlSecMSCngTransformSha256Id +#define xmlSecTransformSha384Id xmlSecMSCngTransformSha384Id +#define xmlSecTransformSha512Id xmlSecMSCngTransformSha512Id + +/******************************************************************** + * + * High level routines form xmlsec command line utility + * + ********************************************************************/ +#define xmlSecCryptoAppInit xmlSecMSCngAppInit +#define xmlSecCryptoAppShutdown xmlSecMSCngAppShutdown +#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecMSCngAppDefaultKeysMngrInit +#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecMSCngAppDefaultKeysMngrAdoptKey +#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecMSCngAppDefaultKeysMngrLoad +#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecMSCngAppDefaultKeysMngrSave +#define xmlSecCryptoAppKeysMngrCertLoad xmlSecMSCngAppKeysMngrCertLoad +#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecMSCngAppKeysMngrCertLoadMemory +#define xmlSecCryptoAppKeyLoad xmlSecMSCngAppKeyLoad +#define xmlSecCryptoAppPkcs12Load xmlSecMSCngAppPkcs12Load +#define xmlSecCryptoAppKeyCertLoad xmlSecMSCngAppKeyCertLoad +#define xmlSecCryptoAppKeyLoadMemory xmlSecMSCngAppKeyLoadMemory +#define xmlSecCryptoAppPkcs12LoadMemory xmlSecMSCngAppPkcs12LoadMemory +#define xmlSecCryptoAppKeyCertLoadMemory xmlSecMSCngAppKeyCertLoadMemory +#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecMSCngAppGetDefaultPwdCallback + +#endif /* XMLSEC_CRYPTO_MSCNG */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XMLSEC_MSCNG_CRYPTO_H__ */ diff --git a/include/xmlsec/mscng/x509.h b/include/xmlsec/mscng/x509.h new file mode 100644 index 00000000..6c2f7415 --- /dev/null +++ b/include/xmlsec/mscng/x509.h @@ -0,0 +1,83 @@ +/* + * XML Security Library (http://www.aleksey.com/xmlsec). + * + * This is free software; see Copyright file in the source + * distribution for preciese wording. + * + * Copyright (C) 2018 Miklos Vajna. All Rights Reserved. + */ +#ifndef __XMLSEC_MSCNG_X509_H__ +#define __XMLSEC_MSCNG_X509_H__ + +#ifndef XMLSEC_NO_X509 + +#include <xmlsec/xmlsec.h> +#include <xmlsec/keys.h> +#include <xmlsec/transforms.h> + +#include <windows.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * xmlSecMSCngKeyDataX509Id: + * + * The MSCng X509 data klass. + */ +#define xmlSecMSCngKeyDataX509Id \ + xmlSecMSCngKeyDataX509GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCngKeyDataX509GetKlass(void); + +/** + * xmlSecMSCngKeyDataRawX509CertId: + * + * The MSCng raw X509 certificate klass. + */ +#define xmlSecMSCngKeyDataRawX509CertId \ + xmlSecMSCngKeyDataRawX509CertGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCngKeyDataRawX509CertGetKlass(void); + +/** + * xmlSecMSCngX509StoreId: + * + * The MSCng X509 store klass. + */ +#define xmlSecMSCngX509StoreId \ + xmlSecMSCngX509StoreGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataStoreId xmlSecMSCngX509StoreGetKlass(void); + +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngKeyDataX509AdoptKeyCert (xmlSecKeyDataPtr data, + PCCERT_CONTEXT cert); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngKeyDataX509AdoptCert (xmlSecKeyDataPtr data, + PCCERT_CONTEXT cert); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngX509StoreAdoptCert (xmlSecKeyDataStorePtr store, + PCCERT_CONTEXT cert, + xmlSecKeyDataType type); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngX509StoreAdoptKeyStore (xmlSecKeyDataStorePtr store, + HCERTSTORE keyStore); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngX509StoreAdoptTrustedStore(xmlSecKeyDataStorePtr store, + HCERTSTORE trustedStore); +XMLSEC_CRYPTO_EXPORT int xmlSecMSCngX509StoreAdoptUntrustedStore(xmlSecKeyDataStorePtr store, + HCERTSTORE untrustedStore); +XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCngX509StoreVerify (xmlSecKeyDataStorePtr store, + HCERTSTORE certs, + xmlSecKeyInfoCtx* keyInfoCtx); +PCCERT_CONTEXT xmlSecMSCngX509StoreFindCert (xmlSecKeyDataStorePtr store, + xmlChar *subjectName, + xmlChar *issuerName, + xmlChar *issuerSerial, + xmlChar *ski, + xmlSecKeyInfoCtx* keyInfoCtx); +PCCERT_CONTEXT xmlSecMSCngX509FindCertBySubject (HCERTSTORE store, + LPTSTR wcSubject, + DWORD dwCertEncodingType); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* XMLSEC_NO_X509 */ + +#endif /* __XMLSEC_MSCNG_X509_H__ */ diff --git a/include/xmlsec/mscrypto/app.h b/include/xmlsec/mscrypto/app.h index 3d23d0e5..86f7e513 100644 --- a/include/xmlsec/mscrypto/app.h +++ b/include/xmlsec/mscrypto/app.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,10 +9,6 @@ #ifndef __XMLSEC_MSCRYPTO_APP_H__ #define __XMLSEC_MSCRYPTO_APP_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <xmlsec/xmlsec.h> #include <xmlsec/keys.h> #include <xmlsec/keysmngr.h> @@ -21,6 +17,10 @@ extern "C" { #include <windows.h> #include <wincrypt.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /******************************************************************** * * Init/shutdown diff --git a/include/xmlsec/mscrypto/certkeys.h b/include/xmlsec/mscrypto/certkeys.h index 1f285656..817e3f44 100644 --- a/include/xmlsec/mscrypto/certkeys.h +++ b/include/xmlsec/mscrypto/certkeys.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,10 +9,6 @@ #ifndef __XMLSEC_MSCRYPTO_CERTKEYS_H__ #define __XMLSEC_MSCRYPTO_CERTKEYS_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <windows.h> #include <wincrypt.h> @@ -20,6 +16,9 @@ extern "C" { #include <xmlsec/keys.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoKeyDataGetCert (xmlSecKeyDataPtr data); XMLSEC_CRYPTO_EXPORT HCRYPTKEY xmlSecMSCryptoKeyDataGetKey (xmlSecKeyDataPtr data, @@ -31,6 +30,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecMSCryptoCertAdopt (PCCERT_ XMLSEC_CRYPTO_EXPORT HCRYPTPROV xmlSecMSCryptoKeyDataGetMSCryptoProvider(xmlSecKeyDataPtr data); XMLSEC_CRYPTO_EXPORT DWORD xmlSecMSCryptoKeyDataGetMSCryptoKeySpec(xmlSecKeyDataPtr data); +XMLSEC_CRYPTO_EXPORT PCRYPT_KEY_PROV_INFO xmlSecMSCryptoKeyDataGetMSCryptoProviderInfo(xmlSecKeyDataPtr data); #ifdef __cplusplus diff --git a/include/xmlsec/mscrypto/crypto.h b/include/xmlsec/mscrypto/crypto.h index 5f3142fc..6c5e1fc6 100644 --- a/include/xmlsec/mscrypto/crypto.h +++ b/include/xmlsec/mscrypto/crypto.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,10 +9,6 @@ #ifndef __XMLSEC_MSCRYPTO_CRYPTO_H__ #define __XMLSEC_MSCRYPTO_CRYPTO_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <windows.h> #include <wincrypt.h> @@ -21,6 +17,10 @@ extern "C" { #include <xmlsec/transforms.h> #include <xmlsec/dl.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_mscrypto(void); /******************************************************************** @@ -33,7 +33,7 @@ XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoShutdown (void); XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeysMngrInit (xmlSecKeysMngrPtr mngr); XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoGenerateRandom (xmlSecBufferPtr buffer, - size_t size); + xmlSecSize size); XMLSEC_CRYPTO_EXPORT void xmlSecMSCryptoErrorsDefaultCallback(const char* file, int line, @@ -48,16 +48,16 @@ XMLSEC_CRYPTO_EXPORT void xmlSecMSCryptoErrorsDefaultCallback(cons * String encoding conversion utils * ******************************************************************************/ -XMLSEC_CRYPTO_EXPORT LPWSTR xmlSecMSCryptoConvertLocaleToUnicode(const char* str); +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT LPWSTR xmlSecMSCryptoConvertLocaleToUnicode(const char* str); -XMLSEC_CRYPTO_EXPORT LPWSTR xmlSecMSCryptoConvertUtf8ToUnicode (const xmlChar* str); -XMLSEC_CRYPTO_EXPORT xmlChar* xmlSecMSCryptoConvertUnicodeToUtf8 (LPCWSTR str); +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT LPWSTR xmlSecMSCryptoConvertUtf8ToUnicode (const xmlChar* str); +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT xmlChar* xmlSecMSCryptoConvertUnicodeToUtf8 (LPCWSTR str); -XMLSEC_CRYPTO_EXPORT xmlChar* xmlSecMSCryptoConvertLocaleToUtf8 (const char* str); -XMLSEC_CRYPTO_EXPORT char* xmlSecMSCryptoConvertUtf8ToLocale (const xmlChar* str); +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT xmlChar* xmlSecMSCryptoConvertLocaleToUtf8 (const char* str); +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT char* xmlSecMSCryptoConvertUtf8ToLocale (const xmlChar* str); -XMLSEC_CRYPTO_EXPORT xmlChar* xmlSecMSCryptoConvertTstrToUtf8 (LPCTSTR str); -XMLSEC_CRYPTO_EXPORT LPTSTR xmlSecMSCryptoConvertUtf8ToTstr (const xmlChar* str); +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT xmlChar* xmlSecMSCryptoConvertTstrToUtf8 (LPCTSTR str); +XMLSEC_DEPRECATED XMLSEC_CRYPTO_EXPORT LPTSTR xmlSecMSCryptoConvertUtf8ToTstr (const xmlChar* str); /******************************************************************** @@ -114,6 +114,52 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGost2001GostR3411_ #endif /* XMLSEC_NO_GOST */ +#ifndef XMLSEC_NO_GOST2012 + +/******************************************************************** + * + * GOST R 34.10-2012 transform + * + *******************************************************************/ + +/** + * xmlSecMSCryptoKeyDataGost2012_256Id: + * + * The GOST R 34.10-2012 256 key klass + */ +#define xmlSecMSCryptoKeyDataGost2012_256Id \ + xmlSecMSCryptoKeyDataGost2012_256GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataGost2012_256GetKlass (void); + +/** + * xmlSecMSCryptoKeyDataGost2012_512Id: + * + * The GOST R 34.10-2012 512 key klass + */ +#define xmlSecMSCryptoKeyDataGost2012_512Id \ + xmlSecMSCryptoKeyDataGost2012_512GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataGost2012_512GetKlass (void); + +/** + * xmlSecMSCryptoTransformGost2012_256Id: + * + * The GOST R 34.10-2012 - GOST R 3411-2012 256 bit signature transform klass. + */ +#define xmlSecMSCryptoTransformGost2012_256Id \ + xmlSecMSCryptoTransformGost2012_256GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGost2012_256GetKlass(void); + +/** + * xmlSecMSCryptoTransformGost2012_512Id: + * + * The GOST R 34.10-2012 - GOST R 3411-2012 512 bit signature transform klass. + */ +#define xmlSecMSCryptoTransformGost2012_512Id \ + xmlSecMSCryptoTransformGost2012_512GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGost2012_512GetKlass(void); + +#endif /* XMLSEC_NO_GOST2012 */ + /******************************************************************** * * RSA transforms @@ -315,8 +361,38 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformSha512GetKlass(voi #define xmlSecMSCryptoTransformGostR3411_94Id \ xmlSecMSCryptoTransformGostR3411_94GetKlass() XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGostR3411_94GetKlass(void); + #endif /* XMLSEC_NO_GOST */ +#ifndef XMLSEC_NO_GOST2012 + +/******************************************************************** + * + * GOST R 34.10-2012 256 and 512-bit digests + * + *******************************************************************/ + +/** + * xmlSecMSCryptoTransformGostR3411_2012_256Id: + * + * The GOST R 34.11-2012 256 digest transform klass. + */ +#define xmlSecMSCryptoTransformGostR3411_2012_256Id \ + xmlSecMSCryptoTransformGostR3411_2012_256GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGostR3411_2012_256GetKlass(void); + +/** + * xmlSecMSCryptoTransformGostR3411_2012_512Id: + * + * The GOST R 34.11-2012 512 digest transform klass. + */ +#define xmlSecMSCryptoTransformGostR3411_2012_512Id \ + xmlSecMSCryptoTransformGostR3411_2012_512GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGostR3411_2012_512GetKlass(void); + +#endif /* XMLSEC_NO_GOST2012 */ + + /******************************************************************** * * AES transforms diff --git a/include/xmlsec/mscrypto/keysstore.h b/include/xmlsec/mscrypto/keysstore.h index afaf6a95..f66f7f4c 100644 --- a/include/xmlsec/mscrypto/keysstore.h +++ b/include/xmlsec/mscrypto/keysstore.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * MSCrypto keys store * @@ -11,12 +11,12 @@ #ifndef __XMLSEC_MSCRYPTO_KEYSSTORE_H__ #define __XMLSEC_MSCRYPTO_KEYSSTORE_H__ +#include <xmlsec/xmlsec.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include <xmlsec/xmlsec.h> - /**************************************************************************** * * MSCrypto Keys Store diff --git a/include/xmlsec/mscrypto/symbols.h b/include/xmlsec/mscrypto/symbols.h index 17000ccf..6d83a34a 100644 --- a/include/xmlsec/mscrypto/symbols.h +++ b/include/xmlsec/mscrypto/symbols.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -65,6 +65,8 @@ extern "C" { #define xmlSecTransformKWDes3Id xmlSecMSCryptoTransformKWDes3Id #define xmlSecTransformDsaSha1Id xmlSecMSCryptoTransformDsaSha1Id #define xmlSecTransformGost2001GostR3411_94Id xmlSecMSCryptoTransformGost2001GostR3411_94Id +#define xmlSecTransformGost2012_256Id xmlSecMSCryptoTransformGost2012_256Id +#define xmlSecTransformGost2012_512Id xmlSecMSCryptoTransformGost2012_512Id #define xmlSecTransformHmacMd5Id xmlSecMSCryptoTransformHmacMd5Id #define xmlSecTransformHmacRipemd160Id xmlSecMSCryptoTransformHmacRipemd160Id #define xmlSecTransformHmacSha1Id xmlSecMSCryptoTransformHmacSha1Id @@ -80,6 +82,8 @@ extern "C" { #define xmlSecTransformSha384Id xmlSecMSCryptoTransformSha384Id #define xmlSecTransformSha512Id xmlSecMSCryptoTransformSha512Id #define xmlSecTransformGostR3411_94Id xmlSecMSCryptoTransformGostR3411_94Id +#define xmlSecTransformGostR3411_2012_256Id xmlSecMSCryptoTransformGostR3411_2012_256Id +#define xmlSecTransformGostR3411_2012_512Id xmlSecMSCryptoTransformGostR3411_2012_512Id /******************************************************************** * diff --git a/include/xmlsec/mscrypto/x509.h b/include/xmlsec/mscrypto/x509.h index 60066bda..cb436097 100644 --- a/include/xmlsec/mscrypto/x509.h +++ b/include/xmlsec/mscrypto/x509.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,10 +9,6 @@ #ifndef __XMLSEC_MSCRYPTO_X509_H__ #define __XMLSEC_MSCRYPTO_X509_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #ifndef XMLSEC_NO_X509 #include <xmlsec/xmlsec.h> @@ -22,6 +18,10 @@ extern "C" { #include <windows.h> #include <wincrypt.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** * xmlSecMSCryptoKeyDataX509Id: * @@ -83,10 +83,10 @@ XMLSEC_CRYPTO_EXPORT void xmlSecMSCryptoX509StoreEnableSystemTrust -#endif /* XMLSEC_NO_X509 */ - #ifdef __cplusplus } #endif /* __cplusplus */ +#endif /* XMLSEC_NO_X509 */ + #endif /* __XMLSEC_MSCRYPTO_X509_H__ */ diff --git a/include/xmlsec/nodeset.h b/include/xmlsec/nodeset.h index 3c0cfc72..92ea1d13 100644 --- a/include/xmlsec/nodeset.h +++ b/include/xmlsec/nodeset.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Enchanced nodes Set @@ -11,15 +11,15 @@ #ifndef __XMLSEC_NODESET_H__ #define __XMLSEC_NODESET_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <libxml/xpath.h> #include <xmlsec/xmlsec.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef struct _xmlSecNodeSet xmlSecNodeSet, *xmlSecNodeSetPtr; /** @@ -34,7 +34,7 @@ typedef struct _xmlSecNodeSet xmlSecNodeSet, *xmlSecNodeSetPtr; * @xmlSecNodeSetTreeWithoutCommentsInvert: nodes set = all document nodes * minus (nodes in the list and all their subtress * plus all comment nodes). - * @xmlSecNodeSetList: nodes set = all nodes in the chidren list of nodes sets. + * @xmlSecNodeSetList: nodes set = all nodes in the children list of nodes sets. * * The basic nodes sets types. */ diff --git a/include/xmlsec/nss/app.h b/include/xmlsec/nss/app.h index aeac55ed..e53ab4d6 100644 --- a/include/xmlsec/nss/app.h +++ b/include/xmlsec/nss/app.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -10,10 +10,6 @@ #ifndef __XMLSEC_NSS_APP_H__ #define __XMLSEC_NSS_APP_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <nspr.h> #include <nss.h> @@ -22,6 +18,10 @@ extern "C" { #include <xmlsec/keysmngr.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /******************************************************************** * * Init/shutdown diff --git a/include/xmlsec/nss/bignum.h b/include/xmlsec/nss/bignum.h index 6147d20a..97848b12 100644 --- a/include/xmlsec/nss/bignum.h +++ b/include/xmlsec/nss/bignum.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * Reading/writing BIGNUM values * @@ -11,10 +11,6 @@ #ifndef __XMLSEC_NSS_BIGNUM_H__ #define __XMLSEC_NSS_BIGNUM_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <nspr.h> @@ -22,6 +18,10 @@ extern "C" { #include <xmlsec/xmlsec.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + XMLSEC_CRYPTO_EXPORT SECItem* xmlSecNssNodeGetBigNumValue (PRArenaPool *arena, const xmlNodePtr cur, SECItem *a); diff --git a/include/xmlsec/nss/crypto.h b/include/xmlsec/nss/crypto.h index 87f31bf1..223c1d85 100644 --- a/include/xmlsec/nss/crypto.h +++ b/include/xmlsec/nss/crypto.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -10,10 +10,6 @@ #ifndef __XMLSEC_NSS_CRYPTO_H__ #define __XMLSEC_NSS_CRYPTO_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <nspr.h> #include <nss.h> #include <pk11func.h> @@ -23,6 +19,10 @@ extern "C" { #include <xmlsec/transforms.h> #include <xmlsec/dl.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_nss(void); /******************************************************************** @@ -175,6 +175,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWDes3GetKlass(void); xmlSecNssKeyDataDsaGetKlass() XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataDsaGetKlass (void); +#ifndef XMLSEC_NO_SHA1 /** * xmlSecNssTransformDsaSha1Id: * @@ -183,12 +184,102 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataDsaGetKlass (void); #define xmlSecNssTransformDsaSha1Id \ xmlSecNssTransformDsaSha1GetKlass() XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformDsaSha1GetKlass(void); +#endif /* XMLSEC_NO_SHA1 */ + +#ifndef XMLSEC_NO_SHA256 +/** + * xmlSecNssTransformDsaSha256Id: + * + * The DSA SHA256 signature transform klass. + */ +#define xmlSecNssTransformDsaSha256Id \ + xmlSecNssTransformDsaSha256GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformDsaSha256GetKlass(void); +#endif /* XMLSEC_NO_SHA256 */ #endif /* XMLSEC_NO_DSA */ /******************************************************************** * + * ECDSA transform + * + *******************************************************************/ +#ifndef XMLSEC_NO_ECDSA + +/** + * xmlSecNssKeyDataEcdsaId: + * + * The ECDSA key klass. + */ +#define xmlSecNssKeyDataEcdsaId xmlSecNssKeyDataEcdsaGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataEcdsaGetKlass(void); + +#ifndef XMLSEC_NO_SHA1 + +/** + * xmlSecNssTransformEcdsaSha1Id: + * + * The ECDSA SHA1 signature transform klass. + */ +#define xmlSecNssTransformEcdsaSha1Id xmlSecNssTransformEcdsaSha1GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformEcdsaSha1GetKlass(void); + +#endif /* XMLSEC_NO_SHA1 */ + +#ifndef XMLSEC_NO_SHA224 + +/** + * xmlSecNssTransformEcdsaSha224Id: + * + * The ECDSA SHA224 signature transform klass. + */ +#define xmlSecNssTransformEcdsaSha224Id xmlSecNssTransformEcdsaSha224GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformEcdsaSha224GetKlass(void); + +#endif /* XMLSEC_NO_SHA224 */ + +#ifndef XMLSEC_NO_SHA256 + +/** + * xmlSecNssTransformEcdsaSha256Id: + * + * The ECDSA SHA256 signature transform klass. + */ +#define xmlSecNssTransformEcdsaSha256Id xmlSecNssTransformEcdsaSha256GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformEcdsaSha256GetKlass(void); + +#endif /* XMLSEC_NO_SHA256 */ + +#ifndef XMLSEC_NO_SHA384 + +/** + * xmlSecNssTransformEcdsaSha384Id: + * + * The ECDSA SHA384 signature transform klass. + */ +#define xmlSecNssTransformEcdsaSha384Id xmlSecNssTransformEcdsaSha384GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformEcdsaSha384GetKlass(void); + +#endif /* XMLSEC_NO_SHA384 */ + +#ifndef XMLSEC_NO_SHA512 + +/** + * xmlSecNssTransformEcdsaSha512Id: + * + * The ECDSA SHA512 signature transform klass. + */ +#define xmlSecNssTransformEcdsaSha512Id xmlSecNssTransformEcdsaSha512GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformEcdsaSha512GetKlass(void); + +#endif /* XMLSEC_NO_SHA512 */ + +#endif /* XMLSEC_NO_ECDSA */ + + +/******************************************************************** + * * HMAC transforms * *******************************************************************/ @@ -241,6 +332,17 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacRipemd160GetKlass(v XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacSha1GetKlass(void); #endif /* XMLSEC_NO_SHA1 */ +#ifndef XMLSEC_NO_SHA224 +/** + * xmlSecNssTransformHmacSha224Id: + * + * The HMAC with SHA224 signature transform klass. + */ +#define xmlSecNssTransformHmacSha224Id \ + xmlSecNssTransformHmacSha224GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacSha224GetKlass(void); +#endif /* XMLSEC_NO_SHA224 */ + #ifndef XMLSEC_NO_SHA256 /** * xmlSecNssTransformHmacSha256Id: @@ -316,6 +418,17 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformRsaMd5GetKlass(void); XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformRsaSha1GetKlass(void); #endif /* XMLSEC_NO_SHA1 */ +#ifndef XMLSEC_NO_SHA224 +/** + * xmlSecNssTransformRsaSha224Id: + * + * The RSA-SHA224 signature transform klass. + */ +#define xmlSecNssTransformRsaSha224Id \ + xmlSecNssTransformRsaSha224GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformRsaSha224GetKlass(void); +#endif /* XMLSEC_NO_SHA224 */ + #ifndef XMLSEC_NO_SHA256 /** * xmlSecNssTransformRsaSha256Id: @@ -395,6 +508,22 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformSha1GetKlass (void); /******************************************************************** * + * SHA224 transform + * + *******************************************************************/ +#ifndef XMLSEC_NO_SHA224 +/** + * xmlSecNssTransformSha224Id: + * + * The SHA224 digest transform klass. + */ +#define xmlSecNssTransformSha224Id \ + xmlSecNssTransformSha224GetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformSha224GetKlass(void); +#endif /* XMLSEC_NO_SHA224 */ + +/******************************************************************** + * * SHA256 transform * *******************************************************************/ diff --git a/include/xmlsec/nss/keysstore.h b/include/xmlsec/nss/keysstore.h index a2cc289b..04f80289 100644 --- a/include/xmlsec/nss/keysstore.h +++ b/include/xmlsec/nss/keysstore.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * Nss keys store * @@ -11,12 +11,12 @@ #ifndef __XMLSEC_NSS_KEYSSTORE_H__ #define __XMLSEC_NSS_KEYSSTORE_H__ +#include <xmlsec/xmlsec.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include <xmlsec/xmlsec.h> - /**************************************************************************** * * Nss Keys Store diff --git a/include/xmlsec/nss/pkikeys.h b/include/xmlsec/nss/pkikeys.h index cb498482..e501f165 100644 --- a/include/xmlsec/nss/pkikeys.h +++ b/include/xmlsec/nss/pkikeys.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,10 +9,6 @@ #ifndef __XMLSEC_NSS_PKIKEYS_H__ #define __XMLSEC_NSS_PKIKEYS_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <nspr.h> #include <nss.h> @@ -20,6 +16,9 @@ extern "C" { #include <xmlsec/keys.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecNssPKIAdoptKey (SECKEYPrivateKey *privkey, SECKEYPublicKey *pubkey); diff --git a/include/xmlsec/nss/symbols.h b/include/xmlsec/nss/symbols.h index 23653ed6..3cd0f9ce 100644 --- a/include/xmlsec/nss/symbols.h +++ b/include/xmlsec/nss/symbols.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -65,6 +65,9 @@ extern "C" { #define xmlSecTransformDes3CbcId xmlSecNssTransformDes3CbcId #define xmlSecTransformKWDes3Id xmlSecNssTransformKWDes3Id #define xmlSecTransformDsaSha1Id xmlSecNssTransformDsaSha1Id +#define xmlSecTransformEcdsaSha1Id xmlSecNssTransformEcdsaSha1Id +#define xmlSecTransformEcdsaSha256Id xmlSecNssTransformEcdsaSha256Id +#define xmlSecTransformEcdsaSha512Id xmlSecNssTransformEcdsaSha512Id #define xmlSecTransformHmacMd5Id xmlSecNssTransformHmacMd5Id #define xmlSecTransformHmacRipemd160Id xmlSecNssTransformHmacRipemd160Id #define xmlSecTransformHmacSha1Id xmlSecNssTransformHmacSha1Id diff --git a/include/xmlsec/nss/x509.h b/include/xmlsec/nss/x509.h index fe5ceb4a..c8bff92d 100644 --- a/include/xmlsec/nss/x509.h +++ b/include/xmlsec/nss/x509.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,10 +9,6 @@ #ifndef __XMLSEC_NSS_X509_H__ #define __XMLSEC_NSS_X509_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #ifndef XMLSEC_NO_X509 #include <nspr.h> @@ -23,6 +19,10 @@ extern "C" { #include <xmlsec/keys.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** * xmlSecNssKeyDataX509Id: * @@ -82,10 +82,10 @@ XMLSEC_CRYPTO_EXPORT int xmlSecNssX509StoreAdoptCert (xml xmlSecKeyDataType type); -#endif /* XMLSEC_NO_X509 */ - #ifdef __cplusplus } #endif /* __cplusplus */ +#endif /* XMLSEC_NO_X509 */ + #endif /* __XMLSEC_NSS_X509_H__ */ diff --git a/include/xmlsec/openssl/app.h b/include/xmlsec/openssl/app.h index 5c5325fe..15a78803 100644 --- a/include/xmlsec/openssl/app.h +++ b/include/xmlsec/openssl/app.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,10 +9,6 @@ #ifndef __XMLSEC_OPENSSL_APP_H__ #define __XMLSEC_OPENSSL_APP_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <openssl/pem.h> #include <openssl/bio.h> @@ -21,6 +17,10 @@ extern "C" { #include <xmlsec/keysmngr.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /******************************************************************** * * Init/shutdown @@ -60,7 +60,7 @@ XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlS XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrAddCertsPath(xmlSecKeysMngrPtr mngr, const char *path); XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrAddCertsFile(xmlSecKeysMngrPtr mngr, - const char *file); + const char *filename); #endif /* XMLSEC_NO_X509 */ diff --git a/include/xmlsec/openssl/bn.h b/include/xmlsec/openssl/bn.h index 7415a9bd..0e813635 100644 --- a/include/xmlsec/openssl/bn.h +++ b/include/xmlsec/openssl/bn.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * Reading/writing BIGNUM values * @@ -11,16 +11,16 @@ #ifndef __XMLSEC_BN_H__ #define __XMLSEC_BN_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <openssl/bn.h> #include <libxml/tree.h> #include <xmlsec/xmlsec.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + XMLSEC_CRYPTO_EXPORT BIGNUM* xmlSecOpenSSLNodeGetBNValue (const xmlNodePtr cur, BIGNUM **a); XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLNodeSetBNValue (xmlNodePtr cur, diff --git a/include/xmlsec/openssl/crypto.h b/include/xmlsec/openssl/crypto.h index c734c144..1eada05f 100644 --- a/include/xmlsec/openssl/crypto.h +++ b/include/xmlsec/openssl/crypto.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,16 +9,34 @@ #ifndef __XMLSEC_OPENSSL_CRYPTO_H__ #define __XMLSEC_OPENSSL_CRYPTO_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <xmlsec/xmlsec.h> #include <xmlsec/keys.h> #include <xmlsec/transforms.h> #include <xmlsec/dl.h> #include <openssl/err.h> +#ifndef OPENSSL_IS_BORINGSSL +#include <openssl/opensslconf.h> +#endif /* OPENSSL_IS_BORINGSSL */ + +#ifndef XMLSEC_NO_DSA +#include <openssl/dsa.h> +#include <openssl/evp.h> +#endif /* XMLSEC_NO_DSA */ + +#ifndef XMLSEC_NO_ECDSA +#include <openssl/ecdsa.h> +#include <openssl/evp.h> +#endif /* XMLSEC_NO_ECDSA */ + +#ifndef XMLSEC_NO_RSA +#include <openssl/rsa.h> +#include <openssl/evp.h> +#endif /* XMLSEC_NO_RSA */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_openssl(void); @@ -39,6 +57,86 @@ XMLSEC_CRYPTO_EXPORT const xmlChar* xmlSecOpenSSLGetDefaultTrustedCertsFolde /******************************************************************** * + * What version of the openssl API do we have? (also see configure.ac) + * + *******************************************************************/ +#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L +/* LibreSSL decided to take over OpenSSL version 2.0.0, likely will create + * issues down the road... */ +#define XMLSEC_OPENSSL_API_100 1 +#elif defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L +/* LibreSSL 2.7 implements (most of) OpenSSL 1.1 API */ +#define XMLSEC_OPENSSL_API_110 1 +#elif OPENSSL_VERSION_NUMBER >= 0x10100000L +#define XMLSEC_OPENSSL_API_110 1 +#elif OPENSSL_VERSION_NUMBER >= 0x10000000L +#define XMLSEC_OPENSSL_API_100 1 +#else /* OPENSSL_VERSION_NUMBER */ +#error "This version of OpenSSL library is not supported" +#endif /* OPENSSL_VERSION_NUMBER */ + +/******************************************************************** + * + * What is supported by the openssl? + * + *******************************************************************/ +#ifdef OPENSSL_NO_AES +#define XMLSEC_NO_AES 1 +#endif /* OPENSSL_NO_AES */ + +#ifdef OPENSSL_NO_DES +#define XMLSEC_NO_DES 1 +#endif /* OPENSSL_NO_DES */ + +#ifdef OPENSSL_NO_DSA +#define XMLSEC_NO_DSA 1 +#endif /* OPENSSL_NO_DSA */ + +#ifdef OPENSSL_NO_ECDSA +#define XMLSEC_NO_ECDSA 1 +#endif /* OPENSSL_NO_ECDSA */ + +#ifdef OPENSSL_NO_GOST +#define XMLSEC_NO_GOST 1 +#define XMLSEC_NO_GOST2012 1 +#endif /* OPENSSL_NO_GOST */ + +#ifdef OPENSSL_NO_HMAC +#define XMLSEC_NO_HMAC 1 +#endif /* OPENSSL_NO_HMAC */ + +#ifdef OPENSSL_NO_MD5 +#define XMLSEC_NO_MD5 1 +#endif /* OPENSSL_NO_MD5 */ + +#ifdef OPENSSL_NO_RIPEMD160 +#define XMLSEC_NO_RIPEMD160 1 +#endif /* OPENSSL_NO_RIPEMD160 */ + +#ifdef OPENSSL_NO_RSA +#define XMLSEC_NO_RSA 1 +#endif /* OPENSSL_NO_RSA */ + +#ifdef OPENSSL_NO_SHA1 +#define XMLSEC_NO_SHA1 1 +#endif /* OPENSSL_NO_SHA1 */ + +#ifdef OPENSSL_NO_SHA256 +#define XMLSEC_NO_SHA256 1 +#define XMLSEC_NO_SHA224 1 +#endif /* OPENSSL_NO_SHA256 */ + +#ifdef OPENSSL_NO_SHA512 +#define XMLSEC_NO_SHA384 1 +#define XMLSEC_NO_SHA512 1 +#endif /* OPENSSL_NO_SHA512 */ + +#if defined(OPENSSL_NO_X509) || defined(OPENSSL_NO_X509_VERIFY) +#define XMLSEC_NO_X509 1 +#endif /* defined(OPENSSL_NO_X509) || defined(OPENSSL_NO_X509_VERIFY) */ + +/******************************************************************** + * * AES transforms * *******************************************************************/ @@ -82,6 +180,34 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes192CbcGetKlass( XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes256CbcGetKlass(void); /** +* xmlSecOpenSSLTransformAes128GcmId: +* +* The AES128 GCM cipher transform klass. +*/ +#define xmlSecOpenSSLTransformAes128GcmId \ + xmlSecOpenSSLTransformAes128GcmGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes128GcmGetKlass(void); + +/** +* xmlSecOpenSSLTransformAes192GcmId: +* +* The AES192 GCM cipher transform klass. +*/ +#define xmlSecOpenSSLTransformAes192GcmId \ + xmlSecOpenSSLTransformAes192GcmGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes192GcmGetKlass(void); + +/** +* xmlSecOpenSSLTransformAes256GcmId: +* +* The AES256 GCM cipher transform klass. +*/ +#define xmlSecOpenSSLTransformAes256GcmId \ + xmlSecOpenSSLTransformAes256GcmGetKlass() +XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes256GcmGetKlass(void); + + +/** * xmlSecOpenSSLTransformKWAes128Id: * * The AES 128 key wrap transform klass. @@ -153,8 +279,6 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWDes3GetKlass(void * *******************************************************************/ #ifndef XMLSEC_NO_DSA -#include <openssl/dsa.h> -#include <openssl/evp.h> /** * xmlSecOpenSSLKeyDataDsaId: @@ -201,8 +325,6 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformDsaSha256GetKlass(v * *******************************************************************/ #ifndef XMLSEC_NO_ECDSA -#include <openssl/ecdsa.h> -#include <openssl/evp.h> /** * xmlSecOpenSSLKeyDataEcdsaId: @@ -309,7 +431,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformGost2001GostR3411_9 * The GOSTR3411_94 signature transform klass. */ #define xmlSecOpenSSLTransformGostR3411_94Id \ - xmlSecOpenSSLTransformGostR3411_94GetKlass() + xmlSecOpenSSLTransformGostR3411_94GetKlass() XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformGostR3411_94GetKlass(void); #endif /* XMLSEC_NO_GOST */ @@ -367,7 +489,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformGostR3410_2012GostR * The GOST R 34.11-2012 256 bit hash transform klass. */ #define xmlSecOpenSSLTransformGostR3411_2012_256Id \ - xmlSecOpenSSLTransformGostR3411_2012_256GetKlass() + xmlSecOpenSSLTransformGostR3411_2012_256GetKlass() XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformGostR3411_2012_256GetKlass(void); @@ -377,7 +499,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformGostR3411_2012_256G * The GOST R 34.11-2012 512 bit hash transform klass. */ #define xmlSecOpenSSLTransformGostR3411_2012_512Id \ - xmlSecOpenSSLTransformGostR3411_2012_512GetKlass() + xmlSecOpenSSLTransformGostR3411_2012_512GetKlass() XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformGostR3411_2012_512GetKlass(void); #endif /* XMLSEC_NO_GOST2012 */ @@ -522,8 +644,6 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRipemd160GetKlass(v * *******************************************************************/ #ifndef XMLSEC_NO_RSA -#include <openssl/rsa.h> -#include <openssl/evp.h> /** * xmlSecOpenSSLKeyDataRsaId: @@ -721,26 +841,6 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha512GetKlass(void #endif /* XMLSEC_NO_SHA512 */ - -/************************************************************** - * - * Error constants for OpenSSL - * - *************************************************************/ -/** - * XMLSEC_OPENSSL_ERRORS_LIB: - * - * Macro. The XMLSec library klass for OpenSSL errors reporting functions. - */ -#define XMLSEC_OPENSSL_ERRORS_LIB (ERR_LIB_USER + 57) - -/** - * XMLSEC_OPENSSL_ERRORS_FUNCTION: - * - * Macro. The XMLSec library functions OpenSSL errors reporting functions. - */ -#define XMLSEC_OPENSSL_ERRORS_FUNCTION 0 - XMLSEC_CRYPTO_EXPORT void xmlSecOpenSSLErrorsDefaultCallback (const char* file, int line, const char* func, @@ -749,6 +849,7 @@ XMLSEC_CRYPTO_EXPORT void xmlSecOpenSSLErrorsDefaultCallback (const c int reason, const char* msg); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/xmlsec/openssl/evp.h b/include/xmlsec/openssl/evp.h index 2f964e80..318ed301 100644 --- a/include/xmlsec/openssl/evp.h +++ b/include/xmlsec/openssl/evp.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,10 +9,6 @@ #ifndef __XMLSEC_OPENSSL_EVP_H__ #define __XMLSEC_OPENSSL_EVP_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <openssl/evp.h> #include <xmlsec/xmlsec.h> @@ -21,6 +17,9 @@ extern "C" { #include <xmlsec/openssl/crypto.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLEvpKeyDataAdoptEvp (xmlSecKeyDataPtr data, EVP_PKEY* pKey); diff --git a/include/xmlsec/openssl/symbols.h b/include/xmlsec/openssl/symbols.h index 74a801ac..90bcc046 100644 --- a/include/xmlsec/openssl/symbols.h +++ b/include/xmlsec/openssl/symbols.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -58,6 +58,9 @@ extern "C" { #define xmlSecTransformAes128CbcId xmlSecOpenSSLTransformAes128CbcId #define xmlSecTransformAes192CbcId xmlSecOpenSSLTransformAes192CbcId #define xmlSecTransformAes256CbcId xmlSecOpenSSLTransformAes256CbcId +#define xmlSecTransformAes128GcmId xmlSecOpenSSLTransformAes128GcmId +#define xmlSecTransformAes192GcmId xmlSecOpenSSLTransformAes192GcmId +#define xmlSecTransformAes256GcmId xmlSecOpenSSLTransformAes256GcmId #define xmlSecTransformKWAes128Id xmlSecOpenSSLTransformKWAes128Id #define xmlSecTransformKWAes192Id xmlSecOpenSSLTransformKWAes192Id #define xmlSecTransformKWAes256Id xmlSecOpenSSLTransformKWAes256Id diff --git a/include/xmlsec/openssl/x509.h b/include/xmlsec/openssl/x509.h index 0163c231..0d9f8c80 100644 --- a/include/xmlsec/openssl/x509.h +++ b/include/xmlsec/openssl/x509.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,10 +9,6 @@ #ifndef __XMLSEC_OPENSSL_X509_H__ #define __XMLSEC_OPENSSL_X509_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #ifndef XMLSEC_NO_X509 #include <openssl/x509.h> @@ -21,6 +17,10 @@ extern "C" { #include <xmlsec/keys.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** * XMLSEC_STACK_OF_X509: * @@ -98,12 +98,12 @@ XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAdoptCrl (xmlSecK XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAddCertsPath(xmlSecKeyDataStorePtr store, const char* path); XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAddCertsFile(xmlSecKeyDataStorePtr store, - const char* file); - -#endif /* XMLSEC_NO_X509 */ + const char* filename); #ifdef __cplusplus } #endif /* __cplusplus */ +#endif /* XMLSEC_NO_X509 */ + #endif /* __XMLSEC_OPENSSL_X509_H__ */ diff --git a/include/xmlsec/parser.h b/include/xmlsec/parser.h index b91aa8db..743a5804 100644 --- a/include/xmlsec/parser.h +++ b/include/xmlsec/parser.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * XML Parser transform and utility functions. @@ -11,15 +11,14 @@ #ifndef __XMLSEC_PARSER_H__ #define __XMLSEC_PARSER_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <xmlsec/xmlsec.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ XMLSEC_EXPORT xmlDocPtr xmlSecParseFile (const char *filename); XMLSEC_EXPORT xmlDocPtr xmlSecParseMemory (const xmlSecByte *buffer, diff --git a/include/xmlsec/private.h b/include/xmlsec/private.h index 0a9d74a0..f35690d9 100644 --- a/include/xmlsec/private.h +++ b/include/xmlsec/private.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * These are internal private declarations. You don't want to use this file @@ -16,10 +16,6 @@ #error "xmlsec/private.h file contains private xmlsec definitions and should not be used outside xmlsec or xmlsec-$crypto libraries" #endif /* XMLSEC_PRIVATE */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <libxml/xmlIO.h> @@ -29,6 +25,19 @@ extern "C" { #include <xmlsec/keysmngr.h> #include <xmlsec/transforms.h> +#ifdef __GNUC__ +#ifdef HAVE_ANSIDECL_H +#include <ansidecl.h> +#endif +#endif + +#ifdef WIN32 +#include <windows.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ /***************************************************************************** * @@ -343,9 +352,12 @@ typedef int (*xmlSecCryptoAppKeyCertLoadMemoryMethod)(xmlSec * @keyDataX509GetKlass: the method to get pointer to X509 key data klass. * @keyDataRawX509CertGetKlass: the method to get pointer to raw X509 cert key data klass. * @x509StoreGetKlass: the method to get pointer to X509 key data store. - * @transformAes128CbcGetKlass: the method to get pointer to AES 128 encryption transform. - * @transformAes192CbcGetKlass: the method to get pointer to AES 192 encryption transform. - * @transformAes256CbcGetKlass: the method to get pointer to AES 256 encryption transform. + * @transformAes128CbcGetKlass: the method to get pointer to AES 128 CBC encryption transform. + * @transformAes192CbcGetKlass: the method to get pointer to AES 192 CBC encryption transform. + * @transformAes256CbcGetKlass: the method to get pointer to AES 256 CBC encryption transform. + * @transformAes128GcmGetKlass: the method to get pointer to AES 128 GCM encryption transform. + * @transformAes192GcmGetKlass: the method to get pointer to AES 192 GCM encryption transform. + * @transformAes256GcmGetKlass: the method to get pointer to AES 256 GCM encryption transform. * @transformKWAes128GetKlass: the method to get pointer to AES 128 key wrapper transform. * @transformKWAes192GetKlass: the method to get pointer to AES 192 key wrapper transform. * @transformKWAes256GetKlass: the method to get pointer to AES 256 key wrapper transform. @@ -431,6 +443,9 @@ struct _xmlSecCryptoDLFunctions { xmlSecCryptoTransformGetKlassMethod transformAes128CbcGetKlass; xmlSecCryptoTransformGetKlassMethod transformAes192CbcGetKlass; xmlSecCryptoTransformGetKlassMethod transformAes256CbcGetKlass; + xmlSecCryptoTransformGetKlassMethod transformAes128GcmGetKlass; + xmlSecCryptoTransformGetKlassMethod transformAes192GcmGetKlass; + xmlSecCryptoTransformGetKlassMethod transformAes256GcmGetKlass; xmlSecCryptoTransformGetKlassMethod transformKWAes128GetKlass; xmlSecCryptoTransformGetKlassMethod transformKWAes192GetKlass; xmlSecCryptoTransformGetKlassMethod transformKWAes256GetKlass; @@ -491,21 +506,97 @@ struct _xmlSecCryptoDLFunctions { void* cryptoAppDefaultPwdCallback; }; -#include <libxml/xmlstring.h> +/** + * ATTRIBUTE_UNUSED: + * + * Macro used to signal to GCC unused function parameters + */ +#ifdef __GNUC__ +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED +#endif +#else +#define ATTRIBUTE_UNUSED +#endif /** - * xmlSecStrPrintf: + * UNREFERENCED_PARAMETER: * - * Prints a string (see @xmlStrPrintf). + * Macro used to signal to MSVC unused function parameters */ -#define xmlSecStrPrintf xmlStrPrintf +#ifndef UNREFERENCED_PARAMETER +#define UNREFERENCED_PARAMETER(x) +#endif /* UNREFERENCED_PARAMETER */ + +/*********************************************************************** + * + * Helpers to convert from void* to function pointer, this silence + * gcc warning + * + * warning: ISO C forbids conversion of object pointer to function + * pointer type + * + * The workaround is to declare a union that does the conversion. This is + * guaranteed (ISO/IEC 9899:1990 "C89"/"C90") to match exactly. + * + ***********************************************************************/ + +/** + * XMLSEC_PTR_TO_FUNC_IMPL: + * @func_type: the function type. + * + * Macro declares helper functions to convert from "void *" pointer to + * function pointer. + */ +#define XMLSEC_PTR_TO_FUNC_IMPL(func_type) \ + union xmlSecPtrToFuncUnion_ ##func_type { \ + void *ptr; \ + func_type * func; \ + } ; \ + static func_type * xmlSecPtrToFunc_ ##func_type(void * ptr) { \ + union xmlSecPtrToFuncUnion_ ##func_type x; \ + x.ptr = ptr; \ + return (x.func); \ + } /** - * xmlSecStrVPrintf: + * XMLSEC_PTR_TO_FUNC: + * @func_type: the function type. + * @ptr: the "void*" pointer to be converted. * - * Prints a string (see @xmlStrVPrintf). + * Macro converts from "void*" pointer to "func_type" function pointer. */ -#define xmlSecStrVPrintf xmlStrVPrintf +#define XMLSEC_PTR_TO_FUNC(func_type, ptr) \ + xmlSecPtrToFunc_ ##func_type((ptr)) + +/** + * XMLSEC_FUNC_TO_PTR_IMPL: + * @func_type: the function type. + * + * Macro declares helper functions to convert from function pointer to + * "void *" pointer; + */ +#define XMLSEC_FUNC_TO_PTR_IMPL(func_type) \ + union xmlSecFuncToPtrUnion_ ##func_type { \ + void *ptr; \ + func_type * func; \ + } ; \ + static void * xmlSecFuncToPtr_ ##func_type(func_type * func) { \ + union xmlSecFuncToPtrUnion_ ##func_type x; \ + x.func = func; \ + return (x.ptr); \ + } + +/** + * XMLSEC_FUNC_TO_PTR: + * @func_type: the function type. + * @func: the "func_type" function pointer to be converted. + * + * Macro converts from "func_type" function pointer to "void*" pointer. + */ +#define XMLSEC_FUNC_TO_PTR(func_type, func) \ + xmlSecFuncToPtr_ ##func_type((func)) + #ifdef __cplusplus } diff --git a/include/xmlsec/private/xslt.h b/include/xmlsec/private/xslt.h index ee3e7283..9fbcc3aa 100644 --- a/include/xmlsec/private/xslt.h +++ b/include/xmlsec/private/xslt.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * XSLT helper functions diff --git a/include/xmlsec/skeleton/app.h b/include/xmlsec/skeleton/app.h index 3d29c32b..fcc9d345 100644 --- a/include/xmlsec/skeleton/app.h +++ b/include/xmlsec/skeleton/app.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,15 +9,15 @@ #ifndef __XMLSEC_SKELETON_APP_H__ #define __XMLSEC_SKELETON_APP_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <xmlsec/xmlsec.h> #include <xmlsec/keys.h> #include <xmlsec/keysmngr.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /******************************************************************** * * Init/shutdown diff --git a/include/xmlsec/skeleton/crypto.h b/include/xmlsec/skeleton/crypto.h index a81ba067..5b9c23f8 100644 --- a/include/xmlsec/skeleton/crypto.h +++ b/include/xmlsec/skeleton/crypto.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -9,15 +9,15 @@ #ifndef __XMLSEC_SKELETON_CRYPTO_H__ #define __XMLSEC_SKELETON_CRYPTO_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <xmlsec/xmlsec.h> #include <xmlsec/keys.h> #include <xmlsec/transforms.h> #include <xmlsec/dl.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_skeleton(void); /******************************************************************** diff --git a/include/xmlsec/skeleton/symbols.h b/include/xmlsec/skeleton/symbols.h index aa7ed387..5800445d 100644 --- a/include/xmlsec/skeleton/symbols.h +++ b/include/xmlsec/skeleton/symbols.h @@ -1,5 +1,5 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source * distribution for preciese wording. diff --git a/include/xmlsec/soap.h b/include/xmlsec/soap.h index c4efc00f..e87eb915 100644 --- a/include/xmlsec/soap.h +++ b/include/xmlsec/soap.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Simple SOAP messages parsing/creation. @@ -6,42 +6,41 @@ * This is free software; see Copyright file in the source * distribution for preciese wording. * - * Copyright (C) 2002-2003 Aleksey Sanin <aleksey@aleksey.com> + * Copyright (C) 2002-2017 Aleksey Sanin <aleksey@aleksey.com> */ #ifndef __XMLSEC_SOAP_H__ #define __XMLSEC_SOAP_H__ #ifndef XMLSEC_NO_SOAP -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <xmlsec/xmlsec.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ /*********************************************************************** * * SOAP 1.1 * **********************************************************************/ -XMLSEC_EXPORT xmlNodePtr xmlSecSoap11CreateEnvelope (xmlDocPtr doc); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap11EnsureHeader (xmlNodePtr envNode); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap11AddBodyEntry (xmlNodePtr envNode, +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap11CreateEnvelope (xmlDocPtr doc); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap11EnsureHeader (xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap11AddBodyEntry (xmlNodePtr envNode, xmlNodePtr entryNode); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap11AddFaultEntry (xmlNodePtr envNode, +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap11AddFaultEntry (xmlNodePtr envNode, const xmlChar* faultCodeHref, const xmlChar* faultCodeLocalPart, const xmlChar* faultString, const xmlChar* faultActor); -XMLSEC_EXPORT int xmlSecSoap11CheckEnvelope (xmlNodePtr envNode); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetHeader (xmlNodePtr envNode); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetBody (xmlNodePtr envNode); -XMLSEC_EXPORT xmlSecSize xmlSecSoap11GetBodyEntriesNumber(xmlNodePtr envNode); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetBodyEntry (xmlNodePtr envNode, +XMLSEC_DEPRECATED XMLSEC_EXPORT int xmlSecSoap11CheckEnvelope (xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetHeader (xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetBody (xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlSecSize xmlSecSoap11GetBodyEntriesNumber(xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetBodyEntry (xmlNodePtr envNode, xmlSecSize pos); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetFaultEntry (xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetFaultEntry (xmlNodePtr envNode); /*********************************************************************** @@ -92,31 +91,31 @@ typedef enum { xmlSecSoap12FaultCodeReceiver } xmlSecSoap12FaultCode; -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12CreateEnvelope (xmlDocPtr doc); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12EnsureHeader (xmlNodePtr envNode); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddBodyEntry (xmlNodePtr envNode, +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12CreateEnvelope (xmlDocPtr doc); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12EnsureHeader (xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddBodyEntry (xmlNodePtr envNode, xmlNodePtr entryNode); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultEntry (xmlNodePtr envNode, +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultEntry (xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode, const xmlChar* faultReasonText, const xmlChar* faultReasonLang, const xmlChar* faultNodeURI, const xmlChar* faultRole); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultSubcode (xmlNodePtr faultNode, +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultSubcode (xmlNodePtr faultNode, const xmlChar* subCodeHref, const xmlChar* subCodeName); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultReasonText (xmlNodePtr faultNode, +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultReasonText (xmlNodePtr faultNode, const xmlChar* faultReasonText, const xmlChar* faultReasonLang); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultDetailEntry (xmlNodePtr faultNode, +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultDetailEntry (xmlNodePtr faultNode, xmlNodePtr detailEntryNode); -XMLSEC_EXPORT int xmlSecSoap12CheckEnvelope (xmlNodePtr envNode); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetHeader (xmlNodePtr envNode); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetBody (xmlNodePtr envNode); -XMLSEC_EXPORT xmlSecSize xmlSecSoap12GetBodyEntriesNumber(xmlNodePtr envNode); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetBodyEntry (xmlNodePtr envNode, +XMLSEC_DEPRECATED XMLSEC_EXPORT int xmlSecSoap12CheckEnvelope (xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetHeader (xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetBody (xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlSecSize xmlSecSoap12GetBodyEntriesNumber(xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetBodyEntry (xmlNodePtr envNode, xmlSecSize pos); -XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetFaultEntry (xmlNodePtr envNode); +XMLSEC_DEPRECATED XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetFaultEntry (xmlNodePtr envNode); #endif /* XMLSEC_NO_SOAP */ diff --git a/include/xmlsec/strings.h b/include/xmlsec/strings.h index 42f5117c..ceaa3d18 100644 --- a/include/xmlsec/strings.h +++ b/include/xmlsec/strings.h @@ -1,7 +1,7 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * - * All the string constans. + * All the string constants. * * This is free software; see Copyright file in the source * distribution for preciese wording. @@ -11,14 +11,14 @@ #ifndef __XMLSEC_STRINGS_H__ #define __XMLSEC_STRINGS_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <xmlsec/xmlsec.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /************************************************************************* * * Global Namespaces @@ -113,6 +113,15 @@ XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefAes192Cbc[]; XMLSEC_EXPORT_VAR const xmlChar xmlSecNameAes256Cbc[]; XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefAes256Cbc[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameAes128Gcm[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefAes128Gcm[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameAes192Gcm[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefAes192Gcm[]; + +XMLSEC_EXPORT_VAR const xmlChar xmlSecNameAes256Gcm[]; +XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefAes256Gcm[]; + XMLSEC_EXPORT_VAR const xmlChar xmlSecNameKWAes128[]; XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefKWAes128[]; diff --git a/include/xmlsec/templates.h b/include/xmlsec/templates.h index 94ee7400..5f67fffa 100644 --- a/include/xmlsec/templates.h +++ b/include/xmlsec/templates.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * KeyInfo node processing @@ -11,15 +11,15 @@ #ifndef __XMLSEC_TEMPLATES_H__ #define __XMLSEC_TEMPLATES_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <xmlsec/xmlsec.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /*********************************************************************** * * <dsig:Signature> node diff --git a/include/xmlsec/transforms.h b/include/xmlsec/transforms.h index 7765afc5..1495ccbd 100644 --- a/include/xmlsec/transforms.h +++ b/include/xmlsec/transforms.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * The transforms engine @@ -11,10 +11,6 @@ #ifndef __XMLSEC_TRANSFORMS_H__ #define __XMLSEC_TRANSFORMS_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <libxml/xpath.h> @@ -24,6 +20,14 @@ extern "C" { #include <xmlsec/nodeset.h> #include <xmlsec/keys.h> +#ifndef XMLSEC_NO_XSLT +#include <libxslt/security.h> +#endif /* XMLSEC_NO_XSLT */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef const struct _xmlSecTransformKlass xmlSecTransformKlass, *xmlSecTransformId; @@ -129,7 +133,7 @@ typedef unsigned int xmlSecTransformUriType; /** * xmlSecTransformUriTypeSameDocument: * - * The smae document ("#...") but not empty ("") URI type. + * The same document ("#...") but not empty ("") URI type. */ #define xmlSecTransformUriTypeSameDocument 0x0002 @@ -296,7 +300,7 @@ typedef int (*xmlSecTransformCtxPreExecuteCallback) (xmlSecT * additional validation (and abort transform execution * if needed). * @result: the pointer to transforms result buffer. - * @status: the transforms chain processng status. + * @status: the transforms chain processing status. * @uri: the data source URI without xpointer expression. * @xptrExpr: the xpointer expression from data source URI (if any). * @first: the first transform in the chain. @@ -376,7 +380,7 @@ XMLSEC_EXPORT void xmlSecTransformCtxDebugXmlDump (xmlSecT /** * xmlSecTransform: * @id: the transform id (pointer to #xmlSecTransformId). - * @operation: the transform's opertaion. + * @operation: the transform's operation. * @status: the current status. * @hereNode: the pointer to transform's <dsig:Transform /> node. * @next: the pointer to next transform in the chain. @@ -748,7 +752,7 @@ typedef int (*xmlSecTransformExecuteMethod) (xmlSecTransform * @href: the transform's identification string (href). * @usage: the allowed transforms usages. * @initialize: the initialization method. - * @finalize: the finmalization (destroy) function. + * @finalize: the finalization (destroy) function. * @readNode: the XML node read method. * @writeNode: the XML node write method. * @setKeyReq: the set key requirements method. @@ -764,7 +768,7 @@ typedef int (*xmlSecTransformExecuteMethod) (xmlSecTransform * @reserved0: reserved for the future. * @reserved1: reserved for the future. * - * The transform klass desccription structure. + * The transform klass description structure. */ struct _xmlSecTransformKlass { /* data */ @@ -801,7 +805,7 @@ struct _xmlSecTransformKlass { /** * xmlSecTransformKlassGetName: - * @klass: the transofrm's klass. + * @klass: the transform's klass. * * Macro. Returns transform klass name. */ @@ -959,7 +963,6 @@ XMLSEC_EXPORT int xmlSecTransformXPointerSetExpr (xmlSecT XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRelationshipGetKlass (void); #ifndef XMLSEC_NO_XSLT -#include <libxslt/security.h> /** * xmlSecTransformXsltId: diff --git a/include/xmlsec/version.h b/include/xmlsec/version.h deleted file mode 100644 index b7178dbf..00000000 --- a/include/xmlsec/version.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * XML Security Library (http://www.aleksey.com/xmlsec). - * - * Version information - * - * 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_VERSION_H__ -#define __XMLSEC_VERSION_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * XMLSEC_VERSION: - * - * The library version string in the format - * "<major-number>.<minor-number>.<sub-minor-number>". - */ -#define XMLSEC_VERSION "1.2.22" - -/** - * XMLSEC_VERSION_MAJOR: - * - * The library major version number. - */ -#define XMLSEC_VERSION_MAJOR 1 - -/** - * XMLSEC_VERSION_MINOR: - * - * The library minor version number. - */ -#define XMLSEC_VERSION_MINOR 2 - -/** - * XMLSEC_VERSION_SUBMINOR: - * - * The library sub-minor version number. - */ -#define XMLSEC_VERSION_SUBMINOR 22 - -/** - * XMLSEC_VERSION_INFO: - * - * The library version info string in the format - * "<major-number>+<minor-number>:<sub-minor-number>:<minor-number>". - */ -#define XMLSEC_VERSION_INFO "3:22:2" - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __XMLSEC_VERSION_H__ */ - diff --git a/include/xmlsec/version.h.in b/include/xmlsec/version.h.in index 6679205c..d8679dd0 100644 --- a/include/xmlsec/version.h.in +++ b/include/xmlsec/version.h.in @@ -1,13 +1,18 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * - * Version information * * 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:version + * @Short_description: Version macros. + * @Stability: Stable + * + */ #ifndef __XMLSEC_VERSION_H__ #define __XMLSEC_VERSION_H__ @@ -19,7 +24,7 @@ extern "C" { * XMLSEC_VERSION: * * The library version string in the format - * "<major-number>.<minor-number>.<sub-minor-number>". + * "$major_number.$minor_number.$sub_minor_number". */ #define XMLSEC_VERSION "@XMLSEC_VERSION@" @@ -48,7 +53,7 @@ extern "C" { * XMLSEC_VERSION_INFO: * * The library version info string in the format - * "<major-number>+<minor-number>:<sub-minor-number>:<minor-number>". + * "$major_number+$minor_number:$sub_minor_number:$minor_number". */ #define XMLSEC_VERSION_INFO "@XMLSEC_VERSION_INFO@" diff --git a/include/xmlsec/x509.h b/include/xmlsec/x509.h index c5b20ba6..6a592eed 100644 --- a/include/xmlsec/x509.h +++ b/include/xmlsec/x509.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * This is free software; see Copyright file in the source @@ -11,9 +11,6 @@ #ifndef XMLSEC_NO_X509 -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ #include <stdio.h> #include <libxml/tree.h> @@ -27,6 +24,10 @@ extern "C" { #include <xmlsec/keyinfo.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** * XMLSEC_X509DATA_CERTIFICATE_NODE: * @@ -67,7 +68,6 @@ extern "C" { (XMLSEC_X509DATA_CERTIFICATE_NODE | XMLSEC_X509DATA_CRL_NODE) XMLSEC_EXPORT int xmlSecX509DataGetNodeContent (xmlNodePtr node, - int deleteChildren, xmlSecKeyInfoCtxPtr keyInfoCtx); #ifdef __cplusplus diff --git a/include/xmlsec/xmldsig.h b/include/xmlsec/xmldsig.h index f00780a1..7dab2411 100644 --- a/include/xmlsec/xmldsig.h +++ b/include/xmlsec/xmldsig.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * "XML Digital Signature" implementation @@ -15,10 +15,6 @@ #ifndef XMLSEC_NO_XMLDSIG -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <libxml/parser.h> @@ -31,6 +27,10 @@ extern "C" { #include <xmlsec/keyinfo.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef struct _xmlSecDSigReferenceCtx xmlSecDSigReferenceCtx, *xmlSecDSigReferenceCtxPtr; @@ -94,40 +94,6 @@ typedef enum { */ #define XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK 0x00000010 -/** TIZEN CUSTUMIZED - * XMLSEC_DSIG_FLAGS_IGNORE_REFERENCES: - * - * If this flag is set then <dsig:Reference/> nodes will not be processed. - */ -#define XMLSEC_DSIG_FLAGS_IGNORE_REFERENCES 0x00000020 - -/** TIZEN CUSTUMIZED - * XMLSEC_DSIG_FLAGS_CHECK_PROXY: - * - * If this flag is set then xmlSecProxyCtx will be processed. - */ -#define XMLSEC_DSIG_FLAGS_CHECK_PROXY 0x00000040 - -/** TIZEN CUSTUMIZED - * XMLSEC_DSIG_FLAGS_SKIP_PROXY: - * - * If this flag is set then xmlSecProxyCtx will not be processed. - */ -#define XMLSEC_DSIG_FLAGS_SKIP_PROXY 0x00000080 - -/** TIZEN CUSTUMIZED - * @cache: the cache include reference uri for supporting partial mode. - * cache represented uri will be check on processing references. - * @next: the pointer to indicate linked node (xmlSecProxyCtx). - */ -struct _xmlSecProxyCtx { - xmlChar* cache; - struct _xmlSecProxyCtx* next; -}; - -typedef struct _xmlSecProxyCtx xmlSecProxyCtx, - *xmlSecProxyCtxPtr; - /** * xmlSecDSigCtx: * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries @@ -148,7 +114,7 @@ typedef struct _xmlSecProxyCtx xmlSecProxyCtx, * functions. * @operation: the operation: sign or verify. * @result: the pointer to signature (not valid for signature verification). - * @status: the <dsig:Signatuire/> processing status. + * @status: the <dsig:Signature/> processing status. * @signMethod: the pointer to signature transform. * @c14nMethod: the pointer to c14n transform. * @preSignMemBufMethod: the pointer to binary buffer right before signature @@ -177,10 +143,6 @@ struct _xmlSecDSigCtx { xmlSecTransformId defC14NMethodId; xmlSecTransformId defDigestMethodId; - /* TIZEN CUTUMIZED: these data user can set before performing the operation */ - xmlSecProxyCtxPtr skipReferences; - xmlSecProxyCtxPtr checkReferences; - /* these data are returned */ xmlSecKeyPtr signKey; xmlSecTransformOperation operation; @@ -219,10 +181,6 @@ XMLSEC_EXPORT void xmlSecDSigCtxDebugDump (xmlSecDSigCtxPt XMLSEC_EXPORT void xmlSecDSigCtxDebugXmlDump (xmlSecDSigCtxPtr dsigCtx, FILE* output); -/* TIZEN CUSTUMIZED: xmlSecProxyCtx operator */ -XMLSEC_EXPORT int xmlSecProxyCtxAdd (xmlSecProxyCtxPtr* proxyCtxPtrPtr, - const xmlChar* uri); -XMLSEC_EXPORT void xmlSecProxyCtxDestroy (xmlSecProxyCtxPtr proxyCtxPtr); /************************************************************************** * diff --git a/include/xmlsec/xmlenc.h b/include/xmlsec/xmlenc.h index 0253e3ed..b09c8df8 100644 --- a/include/xmlsec/xmlenc.h +++ b/include/xmlsec/xmlenc.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * "XML Encryption" implementation @@ -14,9 +14,6 @@ #ifndef XMLSEC_NO_XMLENC -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ #include <stdio.h> #include <libxml/tree.h> @@ -29,6 +26,10 @@ extern "C" { #include <xmlsec/keyinfo.h> #include <xmlsec/transforms.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** * xmlEncCtxMode: * @xmlEncCtxModeEncryptedData: the <enc:EncryptedData/> element procesing. @@ -87,7 +88,7 @@ typedef enum { * @cipherValueNode: the pointer to <enc:CipherValue/> node. * @reserved1: reserved for the future. * - * XML Encrypiton context. + * XML Encryption context. */ struct _xmlSecEncCtx { /* these data user can set before performing the operation */ diff --git a/include/xmlsec/xmlsec.h b/include/xmlsec/xmlsec.h index 963b37a6..4e13ea8d 100644 --- a/include/xmlsec/xmlsec.h +++ b/include/xmlsec/xmlsec.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * General functions and forward declarations. @@ -11,16 +11,16 @@ #ifndef __XMLSEC_H__ #define __XMLSEC_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <xmlsec/version.h> #include <xmlsec/exports.h> #include <xmlsec/strings.h> +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /*********************************************************************** * * Basic types to make ports to exotic platforms easier @@ -86,6 +86,7 @@ typedef struct _xmlSecEncCtx xmlSecEncCtx, *xmlSecEncCtxPtr; XMLSEC_EXPORT int xmlSecInit (void); XMLSEC_EXPORT int xmlSecShutdown (void); XMLSEC_EXPORT const xmlChar * xmlSecGetDefaultCrypto (void); +XMLSEC_EXPORT void xmlSecSetExternalEntityLoader (xmlExternalEntityLoader); /** * XMLSEC_CRYPTO: @@ -97,6 +98,22 @@ XMLSEC_EXPORT const xmlChar * xmlSecGetDefaultCrypto (void); */ #define XMLSEC_CRYPTO (xmlSecGetDefaultCrypto()) +/* + * XMLSEC_DEPRECATED function definition + */ +#if !defined(IN_XMLSEC) +#ifdef __GNUC__ +#define XMLSEC_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) +#define XMLSEC_DEPRECATED __declspec(deprecated) +#else /* defined(_MSC_VER) */ +#pragma message("WARNING: You need to implement XMLSEC_DEPRECATED for this compiler") +#define XMLSEC_DEPRECATED +#endif /* defined(_MSC_VER) */ +#else /* !defined(IN_XMLSEC) */ +#define XMLSEC_DEPRECATED +#endif /* !defined(IN_XMLSEC) */ + /*********************************************************************** * * Version checking @@ -139,79 +156,6 @@ XMLSEC_EXPORT int xmlSecCheckVersionExt (int major, int subminor, xmlSecCheckVersionMode mode); -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ -#ifdef __GNUC__ -#ifdef HAVE_ANSIDECL_H -#include <ansidecl.h> -#endif -#ifndef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED -#endif -#else -#define ATTRIBUTE_UNUSED -#endif - -/*********************************************************************** - * - * Helpers to convert from void* to function pointer, this silence - * gcc warning - * - * warning: ISO C forbids conversion of object pointer to function - * pointer type - * - * The workaround is to declare a union that does the conversion. This is - * guaranteed (ISO/IEC 9899:1990 "C89"/"C90") to match exactly. - * - ***********************************************************************/ - -/** - * XMLSEC_PTR_TO_FUNC_IMPL: - * @func_type: the function type. - * - * Macro declares helper functions to convert between "void *" pointer and - * function pointer. - */ -#define XMLSEC_PTR_TO_FUNC_IMPL(func_type) \ - union xmlSecPtrToFuncUnion_ ##func_type { \ - void *ptr; \ - func_type * func; \ - } ; \ - static func_type * xmlSecPtrToFunc_ ##func_type(void * ptr) { \ - union xmlSecPtrToFuncUnion_ ##func_type x; \ - x.ptr = ptr; \ - return (x.func); \ - } \ - static void * xmlSecFuncToPtr_ ##func_type(func_type * func) { \ - union xmlSecPtrToFuncUnion_ ##func_type x; \ - x.func = func; \ - return (x.ptr); \ - } - -/** - * XMLSEC_PTR_TO_FUNC: - * @func_type: the function type. - * @ptr: the "void*" pointer to be converted. - * - * Macro converts from "void*" pointer to "func_type" function pointer. - */ -#define XMLSEC_PTR_TO_FUNC(func_type, ptr) \ - xmlSecPtrToFunc_ ##func_type((ptr)) - -/** - * XMLSEC_FUNC_TO_PTR: - * @func_type: the function type. - * @func: the "func_type" function pointer to be converted. - * - * Macro converts from "func_type" function pointer to "void*" pointer. - */ -#define XMLSEC_FUNC_TO_PTR(func_type, func) \ - xmlSecFuncToPtr_ ##func_type((func)) - - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/xmlsec/xmltree.h b/include/xmlsec/xmltree.h index 8b575c83..e29016a6 100644 --- a/include/xmlsec/xmltree.h +++ b/include/xmlsec/xmltree.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * Common XML utility functions @@ -11,16 +11,20 @@ #ifndef __XMLSEC_TREE_H__ #define __XMLSEC_TREE_H__ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <stdio.h> #include <libxml/tree.h> #include <libxml/xpath.h> #include <xmlsec/xmlsec.h> +#ifdef WIN32 +#include <windows.h> +#endif /* WIN32 */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** * xmlSecNodeGetName: * @node: the pointer to node. @@ -30,11 +34,17 @@ extern "C" { #define xmlSecNodeGetName(node) \ (((node)) ? ((const char*)((node)->name)) : NULL) +XMLSEC_EXPORT const xmlChar* xmlSecGetDefaultLineFeed(void); +XMLSEC_EXPORT void xmlSecSetDefaultLineFeed(const xmlChar *linefeed); + XMLSEC_EXPORT const xmlChar* xmlSecGetNodeNsHref (const xmlNodePtr cur); XMLSEC_EXPORT int xmlSecCheckNodeName (const xmlNodePtr cur, const xmlChar *name, const xmlChar *ns); XMLSEC_EXPORT xmlNodePtr xmlSecGetNextElementNode(xmlNodePtr cur); +XMLSEC_EXPORT xmlNodePtr xmlSecFindSibling (const xmlNodePtr cur, + const xmlChar *name, + const xmlChar *ns); XMLSEC_EXPORT xmlNodePtr xmlSecFindChild (const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns); @@ -47,6 +57,9 @@ XMLSEC_EXPORT xmlNodePtr xmlSecFindNode (const xmlNodePtr parent XMLSEC_EXPORT xmlNodePtr xmlSecAddChild (xmlNodePtr parent, const xmlChar *name, const xmlChar *ns); +XMLSEC_EXPORT xmlNodePtr xmlSecEnsureEmptyChild (xmlNodePtr parent, + const xmlChar *name, + const xmlChar *ns); XMLSEC_EXPORT xmlNodePtr xmlSecAddChildNode (xmlNodePtr parent, xmlNodePtr child); XMLSEC_EXPORT xmlNodePtr xmlSecAddNextSibling (xmlNodePtr node, @@ -82,13 +95,6 @@ XMLSEC_EXPORT int xmlSecNodeEncodeAndSetContent XMLSEC_EXPORT void xmlSecAddIDs (xmlDocPtr doc, xmlNodePtr cur, const xmlChar** ids); -XMLSEC_EXPORT int xmlSecGenerateAndAddID (xmlNodePtr node, - const xmlChar* attrName, - const xmlChar* prefix, - xmlSecSize len); -XMLSEC_EXPORT xmlChar* xmlSecGenerateID (const xmlChar* prefix, - xmlSecSize len); - XMLSEC_EXPORT xmlDocPtr xmlSecCreateTree (const xmlChar* rootNodeName, const xmlChar* rootNodeNs); XMLSEC_EXPORT int xmlSecIsEmptyNode (xmlNodePtr node); @@ -265,6 +271,25 @@ XMLSEC_EXPORT void xmlSecQName2BitMaskDebugXmlDump(xmlSecQName2BitM FILE* output); +/************************************************************************* + * + * Windows string conversions + * + ************************************************************************/ +#ifdef WIN32 +XMLSEC_EXPORT LPWSTR xmlSecWin32ConvertLocaleToUnicode(const char* str); + +XMLSEC_EXPORT LPWSTR xmlSecWin32ConvertUtf8ToUnicode (const xmlChar* str); +XMLSEC_EXPORT xmlChar* xmlSecWin32ConvertUnicodeToUtf8 (LPCWSTR str); + +XMLSEC_EXPORT xmlChar* xmlSecWin32ConvertLocaleToUtf8 (const char* str); +XMLSEC_EXPORT char* xmlSecWin32ConvertUtf8ToLocale (const xmlChar* str); + +XMLSEC_EXPORT xmlChar* xmlSecWin32ConvertTstrToUtf8 (LPCTSTR str); +XMLSEC_EXPORT LPTSTR xmlSecWin32ConvertUtf8ToTstr (const xmlChar* str); + + +#endif /* WIN32 */ #ifdef __cplusplus |