[xmlsec] fix certificates localization issue on windows; remove spaces at the end of the line



commit a9c2be7a2e3347d2d5f85d324a128d2c00a618af
Author: Aleksey Sanin <aleksey aleksey com>
Date:   Fri Apr 23 21:42:29 2010 -0700

    fix certificates localization issue on windows; remove spaces at the end of the line

 include/xmlsec/app.h                |  170 +++---
 include/xmlsec/base64.h             |   18 +-
 include/xmlsec/bn.h                 |   20 +-
 include/xmlsec/buffer.h             |   16 +-
 include/xmlsec/crypto.h             |    8 +-
 include/xmlsec/dl.h                 |   12 +-
 include/xmlsec/errors.h             |   78 ++--
 include/xmlsec/exports.h            |   22 +-
 include/xmlsec/gnutls/app.h         |   24 +-
 include/xmlsec/gnutls/crypto.h      |   34 +-
 include/xmlsec/gnutls/symbols.h     |   14 +-
 include/xmlsec/io.h                 |   12 +-
 include/xmlsec/keyinfo.h            |   80 ++--
 include/xmlsec/keys.h               |   36 +-
 include/xmlsec/keysdata.h           |   92 ++--
 include/xmlsec/keysmngr.h           |   48 +-
 include/xmlsec/list.h               |   26 +-
 include/xmlsec/membuf.h             |   12 +-
 include/xmlsec/mscrypto/app.h       |   80 ++--
 include/xmlsec/mscrypto/certkeys.h  |   10 +-
 include/xmlsec/mscrypto/crypto.h    |   58 +-
 include/xmlsec/mscrypto/keysstore.h |   14 +-
 include/xmlsec/mscrypto/symbols.h   |   14 +-
 include/xmlsec/mscrypto/x509.h      |   56 +-
 include/xmlsec/nodeset.h            |   28 +-
 include/xmlsec/nss/app.h            |   48 +-
 include/xmlsec/nss/bignum.h         |   20 +-
 include/xmlsec/nss/crypto.h         |   80 ++--
 include/xmlsec/nss/keysstore.h      |   14 +-
 include/xmlsec/nss/pkikeys.h        |    8 +-
 include/xmlsec/nss/symbols.h        |   14 +-
 include/xmlsec/nss/x509.h           |   18 +-
 include/xmlsec/openssl/app.h        |   44 +-
 include/xmlsec/openssl/bn.h         |   16 +-
 include/xmlsec/openssl/crypto.h     |   96 ++--
 include/xmlsec/openssl/evp.h        |   10 +-
 include/xmlsec/openssl/symbols.h    |   14 +-
 include/xmlsec/openssl/x509.h       |   18 +-
 include/xmlsec/parser.h             |   20 +-
 include/xmlsec/private.h            |  100 ++--
 include/xmlsec/private/xkms.h       |   30 +-
 include/xmlsec/skeleton/app.h       |   38 +-
 include/xmlsec/skeleton/crypto.h    |   10 +-
 include/xmlsec/skeleton/symbols.h   |   14 +-
 include/xmlsec/soap.h               |   72 +-
 include/xmlsec/strings.h            |    8 +-
 include/xmlsec/templates.h          |   36 +-
 include/xmlsec/transforms.h         |  180 +++---
 include/xmlsec/version.h            |    8 +-
 include/xmlsec/version.h.in         |    8 +-
 include/xmlsec/x509.h               |   18 +-
 include/xmlsec/xkms.h               |  174 +++---
 include/xmlsec/xmldsig.h            |   44 +-
 include/xmlsec/xmlenc.h             |   34 +-
 include/xmlsec/xmlsec.h             |   42 +-
 include/xmlsec/xmltree.h            |   56 +-
 src/app.c                           |  456 +++++++-------
 src/base64.c                        |  238 ++++----
 src/bn.c                            |  116 ++--
 src/buffer.c                        |  164 +++---
 src/c14n.c                          |  212 +++---
 src/dl.c                            |  192 +++---
 src/enveloped.c                     |   50 +-
 src/errors.c                        |  152 +++---
 src/globals.h                       |    4 +-
 src/gnutls/README                   |    4 +-
 src/gnutls/app.c                    |  122 ++--
 src/gnutls/ciphers.c                |  194 +++---
 src/gnutls/crypto.c                 |   50 +-
 src/gnutls/digests.c                |   78 ++--
 src/gnutls/globals.h                |    4 +-
 src/gnutls/hmac.c                   |  166 +++---
 src/gnutls/symkeys.c                |  100 ++--
 src/io.c                            |   98 ++--
 src/keyinfo.c                       |  434 ++++++------
 src/keys.c                          |  394 ++++++------
 src/keysdata.c                      |  422 ++++++------
 src/keysmngr.c                      |  202 +++---
 src/list.c                          |  136 ++--
 src/membuf.c                        |   58 +-
 src/mscrypto/README                 |   32 +-
 src/mscrypto/app.c                  |  246 ++++----
 src/mscrypto/certkeys.c             |  460 +++++++-------
 src/mscrypto/ciphers.c              |  306 +++++-----
 src/mscrypto/crypto.c               |   94 ++--
 src/mscrypto/csp_calg.h             |   18 +-
 src/mscrypto/csp_oid.h              |   44 +-
 src/mscrypto/digests.c              |   96 ++--
 src/mscrypto/globals.h              |    4 +-
 src/mscrypto/keysstore.c            |  187 ++----
 src/mscrypto/kt_rsa.c               |   92 ++--
 src/mscrypto/signatures.c           |   92 ++--
 src/mscrypto/symkeys.c              |   78 ++--
 src/mscrypto/x509.c                 |  268 ++++----
 src/mscrypto/x509vfy.c              |  494 ++++++++++----
 src/mscrypto/xmlsec-mingw.h         |    2 +-
 src/nodeset.c                       |  142 ++--
 src/nss/README                      |   66 +-
 src/nss/app.c                       |  286 ++++----
 src/nss/bignum.c                    |   48 +-
 src/nss/ciphers.c                   |  202 +++---
 src/nss/crypto.c                    |   84 ++--
 src/nss/digests.c                   |   84 ++--
 src/nss/globals.h                   |    4 +-
 src/nss/hmac.c                      |  168 +++---
 src/nss/keysstore.c                 |  108 ++--
 src/nss/keytrans.c                  |  130 ++--
 src/nss/kw_aes.c                    |  194 +++---
 src/nss/kw_des.c                    |  222 ++++----
 src/nss/pkikeys.c                   |  322 +++++-----
 src/nss/signatures.c                |  106 ++--
 src/nss/symkeys.c                   |  100 ++--
 src/nss/x509.c                      |  338 +++++-----
 src/nss/x509vfy.c                   |   98 ++--
 src/openssl/README                  |    6 +-
 src/openssl/app.c                   |  422 ++++++------
 src/openssl/bn.c                    |   42 +-
 src/openssl/ciphers.c               |  206 +++---
 src/openssl/crypto.c                |  116 ++--
 src/openssl/digests.c               |  176 +++---
 src/openssl/evp.c                   |  412 ++++++------
 src/openssl/globals.h               |    4 +-
 src/openssl/hmac.c                  |  256 ++++----
 src/openssl/kt_rsa.c                |  268 ++++----
 src/openssl/kw_aes.c                |  168 +++---
 src/openssl/kw_des.c                |  226 ++++----
 src/openssl/signatures.c            |  250 ++++----
 src/openssl/symkeys.c               |  100 ++--
 src/openssl/x509.c                  |  432 ++++++------
 src/openssl/x509vfy.c               |  314 +++++-----
 src/parser.c                        |  134 ++--
 src/skeleton/app.c                  |  128 ++--
 src/skeleton/crypto.c               |   50 +-
 src/skeleton/globals.h              |    4 +-
 src/soap.c                          |  308 +++++-----
 src/strings.c                       |    4 +-
 src/templates.c                     |  606 +++++++++---------
 src/transforms.c                    |  866 ++++++++++++------------
 src/x509.c                          |   10 +-
 src/xkms.c                          | 1232 +++++++++++++++++-----------------
 src/xmldsig.c                       |  566 ++++++++--------
 src/xmlenc.c                        |  310 +++++-----
 src/xmlsec.c                        |   36 +-
 src/xmltree.c                       |  478 +++++++-------
 src/xpath.c                         |  224 ++++----
 src/xslt.c                          |  146 ++--
 146 files changed, 10098 insertions(+), 9937 deletions(-)
---
diff --git a/include/xmlsec/app.h b/include/xmlsec/app.h
index 59fe058..7f61ac6 100644
--- a/include/xmlsec/app.h
+++ b/include/xmlsec/app.h
@@ -1,14 +1,14 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_APP_H__
-#define __XMLSEC_APP_H__    
+#define __XMLSEC_APP_H__
 
 #ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING
 
@@ -18,7 +18,7 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 #include <libxml/xmlIO.h>
@@ -46,60 +46,60 @@ XMLSEC_EXPORT int                               xmlSecCryptoKeysMngrInit
  ********************************************************************/
 /**
  * xmlSecKeyDataAesId:
- * 
+ *
  * The AES key klass.
  */
 #define xmlSecKeyDataAesId                      xmlSecKeyDataAesGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataAesGetKlass        (void); 
+XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataAesGetKlass        (void);
 /**
  * xmlSecKeyDataDesId:
- * 
+ *
  * The DES key klass.
  */
 #define xmlSecKeyDataDesId                      xmlSecKeyDataDesGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataDesGetKlass        (void); 
+XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataDesGetKlass        (void);
 /**
  * xmlSecKeyDataDsaId:
- * 
+ *
  * The DSA key klass.
  */
 #define xmlSecKeyDataDsaId                      xmlSecKeyDataDsaGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataDsaGetKlass        (void);         
-/** 
+XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataDsaGetKlass        (void);
+/**
  * xmlSecKeyDataGost2001Id:
- * 
+ *
  * The GOST2001 key klass.
  */
 #define xmlSecKeyDataGost2001Id                 xmlSecKeyDataGost2001GetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataGost2001GetKlass   (void);         
-/** 
+XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataGost2001GetKlass   (void);
+/**
  * xmlSecKeyDataHmacId:
- * 
+ *
  * The DHMAC key klass.
  */
 #define xmlSecKeyDataHmacId                     xmlSecKeyDataHmacGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataHmacGetKlass       (void);         
+XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataHmacGetKlass       (void);
 /**
  * xmlSecKeyDataRsaId:
- * 
+ *
  * The RSA key klass.
  */
 #define xmlSecKeyDataRsaId                      xmlSecKeyDataRsaGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataRsaGetKlass        (void);         
+XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataRsaGetKlass        (void);
 /**
  * xmlSecKeyDataX509Id:
- * 
+ *
  * The X509 data klass.
  */
 #define xmlSecKeyDataX509Id                     xmlSecKeyDataX509GetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataX509GetKlass       (void);         
+XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataX509GetKlass       (void);
 /**
  * xmlSecKeyDataRawX509CertId:
- * 
+ *
  * The  raw X509 certificate klass.
  */
 #define xmlSecKeyDataRawX509CertId              xmlSecKeyDataRawX509CertGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataRawX509CertGetKlass(void);         
+XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataRawX509CertGetKlass(void);
 
 /*********************************************************************
  *
@@ -108,11 +108,11 @@ XMLSEC_EXPORT xmlSecKeyDataId                   xmlSecKeyDataRawX509CertGetKlass
  ********************************************************************/
 /**
  * xmlSecX509StoreId:
- * 
+ *
  * The  X509 store klass.
  */
 #define xmlSecX509StoreId                       xmlSecX509StoreGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataStoreId              xmlSecX509StoreGetKlass         (void); 
+XMLSEC_EXPORT xmlSecKeyDataStoreId              xmlSecX509StoreGetKlass         (void);
 
 /*********************************************************************
  *
@@ -121,241 +121,241 @@ XMLSEC_EXPORT xmlSecKeyDataStoreId              xmlSecX509StoreGetKlass
  ********************************************************************/
 /**
  * xmlSecTransformAes128CbcId:
- * 
+ *
  * The AES128 CBC cipher transform klass.
  */
 #define xmlSecTransformAes128CbcId              xmlSecTransformAes128CbcGetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformAes128CbcGetKlass(void);
 /**
  * xmlSecTransformAes192CbcId:
- * 
+ *
  * The AES192 CBC cipher transform klass.
  */
 #define xmlSecTransformAes192CbcId              xmlSecTransformAes192CbcGetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformAes192CbcGetKlass(void);
 /**
  * xmlSecTransformAes256CbcId:
- * 
+ *
  * The AES256 CBC cipher transform klass.
  */
 #define xmlSecTransformAes256CbcId              xmlSecTransformAes256CbcGetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformAes256CbcGetKlass(void);
 /**
  * xmlSecTransformKWAes128Id:
- * 
+ *
  * The AES 128 key wrap transform klass.
  */
 #define xmlSecTransformKWAes128Id               xmlSecTransformKWAes128GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformKWAes128GetKlass (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformKWAes128GetKlass (void);
 /**
  * xmlSecTransformKWAes192Id:
- * 
+ *
  * The AES 192 key wrap transform klass.
  */
 #define xmlSecTransformKWAes192Id               xmlSecTransformKWAes192GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformKWAes192GetKlass (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformKWAes192GetKlass (void);
 /**
  * xmlSecTransformKWAes256Id:
- * 
+ *
  * The AES 256 key wrap transform klass.
  */
 #define xmlSecTransformKWAes256Id               xmlSecTransformKWAes256GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformKWAes256GetKlass (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformKWAes256GetKlass (void);
 /**
  * xmlSecTransformDes3CbcId:
- * 
+ *
  * The Triple DES encryption transform klass.
  */
 #define xmlSecTransformDes3CbcId                xmlSecTransformDes3CbcGetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformDes3CbcGetKlass  (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformDes3CbcGetKlass  (void);
 /**
  * xmlSecTransformKWDes3Id:
- * 
+ *
  * The DES3 CBC cipher transform klass.
  */
 #define xmlSecTransformKWDes3Id                 xmlSecTransformKWDes3GetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformKWDes3GetKlass   (void);
 /**
  * xmlSecTransformDsaSha1Id:
- * 
+ *
  * The DSA-SHA1 signature transform klass.
  */
 #define xmlSecTransformDsaSha1Id                xmlSecTransformDsaSha1GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformDsaSha1GetKlass  (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformDsaSha1GetKlass  (void);
 
 /**
  * xmlSecTransformGost2001GostR3411_94Id:
- * 
+ *
  * The GOST2001-GOSTR3411_94 signature transform klass.
  */
 #define xmlSecTransformGost2001GostR3411_94Id           xmlSecTransformGost2001GostR3411_94GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformGost2001GostR3411_94GetKlass     (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformGost2001GostR3411_94GetKlass     (void);
 
 /**
  * xmlSecTransformHmacMd5Id:
- * 
+ *
  * The HMAC with MD5 signature transform klass.
  */
 #define xmlSecTransformHmacMd5Id                xmlSecTransformHmacMd5GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacMd5GetKlass  (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacMd5GetKlass  (void);
 /**
  * xmlSecTransformHmacRipemd160Id:
- * 
+ *
  * The HMAC with RipeMD160 signature transform klass.
  */
 #define xmlSecTransformHmacRipemd160Id          xmlSecTransformHmacRipemd160GetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacRipemd160GetKlass(void);
 /**
  * xmlSecTransformHmacSha1Id:
- * 
+ *
  * The HMAC with SHA1 signature transform klass.
  */
 #define xmlSecTransformHmacSha1Id               xmlSecTransformHmacSha1GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacSha1GetKlass (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacSha1GetKlass (void);
 /**
  * xmlSecTransformHmacSha224Id:
- * 
+ *
  * The HMAC with SHA224 signature transform klass.
  */
 #define xmlSecTransformHmacSha224Id             xmlSecTransformHmacSha224GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacSha224GetKlass       (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacSha224GetKlass       (void);
 /**
  * xmlSecTransformHmacSha256Id:
- * 
+ *
  * The HMAC with SHA256 signature transform klass.
  */
 #define xmlSecTransformHmacSha256Id             xmlSecTransformHmacSha256GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacSha256GetKlass       (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacSha256GetKlass       (void);
 /**
  * xmlSecTransformHmacSha384Id:
- * 
+ *
  * The HMAC with SHA384 signature transform klass.
  */
 #define xmlSecTransformHmacSha384Id             xmlSecTransformHmacSha384GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacSha384GetKlass       (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacSha384GetKlass       (void);
 /**
  * xmlSecTransformHmacSha512Id:
- * 
+ *
  * The HMAC with SHA512 signature transform klass.
  */
 #define xmlSecTransformHmacSha512Id             xmlSecTransformHmacSha512GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacSha512GetKlass       (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformHmacSha512GetKlass       (void);
 /**
  * xmlSecTransformMd5Id:
- * 
+ *
  * The MD5 digest transform klass.
  */
 #define xmlSecTransformMd5Id                    xmlSecTransformMd5GetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformMd5GetKlass(void);
 /**
  * xmlSecTransformRipemd160Id:
- * 
+ *
  * The RIPEMD160 digest transform klass.
  */
 #define xmlSecTransformRipemd160Id              xmlSecTransformRipemd160GetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRipemd160GetKlass(void);
 /**
  * xmlSecTransformRsaMd5Id:
- * 
+ *
  * The RSA-MD5 signature transform klass.
  */
 #define xmlSecTransformRsaMd5Id                 xmlSecTransformRsaMd5GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaMd5GetKlass   (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaMd5GetKlass   (void);
 /**
  * xmlSecTransformRsaRipemd160Id:
- * 
+ *
  * The RSA-RIPEMD160 signature transform klass.
  */
 #define xmlSecTransformRsaRipemd160Id           xmlSecTransformRsaRipemd160GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaRipemd160GetKlass     (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaRipemd160GetKlass     (void);
 /**
  * xmlSecTransformRsaSha1Id:
- * 
+ *
  * The RSA-SHA1 signature transform klass.
  */
 #define xmlSecTransformRsaSha1Id                xmlSecTransformRsaSha1GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaSha1GetKlass  (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaSha1GetKlass  (void);
 /**
  * xmlSecTransformRsaSha224Id:
- * 
+ *
  * The RSA-SHA224 signature transform klass.
  */
 #define xmlSecTransformRsaSha224Id              xmlSecTransformRsaSha224GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaSha224GetKlass        (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaSha224GetKlass        (void);
 /**
  * xmlSecTransformRsaSha256Id:
- * 
+ *
  * The RSA-SHA256 signature transform klass.
  */
 #define xmlSecTransformRsaSha256Id              xmlSecTransformRsaSha256GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaSha256GetKlass        (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaSha256GetKlass        (void);
 /**
  * xmlSecTransformRsaSha384Id:
- * 
+ *
  * The RSA-SHA384 signature transform klass.
  */
 #define xmlSecTransformRsaSha384Id              xmlSecTransformRsaSha384GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaSha384GetKlass        (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaSha384GetKlass        (void);
 /**
  * xmlSecTransformRsaSha512Id:
- * 
+ *
  * The RSA-SHA512 signature transform klass.
  */
 #define xmlSecTransformRsaSha512Id              xmlSecTransformRsaSha512GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaSha512GetKlass        (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaSha512GetKlass        (void);
 
 /**
  * xmlSecTransformRsaPkcs1Id:
- * 
+ *
  * The RSA PKCS1 key transport transform klass.
  */
 #define xmlSecTransformRsaPkcs1Id               xmlSecTransformRsaPkcs1GetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaPkcs1GetKlass (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaPkcs1GetKlass (void);
 /**
  * xmlSecTransformRsaOaepId:
- * 
+ *
  * The RSA PKCS1 key transport transform klass.
  */
 #define xmlSecTransformRsaOaepId                xmlSecTransformRsaOaepGetKlass()
-XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaOaepGetKlass  (void); 
+XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformRsaOaepGetKlass  (void);
 /**
  * xmlSecTransformGostR3411_94Id:
- * 
+ *
  * The GOSTR3411_94 digest transform klass.
  */
 #define xmlSecTransformGostR3411_94Id                   xmlSecTransformGostR3411_94GetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformGostR3411_94GetKlass     (void);
 /**
  * xmlSecTransformSha1Id:
- * 
+ *
  * The SHA1 digest transform klass.
  */
 #define xmlSecTransformSha1Id                   xmlSecTransformSha1GetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformSha1GetKlass     (void);
 /**
  * xmlSecTransformSha224Id:
- * 
+ *
  * The SHA224 digest transform klass.
  */
 #define xmlSecTransformSha224Id                 xmlSecTransformSha224GetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformSha224GetKlass   (void);
 /**
  * xmlSecTransformSha256Id:
- * 
+ *
  * The SHA256 digest transform klass.
  */
 #define xmlSecTransformSha256Id                 xmlSecTransformSha256GetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformSha256GetKlass   (void);
 /**
  * xmlSecTransformSha384Id:
- * 
+ *
  * The SHA384 digest transform klass.
  */
 #define xmlSecTransformSha384Id                 xmlSecTransformSha384GetKlass()
 XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformSha384GetKlass   (void);
 /**
  * xmlSecTransformSha512Id:
- * 
+ *
  * The SHA512 digest transform klass.
  */
 #define xmlSecTransformSha512Id                 xmlSecTransformSha512GetKlass()
@@ -365,7 +365,7 @@ XMLSEC_EXPORT xmlSecTransformId                 xmlSecTransformSha512GetKlass
  *
  * High level routines form xmlsec command line utility
  *
- ********************************************************************/ 
+ ********************************************************************/
 XMLSEC_EXPORT int                               xmlSecCryptoAppInit             (const char* config);
 XMLSEC_EXPORT int                               xmlSecCryptoAppShutdown         (void);
 XMLSEC_EXPORT int                               xmlSecCryptoAppDefaultKeysMngrInit      (xmlSecKeysMngrPtr mngr);
@@ -377,7 +377,7 @@ XMLSEC_EXPORT int                               xmlSecCryptoAppDefaultKeysMngrSa
                                                                                          const char* filename,
                                                                                          xmlSecKeyDataType type);
 XMLSEC_EXPORT int                               xmlSecCryptoAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
-                                                                                 const char *filename, 
+                                                                                 const char *filename,
                                                                                  xmlSecKeyDataFormat format,
                                                                                  xmlSecKeyDataType type);
 XMLSEC_EXPORT int                               xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
@@ -385,7 +385,7 @@ XMLSEC_EXPORT int                               xmlSecCryptoAppKeysMngrCertLoadM
                                                                                  xmlSecSize dataSize,
                                                                                  xmlSecKeyDataFormat format,
                                                                                  xmlSecKeyDataType type);
-XMLSEC_EXPORT xmlSecKeyPtr                      xmlSecCryptoAppKeyLoad          (const char *filename, 
+XMLSEC_EXPORT xmlSecKeyPtr                      xmlSecCryptoAppKeyLoad          (const char *filename,
                                                                                  xmlSecKeyDataFormat format,
                                                                                  const char *pwd,
                                                                                  void* pwdCallback,
@@ -396,10 +396,10 @@ XMLSEC_EXPORT xmlSecKeyPtr                      xmlSecCryptoAppKeyLoadMemory
                                                                                  const char *pwd,
                                                                                  void* pwdCallback,
                                                                                  void* pwdCallbackCtx);
-XMLSEC_EXPORT xmlSecKeyPtr                      xmlSecCryptoAppPkcs12Load       (const char* filename, 
+XMLSEC_EXPORT xmlSecKeyPtr                      xmlSecCryptoAppPkcs12Load       (const char* filename,
                                                                                  const char* pwd,
-                                                                                 void* pwdCallback, 
-                                                                                 void* pwdCallbackCtx); 
+                                                                                 void* pwdCallback,
+                                                                                 void* pwdCallbackCtx);
 XMLSEC_EXPORT xmlSecKeyPtr                      xmlSecCryptoAppPkcs12LoadMemory (const xmlSecByte* data,
                                                                                  xmlSecSize dataSize,
                                                                                  const char *pwd,
diff --git a/include/xmlsec/base64.h b/include/xmlsec/base64.h
index 91b4b09..28d8fbc 100644
--- a/include/xmlsec/base64.h
+++ b/include/xmlsec/base64.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Base64 encode/decode transform and utility functions.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_BASE64_H__
-#define __XMLSEC_BASE64_H__    
+#define __XMLSEC_BASE64_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 
@@ -32,19 +32,19 @@ XMLSEC_EXPORT void              xmlSecBase64SetDefaultLineSize  (int columns);
 
 
 /* Base64 Context */
-typedef struct _xmlSecBase64Ctx                                 xmlSecBase64Ctx, 
+typedef struct _xmlSecBase64Ctx                                 xmlSecBase64Ctx,
                                                                 *xmlSecBase64CtxPtr;
 
-XMLSEC_EXPORT xmlSecBase64CtxPtr xmlSecBase64CtxCreate          (int encode, 
+XMLSEC_EXPORT xmlSecBase64CtxPtr xmlSecBase64CtxCreate          (int encode,
                                                                  int columns);
 XMLSEC_EXPORT void              xmlSecBase64CtxDestroy          (xmlSecBase64CtxPtr ctx);
 XMLSEC_EXPORT int               xmlSecBase64CtxInitialize       (xmlSecBase64CtxPtr ctx,
-                                                                 int encode, 
+                                                                 int encode,
                                                                  int columns);
 XMLSEC_EXPORT void              xmlSecBase64CtxFinalize         (xmlSecBase64CtxPtr ctx);
 XMLSEC_EXPORT int               xmlSecBase64CtxUpdate           (xmlSecBase64CtxPtr ctx,
-                                                                 const xmlSecByte *in, 
-                                                                 xmlSecSize inSize, 
+                                                                 const xmlSecByte *in,
+                                                                 xmlSecSize inSize,
                                                                  xmlSecByte *out,
                                                                  xmlSecSize outSize);
 XMLSEC_EXPORT int               xmlSecBase64CtxFinal            (xmlSecBase64CtxPtr ctx,
diff --git a/include/xmlsec/bn.h b/include/xmlsec/bn.h
index 2163be3..65138ed 100644
--- a/include/xmlsec/bn.h
+++ b/include/xmlsec/bn.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Simple Big Numbers processing.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_BN_H__
-#define __XMLSEC_BN_H__    
+#define __XMLSEC_BN_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 #include <xmlsec/xmlsec.h>
@@ -66,8 +66,8 @@ XMLSEC_EXPORT int               xmlSecBnMul                     (xmlSecBnPtr bn,
 XMLSEC_EXPORT int               xmlSecBnDiv                     (xmlSecBnPtr bn,
                                                                  int divider,
                                                                  int* mod);
-XMLSEC_EXPORT int               xmlSecBnAdd                     (xmlSecBnPtr bn, 
-                                                                 int delta); 
+XMLSEC_EXPORT int               xmlSecBnAdd                     (xmlSecBnPtr bn,
+                                                                 int delta);
 XMLSEC_EXPORT int               xmlSecBnReverse                 (xmlSecBnPtr bn);
 XMLSEC_EXPORT int               xmlSecBnCompare                 (xmlSecBnPtr bn,
                                                                  const xmlSecByte* data,
@@ -75,18 +75,18 @@ XMLSEC_EXPORT int               xmlSecBnCompare                 (xmlSecBnPtr bn,
 XMLSEC_EXPORT int               xmlSecBnCompareReverse          (xmlSecBnPtr bn,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize);
-XMLSEC_EXPORT int               xmlSecBnGetNodeValue            (xmlSecBnPtr bn, 
+XMLSEC_EXPORT int               xmlSecBnGetNodeValue            (xmlSecBnPtr bn,
                                                                  xmlNodePtr cur,
                                                                  xmlSecBnFormat format,
                                                                  int reverse);
-XMLSEC_EXPORT int               xmlSecBnSetNodeValue            (xmlSecBnPtr bn, 
-                                                                 xmlNodePtr cur, 
+XMLSEC_EXPORT int               xmlSecBnSetNodeValue            (xmlSecBnPtr bn,
+                                                                 xmlNodePtr cur,
                                                                  xmlSecBnFormat format,
                                                                  int reverse,
                                                                  int addLineBreaks);
 XMLSEC_EXPORT int               xmlSecBnBlobSetNodeValue        (const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
-                                                                 xmlNodePtr cur, 
+                                                                 xmlNodePtr cur,
                                                                  xmlSecBnFormat format,
                                                                  int reverse,
                                                                  int addLineBreaks);
diff --git a/include/xmlsec/buffer.h b/include/xmlsec/buffer.h
index 9401aed..2791a97 100644
--- a/include/xmlsec/buffer.h
+++ b/include/xmlsec/buffer.h
@@ -1,30 +1,30 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Memory buffer.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_BUFFER_H__
-#define __XMLSEC_BUFFER_H__    
+#define __XMLSEC_BUFFER_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 #include <xmlsec/xmlsec.h>
 
-typedef struct _xmlSecBuffer                                    xmlSecBuffer, 
+typedef struct _xmlSecBuffer                                    xmlSecBuffer,
                                                                 *xmlSecBufferPtr;
 
 
-/** 
+/**
  * xmlSecAllocMode:
- * @xmlSecAllocModeExact:       the memory allocation mode that minimizes total 
+ * @xmlSecAllocModeExact:       the memory allocation mode that minimizes total
  *                              allocated memory size.
  * @xmlSecAllocModeDouble:      the memory allocation mode that tries to minimize
  *                              the number of malloc calls.
@@ -42,7 +42,7 @@ typedef enum {
  *
  ****************************************************************************/
 
-/** 
+/**
  * xmlSecBuffer:
  * @data: the pointer to buffer data.
  * @size: the current data size.
diff --git a/include/xmlsec/crypto.h b/include/xmlsec/crypto.h
index 57e9067..9fe9695 100644
--- a/include/xmlsec/crypto.h
+++ b/include/xmlsec/crypto.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Crypto engine selection.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_CRYPTO_H__
-#define __XMLSEC_CRYPTO_H__    
+#define __XMLSEC_CRYPTO_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 
diff --git a/include/xmlsec/dl.h b/include/xmlsec/dl.h
index ca9c1ff..a7e3c43 100644
--- a/include/xmlsec/dl.h
+++ b/include/xmlsec/dl.h
@@ -1,25 +1,25 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_DL_H__
-#define __XMLSEC_DL_H__    
+#define __XMLSEC_DL_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 typedef struct _xmlSecCryptoDLFunctions         xmlSecCryptoDLFunctions,
                                                 *xmlSecCryptoDLFunctionsPtr;
 
 XMLSEC_EXPORT int                               xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms
                                                                             (xmlSecCryptoDLFunctionsPtr functions);
-                                                                                
+
 #ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING
 
 #include <libxml/tree.h>
@@ -43,7 +43,7 @@ XMLSEC_EXPORT int                               xmlSecCryptoDLUnloadLibrary
 
 XMLSEC_EXPORT int                               xmlSecCryptoDLSetFunctions      (xmlSecCryptoDLFunctionsPtr functions);
 XMLSEC_EXPORT xmlSecCryptoDLFunctionsPtr        xmlSecCryptoDLGetFunctions      (void);
-                                        
+
 #endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */
 
 #ifdef __cplusplus
diff --git a/include/xmlsec/errors.h b/include/xmlsec/errors.h
index 7cea675..6e23620 100644
--- a/include/xmlsec/errors.h
+++ b/include/xmlsec/errors.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Error codes and error reporting functions.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_ERRORS_H__
-#define __XMLSEC_ERRORS_H__    
+#define __XMLSEC_ERRORS_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 /***************************************************************
  *
@@ -44,7 +44,7 @@ extern "C" {
 /**
  * XMLSEC_ERRORS_R_CRYPTO_FAILED:
  *
- * Crypto (OpenSSL) function failed (error subject is the failed function). 
+ * Crypto (OpenSSL) function failed (error subject is the failed function).
  */
 #define XMLSEC_ERRORS_R_CRYPTO_FAILED                   4
 
@@ -57,7 +57,7 @@ extern "C" {
 
 /**
  * XMLSEC_ERRORS_R_XSLT_FAILED:
- * 
+ *
  * LibXSLT function failed (error subject is the failed function).
  */
 #define XMLSEC_ERRORS_R_XSLT_FAILED                     6
@@ -108,14 +108,14 @@ extern "C" {
 
 /**
  * XMLSEC_ERRORS_R_INVALID_TYPE:
- * 
+ *
  * Invalid type.
  */
 #define XMLSEC_ERRORS_R_INVALID_TYPE                    14
 
 /**
  * XMLSEC_ERRORS_R_INVALID_OPERATION:
- * 
+ *
  * Invalid operation.
  */
 #define XMLSEC_ERRORS_R_INVALID_OPERATION               15
@@ -143,7 +143,7 @@ extern "C" {
 
 /**
  * XMLSEC_ERRORS_R_INVALID_NODE:
- * 
+ *
  * Invalid node (error subject is the node name).
  */
 #define XMLSEC_ERRORS_R_INVALID_NODE                    21
@@ -178,7 +178,7 @@ extern "C" {
 
 /**
  * XMLSEC_ERRORS_R_UNEXPECTED_NODE:
- * 
+ *
  * Unexpected node (error subject is the node name).
  */
 #define XMLSEC_ERRORS_R_UNEXPECTED_NODE                 27
@@ -192,21 +192,21 @@ extern "C" {
 
 /**
  * XMLSEC_ERRORS_R_INVALID_TRANSFORM:
- * 
+ *
  * This transform is invlaid here.
  */
 #define XMLSEC_ERRORS_R_INVALID_TRANSFORM               31
 
 /**
  * XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY:
- * 
+ *
  * Key is invalid for this transform.
  */
 #define XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY           32
 
 /**
  * XMLSEC_ERRORS_R_INVALID_URI_TYPE:
- * 
+ *
  * Invalid URI type.
  */
 #define XMLSEC_ERRORS_R_INVALID_URI_TYPE                33
@@ -255,12 +255,12 @@ extern "C" {
 
 /**
  * XMLSEC_ERRORS_R_KEY_NOT_FOUND:
- * 
+ *
  * Key not found.
  */
 #define XMLSEC_ERRORS_R_KEY_NOT_FOUND                   45
 
-/** 
+/**
  * XMLSEC_ERRORS_R_KEYDATA_DISABLED:
  *
  * The key data type disabled.
@@ -277,7 +277,7 @@ extern "C" {
 /**
  * XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH:
  *
- * The retrieved key data type does not match the one specified 
+ * The retrieved key data type does not match the one specified
  * in the <dsig:RetrievalMethod/> node.
  */
 #define XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH     52
@@ -305,7 +305,7 @@ extern "C" {
 
 /**
  * XMLSEC_ERRORS_R_CERT_REVOKED:
- * 
+ *
  * The certificate is revoked.
  */
 #define XMLSEC_ERRORS_R_CERT_REVOKED                    73
@@ -354,7 +354,7 @@ extern "C" {
 
 /**
  * XMLSEC_ERRORS_MAX_NUMBER:
- * 
+ *
  * The maximum xmlsec errors number.
  */
 #define XMLSEC_ERRORS_MAX_NUMBER                        256
@@ -365,37 +365,37 @@ extern "C" {
  *
  * Error functions
  *
- *******************************************************************/ 
+ *******************************************************************/
 /**
  * xmlSecErrorsCallback:
  * @file:               the error location file name (__FILE__ macro).
  * @line:               the error location line number (__LINE__ macro).
  * @func:               the error location function name (__FUNCTION__ macro).
- * @errorObject:        the error specific error object 
+ * @errorObject:        the error specific error object
  * @errorSubject:       the error specific error subject.
  * @reason:             the error code.
  * @msg:                the additional error message.
  *
  * The errors reporting callback function.
  */
-typedef void (*xmlSecErrorsCallback)                            (const char* file, 
-                                                                 int line, 
+typedef void (*xmlSecErrorsCallback)                            (const char* file,
+                                                                 int line,
                                                                  const char* func,
                                                                  const char* errorObject,
                                                                  const char* errorSubject,
-                                                                 int reason, 
+                                                                 int reason,
                                                                  const char* msg);
 
 
 XMLSEC_EXPORT void              xmlSecErrorsInit                (void);
 XMLSEC_EXPORT void              xmlSecErrorsShutdown            (void);
 XMLSEC_EXPORT void              xmlSecErrorsSetCallback         (xmlSecErrorsCallback callback);
-XMLSEC_EXPORT void              xmlSecErrorsDefaultCallback     (const char* file, 
-                                                                 int line, 
+XMLSEC_EXPORT void              xmlSecErrorsDefaultCallback     (const char* file,
+                                                                 int line,
                                                                  const char* func,
                                                                  const char* errorObject,
                                                                  const char* errorSubject,
-                                                                 int reason, 
+                                                                 int reason,
                                                                  const char* msg);
 XMLSEC_EXPORT void              xmlSecErrorsDefaultCallbackEnableOutput
                                                                 (int enabled);
@@ -406,7 +406,7 @@ XMLSEC_EXPORT const char*       xmlSecErrorsGetMsg              (xmlSecSize pos)
 
 
 /* __FUNCTION__ is defined for MSC compiler < MS VS .NET 2003 */
-#if defined(_MSC_VER) && (_MSC_VER >= 1300) 
+#if defined(_MSC_VER) && (_MSC_VER >= 1300)
 #define __XMLSEC_FUNCTION__  __FUNCTION__
 #endif /* _MSC_VER */
 
@@ -414,8 +414,8 @@ XMLSEC_EXPORT const char*       xmlSecErrorsGetMsg              (xmlSecSize pos)
 #if !defined(__XMLSEC_FUNCTION__)
 #define __XMLSEC_FUNCTION__  ""
 #endif /*!defined(__XMLSEC_FUNCTION__) */
- 
-/** 
+
+/**
  * XMLSEC_ERRORS_HERE:
  *
  * The macro that specifies the location (file, line and function)
@@ -425,35 +425,35 @@ XMLSEC_EXPORT const char*       xmlSecErrorsGetMsg              (xmlSecSize pos)
 #ifdef __GNUC__
 #define XMLSEC_ERRORS_PRINTF_ATTRIBUTE          __attribute__ ((format (printf, 7, 8)))
 #else /* __GNUC__ */
-#define XMLSEC_ERRORS_PRINTF_ATTRIBUTE          
+#define XMLSEC_ERRORS_PRINTF_ATTRIBUTE
 #endif /* __GNUC__ */
 
 /**
  * xmlSecErrorsSafeString:
  * @str:                the string.
- * 
+ *
  * Macro. Returns @str if it is not NULL or pointer to "NULL" otherwise.
  */
 #define xmlSecErrorsSafeString(str) \
         (((str) != NULL) ? ((char*)(str)) : (char*)"NULL")
 
-/** 
+/**
  * XMLSEC_ERRORS_NO_MESSAGE:
- * 
+ *
  * Empty error message " ".
  */
 #define XMLSEC_ERRORS_NO_MESSAGE                " "
 
 
-XMLSEC_EXPORT void xmlSecError                          (const char* file, 
-                                                         int line, 
+XMLSEC_EXPORT void xmlSecError                          (const char* file,
+                                                         int line,
                                                          const char* func,
                                                          const char* errorObject,
                                                          const char* errorSubject,
                                                          int reason,
                                                          const char* msg, ...) XMLSEC_ERRORS_PRINTF_ATTRIBUTE;
-                                                 
-                                                
+
+
 
 /**********************************************************************
  *
@@ -474,7 +474,7 @@ XMLSEC_EXPORT void xmlSecError                          (const char* file,
                         XMLSEC_ERRORS_R_ASSERTION, \
                         XMLSEC_ERRORS_NO_MESSAGE); \
             return; \
-        } 
+        }
 
 /**
  * xmlSecAssert2:
@@ -491,7 +491,7 @@ XMLSEC_EXPORT void xmlSecError                          (const char* file,
                         XMLSEC_ERRORS_R_ASSERTION, \
                         XMLSEC_ERRORS_NO_MESSAGE); \
             return(ret); \
-        } 
+        }
 
 
 
diff --git a/include/xmlsec/exports.h b/include/xmlsec/exports.h
index 41d0a7e..61678c2 100644
--- a/include/xmlsec/exports.h
+++ b/include/xmlsec/exports.h
@@ -1,21 +1,21 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Export macro declarations for Win32 platform.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_EXPORTS_H__
-#define __XMLSEC_EXPORTS_H__    
+#define __XMLSEC_EXPORTS_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
-/* Now, the export orgy begins. The following we must do for the 
+/* Now, the export orgy begins. The following we must do for the
    Windows platform with MSVC compiler. */
 
 #if !defined XMLSEC_EXPORT
@@ -23,7 +23,7 @@ extern "C" {
      /* if we compile libxmlsec itself: */
 #    if defined(IN_XMLSEC)
 #      if !defined(XMLSEC_STATIC)
-#        define XMLSEC_EXPORT __declspec(dllexport) 
+#        define XMLSEC_EXPORT __declspec(dllexport)
 #      else
 #        define XMLSEC_EXPORT extern
 #      endif
@@ -38,9 +38,9 @@ extern "C" {
 #      define XMLSEC_EXPORT
 #else
 #      if !defined(XMLSEC_STATIC)
-#        define XMLSEC_EXPORT __declspec(dllimport) 
+#        define XMLSEC_EXPORT __declspec(dllimport)
 #      else
-#        define XMLSEC_EXPORT 
+#        define XMLSEC_EXPORT
 #      endif
 #endif
 #    endif
@@ -56,16 +56,16 @@ extern "C" {
      /* if we compile libxmlsec itself: */
 #    if defined(IN_XMLSEC_CRYPTO)
 #      if !defined(XMLSEC_STATIC)
-#        define XMLSEC_CRYPTO_EXPORT __declspec(dllexport) 
+#        define XMLSEC_CRYPTO_EXPORT __declspec(dllexport)
 #      else
 #        define XMLSEC_CRYPTO_EXPORT extern
 #      endif
      /* if a client program includes this file: */
 #    else
 #      if !defined(XMLSEC_STATIC)
-#        define XMLSEC_CRYPTO_EXPORT __declspec(dllimport) 
+#        define XMLSEC_CRYPTO_EXPORT __declspec(dllimport)
 #      else
-#        define XMLSEC_CRYPTO_EXPORT 
+#        define XMLSEC_CRYPTO_EXPORT
 #      endif
 #    endif
    /* This holds on all other platforms/compilers, which are easier to
diff --git a/include/xmlsec/gnutls/app.h b/include/xmlsec/gnutls/app.h
index ede418c..86aa7a7 100644
--- a/include/xmlsec/gnutls/app.h
+++ b/include/xmlsec/gnutls/app.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_GNUTLS_APP_H__
-#define __XMLSEC_GNUTLS_APP_H__    
+#define __XMLSEC_GNUTLS_APP_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/keys.h>
@@ -24,7 +24,7 @@ extern "C" {
 XMLSEC_CRYPTO_EXPORT int        xmlSecGnuTLSAppInit                     (const char* config);
 XMLSEC_CRYPTO_EXPORT int        xmlSecGnuTLSAppShutdown                 (void);
 
-/** 
+/**
  * Keys Manager
  */
 XMLSEC_CRYPTO_EXPORT int        xmlSecGnuTLSAppDefaultKeysMngrInit      (xmlSecKeysMngrPtr mngr);
@@ -36,9 +36,9 @@ XMLSEC_CRYPTO_EXPORT int        xmlSecGnuTLSAppDefaultKeysMngrSave      (xmlSecK
                                                                          const char* filename,
                                                                          xmlSecKeyDataType type);
 #ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT int        xmlSecGnuTLSAppKeysMngrCertLoad         (xmlSecKeysMngrPtr mngr, 
-                                                                         const char *filename, 
-                                                                         xmlSecKeyDataFormat format, 
+XMLSEC_CRYPTO_EXPORT int        xmlSecGnuTLSAppKeysMngrCertLoad         (xmlSecKeysMngrPtr mngr,
+                                                                         const char *filename,
+                                                                         xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
 XMLSEC_CRYPTO_EXPORT int        xmlSecGnuTLSAppKeysMngrCertLoadMemory   (xmlSecKeysMngrPtr mngr,
                                                                          const xmlSecByte* data,
@@ -48,10 +48,10 @@ XMLSEC_CRYPTO_EXPORT int        xmlSecGnuTLSAppKeysMngrCertLoadMemory   (xmlSecK
 #endif /* XMLSEC_NO_X509 */
 
 
-/** 
+/**
  * Keys
  */
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppKeyLoad                (const char *filename, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppKeyLoad                (const char *filename,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
                                                                          void *pwdCallback,
@@ -63,9 +63,9 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppKeyLoadMemory          (const x
                                                                          void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 #ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppPkcs12Load             (const char *filename, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppPkcs12Load             (const char *filename,
                                                                          const char *pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppPkcs12LoadMemory       (const xmlSecByte* data,
                                                                          xmlSecSize dataSize,
diff --git a/include/xmlsec/gnutls/crypto.h b/include/xmlsec/gnutls/crypto.h
index 125c8d9..ddc373c 100644
--- a/include/xmlsec/gnutls/crypto.h
+++ b/include/xmlsec/gnutls/crypto.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_GNUTLS_CRYPTO_H__
-#define __XMLSEC_GNUTLS_CRYPTO_H__    
+#define __XMLSEC_GNUTLS_CRYPTO_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/keys.h>
@@ -39,7 +39,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecGnuTLSGenerateRandom      (xmlSecB
 #ifndef XMLSEC_NO_AES
 /**
  * xmlSecGnuTLSKeyDataAesId:
- * 
+ *
  * The AES key data klass.
  */
 #define xmlSecGnuTLSKeyDataAesId \
@@ -50,7 +50,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecGnuTLSKeyDataAesSet       (xmlSecK
                                                                          xmlSecSize bufSize);
 /**
  * xmlSecGnuTLSTransformAes128CbcId:
- * 
+ *
  * The AES128 CBC cipher transform klass.
  */
 #define xmlSecGnuTLSTransformAes128CbcId \
@@ -59,7 +59,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecGnuTLSTransformAes128CbcGetKlass(v
 
 /**
  * xmlSecGnuTLSTransformAes192CbcId:
- * 
+ *
  * The AES192 CBC cipher transform klass.
  */
 #define xmlSecGnuTLSTransformAes192CbcId \
@@ -68,7 +68,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecGnuTLSTransformAes192CbcGetKlass(v
 
 /**
  * xmlSecGnuTLSTransformAes256CbcId:
- * 
+ *
  * The AES256 CBC cipher transform klass.
  */
 #define xmlSecGnuTLSTransformAes256CbcId \
@@ -85,7 +85,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecGnuTLSTransformAes256CbcGetKlass(v
 #ifndef XMLSEC_NO_DES
 /**
  * xmlSecGnuTLSKeyDataDesId:
- * 
+ *
  * The DES key data klass.
  */
 #define xmlSecGnuTLSKeyDataDesId \
@@ -97,7 +97,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecGnuTLSKeyDataDesSet       (xmlSecK
 
 /**
  * xmlSecGnuTLSTransformDes3CbcId:
- * 
+ *
  * The DES3 CBC cipher transform klass.
  */
 #define xmlSecGnuTLSTransformDes3CbcId \
@@ -117,9 +117,9 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformDes3CbcGetKlass(void
 XMLSEC_CRYPTO_EXPORT int               xmlSecGnuTLSHmacGetMinOutputLength(void);
 XMLSEC_CRYPTO_EXPORT void              xmlSecGnuTLSHmacSetMinOutputLength(int min_length);
 
-/** 
+/**
  * xmlSecGnuTLSKeyDataHmacId:
- * 
+ *
  * The HMAC key klass.
  */
 #define xmlSecGnuTLSKeyDataHmacId \
@@ -130,7 +130,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecGnuTLSKeyDataHmacSet      (xmlSecK
                                                                          xmlSecSize bufSize);
 /**
  * xmlSecGnuTLSTransformHmacMd5Id:
- * 
+ *
  * The HMAC with MD5 signature transform klass.
  */
 #define xmlSecGnuTLSTransformHmacMd5Id \
@@ -140,7 +140,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformHmacMd5GetKlass(void
 
 /**
  * xmlSecGnuTLSTransformHmacRipemd160Id:
- * 
+ *
  * The HMAC with RipeMD160 signature transform klass.
  */
 #define xmlSecGnuTLSTransformHmacRipemd160Id \
@@ -149,7 +149,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformHmacRipemd160GetKlas
 
 /**
  * xmlSecGnuTLSTransformHmacSha1Id:
- * 
+ *
  * The HMAC with SHA1 signature transform klass.
  */
 #define xmlSecGnuTLSTransformHmacSha1Id \
@@ -166,7 +166,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformHmacSha1GetKlass(voi
 #ifndef XMLSEC_NO_SHA1
 /**
  * xmlSecGnuTLSTransformSha1Id:
- * 
+ *
  * The SHA1 digest transform klass.
  */
 #define xmlSecGnuTLSTransformSha1Id \
@@ -180,4 +180,4 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformSha1GetKlass(void);
 
 #endif /* __XMLSEC_GNUTLS_CRYPTO_H__ */
 
-#define __XMLSEC_GNUTLS_CRYPTO_H__    
+#define __XMLSEC_GNUTLS_CRYPTO_H__
diff --git a/include/xmlsec/gnutls/symbols.h b/include/xmlsec/gnutls/symbols.h
index d98d134..582e1a6 100644
--- a/include/xmlsec/gnutls/symbols.h
+++ b/include/xmlsec/gnutls/symbols.h
@@ -1,13 +1,13 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_GNUTLS_SYMBOLS_H__
-#define __XMLSEC_GNUTLS_SYMBOLS_H__    
+#define __XMLSEC_GNUTLS_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
@@ -15,14 +15,14 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 /**
  * Defines for writing simple code
  */
 #ifdef XMLSEC_CRYPTO_GNUTLS
 
-/**  
+/**
  * Crypto Init/shutdown
  */
 #define xmlSecCryptoInit                        xmlSecGnuTLSInit
@@ -69,7 +69,7 @@ extern "C" {
 
 /**
  * High level routines form xmlsec command line utility
- */ 
+ */
 #define xmlSecCryptoAppInit                     xmlSecGnuTLSAppInit
 #define xmlSecCryptoAppShutdown                 xmlSecGnuTLSAppShutdown
 #define xmlSecCryptoAppDefaultKeysMngrInit      xmlSecGnuTLSAppDefaultKeysMngrInit
@@ -94,4 +94,4 @@ extern "C" {
 
 #endif /* __XMLSEC_GNUTLS_CRYPTO_H__ */
 
-#define __XMLSEC_GNUTLS_CRYPTO_H__    
+#define __XMLSEC_GNUTLS_CRYPTO_H__
diff --git a/include/xmlsec/io.h b/include/xmlsec/io.h
index 58ff707..d5a41c1 100644
--- a/include/xmlsec/io.h
+++ b/include/xmlsec/io.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Input uri transform and utility functions.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_IO_H__
-#define __XMLSEC_IO_H__    
+#define __XMLSEC_IO_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 #include <libxml/xmlIO.h>
@@ -32,12 +32,12 @@ XMLSEC_EXPORT int       xmlSecIORegisterCallbacks               (xmlInputMatchCa
 
 /********************************************************************
  *
- * Input URI transform 
+ * Input URI transform
  *
  *******************************************************************/
 /**
  * xmlSecTransformInputURIId:
- * 
+ *
  * The Input URI transform id.
  */
 #define xmlSecTransformInputURIId \
diff --git a/include/xmlsec/keyinfo.h b/include/xmlsec/keyinfo.h
index dd2044a..0751c47 100644
--- a/include/xmlsec/keyinfo.h
+++ b/include/xmlsec/keyinfo.h
@@ -1,20 +1,20 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
- * <dsig:KeyInfo> element processing 
+ * <dsig:KeyInfo> element processing
  * (http://www.w3.org/TR/xmlSec-core/#sec-KeyInfo:
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_KEYINFO_H__
-#define __XMLSEC_KEYINFO_H__    
+#define __XMLSEC_KEYINFO_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <time.h>
 
@@ -36,7 +36,7 @@ XMLSEC_EXPORT int               xmlSecKeyInfoNodeWrite          (xmlNodePtr keyI
                                                                  xmlSecKeyPtr key,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
 
-/** 
+/**
  * xmlSecKeyInfoMode:
  * @xmlSecKeyInfoModeRead: read <dsig:KeyInfo /> element.
  * @xmlSecKeyInfoModeWrite: write <dsig:KeyInfo /> element.
@@ -51,7 +51,7 @@ typedef enum {
 /**
  * XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND:
  *
- * If flag is set then we will continue reading <dsig:KeyInfo /> 
+ * If flag is set then we will continue reading <dsig:KeyInfo />
  * element even when key is already found.
  */
 #define XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND             0x00000001
@@ -59,28 +59,28 @@ typedef enum {
 /**
  * XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD:
  *
- * If flag is set then we abort if an unknown <dsig:KeyInfo /> 
+ * If flag is set then we abort if an unknown <dsig:KeyInfo />
  * child is found.
  */
 #define XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD              0x00000002
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_KEYNAME_STOP_ON_UNKNOWN:
  *
- * If flags is set then we abort if an unknown key name 
+ * If flags is set then we abort if an unknown key name
  * (content of <dsig:KeyName /> element) is found.
  */
 #define XMLSEC_KEYINFO_FLAGS_KEYNAME_STOP_ON_UNKNOWN            0x00000004
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD:
  *
- * If flags is set then we abort if an unknown <dsig:KeyValue /> 
+ * If flags is set then we abort if an unknown <dsig:KeyValue />
  * child is found.
  */
 #define XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD     0x00000008
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_UNKNOWN_HREF:
  *
  * If flag is set then we abort if an unknown href attribute
@@ -88,40 +88,40 @@ typedef enum {
  */
 #define XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_UNKNOWN_HREF    0x00000010
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF:
  *
- * If flag is set then we abort if an href attribute <dsig:RetrievalMethod /> 
+ * If flag is set then we abort if an href attribute <dsig:RetrievalMethod />
  * element does not match the real key data type.
  */
 #define XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF   0x00000020
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD:
  *
- * If flags is set then we abort if an unknown <dsig:X509Data /> 
+ * If flags is set then we abort if an unknown <dsig:X509Data />
  * child is found.
  */
 #define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD     0x00000100
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS:
- * 
+ *
  * If flag is set then we'll load certificates from <dsig:X509Data />
  * element without verification.
  */
 #define XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS         0x00000200
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT:
- * 
+ *
  * If flag is set then we'll stop when we could not resolve reference
- * to certificate from <dsig:X509IssuerSerial />, <dsig:X509SKI /> or 
+ * to certificate from <dsig:X509IssuerSerial />, <dsig:X509SKI /> or
  * <dsig:X509SubjectName /> elements.
  */
 #define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT      0x00000400
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT:
  *
  * If the flag is set then we'll stop when <dsig:X509Data /> element
@@ -129,7 +129,7 @@ typedef enum {
  */
 #define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT      0x00000800
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_ENCKEY_DONT_STOP_ON_FAILED_DECRYPTION:
  *
  * If the flag is set then we'll stop when <enc:EncryptedKey /> element
@@ -137,7 +137,7 @@ typedef enum {
  */
 #define XMLSEC_KEYINFO_FLAGS_ENCKEY_DONT_STOP_ON_FAILED_DECRYPTION 0x00001000
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE:
  *
  * If the flag is set then we'll stop when we found an empty node.
@@ -145,42 +145,42 @@ typedef enum {
  */
 #define XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE                 0x00002000
 
-/** 
+/**
  * XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS:
  *
  * If the flag is set then we'll skip strict checking of certs and CRLs
  */
 #define XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS        0x00004000
 
-/**             
+/**
  * xmlSecKeyInfoCtx:
- * @userData:           the pointer to user data (xmlsec and xmlsec-crypto 
+ * @userData:           the pointer to user data (xmlsec and xmlsec-crypto
  *                      never touch this).
  * @flags:              the bit mask for flags that control processin.
  * @flags2:             reserved for future.
  * @mode:               do we read or write <dsig:KeyInfo /> element.
  * @keysMngr:           the pointer to current keys manager.
- * @enabledKeyData:     the list of enabled @xmlSecKeyDataId (if list is 
+ * @enabledKeyData:     the list of enabled @xmlSecKeyDataId (if list is
  *                      empty then all data ids are enabled).
  * @base64LineSize:     the max columns size for base64 encoding.
  * @retrievalMethodCtx: the transforms context for <dsig:RetrievalMethod />
  *                      element processing.
  * @maxRetrievalMethodLevel: the max recursion level when processing
- *                      <dsig:RetrievalMethod /> element; default level is 1 
+ *                      <dsig:RetrievalMethod /> element; default level is 1
  *                      (see also @curRetrievalMethodLevel).
  * @encCtx:             the encryption context for <dsig:EncryptedKey /> element
  *                      processing.
- * @maxEncryptedKeyLevel: the max recursion level when processing 
- *                      <enc:EncryptedKey /> element; default level is 1 
+ * @maxEncryptedKeyLevel: the max recursion level when processing
+ *                      <enc:EncryptedKey /> element; default level is 1
  *                      (see @curEncryptedKeyLevel).
  * @certsVerificationTime: the time to use for X509 certificates verification
  *                      ("not valid before" and "not valid after" checks);
- *                      if @certsVerificationTime is equal to 0 (default) 
- *                      then we verify certificates against the system's 
+ *                      if @certsVerificationTime is equal to 0 (default)
+ *                      then we verify certificates against the system's
  *                      clock "now".
  * @certsVerificationDepth: the max certifications chain length (default is 9).
  * @pgpReserved:        reserved for PGP.
- * @curRetrievalMethodLevel: the current <dsig:RetrievalMethod /> element 
+ * @curRetrievalMethodLevel: the current <dsig:RetrievalMethod /> element
  *                      processing level (see @maxRetrievalMethodLevel).
  * @curEncryptedKeyLevel: the current <enc:EncryptedKey /> element
  *                      processing level (see @maxEncryptedKeyLevel).
@@ -198,7 +198,7 @@ struct _xmlSecKeyInfoCtx {
     xmlSecKeyInfoMode                   mode;
     xmlSecPtrList                       enabledKeyData;
     int                                 base64LineSize;
-        
+
     /* RetrievalMethod */
     xmlSecTransformCtx                  retrievalMethodCtx;
     int                                 maxRetrievalMethodLevel;
@@ -206,9 +206,9 @@ struct _xmlSecKeyInfoCtx {
 #ifndef XMLSEC_NO_XMLENC
     /* EncryptedKey */
     xmlSecEncCtxPtr                     encCtx;
-    int                                 maxEncryptedKeyLevel; 
+    int                                 maxEncryptedKeyLevel;
 #endif /* XMLSEC_NO_XMLENC */
-            
+
 #ifndef XMLSEC_NO_X509
     /* x509 certificates */
     time_t                              certsVerificationTime;
@@ -217,10 +217,10 @@ struct _xmlSecKeyInfoCtx {
 
     /* PGP */
     void*                               pgpReserved;    /* TODO */
-        
+
     /* internal data */
     int                                 curRetrievalMethodLevel;
-    int                                 curEncryptedKeyLevel;                
+    int                                 curEncryptedKeyLevel;
     xmlSecKeyReq                        keyReq;
 
     /* for the future */
diff --git a/include/xmlsec/keys.h b/include/xmlsec/keys.h
index 141d01d..620ad49 100644
--- a/include/xmlsec/keys.h
+++ b/include/xmlsec/keys.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Keys.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_KEYS_H__
-#define __XMLSEC_KEYS_H__    
+#define __XMLSEC_KEYS_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <time.h>
 
@@ -31,7 +31,7 @@ typedef unsigned int                    xmlSecKeyUsage;
 
 /**
  * xmlSecKeyUsageSign:
- * 
+ *
  * Key can be used in any way.
 
  */
@@ -78,7 +78,7 @@ typedef unsigned int                    xmlSecKeyUsage;
  * xmlSecKeyUseWith
  *
  *************************************************************************/
-typedef struct _xmlSecKeyUseWith                xmlSecKeyUseWith, *xmlSecKeyUseWithPtr; 
+typedef struct _xmlSecKeyUseWith                xmlSecKeyUseWith, *xmlSecKeyUseWithPtr;
 XMLSEC_EXPORT int       xmlSecKeyUseWithInitialize              (xmlSecKeyUseWithPtr keyUseWith);
 XMLSEC_EXPORT void      xmlSecKeyUseWithFinalize                (xmlSecKeyUseWithPtr keyUseWith);
 XMLSEC_EXPORT void      xmlSecKeyUseWithReset                   (xmlSecKeyUseWithPtr keyUseWith);
@@ -113,9 +113,9 @@ struct _xmlSecKeyUseWith {
     void*                       reserved2;
 };
 
-/** 
+/**
  * xmlSecKeyUseWithPtrListId:
- * 
+ *
  * The keys list klass.
  */
 #define xmlSecKeyUseWithPtrListId       xmlSecKeyUseWithPtrListGetKlass()
@@ -126,7 +126,7 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecKeyUseWithPtrListGetKlass (void);
  * xmlSecKeyReq - what key are we looking for?
  *
  *************************************************************************/
-typedef struct _xmlSecKeyReq                    xmlSecKeyReq, *xmlSecKeyReqPtr; 
+typedef struct _xmlSecKeyReq                    xmlSecKeyReq, *xmlSecKeyReqPtr;
 
 /**
  * xmlSecKeyReq:
@@ -145,7 +145,7 @@ struct _xmlSecKeyReq {
     xmlSecKeyDataType           keyType;
     xmlSecKeyUsage              keyUsage;
     xmlSecSize                  keyBitsSize;
-    xmlSecPtrList               keyUseWithList;    
+    xmlSecPtrList               keyUseWithList;
 
     void*                       reserved1;
     void*                       reserved2;
@@ -182,7 +182,7 @@ struct _xmlSecKey {
     xmlSecPtrListPtr                    dataList;
     xmlSecKeyUsage                      usage;
     time_t                              notValidBefore;
-    time_t                              notValidAfter;    
+    time_t                              notValidAfter;
 };
 
 XMLSEC_EXPORT xmlSecKeyPtr      xmlSecKeyCreate         (void);
@@ -202,9 +202,9 @@ XMLSEC_EXPORT xmlSecKeyDataPtr  xmlSecKeyGetValue       (xmlSecKeyPtr key);
 XMLSEC_EXPORT int               xmlSecKeySetValue       (xmlSecKeyPtr key,
                                                          xmlSecKeyDataPtr value);
 
-XMLSEC_EXPORT xmlSecKeyDataPtr  xmlSecKeyGetData        (xmlSecKeyPtr key, 
+XMLSEC_EXPORT xmlSecKeyDataPtr  xmlSecKeyGetData        (xmlSecKeyPtr key,
                                                          xmlSecKeyDataId dataId);
-XMLSEC_EXPORT xmlSecKeyDataPtr  xmlSecKeyEnsureData     (xmlSecKeyPtr key, 
+XMLSEC_EXPORT xmlSecKeyDataPtr  xmlSecKeyEnsureData     (xmlSecKeyPtr key,
                                                          xmlSecKeyDataId dataId);
 XMLSEC_EXPORT int               xmlSecKeyAdoptData      (xmlSecKeyPtr key,
                                                          xmlSecKeyDataPtr data);
@@ -221,7 +221,7 @@ XMLSEC_EXPORT xmlSecKeyPtr      xmlSecKeyGenerateByName (const xmlChar* name,
                                                          xmlSecKeyDataType type);
 
 
-XMLSEC_EXPORT int               xmlSecKeyMatch          (xmlSecKeyPtr key, 
+XMLSEC_EXPORT int               xmlSecKeyMatch          (xmlSecKeyPtr key,
                                                          const xmlChar *name,
                                                          xmlSecKeyReqPtr keyReq);
 
@@ -233,14 +233,14 @@ XMLSEC_EXPORT xmlSecKeyPtr      xmlSecKeyReadMemory     (xmlSecKeyDataId dataId,
                                                          const xmlSecByte* data,
                                                          xmlSecSize dataSize);
 
-                                                         
+
 /**
  * xmlSecKeyIsValid:
  * @key: the pointer to key.
  *
  * Macro. Returns 1 if @key is not NULL and @key->id is not NULL
  * or 0 otherwise.
- */ 
+ */
 #define xmlSecKeyIsValid(key) \
         ((( key ) != NULL) && \
          (( key )->value != NULL) && \
@@ -262,9 +262,9 @@ XMLSEC_EXPORT xmlSecKeyPtr      xmlSecKeyReadMemory     (xmlSecKeyDataId dataId,
  * Keys list
  *
  **********************************************************************/
-/** 
+/**
  * xmlSecKeyPtrListId:
- * 
+ *
  * The keys list klass.
  */
 #define xmlSecKeyPtrListId      xmlSecKeyPtrListGetKlass()
diff --git a/include/xmlsec/keysdata.h b/include/xmlsec/keysdata.h
index 25cce3b..3c44c3a 100644
--- a/include/xmlsec/keysdata.h
+++ b/include/xmlsec/keysdata.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Key data.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_KEYSDATA_H__
-#define __XMLSEC_KEYSDATA_H__    
+#define __XMLSEC_KEYSDATA_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 
@@ -24,12 +24,12 @@ extern "C" {
 /**
  * Forward declarations
  */
-typedef const struct _xmlSecKeyDataKlass                xmlSecKeyDataKlass, 
-                                                        *xmlSecKeyDataId; 
-typedef const struct _xmlSecKeyDataStoreKlass           xmlSecKeyDataStoreKlass, 
-                                                        *xmlSecKeyDataStoreId; 
-typedef struct _xmlSecKeyDataList                       xmlSecKeyDataList, 
-                                                        *xmlSecKeyDataListPtr; 
+typedef const struct _xmlSecKeyDataKlass                xmlSecKeyDataKlass,
+                                                        *xmlSecKeyDataId;
+typedef const struct _xmlSecKeyDataStoreKlass           xmlSecKeyDataStoreKlass,
+                                                        *xmlSecKeyDataStoreId;
+typedef struct _xmlSecKeyDataList                       xmlSecKeyDataList,
+                                                        *xmlSecKeyDataListPtr;
 
 
 /**************************************************************************
@@ -37,7 +37,7 @@ typedef struct _xmlSecKeyDataList                       xmlSecKeyDataList,
  * xmlSecKeyDataUsage
  *
  *************************************************************************/
-/** 
+/**
  * xmlSecKeyDataUsage:
  *
  * The bits mask that determines possible keys data usage.
@@ -214,7 +214,7 @@ typedef unsigned int                            xmlSecKeyDataType;
  * @xmlSecKeyDataFormatPem:             the PEM key data (cert or public/private key).
  * @xmlSecKeyDataFormatDer:             the DER key data (cert or public/private key).
  * @xmlSecKeyDataFormatPkcs8Pem:        the PKCS8 PEM private key.
- * @xmlSecKeyDataFormatPkcs8Der:        the PKCS8 DER private key. 
+ * @xmlSecKeyDataFormatPkcs8Der:        the PKCS8 DER private key.
  * @xmlSecKeyDataFormatPkcs12:          the PKCS12 format (bag of keys and certs)
  * @xmlSecKeyDataFormatCertPem:         the PEM cert.
  * @xmlSecKeyDataFormatCertDer:         the DER cert.
@@ -243,7 +243,7 @@ XMLSEC_EXPORT int               xmlSecKeyDataIdsInit            (void);
 XMLSEC_EXPORT void              xmlSecKeyDataIdsShutdown        (void);
 XMLSEC_EXPORT int               xmlSecKeyDataIdsRegisterDefault (void);
 XMLSEC_EXPORT int               xmlSecKeyDataIdsRegister        (xmlSecKeyDataId id);
-        
+
 /**************************************************************************
  *
  * xmlSecKeyData
@@ -255,7 +255,7 @@ XMLSEC_EXPORT int               xmlSecKeyDataIdsRegister        (xmlSecKeyDataId
  * @reserved0:          reserved for the future.
  * @reserved1:          reserved for the future.
  *
- * The key data: key value (crypto material), x509 data, pgp data, etc.  
+ * The key data: key value (crypto material), x509 data, pgp data, etc.
  */
 struct _xmlSecKeyData {
     xmlSecKeyDataId                     id;
@@ -311,7 +311,7 @@ XMLSEC_EXPORT int               xmlSecKeyDataBinWrite           (xmlSecKeyDataId
  *
  * Macro. Returns 1 if @data is not NULL and @data->id is not NULL
  * or 0 otherwise.
- */ 
+ */
 #define xmlSecKeyDataIsValid(data) \
         ((( data ) != NULL) && \
          (( data )->id != NULL) && \
@@ -363,7 +363,7 @@ XMLSEC_EXPORT int               xmlSecKeyDataBinWrite           (xmlSecKeyDataId
  */
 #define xmlSecKeyDataIdUnknown                  ((xmlSecKeyDataId)NULL)
 
-/** 
+/**
  * xmlSecKeyDataInitMethod:
  * @data:               the pointer to key data.
  *
@@ -373,7 +373,7 @@ XMLSEC_EXPORT int               xmlSecKeyDataBinWrite           (xmlSecKeyDataId
  */
 typedef int                     (*xmlSecKeyDataInitMethod)      (xmlSecKeyDataPtr data);
 
-/** 
+/**
  * xmlSecKeyDataDuplicateMethod:
  * @dst:                the pointer to destination key data.
  * @src:                the poiniter to source key data.
@@ -385,7 +385,7 @@ typedef int                     (*xmlSecKeyDataInitMethod)      (xmlSecKeyDataPt
 typedef int                     (*xmlSecKeyDataDuplicateMethod) (xmlSecKeyDataPtr dst,
                                                                  xmlSecKeyDataPtr src);
 
-/** 
+/**
  * xmlSecKeyDataFinalizeMethod:
  * @data:               the data.
  *
@@ -394,22 +394,22 @@ typedef int                     (*xmlSecKeyDataDuplicateMethod) (xmlSecKeyDataPt
  */
 typedef void                    (*xmlSecKeyDataFinalizeMethod)  (xmlSecKeyDataPtr data);
 
-/** 
+/**
  * xmlSecKeyDataXmlReadMethod:
  * @id:                 the data id.
  * @key:                the key.
  * @node:               the pointer to data's value XML node.
  * @keyInfoCtx:         the <dsig:KeyInfo/> node processing context.
  *
- * Key data specific method for reading XML node. 
- * 
+ * Key data specific method for reading XML node.
+ *
  * Returns: 0 on success or a negative value if an error occurs.
  */
 typedef int                     (*xmlSecKeyDataXmlReadMethod)   (xmlSecKeyDataId id,
                                                                  xmlSecKeyPtr key,
                                                                  xmlNodePtr node,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
-/** 
+/**
  * xmlSecKeyDataXmlWriteMethod:
  * @id:                 the data id.
  * @key:                the key.
@@ -417,14 +417,14 @@ typedef int                     (*xmlSecKeyDataXmlReadMethod)   (xmlSecKeyDataId
  * @keyInfoCtx:         the <dsig:KeyInfo> node processing context.
  *
  * Key data specific method for writing XML node.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs.
  */
 typedef int                     (*xmlSecKeyDataXmlWriteMethod)  (xmlSecKeyDataId id,
                                                                  xmlSecKeyPtr key,
                                                                  xmlNodePtr node,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
-/** 
+/**
  * xmlSecKeyDataBinReadMethod:
  * @id:                 the data id.
  * @key:                the key.
@@ -433,7 +433,7 @@ typedef int                     (*xmlSecKeyDataXmlWriteMethod)  (xmlSecKeyDataId
  * @keyInfoCtx:         the <dsig:KeyInfo/> node processing context.
  *
  * Key data specific method for reading binary buffer.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs.
  */
 typedef int                     (*xmlSecKeyDataBinReadMethod)   (xmlSecKeyDataId id,
@@ -441,7 +441,7 @@ typedef int                     (*xmlSecKeyDataBinReadMethod)   (xmlSecKeyDataId
                                                                  const xmlSecByte* buf,
                                                                  xmlSecSize bufSize,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
-/** 
+/**
  * xmlSecKeyDataBinWriteMethod:
  * @id:                 the data id.
  * @key:                the key.
@@ -449,8 +449,8 @@ typedef int                     (*xmlSecKeyDataBinReadMethod)   (xmlSecKeyDataId
  * @bufSize:            the buffer size.
  * @keyInfoCtx:         the <dsig:KeyInfo/> node processing context.
  *
- * Key data specific method for reading binary buffer. 
- * 
+ * Key data specific method for reading binary buffer.
+ *
  * Returns: 0 on success or a negative value if an error occurs.
  */
 typedef int                     (*xmlSecKeyDataBinWriteMethod)  (xmlSecKeyDataId id,
@@ -459,7 +459,7 @@ typedef int                     (*xmlSecKeyDataBinWriteMethod)  (xmlSecKeyDataId
                                                                  xmlSecSize* bufSize,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
 
-/** 
+/**
  * xmlSecKeyDataGenerateMethod:
  * @data:               the pointer to key data.
  * @sizeBits:           the key data specific size.
@@ -473,7 +473,7 @@ typedef int                     (*xmlSecKeyDataGenerateMethod)  (xmlSecKeyDataPt
                                                                  xmlSecSize sizeBits,
                                                                  xmlSecKeyDataType type);
 
-/** 
+/**
  * xmlSecKeyDataGetTypeMethod:
  * @data:                the data.
  *
@@ -483,7 +483,7 @@ typedef int                     (*xmlSecKeyDataGenerateMethod)  (xmlSecKeyDataPt
  */
 typedef xmlSecKeyDataType       (*xmlSecKeyDataGetTypeMethod)   (xmlSecKeyDataPtr data);
 
-/** 
+/**
  * xmlSecKeyDataGetSizeMethod:
  * @data:               the pointer to key data.
  *
@@ -493,7 +493,7 @@ typedef xmlSecKeyDataType       (*xmlSecKeyDataGetTypeMethod)   (xmlSecKeyDataPt
  */
 typedef xmlSecSize              (*xmlSecKeyDataGetSizeMethod)   (xmlSecKeyDataPtr data);
 
-/** 
+/**
  * xmlSecKeyDataGetIdentifierMethod:
  * @data:               the pointer to key data.
  *
@@ -504,7 +504,7 @@ typedef xmlSecSize              (*xmlSecKeyDataGetSizeMethod)   (xmlSecKeyDataPt
  */
 typedef const xmlChar*          (*xmlSecKeyDataGetIdentifierMethod) (xmlSecKeyDataPtr data);
 
-/** 
+/**
  * xmlSecKeyDataDebugDumpMethod:
  * @data:               the data.
  * @output:             the FILE to print debug info (should be open for writing).
@@ -523,7 +523,7 @@ typedef void                    (*xmlSecKeyDataDebugDumpMethod) (xmlSecKeyDataPt
  * @href:               the identification string (href).
  * @dataNodeName:       the data's XML node name.
  * @dataNodeNs:         the data's XML node namespace.
- * @initialize:         the initialization method.  
+ * @initialize:         the initialization method.
  * @duplicate:          the duplicate (copy) method.
  * @finalize:           the finalization (destroy) method.
  * @generate:           the new data generation method.
@@ -546,18 +546,18 @@ struct _xmlSecKeyDataKlass {
     xmlSecSize                          objSize;
 
     /* data */
-    const xmlChar*                      name;    
+    const xmlChar*                      name;
     xmlSecKeyDataUsage                  usage;
     const xmlChar*                      href;
     const xmlChar*                      dataNodeName;
     const xmlChar*                      dataNodeNs;
-    
+
     /* constructors/destructor */
     xmlSecKeyDataInitMethod             initialize;
     xmlSecKeyDataDuplicateMethod        duplicate;
     xmlSecKeyDataFinalizeMethod         finalize;
     xmlSecKeyDataGenerateMethod         generate;
-    
+
     /* get info */
     xmlSecKeyDataGetTypeMethod          getType;
     xmlSecKeyDataGetSizeMethod          getSize;
@@ -634,7 +634,7 @@ XMLSEC_EXPORT void              xmlSecKeyDataIdListDebugXmlDump (xmlSecPtrListPt
 /**************************************************************************
  *
  * xmlSecKeyDataBinary
- * 
+ *
  * key (xmlSecBuffer) is located after xmlSecKeyData structure
  *
  *************************************************************************/
@@ -645,7 +645,7 @@ XMLSEC_EXPORT void              xmlSecKeyDataIdListDebugXmlDump (xmlSecPtrListPt
  */
 #define xmlSecKeyDataBinarySize \
     (sizeof(xmlSecKeyData) + sizeof(xmlSecBuffer))
- 
+
 XMLSEC_EXPORT int               xmlSecKeyDataBinaryValueInitialize      (xmlSecKeyDataPtr data);
 XMLSEC_EXPORT int               xmlSecKeyDataBinaryValueDuplicate       (xmlSecKeyDataPtr dst,
                                                                         xmlSecKeyDataPtr src);
@@ -691,7 +691,7 @@ XMLSEC_EXPORT int               xmlSecKeyDataBinaryValueSetBuffer       (xmlSecK
  * @reserved1:          reserved for the future.
  *
  * The key data store. Key data store holds common key data specific information
- * required for key data processing. For example, X509 data store may hold 
+ * required for key data processing. For example, X509 data store may hold
  * information about trusted (root) certificates.
  */
 struct _xmlSecKeyDataStore {
@@ -721,7 +721,7 @@ XMLSEC_EXPORT void              xmlSecKeyDataStoreDestroy       (xmlSecKeyDataSt
  *
  * Macro. Returns 1 if @store is not NULL and @store->id is not NULL
  * or 0 otherwise.
- */ 
+ */
 #define xmlSecKeyDataStoreIsValid(store) \
         ((( store ) != NULL) && ((( store )->id) != NULL))
 /**
@@ -759,7 +759,7 @@ XMLSEC_EXPORT void              xmlSecKeyDataStoreDestroy       (xmlSecKeyDataSt
  */
 #define xmlSecKeyDataStoreIdUnknown                     NULL
 
-/** 
+/**
  * xmlSecKeyDataStoreInitializeMethod:
  * @store:              the data store.
  *
@@ -769,7 +769,7 @@ XMLSEC_EXPORT void              xmlSecKeyDataStoreDestroy       (xmlSecKeyDataSt
  */
 typedef int                     (*xmlSecKeyDataStoreInitializeMethod)   (xmlSecKeyDataStorePtr store);
 
-/** 
+/**
  * xmlSecKeyDataStoreFinalizeMethod:
  * @store:              the data store.
  *
@@ -794,8 +794,8 @@ struct _xmlSecKeyDataStoreKlass {
     xmlSecSize                          objSize;
 
     /* data */
-    const xmlChar*                      name;    
-        
+    const xmlChar*                      name;
+
     /* constructors/destructor */
     xmlSecKeyDataStoreInitializeMethod  initialize;
     xmlSecKeyDataStoreFinalizeMethod    finalize;
@@ -808,7 +808,7 @@ struct _xmlSecKeyDataStoreKlass {
 /**
  * xmlSecKeyDataStoreKlassGetName:
  * @klass:              the pointer to store klass.
- * 
+ *
  * Macro. Returns store klass name.
  */
 #define xmlSecKeyDataStoreKlassGetName(klass) \
diff --git a/include/xmlsec/keysmngr.h b/include/xmlsec/keysmngr.h
index e502e87..289da4c 100644
--- a/include/xmlsec/keysmngr.h
+++ b/include/xmlsec/keysmngr.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Keys Manager
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_KEYSMGMR_H__
-#define __XMLSEC_KEYSMGMR_H__    
+#define __XMLSEC_KEYSMGMR_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/list.h>
@@ -21,10 +21,10 @@ extern "C" {
 #include <xmlsec/keysdata.h>
 #include <xmlsec/keyinfo.h>
 
-typedef const struct _xmlSecKeyKlass                    xmlSecKeyKlass, 
-                                                        *xmlSecKeyId; 
-typedef const struct _xmlSecKeyStoreKlass               xmlSecKeyStoreKlass, 
-                                                        *xmlSecKeyStoreId; 
+typedef const struct _xmlSecKeyKlass                    xmlSecKeyKlass,
+                                                        *xmlSecKeyId;
+typedef const struct _xmlSecKeyStoreKlass               xmlSecKeyStoreKlass,
+                                                        *xmlSecKeyStoreId;
 
 
 /****************************************************************************
@@ -55,7 +55,7 @@ XMLSEC_EXPORT xmlSecKeyDataStorePtr     xmlSecKeysMngrGetDataStore      (xmlSecK
  *
  * Reads the <dsig:KeyInfo/> node @keyInfoNode and extracts the key.
  *
- * Returns: the pointer to key or NULL if the key is not found or 
+ * Returns: the pointer to key or NULL if the key is not found or
  * an error occurs.
  */
 typedef xmlSecKeyPtr    (*xmlSecGetKeyCallback)         (xmlNodePtr keyInfoNode,
@@ -69,10 +69,10 @@ typedef xmlSecKeyPtr    (*xmlSecGetKeyCallback)         (xmlNodePtr keyInfoNode,
  *
  * The keys manager structure.
  */
-struct _xmlSecKeysMngr {        
-    xmlSecKeyStorePtr           keysStore;      
-    xmlSecPtrList               storesList;     
-    xmlSecGetKeyCallback        getKey;         
+struct _xmlSecKeysMngr {
+    xmlSecKeyStorePtr           keysStore;
+    xmlSecPtrList               storesList;
+    xmlSecGetKeyCallback        getKey;
 };
 
 
@@ -91,7 +91,7 @@ XMLSEC_EXPORT xmlSecKeyPtr      xmlSecKeysMngrGetKey    (xmlNodePtr keyInfoNode,
  * @reserved0:          reserved for the future.
  * @reserved1:          reserved for the future.
  *
- * The keys store. 
+ * The keys store.
  */
 struct _xmlSecKeyStore {
     xmlSecKeyStoreId                    id;
@@ -122,7 +122,7 @@ XMLSEC_EXPORT xmlSecKeyPtr      xmlSecKeyStoreFindKey           (xmlSecKeyStoreP
  *
  * Macro. Returns 1 if @store is not NULL and @store->id is not NULL
  * or 0 otherwise.
- */ 
+ */
 #define xmlSecKeyStoreIsValid(store) \
         ((( store ) != NULL) && ((( store )->id) != NULL))
 /**
@@ -160,7 +160,7 @@ XMLSEC_EXPORT xmlSecKeyPtr      xmlSecKeyStoreFindKey           (xmlSecKeyStoreP
  */
 #define xmlSecKeyStoreIdUnknown                         ((xmlSecKeyDataStoreId)NULL)
 
-/** 
+/**
  * xmlSecKeyStoreInitializeMethod:
  * @store:              the store.
  *
@@ -170,7 +170,7 @@ XMLSEC_EXPORT xmlSecKeyPtr      xmlSecKeyStoreFindKey           (xmlSecKeyStoreP
  */
 typedef int                     (*xmlSecKeyStoreInitializeMethod)       (xmlSecKeyStorePtr store);
 
-/** 
+/**
  * xmlSecKeyStoreFinalizeMethod:
  * @store:              the store.
  *
@@ -178,13 +178,13 @@ typedef int                     (*xmlSecKeyStoreInitializeMethod)       (xmlSecK
  */
 typedef void                    (*xmlSecKeyStoreFinalizeMethod)         (xmlSecKeyStorePtr store);
 
-/** 
+/**
  * xmlSecKeyStoreFindKeyMethod:
  * @store:              the store.
  * @name:               the desired key name.
  * @keyInfoCtx:         the pointer to key info context.
  *
- * Keys store specific find method. The caller is responsible for destroying 
+ * Keys store specific find method. The caller is responsible for destroying
  * the returned key using #xmlSecKeyDestroy method.
  *
  * Returns: the pointer to a key or NULL if key is not found or an error occurs.
@@ -211,8 +211,8 @@ struct _xmlSecKeyStoreKlass {
     xmlSecSize                          objSize;
 
     /* data */
-    const xmlChar*                      name;    
-        
+    const xmlChar*                      name;
+
     /* constructors/destructor */
     xmlSecKeyStoreInitializeMethod      initialize;
     xmlSecKeyStoreFinalizeMethod        finalize;
@@ -226,7 +226,7 @@ struct _xmlSecKeyStoreKlass {
 /**
  * xmlSecKeyStoreKlassGetName:
  * @klass:              the pointer to store klass.
- * 
+ *
  * Macro. Returns store klass name.
  */
 #define xmlSecKeyStoreKlassGetName(klass) \
@@ -250,7 +250,7 @@ XMLSEC_EXPORT int                       xmlSecSimpleKeysStoreAdoptKey   (xmlSecK
 XMLSEC_EXPORT int                       xmlSecSimpleKeysStoreLoad       (xmlSecKeyStorePtr store,
                                                                          const char *uri,
                                                                          xmlSecKeysMngrPtr keysMngr);
-XMLSEC_EXPORT int                       xmlSecSimpleKeysStoreSave       (xmlSecKeyStorePtr store, 
+XMLSEC_EXPORT int                       xmlSecSimpleKeysStoreSave       (xmlSecKeyStorePtr store,
                                                                          const char *filename,
                                                                          xmlSecKeyDataType type);
 XMLSEC_EXPORT xmlSecPtrListPtr          xmlSecSimpleKeysStoreGetKeys    (xmlSecKeyStorePtr store);
diff --git a/include/xmlsec/list.h b/include/xmlsec/list.h
index be94028..e7900e7 100644
--- a/include/xmlsec/list.h
+++ b/include/xmlsec/list.h
@@ -1,26 +1,26 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * List of pointers.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_LIST_H__
-#define __XMLSEC_LIST_H__    
+#define __XMLSEC_LIST_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
 
-typedef const struct _xmlSecPtrListKlass                        xmlSecPtrListKlass, 
+typedef const struct _xmlSecPtrListKlass                        xmlSecPtrListKlass,
                                                                 *xmlSecPtrListId;
-typedef struct _xmlSecPtrList                                   xmlSecPtrList, 
+typedef struct _xmlSecPtrList                                   xmlSecPtrList,
                                                                 *xmlSecPtrListPtr;
 
 /**
@@ -30,11 +30,11 @@ typedef struct _xmlSecPtrList                                   xmlSecPtrList,
  * @use:                        the current list size.
  * @max:                        the max (allocated) list size.
  * @allocMode:                  the memory allocation mode.
- * 
+ *
  * The pointers list.
  */
 struct _xmlSecPtrList {
-    xmlSecPtrListId             id;        
+    xmlSecPtrListId             id;
 
     xmlSecPtr*                  data;
     xmlSecSize                  use;
@@ -75,7 +75,7 @@ XMLSEC_EXPORT void              xmlSecPtrListDebugXmlDump       (xmlSecPtrListPt
 /**
  * xmlSecPtrListGetName:
  * @list:               the ponter to list.
- * 
+ *
  * Macro. Returns lists's name.
  */
 #define xmlSecPtrListGetName(list) \
@@ -87,7 +87,7 @@ XMLSEC_EXPORT void              xmlSecPtrListDebugXmlDump       (xmlSecPtrListPt
  *
  * Macro. Returns 1 if @list is not NULL and @list->id is not NULL
  * or 0 otherwise.
- */ 
+ */
 #define xmlSecPtrListIsValid(list) \
         ((( list ) != NULL) && ((( list )->id) != NULL))
 /**
@@ -143,7 +143,7 @@ typedef void                    (*xmlSecPtrDebugDumpItemMethod) (xmlSecPtr ptr,
                                                                  FILE* output);
 
 /**
- * xmlSecPtrListKlass: 
+ * xmlSecPtrListKlass:
  * @name:               the list klass name.
  * @duplicateItem:      the duplciate item method.
  * @destroyItem:        the destroy item method.
@@ -161,10 +161,10 @@ struct _xmlSecPtrListKlass {
 };
 
 /**
- * xmlSecPtrListKlassGetName: 
+ * xmlSecPtrListKlassGetName:
  * @klass:              the list klass.
  *2
- 
+
  * Macro. Returns the list klass name.
  */
 #define xmlSecPtrListKlassGetName(klass) \
diff --git a/include/xmlsec/membuf.h b/include/xmlsec/membuf.h
index b25e4c5..fbe6da4 100644
--- a/include/xmlsec/membuf.h
+++ b/include/xmlsec/membuf.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Memory buffer transform
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_MEMBUF_H__
-#define __XMLSEC_MEMBUF_H__    
+#define __XMLSEC_MEMBUF_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 
@@ -23,12 +23,12 @@ extern "C" {
 
 /********************************************************************
  *
- * Memory Buffer transform 
+ * Memory Buffer transform
  *
  *******************************************************************/
 /**
  * xmlSecTransformMemBufId:
- * 
+ *
  * The Memory Buffer transform klass.
  */
 #define xmlSecTransformMemBufId \
diff --git a/include/xmlsec/mscrypto/app.h b/include/xmlsec/mscrypto/app.h
index 7dd03e2..b7f09c9 100644
--- a/include/xmlsec/mscrypto/app.h
+++ b/include/xmlsec/mscrypto/app.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  */
 #ifndef __XMLSEC_MSCRYPTO_APP_H__
-#define __XMLSEC_MSCRYPTO_APP_H__    
+#define __XMLSEC_MSCRYPTO_APP_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/keys.h>
@@ -28,7 +28,7 @@ XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppInit
 XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppShutdown                       (void);
 XMLSEC_CRYPTO_EXPORT const char*xmlSecMSCryptoAppGetCertStoreName               (void);
 
-/** 
+/**
  * Keys Manager
  */
 XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppDefaultKeysMngrInit(
@@ -43,73 +43,73 @@ XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppDefaultKeysMngrSave(
                                     xmlSecKeysMngrPtr mngr,
                                                                         const char* filename,
                                                                         xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppDefaultKeysMngrPrivateKeyLoad(
-                                    xmlSecKeysMngrPtr mngr,
-                                    HCRYPTKEY hKey);
-XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppDefaultKeysMngrPublicKeyLoad(
-                                    xmlSecKeysMngrPtr mngr,
-                                    HCRYPTKEY hKey);
-XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppDefaultKeysMngrSymKeyLoad(
-                                    xmlSecKeysMngrPtr mngr,
+XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppDefaultKeysMngrPrivateKeyLoad(
+                                    xmlSecKeysMngrPtr mngr,
+                                    HCRYPTKEY hKey);
+XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppDefaultKeysMngrPublicKeyLoad(
+                                    xmlSecKeysMngrPtr mngr,
+                                    HCRYPTKEY hKey);
+XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppDefaultKeysMngrSymKeyLoad(
+                                    xmlSecKeysMngrPtr mngr,
                                     HCRYPTKEY hKey);
 #ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT int    xmlSecMSCryptoAppDefaultKeysMngrAdoptKeyStore(
-                                    xmlSecKeysMngrPtr mngr,
-                                    HCERTSTORE keyStore);
-
-XMLSEC_CRYPTO_EXPORT int    xmlSecMSCryptoAppDefaultKeysMngrAdoptTrustedStore(
-                                    xmlSecKeysMngrPtr mngr, 
-                                    HCERTSTORE trustedStore);
-
-XMLSEC_CRYPTO_EXPORT int    xmlSecMSCryptoAppDefaultKeysMngrAdoptUntrustedStore(
-                                    xmlSecKeysMngrPtr mngr,
-                                    HCERTSTORE untrustedStore);
+XMLSEC_CRYPTO_EXPORT int    xmlSecMSCryptoAppDefaultKeysMngrAdoptKeyStore(
+                                    xmlSecKeysMngrPtr mngr,
+                                    HCERTSTORE keyStore);
+
+XMLSEC_CRYPTO_EXPORT int    xmlSecMSCryptoAppDefaultKeysMngrAdoptTrustedStore(
+                                    xmlSecKeysMngrPtr mngr,
+                                    HCERTSTORE trustedStore);
+
+XMLSEC_CRYPTO_EXPORT int    xmlSecMSCryptoAppDefaultKeysMngrAdoptUntrustedStore(
+                                    xmlSecKeysMngrPtr mngr,
+                                    HCERTSTORE untrustedStore);
 
 XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppKeysMngrCertLoad(
-                                    xmlSecKeysMngrPtr mngr, 
-                                                                        const char *filename, 
-                                                                        xmlSecKeyDataFormat format, 
+                                    xmlSecKeysMngrPtr mngr,
+                                                                        const char *filename,
+                                                                        xmlSecKeyDataFormat format,
                                                                         xmlSecKeyDataType type);
 XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppKeysMngrCertLoadMemory(
-                                    xmlSecKeysMngrPtr mngr, 
+                                    xmlSecKeysMngrPtr mngr,
                                                                         const xmlSecByte* data,
-                                                                        xmlSecSize dataSize, 
+                                                                        xmlSecSize dataSize,
                                                                         xmlSecKeyDataFormat format,
                                                                         xmlSecKeyDataType type);
-
+
 #endif /* XMLSEC_NO_X509 */
 
 
-/** 
+/**
  * Keys
  */
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppKeyLoad              (const char *filename, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppKeyLoad              (const char *filename,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
                                                                          void *pwdCallback,
                                                                          void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppKeyLoadMemory        (const xmlSecByte* data, 
-                                                                         xmlSecSize dataSize, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppKeyLoadMemory        (const xmlSecByte* data,
+                                                                         xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 #ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppPkcs12Load           (const char *filename, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppPkcs12Load           (const char *filename,
                                                                          const char *pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppPkcs12LoadMemory     (const xmlSecByte* data,
-                                                                         xmlSecSize dataSize, 
+                                                                         xmlSecSize dataSize,
                                                                          const char* pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppKeyCertLoad            (xmlSecKeyPtr key,
                                                                          const char* filename,
                                                                          xmlSecKeyDataFormat format);
 XMLSEC_CRYPTO_EXPORT int        xmlSecMSCryptoAppKeyCertLoadMemory      (xmlSecKeyPtr key,
                                                                          const xmlSecByte* data,
-                                                                         xmlSecSize dataSize, 
+                                                                         xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format);
 #endif /* XMLSEC_NO_X509 */
 XMLSEC_CRYPTO_EXPORT void*      xmlSecMSCryptoAppGetDefaultPwdCallback  (void);
diff --git a/include/xmlsec/mscrypto/certkeys.h b/include/xmlsec/mscrypto/certkeys.h
index 00565bf..c2b5763 100644
--- a/include/xmlsec/mscrypto/certkeys.h
+++ b/include/xmlsec/mscrypto/certkeys.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  */
 #ifndef __XMLSEC_MSCRYPTO_CERTKEYS_H__
-#define __XMLSEC_MSCRYPTO_CERTKEYS_H__    
+#define __XMLSEC_MSCRYPTO_CERTKEYS_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <windows.h>
 #include <wincrypt.h>
@@ -21,7 +21,7 @@ extern "C" {
 #include <xmlsec/transforms.h>
 
 XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT     xmlSecMSCryptoKeyDataGetCert    (xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT HCRYPTKEY          xmlSecMSCryptoKeyDataGetKey     (xmlSecKeyDataPtr data, 
+XMLSEC_CRYPTO_EXPORT HCRYPTKEY          xmlSecMSCryptoKeyDataGetKey     (xmlSecKeyDataPtr data,
                                                                          xmlSecKeyDataType type);
 XMLSEC_CRYPTO_EXPORT HCRYPTKEY  xmlSecMSCryptoKeyDataGetDecryptKey(xmlSecKeyDataPtr data);
 XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT     xmlSecMSCryptoCertDup           (PCCERT_CONTEXT pCert);
diff --git a/include/xmlsec/mscrypto/crypto.h b/include/xmlsec/mscrypto/crypto.h
index a528da1..3f77adb 100644
--- a/include/xmlsec/mscrypto/crypto.h
+++ b/include/xmlsec/mscrypto/crypto.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  */
 #ifndef __XMLSEC_MSCRYPTO_CRYPTO_H__
-#define __XMLSEC_MSCRYPTO_CRYPTO_H__    
+#define __XMLSEC_MSCRYPTO_CRYPTO_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <windows.h>
 #include <wincrypt.h>
@@ -33,12 +33,12 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeysMngrInit      (xmlSecK
 XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoGenerateRandom    (xmlSecBufferPtr buffer,
                                                                          size_t size);
 
-XMLSEC_CRYPTO_EXPORT void               xmlSecMSCryptoErrorsDefaultCallback(const char* file, 
-                                                                        int line, 
+XMLSEC_CRYPTO_EXPORT void               xmlSecMSCryptoErrorsDefaultCallback(const char* file,
+                                                                        int line,
                                                                         const char* func,
-                                                                        const char* errorObject, 
+                                                                        const char* errorObject,
                                                                         const char* errorSubject,
-                                                                        int reason, 
+                                                                        int reason,
                                                                         const char* msg);
 
 /**
@@ -48,13 +48,13 @@ XMLSEC_CRYPTO_EXPORT LPWSTR             xmlSecMSCryptoConvertUtf8ToUnicode  (con
 XMLSEC_CRYPTO_EXPORT LPWSTR             xmlSecMSCryptoConvertLocaleToUnicode(const char* str);
 
 
-XMLSEC_CRYPTO_EXPORT BYTE*              xmlSecMSCryptoCertStrToName     (DWORD dwCertEncodingType, 
-                                                                         LPCTSTR pszX500, 
+XMLSEC_CRYPTO_EXPORT BYTE*              xmlSecMSCryptoCertStrToName     (DWORD dwCertEncodingType,
+                                                                         LPCTSTR pszX500,
                                                                          DWORD dwStrType,
                                                                          DWORD* len);
 
-XMLSEC_CRYPTO_EXPORT BYTE*              xmlSecMSCryptoCertStrToNameW    (DWORD dwCertEncodingType, 
-                                                                         LPWSTR pszX500, 
+XMLSEC_CRYPTO_EXPORT BYTE*              xmlSecMSCryptoCertStrToNameW    (DWORD dwCertEncodingType,
+                                                                         LPWSTR pszX500,
                                                                          DWORD dwStrType,
                                                                          DWORD* len);
 
@@ -68,7 +68,7 @@ XMLSEC_CRYPTO_EXPORT BYTE*              xmlSecMSCryptoCertStrToNameW    (DWORD d
 
 /**
  * xmlSecMSCryptoKeyDataDsaId:
- * 
+ *
  * The DSA key klass.
  */
 #define xmlSecMSCryptoKeyDataDsaId \
@@ -77,7 +77,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecMSCryptoKeyDataDsaGetKlass
 
 /**
  * xmlSecMSCryptoTransformDsaSha1Id:
- * 
+ *
  * The DSA SHA1 signature transform klass.
  */
 #define xmlSecMSCryptoTransformDsaSha1Id \
@@ -95,7 +95,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformDsaSha1GetKlass(vo
 
 /**
  * xmlSecMSCryptoKeyDataGost2001Id:
- * 
+ *
  * The GOST2001 key klass.
  */
 #define xmlSecMSCryptoKeyDataGost2001Id \
@@ -104,7 +104,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecMSCryptoKeyDataGost2001GetKlass
 
 /**
  * xmlSecMSCryptoTransformGost2001GostR3411_94Id:
- * 
+ *
  * The GOST2001 GOSTR3411_94 signature transform klass.
  */
 #define xmlSecMSCryptoTransformGost2001GostR3411_94Id \
@@ -122,7 +122,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGost2001GostR3411_
 
 /**
  * xmlSecMSCryptoKeyDataRsaId:
- * 
+ *
  * The RSA key klass.
  */
 #define xmlSecMSCryptoKeyDataRsaId \
@@ -132,7 +132,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataRsaGetKlass(void);
 
 /**
  * xmlSecMSCryptoTransformRsaSha1Id:
- * 
+ *
  * The RSA-SHA1 signature transform klass.
  */
 
@@ -142,7 +142,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaSha1GetKlass(vo
 
 /**
  * xmlSecMSCryptoTransformRsaPkcs1Id:
- * 
+ *
  * The RSA PKCS1 key transport transform klass.
  */
 #define xmlSecMSCryptoTransformRsaPkcs1Id \
@@ -151,7 +151,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaPkcs1GetKlass(v
 
 /**
  * xmlSecMSCryptoTransformRsaOaepId:
- * 
+ *
  * The RSA PKCS1 key transport transform klass.
  */
 /*
@@ -170,7 +170,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaOaepGetKlass(vo
 
 /**
  * xmlSecMSCryptoTransformSha1Id:
- * 
+ *
  * The SHA1 digest transform klass.
  */
 #define xmlSecMSCryptoTransformSha1Id \
@@ -187,7 +187,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformSha1GetKlass(void)
 
 /**
  * xmlSecMSCryptoTransformGostR3411_94Id:
- * 
+ *
  * The GOSTR3411_94 digest transform klass.
  */
 #define xmlSecMSCryptoTransformGostR3411_94Id \
@@ -203,7 +203,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGostR3411_94GetKla
 #ifndef XMLSEC_NO_AES
 /**
  * xmlSecMSCryptoKeyDataAesId:
- * 
+ *
  * The AES key data klass.
  */
 #define xmlSecMSCryptoKeyDataAesId \
@@ -214,7 +214,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeyDataAesSet     (xmlSecK
                                                                          xmlSecSize bufSize);
 /**
  * xmlSecMSCryptoTransformAes128CbcId:
- * 
+ *
  * The AES128 CBC cipher transform klass.
  */
 #define xmlSecMSCryptoTransformAes128CbcId \
@@ -223,7 +223,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecMSCryptoTransformAes128CbcGetKlass
 
 /**
  * xmlSecMSCryptoTransformAes192CbcId:
- * 
+ *
  * The AES192 CBC cipher transform klass.
  */
 #define xmlSecMSCryptoTransformAes192CbcId \
@@ -232,7 +232,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecMSCryptoTransformAes192CbcGetKlass
 
 /**
  * xmlSecMSCryptoTransformAes256CbcId:
- * 
+ *
  * The AES256 CBC cipher transform klass.
  */
 #define xmlSecMSCryptoTransformAes256CbcId \
@@ -251,7 +251,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecMSCryptoTransformAes256CbcGetKlass
 
 /**
  * xmlSecMSCryptoKeyDataDesId:
- * 
+ *
  * The DES key data klass.
  */
 #define xmlSecMSCryptoKeyDataDesId \
@@ -260,7 +260,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecMSCryptoKeyDataDesGetKlass(void);
 
 /**
  * xmlSecMSCryptoTransformDes3CbcId:
- * 
+ *
  * The DES3 CBC cipher transform klass.
  */
 #define xmlSecMSCryptoTransformDes3CbcId \
@@ -277,4 +277,4 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformDes3CbcGetKlass(vo
 
 #endif /* __XMLSEC_MSCRYPTO_CRYPTO_H__ */
 
-#define __XMLSEC_MSCRYPTO_CRYPTO_H__    
+#define __XMLSEC_MSCRYPTO_CRYPTO_H__
diff --git a/include/xmlsec/mscrypto/keysstore.h b/include/xmlsec/mscrypto/keysstore.h
index dda5aa9..bd38547 100644
--- a/include/xmlsec/mscrypto/keysstore.h
+++ b/include/xmlsec/mscrypto/keysstore.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XMLSec library
- * 
+ *
  * MSCrypto keys store
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for precise wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  */
 #ifndef __XMLSEC_MSCRYPTO_KEYSSTORE_H__
-#define __XMLSEC_MSCRYPTO_KEYSSTORE_H__    
+#define __XMLSEC_MSCRYPTO_KEYSSTORE_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 
@@ -34,7 +34,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeysStoreAdoptKey (xmlSecK
 XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeysStoreLoad     (xmlSecKeyStorePtr store,
                                                                          const char *uri,
                                                                          xmlSecKeysMngrPtr keysMngr);
-XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeysStoreSave     (xmlSecKeyStorePtr store, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeysStoreSave     (xmlSecKeyStorePtr store,
                                                                          const char *filename,
                                                                          xmlSecKeyDataType type);
 
diff --git a/include/xmlsec/mscrypto/symbols.h b/include/xmlsec/mscrypto/symbols.h
index 9ff1cbb..580e8cf 100644
--- a/include/xmlsec/mscrypto/symbols.h
+++ b/include/xmlsec/mscrypto/symbols.h
@@ -1,13 +1,13 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  */
 #ifndef __XMLSEC_MSCRYPTO_SYMBOLS_H__
-#define __XMLSEC_MSCRYPTO_SYMBOLS_H__    
+#define __XMLSEC_MSCRYPTO_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
@@ -15,14 +15,14 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 /**
  * Defines for writing simple code
  */
 #ifdef XMLSEC_CRYPTO_MSCRYPTO
 
-/**  
+/**
  * Crypto Init/shutdown
  */
 #define xmlSecCryptoInit                        xmlSecMSCryptoInit
@@ -72,7 +72,7 @@ extern "C" {
 
 /**
  * High level routines form xmlsec command line utility
- */ 
+ */
 
 #define xmlSecCryptoAppInit                     xmlSecMSCryptoAppInit
 #define xmlSecCryptoAppShutdown                 xmlSecMSCryptoAppShutdown
@@ -98,5 +98,5 @@ extern "C" {
 
 #endif /* __XMLSEC_MSCRYPTO_CRYPTO_H__ */
 
-#define __XMLSEC_MSCRYPTO_CRYPTO_H__    
+#define __XMLSEC_MSCRYPTO_CRYPTO_H__
 
diff --git a/include/xmlsec/mscrypto/x509.h b/include/xmlsec/mscrypto/x509.h
index f460c03..46bc446 100644
--- a/include/xmlsec/mscrypto/x509.h
+++ b/include/xmlsec/mscrypto/x509.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  */
 #ifndef __XMLSEC_MSCRYPTO_X509_H__
-#define __XMLSEC_MSCRYPTO_X509_H__    
+#define __XMLSEC_MSCRYPTO_X509_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #ifndef XMLSEC_NO_X509
 
@@ -24,7 +24,7 @@ extern "C" {
 
 /**
  * xmlSecMSCryptoKeyDataX509Id:
- * 
+ *
  * The MSCrypto X509 data klass.
  */
 #define xmlSecMSCryptoKeyDataX509Id \
@@ -32,7 +32,7 @@ extern "C" {
 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecMSCryptoKeyDataX509GetKlass(void);
 
 XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT     xmlSecMSCryptoKeyDataX509GetKeyCert     (xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeyDataX509AdoptKeyCert   (xmlSecKeyDataPtr data, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeyDataX509AdoptKeyCert   (xmlSecKeyDataPtr data,
                                                                                 PCCERT_CONTEXT cert);
 XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoKeyDataX509AdoptCert      (xmlSecKeyDataPtr data,
                                                                                  PCCERT_CONTEXT cert);
@@ -49,7 +49,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecSize         xmlSecMSCryptoKeyDataX509GetCrlsSize
 
 /**
  * xmlSecMSCryptoKeyDataRawX509CertId:
- * 
+ *
  * The MSCrypto raw X509 certificate klass.
  */
 #define xmlSecMSCryptoKeyDataRawX509CertId \
@@ -58,7 +58,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecMSCryptoKeyDataRawX509CertGetKlass
 
 /**
  * xmlSecMSCryptoX509StoreId:
- * 
+ *
  * The MSCrypto X509 store klass.
  */
 #define xmlSecMSCryptoX509StoreId \
@@ -67,7 +67,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataStoreId xmlSecMSCryptoX509StoreGetKlass(void);
 
 XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT     xmlSecMSCryptoX509StoreFindCert         (xmlSecKeyDataStorePtr store,
                                                                                  xmlChar *subjectName,
-                                                                                 xmlChar *issuerName, 
+                                                                                 xmlChar *issuerName,
                                                                                  xmlChar *issuerSerial,
                                                                                  xmlChar *ski,
                                                                                  xmlSecKeyInfoCtx* keyInfoCtx);
@@ -80,25 +80,25 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoX509StoreAdoptCert
                                                                                  PCCERT_CONTEXT cert,
                                                                                  xmlSecKeyDataType type);
 
-XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoX509StoreAdoptKeyStore (
-                                                                                xmlSecKeyDataStorePtr store,
-                                                                                HCERTSTORE keyStore
-                                                                ) ;
-
-XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoX509StoreAdoptTrustedStore (
-                                                                                xmlSecKeyDataStorePtr store,
-                                                                                HCERTSTORE trustedStore
-                                                                ) ;
-
-XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoX509StoreAdoptUntrustedStore (
-                                                                                xmlSecKeyDataStorePtr store,
-                                                                                HCERTSTORE untrustedStore
-                                                                ) ;
-
-XMLSEC_CRYPTO_EXPORT void       xmlSecMSCryptoX509StoreEnableSystemTrustedCerts (
-                                        xmlSecKeyDataStorePtr store, 
-                                        int val
-                                ) ;
+XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoX509StoreAdoptKeyStore    (xmlSecKeyDataStorePtr store,
+                                                                                 HCERTSTORE keyStore);
+
+XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoX509StoreAdoptTrustedStore(xmlSecKeyDataStorePtr store,
+                                                                                 HCERTSTORE trustedStore);
+
+XMLSEC_CRYPTO_EXPORT int                xmlSecMSCryptoX509StoreAdoptUntrustedStore(xmlSecKeyDataStorePtr store,
+                                                                                 HCERTSTORE untrustedStore);
+
+XMLSEC_CRYPTO_EXPORT void               xmlSecMSCryptoX509StoreEnableSystemTrustedCerts(xmlSecKeyDataStorePtr store,
+                                                                                 int val);
+
+
+/**
+ * Util functions
+ */
+XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT     xmlSecMSCryptoX509FindCertBySubject     (HCERTSTORE store,
+                                                                                 const LPWSTR wcSubject,
+                                                                                 DWORD dwCertEncodingType);
 
 #endif /* XMLSEC_NO_X509 */
 
diff --git a/include/xmlsec/nodeset.h b/include/xmlsec/nodeset.h
index 62af10e..104e04f 100644
--- a/include/xmlsec/nodeset.h
+++ b/include/xmlsec/nodeset.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Enchanced nodes Set
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_NODESET_H__
-#define __XMLSEC_NODESET_H__    
+#define __XMLSEC_NODESET_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 #include <libxml/xpath.h>
@@ -22,27 +22,27 @@ extern "C" {
 
 typedef struct _xmlSecNodeSet   xmlSecNodeSet, *xmlSecNodeSetPtr;
 
-/** 
+/**
  * xmlSecNodeSetType:
  * @xmlSecNodeSetNormal:        nodes set = nodes in the list.
  * @xmlSecNodeSetInvert:        nodes set = all document nodes minus nodes in the list.
  * @xmlSecNodeSetTree:          nodes set = nodes in the list and all their subtress.
- * @xmlSecNodeSetTreeWithoutComments:           nodes set = nodes in the list and 
+ * @xmlSecNodeSetTreeWithoutComments:           nodes set = nodes in the list and
  *                              all their subtress but no comment nodes.
- * @xmlSecNodeSetTreeInvert:    nodes set = all document nodes minus nodes in the 
+ * @xmlSecNodeSetTreeInvert:    nodes set = all document nodes minus nodes in the
  *                              list and all their subtress.
- * @xmlSecNodeSetTreeWithoutCommentsInvert:     nodes set = all document nodes 
- *                              minus (nodes in the list and all their subtress 
+ * @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.
- * 
+ *
  * The basic nodes sets types.
  */
 typedef enum {
     xmlSecNodeSetNormal = 0,
     xmlSecNodeSetInvert,
     xmlSecNodeSetTree,
-    xmlSecNodeSetTreeWithoutComments, 
+    xmlSecNodeSetTreeWithoutComments,
     xmlSecNodeSetTreeInvert,
     xmlSecNodeSetTreeWithoutCommentsInvert,
     xmlSecNodeSetList
@@ -53,7 +53,7 @@ typedef enum {
  * @xmlSecNodeSetIntersection:  intersection.
  * @xmlSecNodeSetSubtraction:   subtraction.
  * @xmlSecNodeSetUnion:         union.
- * 
+ *
  * The simple nodes sets operations.
  */
 typedef enum {
@@ -72,7 +72,7 @@ typedef enum {
  * @op:                         the operation type.
  * @next:                       the next nodes set.
  * @prev:                       the previous nodes set.
- * @children:                   the children list (valid only if type 
+ * @children:                   the children list (valid only if type
  *                              equal to #xmlSecNodeSetList).
  *
  * The enchanced nodes set.
@@ -130,7 +130,7 @@ XMLSEC_EXPORT int               xmlSecNodeSetDumpTextNodes(xmlSecNodeSetPtr nset
                                                         xmlOutputBufferPtr out);
 XMLSEC_EXPORT void              xmlSecNodeSetDebugDump  (xmlSecNodeSetPtr nset,
                                                          FILE *output);
-                                                         
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/include/xmlsec/nss/app.h b/include/xmlsec/nss/app.h
index 5f88dd0..d1a8cf9 100644
--- a/include/xmlsec/nss/app.h
+++ b/include/xmlsec/nss/app.h
@@ -1,18 +1,18 @@
-/** 
+/**
  * XMLSec library
  *
  * 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) 2003 America Online, Inc.  All rights reserved.
  */
 #ifndef __XMLSEC_NSS_APP_H__
-#define __XMLSEC_NSS_APP_H__    
+#define __XMLSEC_NSS_APP_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <nspr.h>
 #include <nss.h>
@@ -28,7 +28,7 @@ extern "C" {
 XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppInit                (const char* config);
 XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppShutdown            (void);
 
-/** 
+/**
  * Keys Manager
  */
 XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr);
@@ -40,31 +40,31 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppDefaultKeysMngrSave (xmlSecK
                                                                          const char* filename,
                                                                          xmlSecKeyDataType type);
 #ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppKeysMngrCertLoad    (xmlSecKeysMngrPtr mngr, 
-                                                                         const char *filename, 
-                                                                         xmlSecKeyDataFormat format, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppKeysMngrCertLoad    (xmlSecKeysMngrPtr mngr,
+                                                                         const char *filename,
+                                                                         xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, 
-                                                                         const xmlSecByte *data, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
+                                                                         const xmlSecByte *data,
                                                                          xmlSecSize dataSize,
-                                                                         xmlSecKeyDataFormat format, 
+                                                                         xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr,
                                                                          SECItem* secItem,
-                                                                         xmlSecKeyDataFormat format, 
+                                                                         xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
 #endif /* XMLSEC_NO_X509 */
 
 
-/** 
+/**
  * Keys
  */
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecNssAppKeyLoad             (const char *filename, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecNssAppKeyLoad             (const char *filename,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
                                                                          void *pwdCallback,
                                                                          void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecNssAppKeyLoadMemory       (const xmlSecByte *data, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecNssAppKeyLoadMemory       (const xmlSecByte *data,
                                                                          xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
@@ -76,25 +76,25 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecNssAppKeyLoadSECItem      (SECItem
                                                                          void *pwdCallback,
                                                                          void* pwdCallbackCtx);
 #ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecNssAppPkcs12Load          (const char *filename, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecNssAppPkcs12Load          (const char *filename,
                                                                          const char *pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecNssAppPkcs12LoadMemory    (const xmlSecByte *data, 
-                                                                         xmlSecSize dataSize, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecNssAppPkcs12LoadMemory    (const xmlSecByte *data,
+                                                                         xmlSecSize dataSize,
                                                                          const char *pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecNssAppPkcs12LoadSECItem   (SECItem* secItem,
                                                                          const char *pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppKeyCertLoad         (xmlSecKeyPtr key,
                                                                          const char* filename,
                                                                          xmlSecKeyDataFormat format);
 XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppKeyCertLoadMemory   (xmlSecKeyPtr key,
-                                                                         const xmlSecByte *data, 
-                                                                         xmlSecSize dataSize,                                                                    
+                                                                         const xmlSecByte *data,
+                                                                         xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format);
 XMLSEC_CRYPTO_EXPORT int                xmlSecNssAppKeyCertLoadSECItem  (xmlSecKeyPtr key,
                                                                          SECItem* secItem,
diff --git a/include/xmlsec/nss/bignum.h b/include/xmlsec/nss/bignum.h
index c2eb49e..6147d20 100644
--- a/include/xmlsec/nss/bignum.h
+++ b/include/xmlsec/nss/bignum.h
@@ -1,32 +1,32 @@
-/** 
+/**
  * XMLSec library
- * 
+ *
  * Reading/writing BIGNUM values
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for precise wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 #ifndef __XMLSEC_NSS_BIGNUM_H__
-#define __XMLSEC_NSS_BIGNUM_H__    
+#define __XMLSEC_NSS_BIGNUM_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
-#include <libxml/tree.h> 
+#include <libxml/tree.h>
 
 #include <nspr.h>
 #include <nss.h>
 
 #include <xmlsec/xmlsec.h>
 
-XMLSEC_CRYPTO_EXPORT SECItem*   xmlSecNssNodeGetBigNumValue     (PRArenaPool *arena, 
-                                                                 const xmlNodePtr cur, 
+XMLSEC_CRYPTO_EXPORT SECItem*   xmlSecNssNodeGetBigNumValue     (PRArenaPool *arena,
+                                                                 const xmlNodePtr cur,
                                                                  SECItem *a);
 XMLSEC_CRYPTO_EXPORT int        xmlSecNssNodeSetBigNumValue     (xmlNodePtr cur,
-                                                                 const SECItem *a, 
+                                                                 const SECItem *a,
                                                                  int addLineBreaks);
 
 #ifdef __cplusplus
diff --git a/include/xmlsec/nss/crypto.h b/include/xmlsec/nss/crypto.h
index 27ecedc..4a35912 100644
--- a/include/xmlsec/nss/crypto.h
+++ b/include/xmlsec/nss/crypto.h
@@ -1,18 +1,18 @@
-/** 
+/**
  * XMLSec library
  *
  * 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) 2003 America Online, Inc.  All rights reserved.
  */
 #ifndef __XMLSEC_NSS_CRYPTO_H__
-#define __XMLSEC_NSS_CRYPTO_H__    
+#define __XMLSEC_NSS_CRYPTO_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <nspr.h>
 #include <nss.h>
@@ -35,12 +35,12 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeysMngrInit           (xmlSecK
 XMLSEC_CRYPTO_EXPORT int                xmlSecNssGenerateRandom         (xmlSecBufferPtr buffer,
                                                                          xmlSecSize size);
 
-XMLSEC_CRYPTO_EXPORT void               xmlSecNssErrorsDefaultCallback  (const char* file, 
-                                                                        int line, 
+XMLSEC_CRYPTO_EXPORT void               xmlSecNssErrorsDefaultCallback  (const char* file,
+                                                                        int line,
                                                                         const char* func,
-                                                                        const char* errorObject, 
+                                                                        const char* errorObject,
                                                                         const char* errorSubject,
-                                                                        int reason, 
+                                                                        int reason,
                                                                         const char* msg);
 
 XMLSEC_CRYPTO_EXPORT PK11SlotInfo * xmlSecNssGetInternalKeySlot(void);
@@ -53,7 +53,7 @@ XMLSEC_CRYPTO_EXPORT PK11SlotInfo * xmlSecNssGetInternalKeySlot(void);
 #ifndef XMLSEC_NO_AES
 /**
  * xmlSecNssKeyDataAesId:
- * 
+ *
  * The AES key data klass.
  */
 #define xmlSecNssKeyDataAesId \
@@ -64,7 +64,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeyDataAesSet          (xmlSecK
                                                                          xmlSecSize bufSize);
 /**
  * xmlSecNssTransformAes128CbcId:
- * 
+ *
  * The AES128 CBC cipher transform klass.
  */
 #define xmlSecNssTransformAes128CbcId \
@@ -73,7 +73,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecNssTransformAes128CbcGetKlass(void
 
 /**
  * xmlSecNssTransformAes192CbcId:
- * 
+ *
  * The AES192 CBC cipher transform klass.
  */
 #define xmlSecNssTransformAes192CbcId \
@@ -82,7 +82,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecNssTransformAes192CbcGetKlass(void
 
 /**
  * xmlSecNssTransformAes256CbcId:
- * 
+ *
  * The AES256 CBC cipher transform klass.
  */
 #define xmlSecNssTransformAes256CbcId \
@@ -91,7 +91,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecNssTransformAes256CbcGetKlass(void
 
 /**
  * xmlSecNssTransformKWAes128Id:
- * 
+ *
  * The AES 128 key wrap transform klass.
  */
 #define xmlSecNssTransformKWAes128Id \
@@ -100,7 +100,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecNssTransformKWAes128GetKlass(void)
 
 /**
  * xmlSecNssTransformKWAes192Id:
- * 
+ *
  * The AES 192 key wrap transform klass.
  */
 #define xmlSecNssTransformKWAes192Id \
@@ -109,7 +109,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecNssTransformKWAes192GetKlass(void)
 
 /**
  * xmlSecNssTransformKWAes256Id:
- * 
+ *
  * The AES 256 key wrap transform klass.
  */
 #define xmlSecNssTransformKWAes256Id \
@@ -126,7 +126,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecNssTransformKWAes256GetKlass(void)
 #ifndef XMLSEC_NO_DES
 /**
  * xmlSecNssKeyDataDesId:
- * 
+ *
  * The DES key data klass.
  */
 #define xmlSecNssKeyDataDesId \
@@ -138,7 +138,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeyDataDesSet          (xmlSecK
 
 /**
  * xmlSecNssTransformDes3CbcId:
- * 
+ *
  * The Triple DES CBC cipher transform klass.
  */
 #define xmlSecNssTransformDes3CbcId \
@@ -147,9 +147,9 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformDes3CbcGetKlass(void);
 
 /**
 * xmlSecNssTransformKWDes3Id:
-* 
+*
 * The DES3 CBC cipher transform klass.
-*/ 
+*/
 #define xmlSecNssTransformKWDes3Id \
         xmlSecNssTransformKWDes3GetKlass()
 XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWDes3GetKlass(void);
@@ -166,7 +166,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWDes3GetKlass(void);
 
 /**
  * xmlSecNssKeyDataDsaId:
- * 
+ *
  * The DSA key klass.
  */
 #define xmlSecNssKeyDataDsaId \
@@ -175,7 +175,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecNssKeyDataDsaGetKlass     (void);
 
 /**
  * xmlSecNssTransformDsaSha1Id:
- * 
+ *
  * The DSA SHA1 signature transform klass.
  */
 #define xmlSecNssTransformDsaSha1Id \
@@ -195,9 +195,9 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformDsaSha1GetKlass(void);
 XMLSEC_CRYPTO_EXPORT int               xmlSecNssHmacGetMinOutputLength(void);
 XMLSEC_CRYPTO_EXPORT void              xmlSecNssHmacSetMinOutputLength(int min_length);
 
-/** 
+/**
  * xmlSecNssKeyDataHmacId:
- * 
+ *
  * The DHMAC key data klass.
  */
 #define xmlSecNssKeyDataHmacId \
@@ -208,7 +208,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeyDataHmacSet         (xmlSecK
                                                                          xmlSecSize bufSize);
 /**
  * xmlSecNssTransformHmacMd5Id:
- * 
+ *
  * The HMAC with MD5 signature transform klass.
  */
 #define xmlSecNssTransformHmacMd5Id \
@@ -217,7 +217,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacMd5GetKlass(void);
 
 /**
  * xmlSecNssTransformHmacRipemd160Id:
- * 
+ *
  * The HMAC with RipeMD160 signature transform klass.
  */
 #define xmlSecNssTransformHmacRipemd160Id \
@@ -226,7 +226,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacRipemd160GetKlass(v
 
 /**
  * xmlSecNssTransformHmacSha1Id:
- * 
+ *
  * The HMAC with SHA1 signature transform klass.
  */
 #define xmlSecNssTransformHmacSha1Id \
@@ -246,7 +246,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacSha1GetKlass(void);
 
 /**
  * xmlSecNssKeyDataRsaId:
- * 
+ *
  * The RSA key klass.
  */
 #define xmlSecNssKeyDataRsaId \
@@ -255,7 +255,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecNssKeyDataRsaGetKlass     (void);
 
 /**
  * xmlSecNssTransformRsaSha1Id:
- * 
+ *
  * The RSA-SHA1 signature transform klass.
  */
 #define xmlSecNssTransformRsaSha1Id     \
@@ -264,7 +264,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformRsaSha1GetKlass(void);
 
 /**
  * xmlSecNssTransformRsaPkcs1Id:
- * 
+ *
  * The RSA PKCS1 key transport transform klass.
  */
 #define xmlSecNssTransformRsaPkcs1Id \
@@ -273,15 +273,15 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformRsaPkcs1GetKlass(void);
 
 
 /* RSA OAEP is not supported by NSS yet */
-#ifdef TODO
-/**
- * xmlSecNssTransformRsaOaepId:
- * 
- * The RSA OAEP key transport transform klass.
- */
-
-#define xmlSecNssTransformRsaOaepId \
-        xmlSecNssTransformRsaOaepGetKlass()
+#ifdef TODO
+/**
+ * xmlSecNssTransformRsaOaepId:
+ *
+ * The RSA OAEP key transport transform klass.
+ */
+
+#define xmlSecNssTransformRsaOaepId \
+        xmlSecNssTransformRsaOaepGetKlass()
 XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformRsaOaepGetKlass(void);
 #endif /* TODO: RSA OAEP is not supported by NSS yet */
 
@@ -296,7 +296,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformRsaOaepGetKlass(void);
 #ifndef XMLSEC_NO_SHA1
 /**
  * xmlSecNssTransformSha1Id:
- * 
+ *
  * The SHA1 digest transform klass.
  */
 #define xmlSecNssTransformSha1Id \
@@ -310,4 +310,4 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformSha1GetKlass   (void);
 
 #endif /* __XMLSEC_NSS_CRYPTO_H__ */
 
-#define __XMLSEC_NSS_CRYPTO_H__    
+#define __XMLSEC_NSS_CRYPTO_H__
diff --git a/include/xmlsec/nss/keysstore.h b/include/xmlsec/nss/keysstore.h
index c26ab18..a2cc289 100644
--- a/include/xmlsec/nss/keysstore.h
+++ b/include/xmlsec/nss/keysstore.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XMLSec library
- * 
+ *
  * Nss keys store
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for precise wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc. All rights reserved
  */
 #ifndef __XMLSEC_NSS_KEYSSTORE_H__
-#define __XMLSEC_NSS_KEYSSTORE_H__    
+#define __XMLSEC_NSS_KEYSSTORE_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 
@@ -34,7 +34,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeysStoreAdoptKey      (xmlSecK
 XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeysStoreLoad  (xmlSecKeyStorePtr store,
                                                                  const char *uri,
                                                                  xmlSecKeysMngrPtr keysMngr);
-XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeysStoreSave  (xmlSecKeyStorePtr store, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeysStoreSave  (xmlSecKeyStorePtr store,
                                                                  const char *filename,
                                                                  xmlSecKeyDataType type);
 
diff --git a/include/xmlsec/nss/pkikeys.h b/include/xmlsec/nss/pkikeys.h
index 641ba7f..cb49848 100644
--- a/include/xmlsec/nss/pkikeys.h
+++ b/include/xmlsec/nss/pkikeys.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 #ifndef __XMLSEC_NSS_PKIKEYS_H__
-#define __XMLSEC_NSS_PKIKEYS_H__    
+#define __XMLSEC_NSS_PKIKEYS_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <nspr.h>
 #include <nss.h>
diff --git a/include/xmlsec/nss/symbols.h b/include/xmlsec/nss/symbols.h
index ea03591..e915188 100644
--- a/include/xmlsec/nss/symbols.h
+++ b/include/xmlsec/nss/symbols.h
@@ -1,14 +1,14 @@
-/** 
+/**
  * XMLSec library
  *
  * 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) 2003 America Online, Inc.  All rights reserved.
  */
 #ifndef __XMLSEC_NSS_SYMBOLS_H__
-#define __XMLSEC_NSS_SYMBOLS_H__    
+#define __XMLSEC_NSS_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
@@ -17,14 +17,14 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 /**
  * Defines for writing simple code
  */
 #ifdef XMLSEC_CRYPTO_NSS
 
-/**  
+/**
  * Crypto Init/shutdown
  */
 #define xmlSecCryptoInit                        xmlSecNssInit
@@ -71,7 +71,7 @@ extern "C" {
 
 /**
  * High level routines form xmlsec command line utility
- */ 
+ */
 #define xmlSecCryptoAppInit                     xmlSecNssAppInit
 #define xmlSecCryptoAppShutdown                 xmlSecNssAppShutdown
 #define xmlSecCryptoAppDefaultKeysMngrInit      xmlSecNssAppDefaultKeysMngrInit
@@ -96,4 +96,4 @@ extern "C" {
 
 #endif /* __XMLSEC_NSS_CRYPTO_H__ */
 
-#define __XMLSEC_NSS_CRYPTO_H__    
+#define __XMLSEC_NSS_CRYPTO_H__
diff --git a/include/xmlsec/nss/x509.h b/include/xmlsec/nss/x509.h
index cfad2d8..fe5ceb4 100644
--- a/include/xmlsec/nss/x509.h
+++ b/include/xmlsec/nss/x509.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 #ifndef __XMLSEC_NSS_X509_H__
-#define __XMLSEC_NSS_X509_H__    
+#define __XMLSEC_NSS_X509_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #ifndef XMLSEC_NO_X509
 
@@ -25,7 +25,7 @@ extern "C" {
 
 /**
  * xmlSecNssKeyDataX509Id:
- * 
+ *
  * The NSS X509 data klass.
  */
 #define xmlSecNssKeyDataX509Id \
@@ -33,7 +33,7 @@ extern "C" {
 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecNssKeyDataX509GetKlass(void);
 
 XMLSEC_CRYPTO_EXPORT CERTCertificate*   xmlSecNssKeyDataX509GetKeyCert(xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data,
                                                                          CERTCertificate* cert);
 
 XMLSEC_CRYPTO_EXPORT int                xmlSecNssKeyDataX509AdoptCert(xmlSecKeyDataPtr data,
@@ -52,7 +52,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr   xmlSecNssX509CertGetKey         (CERTCer
 
 /**
  * xmlSecNssKeyDataRawX509CertId:
- * 
+ *
  * The NSS raw X509 certificate klass.
  */
 #define xmlSecNssKeyDataRawX509CertId \
@@ -61,7 +61,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecNssKeyDataRawX509CertGetKlass(void
 
 /**
  * xmlSecNssX509StoreId:
- * 
+ *
  * The NSS X509 store klass.
  */
 #define xmlSecNssX509StoreId \
@@ -69,7 +69,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecNssKeyDataRawX509CertGetKlass(void
 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataStoreId xmlSecNssX509StoreGetKlass(void);
 XMLSEC_CRYPTO_EXPORT CERTCertificate*           xmlSecNssX509StoreFindCert      (xmlSecKeyDataStorePtr store,
                                                                                  xmlChar *subjectName,
-                                                                                 xmlChar *issuerName, 
+                                                                                 xmlChar *issuerName,
                                                                                  xmlChar *issuerSerial,
                                                                                  xmlChar *ski,
                                                                                  xmlSecKeyInfoCtx* keyInfoCtx);
diff --git a/include/xmlsec/openssl/app.h b/include/xmlsec/openssl/app.h
index 59cc87e..a7ba419 100644
--- a/include/xmlsec/openssl/app.h
+++ b/include/xmlsec/openssl/app.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_OPENSSL_APP_H__
-#define __XMLSEC_OPENSSL_APP_H__    
+#define __XMLSEC_OPENSSL_APP_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <openssl/pem.h>
 #include <openssl/bio.h>
@@ -27,7 +27,7 @@ extern "C" {
 XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppInit            (const char* config);
 XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppShutdown        (void);
 
-/** 
+/**
  * Keys Manager
  */
 XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr);
@@ -39,21 +39,21 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppDefaultKeysMngrSave(xmlS
                                                                          const char* filename,
                                                                          xmlSecKeyDataType type);
 #ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, 
-                                                                         const char *filename, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr,
+                                                                         const char *filename,
                                                                          xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
                                                                          const xmlSecByte* data,
-                                                                         xmlSecSize dataSize, 
+                                                                         xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr,
                                                                          BIO* bio,
                                                                          xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
 
-XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeysMngrAddCertsPath(xmlSecKeysMngrPtr mngr, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeysMngrAddCertsPath(xmlSecKeysMngrPtr mngr,
                                                                          const char *path);
 XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeysMngrAddCertsFile(xmlSecKeysMngrPtr mngr,
                                                                          const char *file);
@@ -61,16 +61,16 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeysMngrAddCertsFile(xml
 #endif /* XMLSEC_NO_X509 */
 
 
-/** 
+/**
  * Keys
  */
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppKeyLoad         (const char *filename, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppKeyLoad         (const char *filename,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
                                                                          void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppKeyLoadMemory   (const xmlSecByte* data,
-                                                                         xmlSecSize dataSize, 
+                                                                         xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
                                                                          void* pwdCallback,
@@ -82,18 +82,18 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppKeyLoadBIO      (BIO* bi
                                                                          void* pwdCallbackCtx);
 
 #ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppPkcs12Load      (const char* filename, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppPkcs12Load      (const char* filename,
                                                                          const char* pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data,
-                                                                         xmlSecSize dataSize, 
+                                                                         xmlSecSize dataSize,
                                                                          const char* pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppPkcs12LoadBIO   (BIO* bio, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppPkcs12LoadBIO   (BIO* bio,
                                                                          const char* pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 
 XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeyCertLoad     (xmlSecKeyPtr key,
@@ -101,12 +101,12 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeyCertLoad     (xmlSecK
                                                                          xmlSecKeyDataFormat format);
 XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key,
                                                                          const xmlSecByte* data,
-                                                                         xmlSecSize dataSize, 
+                                                                         xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format);
 XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLAppKeyCertLoadBIO  (xmlSecKeyPtr key,
                                                                          BIO* bio,
                                                                          xmlSecKeyDataFormat format);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr       xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio,
                                                                          xmlSecKeyDataFormat format);
 #endif /* XMLSEC_NO_X509 */
 
diff --git a/include/xmlsec/openssl/bn.h b/include/xmlsec/openssl/bn.h
index eeadf39..bdb9c7c 100644
--- a/include/xmlsec/openssl/bn.h
+++ b/include/xmlsec/openssl/bn.h
@@ -1,29 +1,29 @@
-/** 
+/**
  * XMLSec library
- * 
+ *
  * Reading/writing BIGNUM values
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_BN_H__
-#define __XMLSEC_BN_H__    
+#define __XMLSEC_BN_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <openssl/bn.h>
 
-#include <libxml/tree.h> 
+#include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
 
 XMLSEC_CRYPTO_EXPORT BIGNUM*    xmlSecOpenSSLNodeGetBNValue     (const xmlNodePtr cur,
                                                                  BIGNUM **a);
-XMLSEC_CRYPTO_EXPORT int        xmlSecOpenSSLNodeSetBNValue     (xmlNodePtr cur, 
+XMLSEC_CRYPTO_EXPORT int        xmlSecOpenSSLNodeSetBNValue     (xmlNodePtr cur,
                                                                  const BIGNUM *a,
                                                                  int addLineBreaks);
 
diff --git a/include/xmlsec/openssl/crypto.h b/include/xmlsec/openssl/crypto.h
index d7bdc4d..30154ba 100644
--- a/include/xmlsec/openssl/crypto.h
+++ b/include/xmlsec/openssl/crypto.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_OPENSSL_CRYPTO_H__
-#define __XMLSEC_OPENSSL_CRYPTO_H__    
+#define __XMLSEC_OPENSSL_CRYPTO_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/keys.h>
@@ -56,7 +56,7 @@ XMLSEC_CRYPTO_EXPORT const xmlChar*     xmlSecOpenSSLGetDefaultTrustedCertsFolde
 #ifndef XMLSEC_NO_AES
 /**
  * xmlSecOpenSSLKeyDataAesId:
- * 
+ *
  * The AES key klass.
  */
 #define xmlSecOpenSSLKeyDataAesId \
@@ -67,7 +67,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLKeyDataAesSet      (xmlSecK
                                                                          xmlSecSize bufSize);
 /**
  * xmlSecOpenSSLTransformAes128CbcId:
- * 
+ *
  * The AES128 CBC cipher transform klass.
  */
 #define xmlSecOpenSSLTransformAes128CbcId \
@@ -76,7 +76,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecOpenSSLTransformAes128CbcGetKlass(
 
 /**
  * xmlSecOpenSSLTransformAes192CbcId:
- * 
+ *
  * The AES192 CBC cipher transform klass.
  */
 #define xmlSecOpenSSLTransformAes192CbcId \
@@ -85,7 +85,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecOpenSSLTransformAes192CbcGetKlass(
 
 /**
  * xmlSecOpenSSLTransformAes256CbcId:
- * 
+ *
  * The AES256 CBC cipher transform klass.
  */
 #define xmlSecOpenSSLTransformAes256CbcId \
@@ -94,7 +94,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecOpenSSLTransformAes256CbcGetKlass(
 
 /**
  * xmlSecOpenSSLTransformKWAes128Id:
- * 
+ *
  * The AES 128 key wrap transform klass.
  */
 #define xmlSecOpenSSLTransformKWAes128Id \
@@ -103,7 +103,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecOpenSSLTransformKWAes128GetKlass(v
 
 /**
  * xmlSecOpenSSLTransformKWAes192Id:
- * 
+ *
  * The AES 192 key wrap transform klass.
  */
 #define xmlSecOpenSSLTransformKWAes192Id \
@@ -112,7 +112,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecOpenSSLTransformKWAes192GetKlass(v
 
 /**
  * xmlSecOpenSSLTransformKWAes256Id:
- * 
+ *
  * The AES 256 key wrap transform klass.
  */
 #define xmlSecOpenSSLTransformKWAes256Id \
@@ -129,7 +129,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId  xmlSecOpenSSLTransformKWAes256GetKlass(v
 #ifndef XMLSEC_NO_DES
 /**
  * xmlSecOpenSSLKeyDataDesId:
- * 
+ *
  * The DES key klass.
  */
 #define xmlSecOpenSSLKeyDataDesId \
@@ -140,7 +140,7 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLKeyDataDesSet      (xmlSecK
                                                                          xmlSecSize bufSize);
 /**
  * xmlSecOpenSSLTransformDes3CbcId:
- * 
+ *
  * The DES3 CBC cipher transform klass.
  */
 #define xmlSecOpenSSLTransformDes3CbcId \
@@ -149,7 +149,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformDes3CbcGetKlass(voi
 
 /**
  * xmlSecOpenSSLTransformKWDes3Id:
- * 
+ *
  * The DES3 CBC cipher transform klass.
  */
 #define xmlSecOpenSSLTransformKWDes3Id \
@@ -168,7 +168,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWDes3GetKlass(void
 
 /**
  * xmlSecOpenSSLKeyDataDsaId:
- * 
+ *
  * The DSA key klass.
  */
 #define xmlSecOpenSSLKeyDataDsaId \
@@ -184,7 +184,7 @@ XMLSEC_CRYPTO_EXPORT EVP_PKEY*          xmlSecOpenSSLKeyDataDsaGetEvp   (xmlSecK
 #ifndef XMLSEC_NO_SHA1
 /**
  * xmlSecOpenSSLTransformDsaSha1Id:
- * 
+ *
  * The DSA SHA1 signature transform klass.
  */
 #define xmlSecOpenSSLTransformDsaSha1Id \
@@ -204,9 +204,9 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformDsaSha1GetKlass(voi
 XMLSEC_CRYPTO_EXPORT int               xmlSecOpenSSLHmacGetMinOutputLength(void);
 XMLSEC_CRYPTO_EXPORT void              xmlSecOpenSSLHmacSetMinOutputLength(int min_length);
 
-/** 
+/**
  * xmlSecOpenSSLKeyDataHmacId:
- * 
+ *
  * The DHMAC key klass.
  */
 #define xmlSecOpenSSLKeyDataHmacId \
@@ -216,10 +216,10 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLKeyDataHmacSet     (xmlSecK
                                                                          const xmlSecByte* buf,
                                                                          xmlSecSize bufSize);
 
-#ifndef XMLSEC_NO_MD5                                                                    
+#ifndef XMLSEC_NO_MD5
 /**
  * xmlSecOpenSSLTransformHmacMd5Id:
- * 
+ *
  * The HMAC with MD5 signature transform klass.
  */
 #define xmlSecOpenSSLTransformHmacMd5Id \
@@ -230,7 +230,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacMd5GetKlass(voi
 #ifndef XMLSEC_NO_RIPEMD160
 /**
  * xmlSecOpenSSLTransformHmacRipemd160Id:
- * 
+ *
  * The HMAC with RipeMD160 signature transform klass.
  */
 #define xmlSecOpenSSLTransformHmacRipemd160Id \
@@ -241,7 +241,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacRipemd160GetKla
 #ifndef XMLSEC_NO_SHA1
 /**
  * xmlSecOpenSSLTransformHmacSha1Id:
- * 
+ *
  * The HMAC with SHA1 signature transform klass.
  */
 #define xmlSecOpenSSLTransformHmacSha1Id \
@@ -252,7 +252,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha1GetKlass(vo
 #ifndef XMLSEC_NO_SHA224
 /**
  * xmlSecOpenSSLTransformHmacSha224Id:
- * 
+ *
  * The HMAC with SHA224 signature transform klass.
  */
 #define xmlSecOpenSSLTransformHmacSha224Id \
@@ -263,7 +263,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha224GetKlass(
 #ifndef XMLSEC_NO_SHA256
 /**
  * xmlSecOpenSSLTransformHmacSha256Id:
- * 
+ *
  * The HMAC with SHA256 signature transform klass.
  */
 #define xmlSecOpenSSLTransformHmacSha256Id \
@@ -274,7 +274,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha256GetKlass(
 #ifndef XMLSEC_NO_SHA384
 /**
  * xmlSecOpenSSLTransformHmacSha384Id:
- * 
+ *
  * The HMAC with SHA384 signature transform klass.
  */
 #define xmlSecOpenSSLTransformHmacSha384Id \
@@ -285,7 +285,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha384GetKlass(
 #ifndef XMLSEC_NO_SHA512
 /**
  * xmlSecOpenSSLTransformHmacSha512Id:
- * 
+ *
  * The HMAC with SHA512 signature transform klass.
  */
 #define xmlSecOpenSSLTransformHmacSha512Id \
@@ -303,7 +303,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha512GetKlass(
 #ifndef XMLSEC_NO_MD5
 /**
  * xmlSecOpenSSLTransformMd5Id:
- * 
+ *
  * The MD5 digest transform klass.
  */
 #define xmlSecOpenSSLTransformMd5Id \
@@ -320,7 +320,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformMd5GetKlass(void);
 #ifndef XMLSEC_NO_RIPEMD160
 /**
  * xmlSecOpenSSLTransformRipemd160Id:
- * 
+ *
  * The RIPEMD160 digest transform klass.
  */
 #define xmlSecOpenSSLTransformRipemd160Id \
@@ -339,7 +339,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRipemd160GetKlass(v
 
 /**
  * xmlSecOpenSSLKeyDataRsaId:
- * 
+ *
  * The RSA key klass.
  */
 #define xmlSecOpenSSLKeyDataRsaId \
@@ -355,7 +355,7 @@ XMLSEC_CRYPTO_EXPORT EVP_PKEY*          xmlSecOpenSSLKeyDataRsaGetEvp   (xmlSecK
 #ifndef XMLSEC_NO_MD5
 /**
  * xmlSecOpenSSLTransformRsaMd5Id:
- * 
+ *
  * The RSA-MD5 signature transform klass.
  */
 #define xmlSecOpenSSLTransformRsaMd5Id  \
@@ -366,7 +366,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaMd5GetKlass(void
 #ifndef XMLSEC_NO_RIPEMD160
 /**
  * xmlSecOpenSSLTransformRsaRipemd160Id:
- * 
+ *
  * The RSA-RIPEMD160 signature transform klass.
  */
 #define xmlSecOpenSSLTransformRsaRipemd160Id    \
@@ -377,7 +377,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaRipemd160GetKlas
 #ifndef XMLSEC_NO_SHA1
 /**
  * xmlSecOpenSSLTransformRsaSha1Id:
- * 
+ *
  * The RSA-SHA1 signature transform klass.
  */
 #define xmlSecOpenSSLTransformRsaSha1Id \
@@ -388,7 +388,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha1GetKlass(voi
 #ifndef XMLSEC_NO_SHA224
 /**
  * xmlSecOpenSSLTransformRsaSha224Id:
- * 
+ *
  * The RSA-SHA224 signature transform klass.
  */
 #define xmlSecOpenSSLTransformRsaSha224Id       \
@@ -399,7 +399,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha224GetKlass(v
 #ifndef XMLSEC_NO_SHA256
 /**
  * xmlSecOpenSSLTransformRsaSha256Id:
- * 
+ *
  * The RSA-SHA256 signature transform klass.
  */
 #define xmlSecOpenSSLTransformRsaSha256Id       \
@@ -410,7 +410,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha256GetKlass(v
 #ifndef XMLSEC_NO_SHA384
 /**
  * xmlSecOpenSSLTransformRsaSha384Id:
- * 
+ *
  * The RSA-SHA384 signature transform klass.
  */
 #define xmlSecOpenSSLTransformRsaSha384Id       \
@@ -421,7 +421,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha384GetKlass(v
 #ifndef XMLSEC_NO_SHA512
 /**
  * xmlSecOpenSSLTransformRsaSha512Id:
- * 
+ *
  * The RSA-SHA512 signature transform klass.
  */
 #define xmlSecOpenSSLTransformRsaSha512Id       \
@@ -431,7 +431,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha512GetKlass(v
 
 /**
  * xmlSecOpenSSLTransformRsaPkcs1Id:
- * 
+ *
  * The RSA PKCS1 key transport transform klass.
  */
 #define xmlSecOpenSSLTransformRsaPkcs1Id \
@@ -440,7 +440,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaPkcs1GetKlass(vo
 
 /**
  * xmlSecOpenSSLTransformRsaOaepId:
- * 
+ *
  * The RSA PKCS1 key transport transform klass.
  */
 #define xmlSecOpenSSLTransformRsaOaepId \
@@ -458,7 +458,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaOaepGetKlass(voi
 #ifndef XMLSEC_NO_SHA1
 /**
  * xmlSecOpenSSLTransformSha1Id:
- * 
+ *
  * The SHA1 digest transform klass.
  */
 #define xmlSecOpenSSLTransformSha1Id \
@@ -475,7 +475,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha1GetKlass(void);
 #ifndef XMLSEC_NO_SHA224
 /**
  * xmlSecOpenSSLTransformSha224Id:
- * 
+ *
  * The SHA224 digest transform klass.
  */
 #define xmlSecOpenSSLTransformSha224Id \
@@ -492,7 +492,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha224GetKlass(void
 #ifndef XMLSEC_NO_SHA256
 /**
  * xmlSecOpenSSLTransformSha256Id:
- * 
+ *
  * The SHA256 digest transform klass.
  */
 #define xmlSecOpenSSLTransformSha256Id \
@@ -508,7 +508,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha256GetKlass(void
 #ifndef XMLSEC_NO_SHA384
 /**
  * xmlSecOpenSSLTransformSha384Id:
- * 
+ *
  * The SHA384 digest transform klass.
  */
 #define xmlSecOpenSSLTransformSha384Id \
@@ -524,7 +524,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha384GetKlass(void
 #ifndef XMLSEC_NO_SHA512
 /**
  * xmlSecOpenSSLTransformSha512Id:
- * 
+ *
  * The SHA512 digest transform klass.
  */
 #define xmlSecOpenSSLTransformSha512Id \
@@ -537,7 +537,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha512GetKlass(void
 
 /**************************************************************
  *
- * Error constants for OpenSSL 
+ * Error constants for OpenSSL
  *
  *************************************************************/
 /**
@@ -554,12 +554,12 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha512GetKlass(void
  */
 #define XMLSEC_OPENSSL_ERRORS_FUNCTION                  0
 
-XMLSEC_CRYPTO_EXPORT void       xmlSecOpenSSLErrorsDefaultCallback      (const char* file, 
-                                                                         int line, 
+XMLSEC_CRYPTO_EXPORT void       xmlSecOpenSSLErrorsDefaultCallback      (const char* file,
+                                                                         int line,
                                                                          const char* func,
                                                                          const char* errorObject,
                                                                          const char* errorSubject,
-                                                                         int reason, 
+                                                                         int reason,
                                                                          const char* msg);
 
 #ifdef __cplusplus
@@ -568,4 +568,4 @@ XMLSEC_CRYPTO_EXPORT void       xmlSecOpenSSLErrorsDefaultCallback      (const c
 
 #endif /* __XMLSEC_OPENSSL_CRYPTO_H__ */
 
-#define __XMLSEC_OPENSSL_CRYPTO_H__    
+#define __XMLSEC_OPENSSL_CRYPTO_H__
diff --git a/include/xmlsec/openssl/evp.h b/include/xmlsec/openssl/evp.h
index 41cee0a..30db8f4 100644
--- a/include/xmlsec/openssl/evp.h
+++ b/include/xmlsec/openssl/evp.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_OPENSSL_EVP_H__
-#define __XMLSEC_OPENSSL_EVP_H__    
+#define __XMLSEC_OPENSSL_EVP_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <openssl/evp.h>
 
@@ -22,7 +22,7 @@ extern "C" {
 #include <xmlsec/openssl/crypto.h>
 
 
-XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLEvpKeyDataAdoptEvp (xmlSecKeyDataPtr data, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLEvpKeyDataAdoptEvp (xmlSecKeyDataPtr data,
                                                                          EVP_PKEY* pKey);
 XMLSEC_CRYPTO_EXPORT EVP_PKEY*          xmlSecOpenSSLEvpKeyDataGetEvp   (xmlSecKeyDataPtr data);
 
diff --git a/include/xmlsec/openssl/symbols.h b/include/xmlsec/openssl/symbols.h
index 5b4692f..0c2f20c 100644
--- a/include/xmlsec/openssl/symbols.h
+++ b/include/xmlsec/openssl/symbols.h
@@ -1,13 +1,13 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_OPENSSL_SYMBOLS_H__
-#define __XMLSEC_OPENSSL_SYMBOLS_H__    
+#define __XMLSEC_OPENSSL_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
@@ -15,14 +15,14 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 /**
  * Defines for writing simple code
  */
 #ifdef XMLSEC_CRYPTO_OPENSSL
 
-/**  
+/**
  * Crypto Init/shutdown
  */
 #define xmlSecCryptoInit                        xmlSecOpenSSLInit
@@ -84,7 +84,7 @@ extern "C" {
 
 /**
  * High level routines form xmlsec command line utility
- */ 
+ */
 #define xmlSecCryptoAppInit                     xmlSecOpenSSLAppInit
 #define xmlSecCryptoAppShutdown                 xmlSecOpenSSLAppShutdown
 #define xmlSecCryptoAppDefaultKeysMngrInit      xmlSecOpenSSLAppDefaultKeysMngrInit
@@ -113,4 +113,4 @@ extern "C" {
 
 #endif /* __XMLSEC_OPENSSL_CRYPTO_H__ */
 
-#define __XMLSEC_OPENSSL_CRYPTO_H__    
+#define __XMLSEC_OPENSSL_CRYPTO_H__
diff --git a/include/xmlsec/openssl/x509.h b/include/xmlsec/openssl/x509.h
index e041ec7..6da3281 100644
--- a/include/xmlsec/openssl/x509.h
+++ b/include/xmlsec/openssl/x509.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_OPENSSL_X509_H__
-#define __XMLSEC_OPENSSL_X509_H__    
+#define __XMLSEC_OPENSSL_X509_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #ifndef XMLSEC_NO_X509
 
@@ -37,7 +37,7 @@ extern "C" {
 
 /**
  * xmlSecOpenSSLKeyDataX509Id:
- * 
+ *
  * The OpenSSL X509 data klass.
  */
 #define xmlSecOpenSSLKeyDataX509Id \
@@ -45,7 +45,7 @@ extern "C" {
 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecOpenSSLKeyDataX509GetKlass(void);
 
 XMLSEC_CRYPTO_EXPORT X509*              xmlSecOpenSSLKeyDataX509GetKeyCert(xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, 
+XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data,
                                                                          X509* cert);
 
 XMLSEC_CRYPTO_EXPORT int                xmlSecOpenSSLKeyDataX509AdoptCert(xmlSecKeyDataPtr data,
@@ -65,7 +65,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr   xmlSecOpenSSLX509CertGetKey     (X509* c
 
 /**
  * xmlSecOpenSSLKeyDataRawX509CertId:
- * 
+ *
  * The OpenSSL raw X509 certificate klass.
  */
 #define xmlSecOpenSSLKeyDataRawX509CertId \
@@ -74,7 +74,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecOpenSSLKeyDataRawX509CertGetKlass(
 
 /**
  * xmlSecOpenSSLX509StoreId:
- * 
+ *
  * The OpenSSL X509 store klass.
  */
 #define xmlSecOpenSSLX509StoreId \
@@ -82,7 +82,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId    xmlSecOpenSSLKeyDataRawX509CertGetKlass(
 XMLSEC_CRYPTO_EXPORT xmlSecKeyDataStoreId xmlSecOpenSSLX509StoreGetKlass(void);
 XMLSEC_CRYPTO_EXPORT X509*              xmlSecOpenSSLX509StoreFindCert  (xmlSecKeyDataStorePtr store,
                                                                          xmlChar *subjectName,
-                                                                         xmlChar *issuerName, 
+                                                                         xmlChar *issuerName,
                                                                          xmlChar *issuerSerial,
                                                                          xmlChar *ski,
                                                                          xmlSecKeyInfoCtx* keyInfoCtx);
diff --git a/include/xmlsec/parser.h b/include/xmlsec/parser.h
index c10bf1f..182f295 100644
--- a/include/xmlsec/parser.h
+++ b/include/xmlsec/parser.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * XML Parser transform and utility functions.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_PARSER_H__
-#define __XMLSEC_PARSER_H__    
+#define __XMLSEC_PARSER_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 
@@ -22,20 +22,20 @@ extern "C" {
 
 
 XMLSEC_EXPORT xmlDocPtr         xmlSecParseFile         (const char *filename);
-XMLSEC_EXPORT xmlDocPtr         xmlSecParseMemory       (const xmlSecByte *buffer, 
+XMLSEC_EXPORT xmlDocPtr         xmlSecParseMemory       (const xmlSecByte *buffer,
                                                          xmlSecSize size,
                                                          int recovery);
-XMLSEC_EXPORT xmlDocPtr         xmlSecParseMemoryExt    (const xmlSecByte *prefix, 
+XMLSEC_EXPORT xmlDocPtr         xmlSecParseMemoryExt    (const xmlSecByte *prefix,
                                                          xmlSecSize prefixSize,
-                                                         const xmlSecByte *buffer, 
-                                                         xmlSecSize bufferSize, 
-                                                         const xmlSecByte *postfix, 
+                                                         const xmlSecByte *buffer,
+                                                         xmlSecSize bufferSize,
+                                                         const xmlSecByte *postfix,
                                                          xmlSecSize postfixSize);
 
 
 /**
  * xmlSecTransformXmlParserId:
- * 
+ *
  * The XML Parser transform klass.
  */
 #define xmlSecTransformXmlParserId \
diff --git a/include/xmlsec/private.h b/include/xmlsec/private.h
index 9e22e33..0d7d36b 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
@@ -6,11 +6,11 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_PRIVATE_H__
-#define __XMLSEC_PRIVATE_H__    
+#define __XMLSEC_PRIVATE_H__
 
 #ifndef XMLSEC_PRIVATE
 #error "xmlsec/private.h file contains private xmlsec definitions and should not be used outside xmlsec or xmlsec-<crypto> libraries"
@@ -18,7 +18,7 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 #include <libxml/xmlIO.h>
@@ -38,15 +38,15 @@ extern "C" {
 /**
  * xmlSecCryptoInitMethod:
  *
- * xmlsec-crypto libraryinitialization method. 
+ * xmlsec-crypto libraryinitialization method.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
 typedef int                     (*xmlSecCryptoInitMethod)               (void);
 /**
  * xmlSecCryptoShutdownMethod:
- * 
- * xmlsec-crypto library shutdown method. 
+ *
+ * xmlsec-crypto library shutdown method.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
@@ -58,7 +58,7 @@ typedef int                     (*xmlSecCryptoShutdownMethod)           (void);
  * Initializes @mngr with xmlsec-crypto library specific data.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 typedef int                     (*xmlSecCryptoKeysMngrInitMethod)       (xmlSecKeysMngrPtr mngr);
 
 /*****************************************************************************
@@ -71,11 +71,11 @@ typedef int                     (*xmlSecCryptoKeysMngrInitMethod)       (xmlSecK
  *
  * Gets the key data klass.
  *
- * Returns: pointer to key data klass or NULL if an error occurs 
+ * Returns: pointer to key data klass or NULL if an error occurs
  * (the xmlsec-crypto library is not loaded or this key data klass is not
  * implemented).
- */ 
-typedef xmlSecKeyDataId         (*xmlSecCryptoKeyDataGetKlassMethod)    (void); 
+ */
+typedef xmlSecKeyDataId         (*xmlSecCryptoKeyDataGetKlassMethod)    (void);
 
 /*****************************************************************************
  *
@@ -87,11 +87,11 @@ typedef xmlSecKeyDataId         (*xmlSecCryptoKeyDataGetKlassMethod)    (void);
  *
  * Gets the key data store klass.
  *
- * Returns: pointer to key data store klass or NULL if an error occurs 
+ * Returns: pointer to key data store klass or NULL if an error occurs
  * (the xmlsec-crypto library is not loaded or this key data store klass is not
  * implemented).
- */ 
-typedef xmlSecKeyDataStoreId    (*xmlSecCryptoKeyDataStoreGetKlassMethod)(void);        
+ */
+typedef xmlSecKeyDataStoreId    (*xmlSecCryptoKeyDataStoreGetKlassMethod)(void);
 
 /*****************************************************************************
  *
@@ -103,23 +103,23 @@ typedef xmlSecKeyDataStoreId    (*xmlSecCryptoKeyDataStoreGetKlassMethod)(void);
  *
  * Gets the transform klass.
  *
- * Returns: pointer to transform klass or NULL if an error occurs 
+ * Returns: pointer to transform klass or NULL if an error occurs
  * (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
- */ 
+ */
 typedef xmlSecTransformId       (*xmlSecCryptoTransformGetKlassMethod)  (void);
-    
+
 /*****************************************************************************
  *
  * High level routines form xmlsec command line utility
  *
- ****************************************************************************/ 
+ ****************************************************************************/
 /**
  * xmlSecCryptoAppInitMethod:
  * @config:             the path to crypto library configuration.
  *
  * General crypto engine initialization. This function is used
- * by XMLSec command line utility and called before 
+ * by XMLSec command line utility and called before
  * @xmlSecInit function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -127,9 +127,9 @@ typedef xmlSecTransformId       (*xmlSecCryptoTransformGetKlassMethod)  (void);
 typedef int                     (*xmlSecCryptoAppInitMethod)            (const char* config);
 /**
  * xmlSecCryptoAppShutdownMethod:
- * 
+ *
  * General crypto engine shutdown. This function is used
- * by XMLSec command line utility and called after 
+ * by XMLSec command line utility and called after
  * @xmlSecShutdown function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -143,8 +143,8 @@ typedef int                     (*xmlSecCryptoAppShutdownMethod)        (void);
  * and a default crypto key data stores.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-typedef int                     (*xmlSecCryptoAppDefaultKeysMngrInitMethod)     
+ */
+typedef int                     (*xmlSecCryptoAppDefaultKeysMngrInitMethod)
                                                                         (xmlSecKeysMngrPtr mngr);
 /**
  * xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod:
@@ -153,10 +153,10 @@ typedef int                     (*xmlSecCryptoAppDefaultKeysMngrInitMethod)
  *
  * Adds @key to the keys manager @mngr created with #xmlSecCryptoAppDefaultKeysMngrInit
  * function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-typedef int                     (*xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod) 
+ */
+typedef int                     (*xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod)
                                                                         (xmlSecKeysMngrPtr mngr,
                                                                          xmlSecKeyPtr key);
 /**
@@ -164,11 +164,11 @@ typedef int                     (*xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod)
  * @mngr:               the pointer to keys manager.
  * @uri:                the uri.
  *
- * Loads XML keys file from @uri to the keys manager @mngr created 
+ * Loads XML keys file from @uri to the keys manager @mngr created
  * with #xmlSecCryptoAppDefaultKeysMngrInit function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 typedef int                     (*xmlSecCryptoAppDefaultKeysMngrLoadMethod)
                                                                         (xmlSecKeysMngrPtr mngr,
                                                                          const char* uri);
@@ -179,9 +179,9 @@ typedef int                     (*xmlSecCryptoAppDefaultKeysMngrLoadMethod)
  * @type:               the type of keys to save (public/private/symmetric).
  *
  * Saves keys from @mngr to  XML keys file.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 typedef int                     (*xmlSecCryptoAppDefaultKeysMngrSaveMethod)
                                                                         (xmlSecKeysMngrPtr mngr,
                                                                          const char* filename,
@@ -193,14 +193,14 @@ typedef int                     (*xmlSecCryptoAppDefaultKeysMngrSaveMethod)
  * @format:             the certificate file format.
  * @type:               the flag that indicates is the certificate in @filename
  *                      trusted or not.
- * 
+ *
  * Reads cert from @filename and adds to the list of trusted or known
  * untrusted certs in @store.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
 typedef int                     (*xmlSecCryptoAppKeysMngrCertLoadMethod)(xmlSecKeysMngrPtr mngr,
-                                                                         const char *filename, 
+                                                                         const char *filename,
                                                                          xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
 /**
@@ -211,7 +211,7 @@ typedef int                     (*xmlSecCryptoAppKeysMngrCertLoadMethod)(xmlSecK
  * @format:             the certificate format.
  * @type:               the flag that indicates is the certificate in @data
  *                      trusted or not.
- * 
+ *
  * Reads cert from @data and adds to the list of trusted or known
  * untrusted certs in @store.
  *
@@ -219,7 +219,7 @@ typedef int                     (*xmlSecCryptoAppKeysMngrCertLoadMethod)(xmlSecK
  */
 typedef int                     (*xmlSecCryptoAppKeysMngrCertLoadMemoryMethod)(xmlSecKeysMngrPtr mngr,
                                                                          const xmlSecByte* data,
-                                                                         xmlSecSize dataSize, 
+                                                                         xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
 /**
@@ -234,7 +234,7 @@ typedef int                     (*xmlSecCryptoAppKeysMngrCertLoadMemoryMethod)(x
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-typedef xmlSecKeyPtr            (*xmlSecCryptoAppKeyLoadMethod)         (const char *filename, 
+typedef xmlSecKeyPtr            (*xmlSecCryptoAppKeyLoadMethod)         (const char *filename,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
                                                                          void* pwdCallback,
@@ -254,7 +254,7 @@ typedef xmlSecKeyPtr            (*xmlSecCryptoAppKeyLoadMethod)         (const c
  * Returns: pointer to the key or NULL if an error occurs.
  */
 typedef xmlSecKeyPtr            (*xmlSecCryptoAppKeyLoadMemoryMethod)   (const xmlSecByte* data,
-                                                                         xmlSecSize dataSize, 
+                                                                         xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
                                                                          void* pwdCallback,
@@ -274,10 +274,10 @@ typedef xmlSecKeyPtr            (*xmlSecCryptoAppKeyLoadMemoryMethod)   (const x
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-typedef xmlSecKeyPtr            (*xmlSecCryptoAppPkcs12LoadMethod)      (const char* filename, 
+typedef xmlSecKeyPtr            (*xmlSecCryptoAppPkcs12LoadMethod)      (const char* filename,
                                                                          const char* pwd,
-                                                                         void* pwdCallback, 
-                                                                         void* pwdCallbackCtx); 
+                                                                         void* pwdCallback,
+                                                                         void* pwdCallbackCtx);
 /**
  * xmlSecCryptoAppPkcs12LoadMemoryMethod:
  * @data:               the pkcs12 data.
@@ -293,9 +293,9 @@ typedef xmlSecKeyPtr            (*xmlSecCryptoAppPkcs12LoadMethod)      (const c
  * Returns: pointer to the key or NULL if an error occurs.
  */
 typedef xmlSecKeyPtr            (*xmlSecCryptoAppPkcs12LoadMemoryMethod)(const xmlSecByte* data,
-                                                                         xmlSecSize dataSize, 
+                                                                         xmlSecSize dataSize,
                                                                          const char* pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 /**
  * xmlSecCryptoAppKeyCertLoadMethod:
@@ -304,7 +304,7 @@ typedef xmlSecKeyPtr            (*xmlSecCryptoAppPkcs12LoadMemoryMethod)(const x
  * @format:             the certificate file format.
  *
  * Reads the certificate from $ filename and adds it to key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
 typedef int                     (*xmlSecCryptoAppKeyCertLoadMethod)     (xmlSecKeyPtr key,
@@ -319,14 +319,14 @@ typedef int                     (*xmlSecCryptoAppKeyCertLoadMethod)     (xmlSecK
  * @format:             the certificate data format.
  *
  * Reads the certificate from binary @data buffer and adds it to key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
 typedef int                     (*xmlSecCryptoAppKeyCertLoadMemoryMethod)(xmlSecKeyPtr key,
                                                                          const xmlSecByte* data,
-                                                                         xmlSecSize dataSize, 
+                                                                         xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format);
-/** 
+/**
  * xmlSecCryptoDLFunctions:
  * @cryptoInit:                 the xmlsec-crypto library initialization method.
  * @cryptoShutdown:             the xmlsec-crypto library shutdown method.
@@ -389,11 +389,11 @@ typedef int                     (*xmlSecCryptoAppKeyCertLoadMemoryMethod)(xmlSec
  * @cryptoAppKeyCertLoad:       the cert file load method.
  * @cryptoAppKeyCertLoadMemory: the memory cert load method.
  * @cryptoAppDefaultPwdCallback:the default password callback.
- * 
+ *
  * The list of crypto engine functions, key data and transform classes.
  */
 struct _xmlSecCryptoDLFunctions {
-    /**  
+    /**
      * Crypto Init/shutdown
      */
     xmlSecCryptoInitMethod                       cryptoInit;
@@ -454,10 +454,10 @@ struct _xmlSecCryptoDLFunctions {
     xmlSecCryptoTransformGetKlassMethod          transformSha256GetKlass;
     xmlSecCryptoTransformGetKlassMethod          transformSha384GetKlass;
     xmlSecCryptoTransformGetKlassMethod          transformSha512GetKlass;
-    
+
     /**
      * High level routines form xmlsec command line utility
-     */ 
+     */
     xmlSecCryptoAppInitMethod                    cryptoAppInit;
     xmlSecCryptoAppShutdownMethod                cryptoAppShutdown;
     xmlSecCryptoAppDefaultKeysMngrInitMethod     cryptoAppDefaultKeysMngrInit;
diff --git a/include/xmlsec/private/xkms.h b/include/xmlsec/private/xkms.h
index c86bb0d..0c60664 100644
--- a/include/xmlsec/private/xkms.h
+++ b/include/xmlsec/private/xkms.h
@@ -1,30 +1,30 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * "XML Key Management Specification v 2.0" implementation
  *  http://www.w3.org/TR/xkms2/
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_PRIVATE_XKMS_H__
-#define __XMLSEC_PRIVATE_XKMS_H__    
+#define __XMLSEC_PRIVATE_XKMS_H__
 
 #ifndef XMLSEC_PRIVATE
 #error "xmlsec/private/xkms.h file contains private xmlsec definitions and should not be used outside xmlsec or xmlsec-<crypto> libraries"
 #endif /* XMLSEC_PRIVATE */
 
 #ifndef XMLSEC_NO_XKMS
-        
+
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
-#include <stdio.h>              
+#endif /* __cplusplus */
+#include <stdio.h>
 
 #include <libxml/tree.h>
-#include <libxml/parser.h> 
+#include <libxml/parser.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -39,7 +39,7 @@ extern "C" {
  *
  * XKMS RespondWith Klass
  *
- ************************************************************************/ 
+ ************************************************************************/
 typedef int             (*xmlSecXkmsRespondWithNodeReadMethod)  (xmlSecXkmsRespondWithId id,
                                                                  xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
@@ -49,10 +49,10 @@ typedef int             (*xmlSecXkmsRespondWithNodeWriteMethod) (xmlSecXkmsRespo
 struct _xmlSecXkmsRespondWithKlass {
     const xmlChar*                              valueName;
     const xmlChar*                              valueNs;
-    
+
     const xmlChar*                              nodeName;
     const xmlChar*                              nodeNs;
-    
+
     xmlSecXkmsRespondWithNodeReadMethod         readNode;
     xmlSecXkmsRespondWithNodeWriteMethod        writeNode;
 
@@ -67,7 +67,7 @@ struct _xmlSecXkmsRespondWithKlass {
  *
  * XKMS ServerRequest Klass
  *
- ************************************************************************/ 
+ ************************************************************************/
 typedef int                     (*xmlSecXkmsServerRequestNodeReadMethod)
                                                                 (xmlSecXkmsServerRequestId id,
                                                                  xmlSecXkmsServerCtxPtr ctx,
@@ -86,11 +86,11 @@ struct _xmlSecXkmsServerRequestKlass {
     const xmlChar*                              resultNodeName;
     const xmlChar*                              resultNodeNs;
     xmlSecBitMask                               flags;
-    
+
     xmlSecXkmsServerRequestNodeReadMethod       readNode;
     xmlSecXkmsServerRequestNodeWriteMethod      writeNode;
     xmlSecXkmsServerRequestExecuteMethod        execute;
-    
+
     void*                                       reserved1;
     void*                                       reserved2;
 };
@@ -103,7 +103,7 @@ struct _xmlSecXkmsServerRequestKlass {
  *
  * XKMS ServerRequest Klass flags
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * XMLSEC_XKMS_SERVER_REQUEST_KLASS_ALLOWED_IN_COUMPOUND:
  *
diff --git a/include/xmlsec/skeleton/app.h b/include/xmlsec/skeleton/app.h
index 93f65d3..ba6895d 100644
--- a/include/xmlsec/skeleton/app.h
+++ b/include/xmlsec/skeleton/app.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_SKELETON_APP_H__
-#define __XMLSEC_SKELETON_APP_H__    
+#define __XMLSEC_SKELETON_APP_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/keys.h>
@@ -24,7 +24,7 @@ extern "C" {
 XMLSEC_CRYPTO_EXPORT int        xmlSecSkeletonAppInit                   (const char* config);
 XMLSEC_CRYPTO_EXPORT int        xmlSecSkeletonAppShutdown               (void);
 
-/** 
+/**
  * Keys Manager
  */
 XMLSEC_CRYPTO_EXPORT int        xmlSecSkeletonAppDefaultKeysMngrInit    (xmlSecKeysMngrPtr mngr);
@@ -36,47 +36,47 @@ XMLSEC_CRYPTO_EXPORT int        xmlSecSkeletonAppDefaultKeysMngrSave    (xmlSecK
                                                                          const char* filename,
                                                                          xmlSecKeyDataType type);
 #ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT int        xmlSecSkeletonAppKeysMngrCertLoad       (xmlSecKeysMngrPtr mngr, 
-                                                                         const char *filename, 
-                                                                         xmlSecKeyDataFormat format, 
+XMLSEC_CRYPTO_EXPORT int        xmlSecSkeletonAppKeysMngrCertLoad       (xmlSecKeysMngrPtr mngr,
+                                                                         const char *filename,
+                                                                         xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int        xmlSecSkeletonAppKeysMngrCertLoadMemory (xmlSecKeysMngrPtr mngr, 
-                                                                         const xmlSecByte *data, 
+XMLSEC_CRYPTO_EXPORT int        xmlSecSkeletonAppKeysMngrCertLoadMemory (xmlSecKeysMngrPtr mngr,
+                                                                         const xmlSecByte *data,
                                                                          xmlSecSize dataSize,
-                                                                         xmlSecKeyDataFormat format, 
+                                                                         xmlSecKeyDataFormat format,
                                                                          xmlSecKeyDataType type);
 #endif /* XMLSEC_NO_X509 */
 
 
-/** 
+/**
  * Keys
  */
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppKeyLoad              (const char *filename, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppKeyLoad              (const char *filename,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
                                                                          void *pwdCallback,
                                                                          void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppKeyLoadMemory        (const xmlSecByte *data, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppKeyLoadMemory        (const xmlSecByte *data,
                                                                          xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format,
                                                                          const char *pwd,
                                                                          void *pwdCallback,
                                                                          void* pwdCallbackCtx);
 #ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppPkcs12Load           (const char *filename, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppPkcs12Load           (const char *filename,
                                                                          const char *pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppPkcs12LoadMemory     (const xmlSecByte *data, 
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppPkcs12LoadMemory     (const xmlSecByte *data,
                                                                          xmlSecSize dataSize,
                                                                          const char *pwd,
-                                                                         void* pwdCallback, 
+                                                                         void* pwdCallback,
                                                                          void* pwdCallbackCtx);
 XMLSEC_CRYPTO_EXPORT int        xmlSecSkeletonAppKeyCertLoad            (xmlSecKeyPtr key,
                                                                          const char* filename,
                                                                          xmlSecKeyDataFormat format);
 XMLSEC_CRYPTO_EXPORT int        xmlSecSkeletonAppKeyCertLoadMemory      (xmlSecKeyPtr key,
-                                                                         const xmlSecByte *data, 
+                                                                         const xmlSecByte *data,
                                                                          xmlSecSize dataSize,
                                                                          xmlSecKeyDataFormat format);
 #endif /* XMLSEC_NO_X509 */
diff --git a/include/xmlsec/skeleton/crypto.h b/include/xmlsec/skeleton/crypto.h
index 1d9f008..95a2fc2 100644
--- a/include/xmlsec/skeleton/crypto.h
+++ b/include/xmlsec/skeleton/crypto.h
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_SKELETON_CRYPTO_H__
-#define __XMLSEC_SKELETON_CRYPTO_H__    
+#define __XMLSEC_SKELETON_CRYPTO_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/keys.h>
@@ -35,4 +35,4 @@ XMLSEC_CRYPTO_EXPORT int                xmlSecSkeletonKeysMngrInit      (xmlSecK
 
 #endif /* __XMLSEC_SKELETON_CRYPTO_H__ */
 
-#define __XMLSEC_SKELETON_CRYPTO_H__    
+#define __XMLSEC_SKELETON_CRYPTO_H__
diff --git a/include/xmlsec/skeleton/symbols.h b/include/xmlsec/skeleton/symbols.h
index d87d03d..c21e9f6 100644
--- a/include/xmlsec/skeleton/symbols.h
+++ b/include/xmlsec/skeleton/symbols.h
@@ -1,13 +1,13 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_SKELETON_SYMBOLS_H__
-#define __XMLSEC_SKELETON_SYMBOLS_H__    
+#define __XMLSEC_SKELETON_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
@@ -15,14 +15,14 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 /**
  * Defines for writing simple code
  */
 #ifdef XMLSEC_CRYPTO_SKELETON
 
-/**  
+/**
  * Crypto Init/shutdown
  */
 #define xmlSecCryptoInit                        xmlSecSkeletonInit
@@ -82,7 +82,7 @@ extern "C" {
 
 /**
  * High level routines form xmlsec command line utility
- */ 
+ */
 #define xmlSecCryptoAppInit                     xmlSecSkeletonAppInit
 #define xmlSecCryptoAppShutdown                 xmlSecSkeletonAppShutdown
 #define xmlSecCryptoAppDefaultKeysMngrInit      xmlSecSkeletonAppDefaultKeysMngrInit
@@ -107,4 +107,4 @@ extern "C" {
 
 #endif /* __XMLSEC_SKELETON_CRYPTO_H__ */
 
-#define __XMLSEC_SKELETON_CRYPTO_H__    
+#define __XMLSEC_SKELETON_CRYPTO_H__
diff --git a/include/xmlsec/soap.h b/include/xmlsec/soap.h
index 1aa5649..c4efc00 100644
--- a/include/xmlsec/soap.h
+++ b/include/xmlsec/soap.h
@@ -1,21 +1,21 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Simple SOAP messages parsing/creation.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_SOAP_H__
-#define __XMLSEC_SOAP_H__    
+#define __XMLSEC_SOAP_H__
 
 #ifndef XMLSEC_NO_SOAP
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 #include <xmlsec/xmlsec.h>
@@ -23,7 +23,7 @@ extern "C" {
 
 /***********************************************************************
  *
- * SOAP 1.1 
+ * SOAP 1.1
  *
  **********************************************************************/
 XMLSEC_EXPORT xmlNodePtr        xmlSecSoap11CreateEnvelope      (xmlDocPtr doc);
@@ -46,41 +46,41 @@ XMLSEC_EXPORT xmlNodePtr        xmlSecSoap11GetFaultEntry       (xmlNodePtr envN
 
 /***********************************************************************
  *
- * SOAP 1.2 
+ * SOAP 1.2
  *
  **********************************************************************/
 /**
  * xmlSecSoap12FaultCode:
  * @xmlSecSoap12FaultCodeUnknown:               The fault code is not available.
- * @xmlSecSoap12FaultCodeVersionMismatch:       The faulting node found an 
- *                                              invalid element information 
- *                                              item instead of the expected 
- *                                              Envelope element information item. 
- * @xmlSecSoap12FaultCodeMustUnderstand:        An immediate child element 
- *                                              information item of the SOAP 
- *                                              Header element information item 
- *                                              targeted at the faulting node 
- *                                              that was not understood by the 
- *                                              faulting node contained a SOAP 
- *                                              mustUnderstand attribute 
+ * @xmlSecSoap12FaultCodeVersionMismatch:       The faulting node found an
+ *                                              invalid element information
+ *                                              item instead of the expected
+ *                                              Envelope element information item.
+ * @xmlSecSoap12FaultCodeMustUnderstand:        An immediate child element
+ *                                              information item of the SOAP
+ *                                              Header element information item
+ *                                              targeted at the faulting node
+ *                                              that was not understood by the
+ *                                              faulting node contained a SOAP
+ *                                              mustUnderstand attribute
  *                                              information item with a value of "true"
- * @xmlSecSoap12FaultCodeDataEncodingUnknown:   A SOAP header block or SOAP 
- *                                              body child element information 
- *                                              item targeted at the faulting 
- *                                              SOAP node is scoped with a data 
- *                                              encoding that the faulting node 
+ * @xmlSecSoap12FaultCodeDataEncodingUnknown:   A SOAP header block or SOAP
+ *                                              body child element information
+ *                                              item targeted at the faulting
+ *                                              SOAP node is scoped with a data
+ *                                              encoding that the faulting node
  *                                              does not support.
- * @xmlSecSoap12FaultCodeSender:                The message was incorrectly 
- *                                              formed or did not contain the 
- *                                              appropriate information in order 
- *                                              to succeed. 
- * @xmlSecSoap12FaultCodeReceiver:              The message could not be processed 
- *                                              for reasons attributable to the 
- *                                              processing of the message rather 
- *                                              than to the contents of the 
- *                                              message itself. 
- * 
- * The values of the <Value> child element information item of the 
+ * @xmlSecSoap12FaultCodeSender:                The message was incorrectly
+ *                                              formed or did not contain the
+ *                                              appropriate information in order
+ *                                              to succeed.
+ * @xmlSecSoap12FaultCodeReceiver:              The message could not be processed
+ *                                              for reasons attributable to the
+ *                                              processing of the message rather
+ *                                              than to the contents of the
+ *                                              message itself.
+ *
+ * The values of the <Value> child element information item of the
  * <Code> element information item (http://www.w3.org/TR/2003/REC-soap12-part1-20030624/#faultcodes).
  */
 typedef enum {
@@ -90,7 +90,7 @@ typedef enum {
     xmlSecSoap12FaultCodeDataEncodingUnknown,
     xmlSecSoap12FaultCodeSender,
     xmlSecSoap12FaultCodeReceiver
-} xmlSecSoap12FaultCode; 
+} xmlSecSoap12FaultCode;
 
 XMLSEC_EXPORT xmlNodePtr        xmlSecSoap12CreateEnvelope      (xmlDocPtr doc);
 XMLSEC_EXPORT xmlNodePtr        xmlSecSoap12EnsureHeader        (xmlNodePtr envNode);
@@ -104,7 +104,7 @@ XMLSEC_EXPORT xmlNodePtr        xmlSecSoap12AddFaultEntry       (xmlNodePtr envN
                                                                  const xmlChar* faultRole);
 XMLSEC_EXPORT xmlNodePtr        xmlSecSoap12AddFaultSubcode     (xmlNodePtr faultNode,
                                                                  const xmlChar* subCodeHref,
-                                                                 const xmlChar* subCodeName);                                                            
+                                                                 const xmlChar* subCodeName);
 XMLSEC_EXPORT xmlNodePtr        xmlSecSoap12AddFaultReasonText  (xmlNodePtr faultNode,
                                                                  const xmlChar* faultReasonText,
                                                                  const xmlChar* faultReasonLang);
@@ -118,7 +118,7 @@ XMLSEC_EXPORT xmlNodePtr        xmlSecSoap12GetBodyEntry        (xmlNodePtr envN
                                                                  xmlSecSize pos);
 XMLSEC_EXPORT xmlNodePtr        xmlSecSoap12GetFaultEntry       (xmlNodePtr envNode);
 
-                                                                 
+
 #endif /* XMLSEC_NO_SOAP */
 
 
diff --git a/include/xmlsec/strings.h b/include/xmlsec/strings.h
index 07afb9d..98650bf 100644
--- a/include/xmlsec/strings.h
+++ b/include/xmlsec/strings.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * All the string constans.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_STRINGS_H__
-#define __XMLSEC_STRINGS_H__    
+#define __XMLSEC_STRINGS_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 
diff --git a/include/xmlsec/templates.h b/include/xmlsec/templates.h
index 7162dce..815cddc 100644
--- a/include/xmlsec/templates.h
+++ b/include/xmlsec/templates.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * KeyInfo node processing
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_TEMPLATES_H__
-#define __XMLSEC_TEMPALTES_H__    
+#define __XMLSEC_TEMPALTES_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 
@@ -38,7 +38,7 @@ XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureEnsureKeyInfo       (xmlNodePtr sign
                                                                  const xmlChar *id);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureAddReference        (xmlNodePtr signNode,
                                                                  xmlSecTransformId digestMethodId,
-                                                                 const xmlChar *id, 
+                                                                 const xmlChar *id,
                                                                  const xmlChar *uri,
                                                                  const xmlChar *type);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureAddObject           (xmlNodePtr signNode,
@@ -52,12 +52,12 @@ XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceAddTransform        (xmlNodePtr refe
                                                                  xmlSecTransformId transformId);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplObjectAddSignProperties      (xmlNodePtr objectNode,
                                                                  const xmlChar *id,
-                                                                 const xmlChar *target);                                                                                                                 
+                                                                 const xmlChar *target);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplObjectAddManifest            (xmlNodePtr objectNode,
                                                                  const xmlChar *id);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplManifestAddReference         (xmlNodePtr manifestNode,
                                                                  xmlSecTransformId digestMethodId,
-                                                                 const xmlChar *id, 
+                                                                 const xmlChar *id,
                                                                  const xmlChar *uri,
                                                                  const xmlChar *type);
 
@@ -65,7 +65,7 @@ XMLSEC_EXPORT xmlNodePtr xmlSecTmplManifestAddReference         (xmlNodePtr mani
  *
  * <enc:EncryptedData> node
  *
- **********************************************************************/ 
+ **********************************************************************/
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataCreate                (xmlDocPtr doc,
                                                                  xmlSecTransformId encMethodId,
                                                                  const xmlChar *id,
@@ -75,7 +75,7 @@ XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataCreate                (xmlDocPtr doc,
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureKeyInfo         (xmlNodePtr encNode,
                                                                  const xmlChar *id);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureEncProperties   (xmlNodePtr encNode,
-                                                                 const xmlChar *id); 
+                                                                 const xmlChar *id);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataAddEncProperty        (xmlNodePtr encNode,
                                                                  const xmlChar *id,
                                                                  const xmlChar *target);
@@ -90,7 +90,7 @@ XMLSEC_EXPORT xmlNodePtr xmlSecTmplCipherReferenceAddTransform  (xmlNodePtr ciph
  *
  * <enc:EncryptedKey> node
  *
- **********************************************************************/ 
+ **********************************************************************/
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceListAddDataReference(xmlNodePtr encNode,
                                                                  const xmlChar *uri);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceListAddKeyReference (xmlNodePtr encNode,
@@ -100,7 +100,7 @@ XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceListAddKeyReference (xmlNodePtr encN
  *
  * <dsig:KeyInfo> node
  *
- **********************************************************************/ 
+ **********************************************************************/
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddKeyName            (xmlNodePtr keyInfoNode,
                                                                  const xmlChar* name);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddKeyValue           (xmlNodePtr keyInfoNode);
@@ -120,7 +120,7 @@ XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddEncryptedKey       (xmlNodePtr keyI
  *
  * <dsig:X509Data> node
  *
- **********************************************************************/ 
+ **********************************************************************/
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddIssuerSerial      (xmlNodePtr x509DataNode);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509IssuerSerialAddIssuerName(xmlNodePtr x509IssuerSerialNode, const xmlChar* issuerName);
 XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509IssuerSerialAddSerialNumber(xmlNodePtr x509IssuerSerialNode, const xmlChar* serial);
@@ -133,24 +133,24 @@ XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddCRL               (xmlNodePtr x509
  *
  * <dsig:Transform> node
  *
- **********************************************************************/ 
+ **********************************************************************/
 XMLSEC_EXPORT int       xmlSecTmplTransformAddHmacOutputLength  (xmlNodePtr transformNode,
                                                                  xmlSecSize bitsLen);
 XMLSEC_EXPORT int       xmlSecTmplTransformAddRsaOaepParam      (xmlNodePtr transformNode,
                                                                  const xmlSecByte *buf,
                                                                  xmlSecSize size);
-XMLSEC_EXPORT int       xmlSecTmplTransformAddXsltStylesheet    (xmlNodePtr transformNode, 
+XMLSEC_EXPORT int       xmlSecTmplTransformAddXsltStylesheet    (xmlNodePtr transformNode,
                                                                  const xmlChar *xslt);
 XMLSEC_EXPORT int       xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode,
-                                                                 const xmlChar *prefixList);                                                     
-XMLSEC_EXPORT int       xmlSecTmplTransformAddXPath             (xmlNodePtr transformNode, 
+                                                                 const xmlChar *prefixList);
+XMLSEC_EXPORT int       xmlSecTmplTransformAddXPath             (xmlNodePtr transformNode,
                                                                  const xmlChar *expression,
                                                                  const xmlChar **nsList);
-XMLSEC_EXPORT int       xmlSecTmplTransformAddXPath2            (xmlNodePtr transformNode, 
+XMLSEC_EXPORT int       xmlSecTmplTransformAddXPath2            (xmlNodePtr transformNode,
                                                                  const xmlChar* type,
                                                                  const xmlChar *expression,
                                                                  const xmlChar **nsList);
-XMLSEC_EXPORT int       xmlSecTmplTransformAddXPointer          (xmlNodePtr transformNode, 
+XMLSEC_EXPORT int       xmlSecTmplTransformAddXPointer          (xmlNodePtr transformNode,
                                                                  const xmlChar *expression,
                                                                  const xmlChar **nsList);
 
diff --git a/include/xmlsec/transforms.h b/include/xmlsec/transforms.h
index 879ec52..6db81f7 100644
--- a/include/xmlsec/transforms.h
+++ b/include/xmlsec/transforms.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
- * The transforms engine 
+ * The transforms engine
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_TRANSFORMS_H__
-#define __XMLSEC_TRANSFORMS_H__    
+#define __XMLSEC_TRANSFORMS_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 #include <libxml/xpath.h>
@@ -24,13 +24,13 @@ extern "C" {
 #include <xmlsec/nodeset.h>
 #include <xmlsec/keys.h>
 
-typedef const struct _xmlSecTransformKlass              xmlSecTransformKlass, 
+typedef const struct _xmlSecTransformKlass              xmlSecTransformKlass,
                                                         *xmlSecTransformId;
 
 /**
  * XMLSEC_TRANSFORM_BINARY_CHUNK:
  *
- * The binary data chunks size. XMLSec processes binary data one chunk 
+ * The binary data chunks size. XMLSec processes binary data one chunk
  * at a time. Changing this impacts xmlsec memory usage and performance.
  */
 #define XMLSEC_TRANSFORM_BINARY_CHUNK                   64
@@ -67,7 +67,7 @@ typedef enum  {
 /**
  * xmlSecTransformMode:
  * @xmlSecTransformModeNone:            the mode is unknown.
- * @xmlSecTransformModePush:            pushing data thru transform. 
+ * @xmlSecTransformModePush:            pushing data thru transform.
  * @xmlSecTransformModePop:             popping data from transform.
  *
  * The transform operation mode
@@ -81,13 +81,13 @@ typedef enum  {
 /**
  * xmlSecTransformOperation:
  * @xmlSecTransformOperationNone:       the operation is unknown.
- * @xmlSecTransformOperationEncode:     the encode operation (for base64 transform).    
+ * @xmlSecTransformOperationEncode:     the encode operation (for base64 transform).
  * @xmlSecTransformOperationDecode:     the decode operation (for base64 transform).
  * @xmlSecTransformOperationSign:       the sign or digest operation.
  * @xmlSecTransformOperationVerify:     the verification of signature or digest operation.
  * @xmlSecTransformOperationEncrypt:    the encryption operation.
  * @xmlSecTransformOperationDecrypt:    the decryption operation.
- * 
+ *
  * The transform operation.
  */
 typedef enum  {
@@ -131,7 +131,7 @@ typedef unsigned int                            xmlSecTransformUriType;
  *
  * The smae document ("#...") but not empty ("") URI type.
  */
-#define xmlSecTransformUriTypeSameDocument      0x0002          
+#define xmlSecTransformUriTypeSameDocument      0x0002
 
 /**
  * xmlSecTransformUriTypeLocal:
@@ -163,9 +163,9 @@ XMLSEC_EXPORT int                       xmlSecTransformUriTypeCheck     (xmlSecT
  *************************************************************************/
 /**
  * xmlSecTransformDataType:
- * 
+ *
  * Transform data type bit mask.
- */ 
+ */
 typedef xmlSecByte                              xmlSecTransformDataType;
 
 /**
@@ -229,8 +229,8 @@ typedef unsigned int                            xmlSecTransformUsage;
  */
 #define xmlSecTransformUsageDigestMethod        0x0004
 
-/** 
- * xmlSecTransformUsageSignatureMethod: 
+/**
+ * xmlSecTransformUsageSignatureMethod:
  *
  * Transform could be used in <dsig:SignatureMethod>.
  */
@@ -257,7 +257,7 @@ typedef unsigned int                            xmlSecTransformUsage;
  *************************************************************************/
 /**
  * xmlSecTransformCtxPreExecuteCallback:
- * @transformCtx:       the pointer to transform's context. 
+ * @transformCtx:       the pointer to transform's context.
  *
  * The callback called after creating transforms chain but before
  * starting data processing. Application can use this callback to
@@ -267,24 +267,24 @@ typedef unsigned int                            xmlSecTransformUsage;
  * Returns: 0 on success and a negative value otherwise (in this case,
  * transforms chain will not be executed and xmlsec processing stops).
  */
-typedef int             (*xmlSecTransformCtxPreExecuteCallback)         (xmlSecTransformCtxPtr transformCtx); 
+typedef int             (*xmlSecTransformCtxPreExecuteCallback)         (xmlSecTransformCtxPtr transformCtx);
 
 /**
  * XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK:
  *
  * If this flag is set then URI ID references are resolved directly
  * without using XPointers. This allows one to sign/verify Visa3D
- * documents that don't follow XML, XPointer and XML DSig specifications. 
+ * documents that don't follow XML, XPointer and XML DSig specifications.
  */
 #define XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK               0x00000001
 
 /**
  * xmlSecTransformCtx:
- * @userData:           the pointer to user data (xmlsec and xmlsec-crypto never 
+ * @userData:           the pointer to user data (xmlsec and xmlsec-crypto never
  *                      touch this).
- * @flags:              the bit mask flags to control transforms execution 
+ * @flags:              the bit mask flags to control transforms execution
  *                      (reserved for the future).
- * @flags2:             the bit mask flags to control transforms execution 
+ * @flags2:             the bit mask flags to control transforms execution
  *                      (reserved for the future).
  * @enabledUris:        the allowed transform data source uri types.
  * @enabledTransforms:  the list of enabled transforms; if list is empty (default)
@@ -293,7 +293,7 @@ typedef int             (*xmlSecTransformCtxPreExecuteCallback)         (xmlSecT
  *                      and right before actual data processing; application
  *                      can use this callback to change transforms parameters,
  *                      insert additional transforms in the chain or do
- *                      additional validation (and abort transform execution 
+ *                      additional validation (and abort transform execution
  *                      if needed).
  * @result:             the pointer to transforms result buffer.
  * @status:             the transforms chain processng status.
@@ -314,7 +314,7 @@ struct _xmlSecTransformCtx {
     xmlSecTransformUriType                      enabledUris;
     xmlSecPtrList                               enabledTransforms;
     xmlSecTransformCtxPreExecuteCallback        preExecCallback;
-    
+
     /* results */
     xmlSecBufferPtr                             result;
     xmlSecTransformStatus                       status;
@@ -354,12 +354,12 @@ XMLSEC_EXPORT int                       xmlSecTransformCtxNodesListRead (xmlSecT
                                                                          xmlSecTransformUsage usage);
 XMLSEC_EXPORT int                       xmlSecTransformCtxPrepare       (xmlSecTransformCtxPtr ctx,
                                                                          xmlSecTransformDataType inputDataType);
-XMLSEC_EXPORT int                       xmlSecTransformCtxBinaryExecute (xmlSecTransformCtxPtr ctx, 
-                                                                         const xmlSecByte* data, 
+XMLSEC_EXPORT int                       xmlSecTransformCtxBinaryExecute (xmlSecTransformCtxPtr ctx,
+                                                                         const xmlSecByte* data,
                                                                          xmlSecSize dataSize);
-XMLSEC_EXPORT int                       xmlSecTransformCtxUriExecute    (xmlSecTransformCtxPtr ctx, 
+XMLSEC_EXPORT int                       xmlSecTransformCtxUriExecute    (xmlSecTransformCtxPtr ctx,
                                                                          const xmlChar* uri);
-XMLSEC_EXPORT int                       xmlSecTransformCtxXmlExecute    (xmlSecTransformCtxPtr ctx, 
+XMLSEC_EXPORT int                       xmlSecTransformCtxXmlExecute    (xmlSecTransformCtxPtr ctx,
                                                                          xmlSecNodeSetPtr nodes);
 XMLSEC_EXPORT int                       xmlSecTransformCtxExecute       (xmlSecTransformCtxPtr ctx,
                                                                          xmlDocPtr doc);
@@ -367,7 +367,7 @@ XMLSEC_EXPORT void                      xmlSecTransformCtxDebugDump     (xmlSecT
                                                                         FILE* output);
 XMLSEC_EXPORT void                      xmlSecTransformCtxDebugXmlDump  (xmlSecTransformCtxPtr ctx,
                                                                          FILE* output);
-        
+
 /**************************************************************************
  *
  * xmlSecTransform
@@ -391,7 +391,7 @@ XMLSEC_EXPORT void                      xmlSecTransformCtxDebugXmlDump  (xmlSecT
  * The transform structure.
  */
 struct _xmlSecTransform {
-    xmlSecTransformId                   id; 
+    xmlSecTransformId                   id;
     xmlSecTransformOperation            operation;
     xmlSecTransformStatus               status;
     xmlNodePtr                          hereNode;
@@ -403,56 +403,56 @@ struct _xmlSecTransform {
     /* binary data */
     xmlSecBuffer                        inBuf;
     xmlSecBuffer                        outBuf;
-        
+
     /* xml data */
     xmlSecNodeSetPtr                    inNodes;
     xmlSecNodeSetPtr                    outNodes;
 
-    /* reserved for the future */    
+    /* reserved for the future */
     void*                               reserved0;
     void*                               reserved1;
 };
 
 XMLSEC_EXPORT xmlSecTransformPtr        xmlSecTransformCreate   (xmlSecTransformId id);
 XMLSEC_EXPORT void                      xmlSecTransformDestroy  (xmlSecTransformPtr transform);
-XMLSEC_EXPORT xmlSecTransformPtr        xmlSecTransformNodeRead (xmlNodePtr node, 
+XMLSEC_EXPORT xmlSecTransformPtr        xmlSecTransformNodeRead (xmlNodePtr node,
                                                                  xmlSecTransformUsage usage,
                                                                  xmlSecTransformCtxPtr transformCtx);
 XMLSEC_EXPORT int                       xmlSecTransformPump     (xmlSecTransformPtr left,
                                                                  xmlSecTransformPtr right,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformSetKey   (xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformSetKey   (xmlSecTransformPtr transform,
                                                                  xmlSecKeyPtr key);
-XMLSEC_EXPORT int                       xmlSecTransformSetKeyReq(xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformSetKeyReq(xmlSecTransformPtr transform,
                                                                  xmlSecKeyReqPtr keyReq);
-XMLSEC_EXPORT int                       xmlSecTransformVerify   (xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformVerify   (xmlSecTransformPtr transform,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform,
                                                                  xmlNodePtr node,
                                                                  xmlSecTransformCtxPtr transformCtx);
 XMLSEC_EXPORT xmlSecTransformDataType   xmlSecTransformGetDataType(xmlSecTransformPtr transform,
                                                                  xmlSecTransformMode mode,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformPushBin  (xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformPushBin  (xmlSecTransformPtr transform,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
                                                                  int final,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformPopBin   (xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformPopBin   (xmlSecTransformPtr transform,
                                                                  xmlSecByte* data,
                                                                  xmlSecSize maxDataSize,
                                                                  xmlSecSize* dataSize,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformPushXml  (xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformPushXml  (xmlSecTransformPtr transform,
                                                                  xmlSecNodeSetPtr nodes,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformPopXml   (xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformPopXml   (xmlSecTransformPtr transform,
                                                                  xmlSecNodeSetPtr* nodes,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformExecute  (xmlSecTransformPtr transform, 
-                                                                 int last, 
+XMLSEC_EXPORT int                       xmlSecTransformExecute  (xmlSecTransformPtr transform,
+                                                                 int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
 XMLSEC_EXPORT void                      xmlSecTransformDebugDump(xmlSecTransformPtr transform,
                                                                  FILE* output);
@@ -480,13 +480,13 @@ XMLSEC_EXPORT void                      xmlSecTransformDebugXmlDump(xmlSecTransf
          (( transform )->id->klassSize >= sizeof(xmlSecTransformKlass)) && \
          (( transform )->id->objSize >= sizeof(xmlSecTransform)) && \
          (( transform )->id->name != NULL))
- 
+
 /**
  * xmlSecTransformCheckType:
  * @transform:          the pointer to transform.
  * @t:                  the transform type.
  *
- * Macro. Returns 1 if the @transform is valid and has specified type @t 
+ * Macro. Returns 1 if the @transform is valid and has specified type @t
  * or 0 otherwise.
  */
 #define xmlSecTransformCheckType(transform, t) \
@@ -498,7 +498,7 @@ XMLSEC_EXPORT void                      xmlSecTransformDebugXmlDump(xmlSecTransf
  * @transform:          the pointer to transform.
  * @i:                  the transform id.
  *
- * Macro. Returns 1 if the @transform is valid and has specified id @i 
+ * Macro. Returns 1 if the @transform is valid and has specified id @i
  * or 0 otherwise.
  */
 #define xmlSecTransformCheckId(transform, i) \
@@ -522,7 +522,7 @@ XMLSEC_EXPORT void                      xmlSecTransformDebugXmlDump(xmlSecTransf
  *
  * Operations on transforms chain
  *
- ************************************************************************/ 
+ ************************************************************************/
 XMLSEC_EXPORT int                       xmlSecTransformConnect  (xmlSecTransformPtr left,
                                                                  xmlSecTransformPtr right,
                                                                  xmlSecTransformCtxPtr transformCtx);
@@ -532,24 +532,24 @@ XMLSEC_EXPORT void                      xmlSecTransformRemove   (xmlSecTransform
  *
  * Default callbacks, most of the transforms can use them
  *
- ************************************************************************/ 
+ ************************************************************************/
 XMLSEC_EXPORT xmlSecTransformDataType   xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform,
                                                                  xmlSecTransformMode mode,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
                                                                  int final,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform,
                                                                  xmlSecByte* data,
                                                                  xmlSecSize maxDataSize,
                                                                  xmlSecSize* dataSize,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform,
                                                                  xmlSecNodeSetPtr nodes,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int                       xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform, 
+XMLSEC_EXPORT int                       xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform,
                                                                  xmlSecNodeSetPtr* nodes,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
@@ -557,17 +557,17 @@ XMLSEC_EXPORT int                       xmlSecTransformDefaultPopXml(xmlSecTrans
  *
  * IO buffers for transforms
  *
- ************************************************************************/ 
-XMLSEC_EXPORT xmlOutputBufferPtr        xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform, 
+ ************************************************************************/
+XMLSEC_EXPORT xmlOutputBufferPtr        xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform,
                                                                  xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT xmlParserInputBufferPtr   xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform, 
+XMLSEC_EXPORT xmlParserInputBufferPtr   xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
 /************************************************************************
  *
  * Transform Klass
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * xmlSecTransformInitializeMethod:
  * @transform:                  the pointer to transform object.
@@ -607,7 +607,7 @@ typedef xmlSecTransformDataType (*xmlSecTransformGetDataTypeMethod)(xmlSecTransf
  * @node:                       the pointer to <dsig:Transform/> node.
  * @transformCtx:               the pointer to transform context object.
  *
- * The transform specific method to read the transform data from 
+ * The transform specific method to read the transform data from
  * the @node.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -636,10 +636,10 @@ typedef int             (*xmlSecTransformNodeWriteMethod)       (xmlSecTransform
  * @keyReq:                     the pointer to key requirements structure.
  *
  * Transform specific method to set transform's key requirements.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-typedef int             (*xmlSecTransformSetKeyRequirementsMethod)(xmlSecTransformPtr transform, 
+typedef int             (*xmlSecTransformSetKeyRequirementsMethod)(xmlSecTransformPtr transform,
                                                                  xmlSecKeyReqPtr keyReq);
 
 /**
@@ -648,10 +648,10 @@ typedef int             (*xmlSecTransformSetKeyRequirementsMethod)(xmlSecTransfo
  * @key:                        the pointer to key.
  *
  * The transform specific method to set the key for use.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-typedef int             (*xmlSecTransformSetKeyMethod)          (xmlSecTransformPtr transform, 
+typedef int             (*xmlSecTransformSetKeyMethod)          (xmlSecTransformPtr transform,
                                                                  xmlSecKeyPtr key);
 
 /**
@@ -665,10 +665,10 @@ typedef int             (*xmlSecTransformSetKeyMethod)          (xmlSecTransform
  * (used by digest and signature transforms). This method sets @status
  * member of the #xmlSecTransform structure to either #xmlSecTransformStatusOk
  * if verification succeeded or #xmlSecTransformStatusFail otherwise.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-typedef int             (*xmlSecTransformVerifyMethod)          (xmlSecTransformPtr transform, 
+typedef int             (*xmlSecTransformVerifyMethod)          (xmlSecTransformPtr transform,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
                                                                  xmlSecTransformCtxPtr transformCtx);
@@ -686,7 +686,7 @@ typedef int             (*xmlSecTransformVerifyMethod)          (xmlSecTransform
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-typedef int             (*xmlSecTransformPushBinMethod)         (xmlSecTransformPtr transform, 
+typedef int             (*xmlSecTransformPushBinMethod)         (xmlSecTransformPtr transform,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
                                                                  int final,
@@ -699,13 +699,13 @@ typedef int             (*xmlSecTransformPushBinMethod)         (xmlSecTransform
  * @dataSize:                   the pointer to returned data size.
  * @transformCtx:               the pointer to transform context object.
  *
- * The transform specific method to pop data from previous transform 
+ * The transform specific method to pop data from previous transform
  * in the chain and return result in the @data buffer. The size of returned
  * data is placed in the @dataSize.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-typedef int             (*xmlSecTransformPopBinMethod)          (xmlSecTransformPtr transform, 
+typedef int             (*xmlSecTransformPopBinMethod)          (xmlSecTransformPtr transform,
                                                                  xmlSecByte* data,
                                                                  xmlSecSize maxDataSize,
                                                                  xmlSecSize* dataSize,
@@ -716,12 +716,12 @@ typedef int             (*xmlSecTransformPopBinMethod)          (xmlSecTransform
  * @nodes:                      the input nodes.
  * @transformCtx:               the pointer to transform context object.
  *
- * The transform specific method to process @nodes and push result to the next 
+ * The transform specific method to process @nodes and push result to the next
  * transform in the chain.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-typedef int             (*xmlSecTransformPushXmlMethod)         (xmlSecTransformPtr transform, 
+typedef int             (*xmlSecTransformPushXmlMethod)         (xmlSecTransformPtr transform,
                                                                  xmlSecNodeSetPtr nodes,
                                                                  xmlSecTransformCtxPtr transformCtx);
 /**
@@ -732,10 +732,10 @@ typedef int             (*xmlSecTransformPushXmlMethod)         (xmlSecTransform
  *
  * The transform specific method to pop data from previous transform in the chain,
  * process the data and return result in @nodes.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-typedef int             (*xmlSecTransformPopXmlMethod)          (xmlSecTransformPtr transform, 
+typedef int             (*xmlSecTransformPopXmlMethod)          (xmlSecTransformPtr transform,
                                                                  xmlSecNodeSetPtr* nodes,
                                                                  xmlSecTransformCtxPtr transformCtx);
 /**
@@ -748,7 +748,7 @@ typedef int             (*xmlSecTransformPopXmlMethod)          (xmlSecTransform
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-typedef int             (*xmlSecTransformExecuteMethod)         (xmlSecTransformPtr transform, 
+typedef int             (*xmlSecTransformExecuteMethod)         (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
@@ -775,7 +775,7 @@ typedef int             (*xmlSecTransformExecuteMethod)         (xmlSecTransform
  *                              implementations of @pushBin, @popBin, @pushXml and @popXml.
  * @reserved0:                  reserved for the future.
  * @reserved1:                  reserved for the future.
- * 
+ *
  * The transform klass desccription structure.
  */
 struct _xmlSecTransformKlass {
@@ -802,11 +802,11 @@ struct _xmlSecTransformKlass {
     xmlSecTransformPopBinMethod         popBin;
     xmlSecTransformPushXmlMethod        pushXml;
     xmlSecTransformPopXmlMethod         popXml;
-    
+
     /* low level method */
     xmlSecTransformExecuteMethod        execute;
 
-    /* reserved for future */ 
+    /* reserved for future */
     void*                               reserved0;
     void*                               reserved1;
 };
@@ -846,7 +846,7 @@ XMLSEC_EXPORT void              xmlSecTransformIdListDebugXmlDump(xmlSecPtrListP
                                                                  FILE* output);
 
 
-/******************************************************************** 
+/********************************************************************
  *
  * XML Sec Library Transform Ids
  *
@@ -862,7 +862,7 @@ XMLSEC_EXPORT void              xmlSecTransformIdListDebugXmlDump(xmlSecPtrListP
  * xmlSecTransformBase64Id:
  *
  * The base64 encode transform klass.
- */ 
+ */
 #define xmlSecTransformBase64Id \
         xmlSecTransformBase64GetKlass()
 XMLSEC_EXPORT xmlSecTransformId xmlSecTransformBase64GetKlass           (void);
@@ -870,7 +870,7 @@ XMLSEC_EXPORT void              xmlSecTransformBase64SetLineSize        (xmlSecT
                                                                          xmlSecSize lineSize);
 /**
  * xmlSecTransformInclC14NId:
- * 
+ *
  * The regular (inclusive) C14N without comments transform klass.
  */
 #define xmlSecTransformInclC14NId \
@@ -879,7 +879,7 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NGetKlass         (void);
 
 /**
  * xmlSecTransformInclC14NWithCommentsId:
- * 
+ *
  * The regular (inclusive) C14N with comments transform klass.
  */
 #define xmlSecTransformInclC14NWithCommentsId \
@@ -888,7 +888,7 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NWithCommentsGetKlass(void
 
 /**
  * xmlSecTransformInclC14N11Id:
- * 
+ *
  * The regular (inclusive) C14N 1.1 without comments transform klass.
  */
 #define xmlSecTransformInclC14N11Id \
@@ -897,7 +897,7 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14N11GetKlass       (void);
 
 /**
  * xmlSecTransformInclC14N11WithCommentsId:
- * 
+ *
  * The regular (inclusive) C14N 1.1 with comments transform klass.
  */
 #define xmlSecTransformInclC14N11WithCommentsId \
@@ -906,7 +906,7 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14N11WithCommentsGetKlass(vo
 
 /**
  * xmlSecTransformExclC14NId
- * 
+ *
  * The exclusive C14N without comments transform klass.
  */
 #define xmlSecTransformExclC14NId \
@@ -915,7 +915,7 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NGetKlass         (void);
 
 /**
  * xmlSecTransformExclC14NWithCommentsId:
- * 
+ *
  * The exclusive C14N with comments transform klass.
  */
 #define xmlSecTransformExclC14NWithCommentsId \
@@ -924,7 +924,7 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NWithCommentsGetKlass(void
 
 /**
  * xmlSecTransformEnvelopedId:
- * 
+ *
  * The "enveloped" transform klass.
  */
 #define xmlSecTransformEnvelopedId \
@@ -933,7 +933,7 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformEnvelopedGetKlass        (void);
 
 /**
  * xmlSecTransformXPathId:
- * 
+ *
  * The XPath transform klass.
  */
 #define xmlSecTransformXPathId \
@@ -942,7 +942,7 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPathGetKlass            (void);
 
 /**
  * xmlSecTransformXPath2Id:
- * 
+ *
  * The XPath2 transform klass.
  */
 #define xmlSecTransformXPath2Id \
@@ -951,7 +951,7 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPath2GetKlass           (void);
 
 /**
  * xmlSecTransformXPointerId:
- * 
+ *
  * The XPointer transform klass.
  */
 #define xmlSecTransformXPointerId \
@@ -964,7 +964,7 @@ XMLSEC_EXPORT int               xmlSecTransformXPointerSetExpr          (xmlSecT
 #ifndef XMLSEC_NO_XSLT
 /**
  * xmlSecTransformXsltId:
- * 
+ *
  * The XSLT transform klass.
  */
 #define xmlSecTransformXsltId \
@@ -974,7 +974,7 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXsltGetKlass             (void);
 
 /**
  * xmlSecTransformRemoveXmlTagsC14NId:
- * 
+ *
  * The "remove all xml tags" transform klass (used before base64 transforms).
  */
 #define xmlSecTransformRemoveXmlTagsC14NId \
@@ -984,9 +984,9 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRemoveXmlTagsC14NGetKlass(void);
 /**
  * xmlSecTransformVisa3DHackId:
  *
- * Selects node subtree by given node id string. The only reason why we need this 
- * is Visa3D protocol. It doesn't follow XML/XPointer/XMLDSig specs and allows 
- * invalid XPointer expressions in the URI attribute. Since we couldn't evaluate 
+ * Selects node subtree by given node id string. The only reason why we need this
+ * is Visa3D protocol. It doesn't follow XML/XPointer/XMLDSig specs and allows
+ * invalid XPointer expressions in the URI attribute. Since we couldn't evaluate
  * such expressions thru XPath/XPointer engine, we need to have this hack here.
  */
 #define xmlSecTransformVisa3DHackId \
diff --git a/include/xmlsec/version.h b/include/xmlsec/version.h
index 93ff884..8c120d4 100644
--- a/include/xmlsec/version.h
+++ b/include/xmlsec/version.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * 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-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_VERSION_H__
-#define __XMLSEC_VERSION_H__    
+#define __XMLSEC_VERSION_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 /**
  * XMLSEC_VERSION:
diff --git a/include/xmlsec/version.h.in b/include/xmlsec/version.h.in
index 28cc318..16bbafa 100644
--- a/include/xmlsec/version.h.in
+++ b/include/xmlsec/version.h.in
@@ -1,19 +1,19 @@
-/** 
+/**
  * 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-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_VERSION_H__
-#define __XMLSEC_VERSION_H__    
+#define __XMLSEC_VERSION_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 /**
  * XMLSEC_VERSION:
diff --git a/include/xmlsec/x509.h b/include/xmlsec/x509.h
index 93ba8e3..e58f37c 100644
--- a/include/xmlsec/x509.h
+++ b/include/xmlsec/x509.h
@@ -1,23 +1,23 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_X509_H__
-#define __XMLSEC_X509_H__    
+#define __XMLSEC_X509_H__
 
 #ifndef XMLSEC_NO_X509
-        
+
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
-#include <stdio.h>              
+#endif /* __cplusplus */
+#include <stdio.h>
 
 #include <libxml/tree.h>
-#include <libxml/parser.h> 
+#include <libxml/parser.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -65,8 +65,8 @@ extern "C" {
  */
 #define XMLSEC_X509DATA_DEFAULT \
         (XMLSEC_X509DATA_CERTIFICATE_NODE | XMLSEC_X509DATA_CRL_NODE)
-            
-XMLSEC_EXPORT int               xmlSecX509DataGetNodeContent    (xmlNodePtr node, 
+
+XMLSEC_EXPORT int               xmlSecX509DataGetNodeContent    (xmlNodePtr node,
                                                                  int deleteChildren,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
 
diff --git a/include/xmlsec/xkms.h b/include/xmlsec/xkms.h
index 9c8c68f..8035035 100644
--- a/include/xmlsec/xkms.h
+++ b/include/xmlsec/xkms.h
@@ -1,26 +1,26 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * "XML Key Management Specification v 2.0" implementation
  *  http://www.w3.org/TR/xkms2/
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_XKMS_H__
-#define __XMLSEC_XKMS_H__    
+#define __XMLSEC_XKMS_H__
 
 #ifndef XMLSEC_NO_XKMS
-        
+
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
-#include <stdio.h>              
+#endif /* __cplusplus */
+#include <stdio.h>
 
 #include <libxml/tree.h>
-#include <libxml/parser.h> 
+#include <libxml/parser.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -35,33 +35,33 @@ extern "C" {
  * Forward declarations. These internal xmlsec library structures are
  * declared in "xmlsec/private/xkms.h" file.
  *
- ************************************************************************/ 
-typedef struct _xmlSecXkmsRespondWithKlass      xmlSecXkmsRespondWithKlass, 
+ ************************************************************************/
+typedef struct _xmlSecXkmsRespondWithKlass      xmlSecXkmsRespondWithKlass,
                                                 *xmlSecXkmsRespondWithId;
 
-typedef struct _xmlSecXkmsServerRequestKlass    xmlSecXkmsServerRequestKlass, 
+typedef struct _xmlSecXkmsServerRequestKlass    xmlSecXkmsServerRequestKlass,
                                                 *xmlSecXkmsServerRequestId;
 
 
 /**
  * xmlSecXkmsResultMajor:
  * @xmlSecXkmsResultMajorSuccess:               The operation succeeded.
- * @xmlSecXkmsResultMajorVersionMismatch:       The service does not support 
- *                                              the protocol version specified 
+ * @xmlSecXkmsResultMajorVersionMismatch:       The service does not support
+ *                                              the protocol version specified
  *                                              in the request.
  * @xmlSecXkmsResultMajorSender:                An error occurred that was due
  *                                              to the message sent by the sender.
  * @xmlSecXkmsResultMajorReceiver:              An error occurred at the receiver.
- * @xmlSecXkmsResultMajorRepresent:             The service has not acted on the 
+ * @xmlSecXkmsResultMajorRepresent:             The service has not acted on the
  *                                              request. In order for the request
- *                                              to be acted upon the request MUST 
+ *                                              to be acted upon the request MUST
  *                                              be represented with the specified
  *                                              nonce in accordance with the two
  *                                              phase protocol.
- * @xmlSecXkmsResultMajorPending:               The request has been accepted 
- *                                              for processing and the service 
+ * @xmlSecXkmsResultMajorPending:               The request has been accepted
+ *                                              for processing and the service
  *                                              will return the result asynchronously.
- * 
+ *
  * The values for ResultMajor attribute.
  */
 typedef enum {
@@ -76,34 +76,34 @@ typedef enum {
 /**
  * xmlSecXkmsResultMinor:
  * @xmlSecXkmsResultMinorNone:                  No minor result code available.
- * @xmlSecXkmsResultMinorNoMatch:               No match was found for the search 
+ * @xmlSecXkmsResultMinorNoMatch:               No match was found for the search
  *                                              prototype provided.
- * @xmlSecXkmsResultMinorTooManyResponses:      The request resulted in the 
- *                                              number of responses that 
- *                                              exceeded either the ResponseLimit 
- *                                              value specified in the request or 
- *                                              some other limit determined by 
- *                                              the service. The service MAY 
- *                                              either return a subset of the 
+ * @xmlSecXkmsResultMinorTooManyResponses:      The request resulted in the
+ *                                              number of responses that
+ *                                              exceeded either the ResponseLimit
+ *                                              value specified in the request or
+ *                                              some other limit determined by
+ *                                              the service. The service MAY
+ *                                              either return a subset of the
  *                                              possible responses or none at all.
- * @xmlSecXkmsResultMinorIncomplete:            Only part of the information 
+ * @xmlSecXkmsResultMinorIncomplete:            Only part of the information
  *                                              requested could be provided.
- * @xmlSecXkmsResultMinorFailure:               The service attempted to perform 
- *                                              the request but the operation 
+ * @xmlSecXkmsResultMinorFailure:               The service attempted to perform
+ *                                              the request but the operation
  *                                              failed for unspecified reasons.
- * @xmlSecXkmsResultMinorRefused:               The operation was refused. The 
- *                                              service did not attempt to 
+ * @xmlSecXkmsResultMinorRefused:               The operation was refused. The
+ *                                              service did not attempt to
  *                                              perform the request.
- * @xmlSecXkmsResultMinorNoAuthentication:      The operation was refused 
- *                                              because the necessary authentication 
+ * @xmlSecXkmsResultMinorNoAuthentication:      The operation was refused
+ *                                              because the necessary authentication
  *                                              information was incorrect or missing.
- * @xmlSecXkmsResultMinorMessageNotSupported:   The receiver does not implement 
+ * @xmlSecXkmsResultMinorMessageNotSupported:   The receiver does not implement
  *                                              the specified operation.
- * @xmlSecXkmsResultMinorUnknownResponseId:     The ResponseId for which pending 
- *                                              status was requested is unknown to 
+ * @xmlSecXkmsResultMinorUnknownResponseId:     The ResponseId for which pending
+ *                                              status was requested is unknown to
  *                                              the service.
- * @xmlSecXkmsResultMinorSynchronous:           The receiver does not support 
- *                                              synchronous processing of this 
+ * @xmlSecXkmsResultMinorSynchronous:           The receiver does not support
+ *                                              synchronous processing of this
  *                                              type of request.
  *
  * The values for ResultMinor attribute.
@@ -121,7 +121,7 @@ typedef enum {
     xmlSecXkmsResultMinorSynchronous
 } xmlSecXkmsResultMinor;
 
-/** 
+/**
  * xmlSecXkmsKeyBindingStatus:
  * @xmlSecXkmsKeyBindingStatusNone:             The key status is not available.
  * @xmlSecXkmsKeyBindingStatusValid:            The key is valid.
@@ -129,7 +129,7 @@ typedef enum {
  * @xmlSecXkmsKeyBindingStatusIndeterminate:    Could not determine key status.
  *
  * The values for key binding StatusValue attribute.
- */ 
+ */
 typedef enum {
     xmlSecXkmsKeyBindingStatusNone,
     xmlSecXkmsKeyBindingStatusValid,
@@ -161,8 +161,8 @@ XMLSEC_EXPORT const xmlChar*     xmlSecXkmsServerFormatToString (xmlSecXkmsServe
  *
  * XKMS requests server side processing klass
  *
- ************************************************************************/ 
-/** 
+ ************************************************************************/
+/**
  * xmlSecXkmsServerCtx:
  * @userData:                   the pointer to user data (xmlsec and xmlsec-crypto libraries
  *                              never touches this).
@@ -172,14 +172,14 @@ XMLSEC_EXPORT const xmlChar*     xmlSecXkmsServerFormatToString (xmlSecXkmsServe
  * @keyInfoWriteCtx:            the writing key context (not used for signature verification).
  * @reserved0:                  reserved for the future.
  * @reserved1:                  reserved for the future.
- * 
+ *
  * XKMS context.
  */
 struct _xmlSecXkmsServerCtx {
     /* these data user can set before performing the operation */
     void*                       userData;
     xmlSecBitMask               flags;
-    xmlSecBitMask               flags2;    
+    xmlSecBitMask               flags2;
     xmlSecKeyInfoCtx            keyInfoReadCtx;
     xmlSecKeyInfoCtx            keyInfoWriteCtx;
     xmlSecPtrList               enabledRespondWithIds;
@@ -187,13 +187,13 @@ struct _xmlSecXkmsServerCtx {
     xmlChar*                    expectedService;
     xmlChar*                    idPrefix;
     xmlSecSize                  idLen;
-        
+
     /* these data are returned */
     xmlSecPtrList               keys;
     xmlSecXkmsResultMajor       resultMajor;
     xmlSecXkmsResultMinor       resultMinor;
     xmlSecXkmsServerRequestId   requestId;
-    xmlChar*                    id;    
+    xmlChar*                    id;
     xmlChar*                    service;
     xmlChar*                    nonce;
     xmlChar*                    originalRequestId;
@@ -209,7 +209,7 @@ struct _xmlSecXkmsServerCtx {
     xmlNodePtr                  firtsMsgExtNode;
     xmlNodePtr                  keyInfoNode;
     xmlSecPtrList               respWithList;
-    
+
     /* reserved for future */
     void*                       reserved0;
     void*                       reserved1;
@@ -238,7 +238,7 @@ XMLSEC_EXPORT xmlNodePtr        xmlSecXkmsServerCtxResponseWrap (xmlSecXkmsServe
                                                                  xmlNodePtr node,
                                                                  xmlSecXkmsServerFormat format,
                                                                  xmlDocPtr doc);
-XMLSEC_EXPORT xmlNodePtr        xmlSecXkmsServerCtxFatalErrorResponseCreate 
+XMLSEC_EXPORT xmlNodePtr        xmlSecXkmsServerCtxFatalErrorResponseCreate
                                                                 (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlSecXkmsServerFormat format,
                                                                  xmlDocPtr doc);
@@ -254,7 +254,7 @@ XMLSEC_EXPORT void              xmlSecXkmsServerCtxDebugXmlDump (xmlSecXkmsServe
  *
  * xmlSecXkmsServerCtxPtr list
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * xmlSecXkmsServerCtxPtrListId:
  *
@@ -268,11 +268,11 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
  *
  * xmlSecXkmsServerCtxFlags
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM
  *
- * If flag is set then we abort if an unknown <xkms:ResponseMechanism/> 
+ * If flag is set then we abort if an unknown <xkms:ResponseMechanism/>
  * value is found.
  */
 #define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM     0x00000001
@@ -280,7 +280,7 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
 /**
  * XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH
  *
- * If flag is set then we abort if an unknown <xkms:RespondWith/> 
+ * If flag is set then we abort if an unknown <xkms:RespondWith/>
  * value is found.
  */
 #define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH           0x00000002
@@ -288,7 +288,7 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
 /**
  * XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE
  *
- * If flag is set then we abort if an unknown <xkms:KeyUsage/> 
+ * If flag is set then we abort if an unknown <xkms:KeyUsage/>
  * value is found.
  */
 #define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE              0x00000004
@@ -297,21 +297,21 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
  *
  * XKMS ResponseMechanism element values.
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT:
  *
- * XKMS ResponseMechanism element value. The requestor is prepared to 
- * accept a response that uses asynchronous processing, i.e. the service 
+ * XKMS ResponseMechanism element value. The requestor is prepared to
+ * accept a response that uses asynchronous processing, i.e. the service
  * MAY return the MajorResult code Pending.
  */
-#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_PENDING                     0x00000001      
+#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_PENDING                     0x00000001
 
 /**
  * XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT:
  *
- * XKMS ResponseMechanism element value. The requestor is prepared to 
- * accept a response that uses the two phase protocol, i.e. the service 
+ * XKMS ResponseMechanism element value. The requestor is prepared to
+ * accept a response that uses the two phase protocol, i.e. the service
  * MAY return the MajorResult code Represent.
  */
 #define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT                   0x00000002
@@ -319,7 +319,7 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
 /**
  * XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE:
  *
- * XKMS ResponseMechanism element value. The requestor is prepared to 
+ * XKMS ResponseMechanism element value. The requestor is prepared to
  * accept a response that carries a <RequestSignatureValue> element.
  */
 #define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE     0x00000004
@@ -328,7 +328,7 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
  *
  * XKMS ResponseLimit element values
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * XMLSEC_XKMS_NO_RESPONSE_LIMIT:
  *
@@ -341,11 +341,11 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
  *
  * XKMS KeyBinding reason values
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * XMLSEC_XKMS_KEY_BINDING_REASON_MASK_ISSUER_TRAST:
  *
- * The issuer of the information on which the key binding is based is 
+ * The issuer of the information on which the key binding is based is
  * considered to be trustworthy by the XKMS service.
  *
  * X.509 Equivalents
@@ -357,7 +357,7 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
 /**
  * XMLSEC_XKMS_KEY_BINDING_REASON_MASK_REVOCATION_STATUS:
  *
- * The XKMS service has affirmatively verified the status of the 
+ * The XKMS service has affirmatively verified the status of the
  * key binding with an authoritative source
  *
  * X.509 Equivalents
@@ -369,12 +369,12 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
 /**
  * XMLSEC_XKMS_KEY_BINDING_REASON_MASK_VALIDITY_INTERVAL:
  *
- * The requested time instant was within the validity interval of 
+ * The requested time instant was within the validity interval of
  * the key binding
  *
  * X.509 Equivalents
  *   - Valid:   The certificate chain was valid at the requested time instant.
- *   - Invalid: The requested time instant was before or after the certificate 
+ *   - Invalid: The requested time instant was before or after the certificate
  *              chain validity interval.
  */
 #define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_VALIDITY_INTERVAL    0x00000004
@@ -382,7 +382,7 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
 /**
  * XMLSEC_XKMS_KEY_BINDING_REASON_MASK_SIGNATURE:
  *
- * Signature on signed data provided by the client in the <Keyinfo> element was 
+ * Signature on signed data provided by the client in the <Keyinfo> element was
  * successfully verified.
  *
  * X.509 Equivalents
@@ -396,7 +396,7 @@ XMLSEC_EXPORT xmlSecPtrListId   xmlSecXkmsServerCtxPtrListGetKlass
  *
  * XKMS RespondWith Klass
  *
- ************************************************************************/ 
+ ************************************************************************/
 XMLSEC_EXPORT xmlSecPtrListPtr  xmlSecXkmsRespondWithIdsGet     (void);
 XMLSEC_EXPORT int               xmlSecXkmsRespondWithIdsInit    (void);
 XMLSEC_EXPORT void              xmlSecXkmsRespondWithIdsShutdown(void);
@@ -426,7 +426,7 @@ XMLSEC_EXPORT int               xmlSecXkmsRespondWithDefaultNodeWrite
  *
  * XKMS RespondWith Klass List
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * xmlSecXkmsRespondWithIdListId:
  *
@@ -444,7 +444,7 @@ XMLSEC_EXPORT int               xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPt
                                                                  xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
 
-/******************************************************************** 
+/********************************************************************
  *
  * XML Sec Library RespondWith Ids
  *
@@ -460,7 +460,7 @@ XMLSEC_EXPORT int               xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPt
  * xmlSecXkmsRespondWithKeyNameId:
  *
  * The respond with KeyName klass.
- */ 
+ */
 #define xmlSecXkmsRespondWithKeyNameId \
         xmlSecXkmsRespondWithKeyNameGetKlass()
 XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithKeyNameGetKlass(void);
@@ -469,7 +469,7 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithKeyNameGetKlass(voi
  * xmlSecXkmsRespondWithKeyValueId:
  *
  * The respond with KeyValue klass.
- */ 
+ */
 #define xmlSecXkmsRespondWithKeyValueId \
         xmlSecXkmsRespondWithKeyValueGetKlass()
 XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithKeyValueGetKlass(void);
@@ -478,7 +478,7 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithKeyValueGetKlass(vo
  * xmlSecXkmsRespondWithPrivateKeyId:
  *
  * The respond with PrivateKey klass.
- */ 
+ */
 #define xmlSecXkmsRespondWithPrivateKeyId \
         xmlSecXkmsRespondWithPrivateKeyGetKlass()
 XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithPrivateKeyGetKlass(void);
@@ -487,7 +487,7 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithPrivateKeyGetKlass(
  * xmlSecXkmsRespondWithRetrievalMethodId:
  *
  * The respond with RetrievalMethod klass.
- */ 
+ */
 #define xmlSecXkmsRespondWithRetrievalMethodId \
         xmlSecXkmsRespondWithRetrievalMethodGetKlass()
 XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithRetrievalMethodGetKlass(void);
@@ -496,7 +496,7 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithRetrievalMethodGetK
  * xmlSecXkmsRespondWithX509CertId:
  *
  * The respond with X509Cert klass.
- */ 
+ */
 #define xmlSecXkmsRespondWithX509CertId \
         xmlSecXkmsRespondWithX509CertGetKlass()
 XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithX509CertGetKlass(void);
@@ -505,7 +505,7 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithX509CertGetKlass(vo
  * xmlSecXkmsRespondWithX509ChainId:
  *
  * The respond with X509Chain klass.
- */ 
+ */
 #define xmlSecXkmsRespondWithX509ChainId \
         xmlSecXkmsRespondWithX509ChainGetKlass()
 XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithX509ChainGetKlass(void);
@@ -514,7 +514,7 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithX509ChainGetKlass(v
  * xmlSecXkmsRespondWithX509CRLId:
  *
  * The respond with X509CRL klass.
- */ 
+ */
 #define xmlSecXkmsRespondWithX509CRLId \
         xmlSecXkmsRespondWithX509CRLGetKlass()
 XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithX509CRLGetKlass(void);
@@ -524,7 +524,7 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithX509CRLGetKlass(voi
  * xmlSecXkmsRespondWithPGPId:
  *
  * The respond with PGP klass.
- */ 
+ */
 #define xmlSecXkmsRespondWithPGPId \
         xmlSecXkmsRespondWithPGPGetKlass()
 XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithPGPGetKlass(void);
@@ -533,7 +533,7 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithPGPGetKlass(void);
  * xmlSecXkmsRespondWithSPKIId:
  *
  * The respond with SPKI klass.
- */ 
+ */
 #define xmlSecXkmsRespondWithSPKIId \
         xmlSecXkmsRespondWithSPKIGetKlass()
 XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithSPKIGetKlass(void);
@@ -543,14 +543,14 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId   xmlSecXkmsRespondWithSPKIGetKlass(void);
  *
  * XKMS ServerRequest Klass
  *
- ************************************************************************/ 
+ ************************************************************************/
 XMLSEC_EXPORT xmlSecPtrListPtr  xmlSecXkmsServerRequestIdsGet   (void);
 XMLSEC_EXPORT int               xmlSecXkmsServerRequestIdsInit  (void);
 XMLSEC_EXPORT void              xmlSecXkmsServerRequestIdsShutdown
                                                                 (void);
 XMLSEC_EXPORT int               xmlSecXkmsServerRequestIdsRegisterDefault
                                                                 (void);
-XMLSEC_EXPORT int               xmlSecXkmsServerRequestIdsRegister      
+XMLSEC_EXPORT int               xmlSecXkmsServerRequestIdsRegister
                                                                 (xmlSecXkmsServerRequestId id);
 XMLSEC_EXPORT int               xmlSecXkmsServerRequestNodeRead (xmlSecXkmsServerRequestId id,
                                                                  xmlSecXkmsServerCtxPtr ctx,
@@ -571,7 +571,7 @@ XMLSEC_EXPORT void              xmlSecXkmsServerRequestDebugXmlDump
  *
  * XKMS ServerRequest Klass List
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * xmlSecXkmsServerRequestIdListId:
  *
@@ -601,7 +601,7 @@ XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestIdListFindByNode
  * xmlSecXkmsServerRequestResultId:
  *
  * The Result response klass.
- */ 
+ */
 #define xmlSecXkmsServerRequestResultId \
         xmlSecXkmsServerRequestResultGetKlass()
 XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestResultGetKlass(void);
@@ -610,7 +610,7 @@ XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestResultGetKlass(vo
  * xmlSecXkmsServerRequestStatusId:
  *
  * The StatusRequest klass.
- */ 
+ */
 #define xmlSecXkmsServerRequestStatusId \
         xmlSecXkmsServerRequestStatusGetKlass()
 XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestStatusGetKlass(void);
@@ -619,7 +619,7 @@ XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestStatusGetKlass(vo
  * xmlSecXkmsServerRequestCompoundId:
  *
  * The CompoundRequest klass.
- */ 
+ */
 #define xmlSecXkmsServerRequestCompoundId \
         xmlSecXkmsServerRequestCompoundGetKlass()
 XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestCompoundGetKlass(void);
@@ -628,7 +628,7 @@ XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestCompoundGetKlass(
  * xmlSecXkmsServerRequestLocateId:
  *
  * The LocateRequest klass.
- */ 
+ */
 #define xmlSecXkmsServerRequestLocateId \
         xmlSecXkmsServerRequestLocateGetKlass()
 XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestLocateGetKlass(void);
@@ -637,7 +637,7 @@ XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestLocateGetKlass(vo
  * xmlSecXkmsServerRequestValidateId:
  *
  * The ValidateRequest klass.
- */ 
+ */
 #define xmlSecXkmsServerRequestValidateId \
         xmlSecXkmsServerRequestValidateGetKlass()
 XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestValidateGetKlass(void);
diff --git a/include/xmlsec/xmldsig.h b/include/xmlsec/xmldsig.h
index 6c3a332..689980b 100644
--- a/include/xmlsec/xmldsig.h
+++ b/include/xmlsec/xmldsig.h
@@ -1,26 +1,26 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * "XML Digital Signature" implementation
  *  http://www.w3.org/TR/xmldsig-core/
  *  http://www.w3.org/Signature/Overview.html
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_XMLDSIG_H__
-#define __XMLSEC_XMLDSIG_H__    
+#define __XMLSEC_XMLDSIG_H__
 
 #ifndef XMLSEC_NO_XMLDSIG
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
-#include <libxml/parser.h> 
+#include <libxml/parser.h>
 
 
 #include <xmlsec/xmlsec.h>
@@ -90,7 +90,7 @@ typedef enum {
  *
  * If this flag is set then URI ID references are resolved directly
  * without using XPointers. This allows one to sign/verify Visa3D
- * documents that don't follow XML, XPointer and XML DSig specifications. 
+ * documents that don't follow XML, XPointer and XML DSig specifications.
  */
 #define XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK                       0x00000010
 
@@ -121,12 +121,12 @@ typedef enum {
  *                              (valid only if #XMLSEC_DSIG_FLAGS_STORE_SIGNATURE flag is set).
  * @signValueNode:              the pointer to <dsig:SignatureValue/> node.
  * @id:                         the pointer to Id attribute of <dsig:Signature/> node.
- * @signedInfoReferences:       the list of references in <dsig:SignedInfo/> node.              
+ * @signedInfoReferences:       the list of references in <dsig:SignedInfo/> node.
  * @manifestReferences:         the list of references in <dsig:Manifest/> nodes.
  * @reserved0:                  reserved for the future.
  * @reserved1:                  reserved for the future.
  *
- * XML DSig processing context. 
+ * XML DSig processing context.
  */
 struct _xmlSecDSigCtx {
     /* these data user can set before performing the operation */
@@ -142,7 +142,7 @@ struct _xmlSecDSigCtx {
     xmlSecTransformId           defSignMethodId;
     xmlSecTransformId           defC14NMethodId;
     xmlSecTransformId           defDigestMethodId;
-        
+
     /* these data are returned */
     xmlSecKeyPtr                signKey;
     xmlSecTransformOperation    operation;
@@ -152,14 +152,14 @@ struct _xmlSecDSigCtx {
     xmlSecTransformPtr          c14nMethod;
     xmlSecTransformPtr          preSignMemBufMethod;
     xmlNodePtr                  signValueNode;
-    xmlChar*                    id;    
+    xmlChar*                    id;
     xmlSecPtrList               signedInfoReferences;
     xmlSecPtrList               manifestReferences;
 
     /* reserved for future */
     void*                       reserved0;
-    void*                       reserved1;    
-};                                              
+    void*                       reserved1;
+};
 
 /* constructor/destructor */
 XMLSEC_EXPORT xmlSecDSigCtxPtr  xmlSecDSigCtxCreate             (xmlSecKeysMngrPtr keysMngr);
@@ -191,8 +191,8 @@ XMLSEC_EXPORT void              xmlSecDSigCtxDebugXmlDump       (xmlSecDSigCtxPt
  * xmlSecDSigReferenceOrigin:
  * @xmlSecDSigReferenceOriginSignedInfo:reference in <dsig:SignedInfo> node.
  * @xmlSecDSigReferenceOriginManifest:  reference <dsig:Manifest> node.
- * 
- * The possible <dsig:Reference/> node locations: in the <dsig:SignedInfo/> 
+ *
+ * The possible <dsig:Reference/> node locations: in the <dsig:SignedInfo/>
  * node or in the <dsig:Manifest/> node.
  */
 typedef enum  {
@@ -214,9 +214,9 @@ typedef enum  {
  *                              (valid only if either
  *                              #XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES or
  *                              #XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES flags are set).
- * @id:                         the <dsig:Reference/> node ID attribute. 
- * @uri:                        the <dsig:Reference/> node URI attribute. 
- * @type:                       the <dsig:Reference/> node Type attribute. 
+ * @id:                         the <dsig:Reference/> node ID attribute.
+ * @uri:                        the <dsig:Reference/> node URI attribute.
+ * @type:                       the <dsig:Reference/> node Type attribute.
  * @reserved0:                  reserved for the future.
  * @reserved1:                  reserved for the future.
  *
@@ -235,10 +235,10 @@ struct _xmlSecDSigReferenceCtx {
     xmlChar*                    id;
     xmlChar*                    uri;
     xmlChar*                    type;
-    
+
      /* reserved for future */
     void*                       reserved0;
-    void*                       reserved1;    
+    void*                       reserved1;
 };
 
 XMLSEC_EXPORT xmlSecDSigReferenceCtxPtr xmlSecDSigReferenceCtxCreate(xmlSecDSigCtxPtr dsigCtx,
@@ -246,9 +246,9 @@ XMLSEC_EXPORT xmlSecDSigReferenceCtxPtr xmlSecDSigReferenceCtxCreate(xmlSecDSigC
 XMLSEC_EXPORT void              xmlSecDSigReferenceCtxDestroy   (xmlSecDSigReferenceCtxPtr dsigRefCtx);
 XMLSEC_EXPORT int               xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx,
                                                                 xmlSecDSigCtxPtr dsigCtx,
-                                                                xmlSecDSigReferenceOrigin origin); 
+                                                                xmlSecDSigReferenceOrigin origin);
 XMLSEC_EXPORT void              xmlSecDSigReferenceCtxFinalize  (xmlSecDSigReferenceCtxPtr dsigRefCtx);
-XMLSEC_EXPORT int               xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, 
+XMLSEC_EXPORT int               xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx,
                                                                   xmlNodePtr node);
 XMLSEC_EXPORT xmlSecBufferPtr   xmlSecDSigReferenceCtxGetPreDigestBuffer
                                                                 (xmlSecDSigReferenceCtxPtr dsigRefCtx);
diff --git a/include/xmlsec/xmlenc.h b/include/xmlsec/xmlenc.h
index a21fe99..8f97277 100644
--- a/include/xmlsec/xmlenc.h
+++ b/include/xmlsec/xmlenc.h
@@ -1,26 +1,26 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * "XML Encryption" implementation
  *  http://www.w3.org/TR/xmlenc-core
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_XMLENC_H__
-#define __XMLSEC_XMLENC_H__    
+#define __XMLSEC_XMLENC_H__
 
 #ifndef XMLSEC_NO_XMLENC
-        
+
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
-#include <stdio.h>              
+#endif /* __cplusplus */
+#include <stdio.h>
 
 #include <libxml/tree.h>
-#include <libxml/parser.h> 
+#include <libxml/parser.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -29,8 +29,8 @@ extern "C" {
 #include <xmlsec/keyinfo.h>
 #include <xmlsec/transforms.h>
 
-/** 
- * xmlEncCtxMode: 
+/**
+ * xmlEncCtxMode:
  * @xmlEncCtxModeEncryptedData: the <enc:EncryptedData/> element procesing.
  * @xmlEncCtxModeEncryptedKey:  the <enc:EncryptedKey/> element processing.
  *
@@ -49,7 +49,7 @@ typedef enum {
  */
 #define XMLSEC_ENC_RETURN_REPLACED_NODE                 0x00000001
 
-/** 
+/**
  * xmlSecEncCtx:
  * @userData:                   the pointer to user data (xmlsec and xmlsec-crypto libraries
  *                              never touches this).
@@ -77,7 +77,7 @@ typedef enum {
  * @mimeType:                   the MimeType attribute of <enc:EncryptedData/>
  *                              or <enc:EncryptedKey/> node.
  * @encoding:                   the Encoding attributeof <enc:EncryptedData/>
- *                              or <enc:EncryptedKey/> node. 
+ *                              or <enc:EncryptedKey/> node.
  * @recipient:                  the Recipient attribute of <enc:EncryptedKey/> node..
  * @carriedKeyName:             the CarriedKeyName attribute of <enc:EncryptedKey/> node.
  * @encDataNode:                the pointer to <enc:EncryptedData/>
@@ -86,14 +86,14 @@ typedef enum {
  * @keyInfoNode:                the pointer to <enc:KeyInfo/> node.
  * @cipherValueNode:            the pointer to <enc:CipherValue/> node.
  * @reserved1:                  reserved for the future.
- * 
+ *
  * XML Encrypiton context.
  */
 struct _xmlSecEncCtx {
     /* these data user can set before performing the operation */
     void*                       userData;
     unsigned int                flags;
-    unsigned int                flags2;    
+    unsigned int                flags2;
     xmlEncCtxMode               mode;
     xmlSecKeyInfoCtx            keyInfoReadCtx;
     xmlSecKeyInfoCtx            keyInfoWriteCtx;
@@ -107,8 +107,8 @@ struct _xmlSecEncCtx {
     int                         resultBase64Encoded;
     int                         resultReplaced;
     xmlSecTransformPtr          encMethod;
-                
-    /* attributes from EncryptedData or EncryptedKey */    
+
+    /* attributes from EncryptedData or EncryptedKey */
     xmlChar*                    id;
     xmlChar*                    type;
     xmlChar*                    mimeType;
@@ -121,7 +121,7 @@ struct _xmlSecEncCtx {
     xmlNodePtr                  encMethodNode;
     xmlNodePtr                  keyInfoNode;
     xmlNodePtr                  cipherValueNode;
-        
+
     xmlNodePtr                  replacedNodeList; /* the pointer to the replaced node */
     void*                       reserved1;        /* reserved for future */
 };
diff --git a/include/xmlsec/xmlsec.h b/include/xmlsec/xmlsec.h
index 4c267f7..25a9a79 100644
--- a/include/xmlsec/xmlsec.h
+++ b/include/xmlsec/xmlsec.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * General functions and forward declarations.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_H__
-#define __XMLSEC_H__    
+#define __XMLSEC_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <libxml/tree.h>
 
@@ -58,25 +58,25 @@ typedef void*                                   xmlSecPtr;
  * Forward declarations
  *
  ***********************************************************************/
-typedef struct _xmlSecKeyData                   xmlSecKeyData, *xmlSecKeyDataPtr; 
-typedef struct _xmlSecKeyDataStore              xmlSecKeyDataStore, *xmlSecKeyDataStorePtr; 
-typedef struct _xmlSecKeyInfoCtx                xmlSecKeyInfoCtx, *xmlSecKeyInfoCtxPtr; 
-typedef struct _xmlSecKey                       xmlSecKey, *xmlSecKeyPtr; 
-typedef struct _xmlSecKeyStore                  xmlSecKeyStore, *xmlSecKeyStorePtr; 
-typedef struct _xmlSecKeysMngr                  xmlSecKeysMngr, *xmlSecKeysMngrPtr; 
-typedef struct _xmlSecTransform                 xmlSecTransform, *xmlSecTransformPtr; 
-typedef struct _xmlSecTransformCtx              xmlSecTransformCtx, *xmlSecTransformCtxPtr; 
+typedef struct _xmlSecKeyData                   xmlSecKeyData, *xmlSecKeyDataPtr;
+typedef struct _xmlSecKeyDataStore              xmlSecKeyDataStore, *xmlSecKeyDataStorePtr;
+typedef struct _xmlSecKeyInfoCtx                xmlSecKeyInfoCtx, *xmlSecKeyInfoCtxPtr;
+typedef struct _xmlSecKey                       xmlSecKey, *xmlSecKeyPtr;
+typedef struct _xmlSecKeyStore                  xmlSecKeyStore, *xmlSecKeyStorePtr;
+typedef struct _xmlSecKeysMngr                  xmlSecKeysMngr, *xmlSecKeysMngrPtr;
+typedef struct _xmlSecTransform                 xmlSecTransform, *xmlSecTransformPtr;
+typedef struct _xmlSecTransformCtx              xmlSecTransformCtx, *xmlSecTransformCtxPtr;
 
 #ifndef XMLSEC_NO_XMLDSIG
-typedef struct _xmlSecDSigCtx                   xmlSecDSigCtx, *xmlSecDSigCtxPtr; 
+typedef struct _xmlSecDSigCtx                   xmlSecDSigCtx, *xmlSecDSigCtxPtr;
 #endif /* XMLSEC_NO_XMLDSIG */
 
 #ifndef XMLSEC_NO_XMLENC
-typedef struct _xmlSecEncCtx                    xmlSecEncCtx, *xmlSecEncCtxPtr; 
+typedef struct _xmlSecEncCtx                    xmlSecEncCtx, *xmlSecEncCtxPtr;
 #endif /* XMLSEC_NO_XMLENC */
 
 #ifndef XMLSEC_NO_XKMS
-typedef struct _xmlSecXkmsServerCtx             xmlSecXkmsServerCtx, *xmlSecXkmsServerCtxPtr; 
+typedef struct _xmlSecXkmsServerCtx             xmlSecXkmsServerCtx, *xmlSecXkmsServerCtxPtr;
 #endif /* XMLSEC_NO_XKMS */
 
 XMLSEC_EXPORT int       xmlSecInit              (void);
@@ -89,17 +89,17 @@ XMLSEC_EXPORT int       xmlSecShutdown          (void);
  * Version checking
  *
  ***********************************************************************/
-/** 
+/**
  * xmlSecCheckVersionExact:
  *
- * Macro. Returns 1 if the loaded xmlsec library version exactly matches 
+ * Macro. Returns 1 if the loaded xmlsec library version exactly matches
  * the one used to compile the caller, 0 if it does not or a negative
  * value if an error occurs.
  */
 #define xmlSecCheckVersionExact()       \
     xmlSecCheckVersionExt(XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR, xmlSecCheckVersionExactMatch)
 
-/** 
+/**
  * xmlSecCheckVersion:
  *
  * Macro. Returns 1 if the loaded xmlsec library version ABI compatible with
@@ -121,9 +121,9 @@ typedef enum {
     xmlSecCheckVersionABICompatible
 } xmlSecCheckVersionMode;
 
-XMLSEC_EXPORT int       xmlSecCheckVersionExt   (int major, 
-                                                 int minor, 
-                                                 int subminor, 
+XMLSEC_EXPORT int       xmlSecCheckVersionExt   (int major,
+                                                 int minor,
+                                                 int subminor,
                                                  xmlSecCheckVersionMode mode);
 
 /**
diff --git a/include/xmlsec/xmltree.h b/include/xmlsec/xmltree.h
index 55a8df2..c75e51e 100644
--- a/include/xmlsec/xmltree.h
+++ b/include/xmlsec/xmltree.h
@@ -1,19 +1,19 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Common XML utility functions
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_TREE_H__
-#define __XMLSEC_TREE_H__    
+#define __XMLSEC_TREE_H__
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* __cplusplus */ 
+#endif /* __cplusplus */
 
 #include <stdio.h>
 
@@ -31,28 +31,28 @@ extern "C" {
     (((node)) ? ((const char*)((node)->name)) : NULL)
 
 XMLSEC_EXPORT const xmlChar*    xmlSecGetNodeNsHref     (const xmlNodePtr cur);
-XMLSEC_EXPORT int               xmlSecCheckNodeName     (const xmlNodePtr cur, 
-                                                         const xmlChar *name, 
+XMLSEC_EXPORT int               xmlSecCheckNodeName     (const xmlNodePtr cur,
+                                                         const xmlChar *name,
                                                          const xmlChar *ns);
 XMLSEC_EXPORT xmlNodePtr        xmlSecGetNextElementNode(xmlNodePtr cur);
 XMLSEC_EXPORT xmlNodePtr        xmlSecFindChild         (const xmlNodePtr parent,
                                                          const xmlChar *name,
                                                          const xmlChar *ns);
-XMLSEC_EXPORT xmlNodePtr        xmlSecFindParent        (const xmlNodePtr cur, 
-                                                         const xmlChar *name, 
+XMLSEC_EXPORT xmlNodePtr        xmlSecFindParent        (const xmlNodePtr cur,
+                                                         const xmlChar *name,
                                                          const xmlChar *ns);
 XMLSEC_EXPORT xmlNodePtr        xmlSecFindNode          (const xmlNodePtr parent,
                                                          const xmlChar *name,
                                                          const xmlChar *ns);
-XMLSEC_EXPORT xmlNodePtr        xmlSecAddChild          (xmlNodePtr parent, 
+XMLSEC_EXPORT xmlNodePtr        xmlSecAddChild          (xmlNodePtr parent,
                                                          const xmlChar *name,
                                                          const xmlChar *ns);
-XMLSEC_EXPORT xmlNodePtr        xmlSecAddChildNode      (xmlNodePtr parent, 
+XMLSEC_EXPORT xmlNodePtr        xmlSecAddChildNode      (xmlNodePtr parent,
                                                          xmlNodePtr child);
-XMLSEC_EXPORT xmlNodePtr        xmlSecAddNextSibling    (xmlNodePtr node, 
+XMLSEC_EXPORT xmlNodePtr        xmlSecAddNextSibling    (xmlNodePtr node,
                                                          const xmlChar *name,
                                                          const xmlChar *ns);
-XMLSEC_EXPORT xmlNodePtr        xmlSecAddPrevSibling    (xmlNodePtr node, 
+XMLSEC_EXPORT xmlNodePtr        xmlSecAddPrevSibling    (xmlNodePtr node,
                                                          const xmlChar *name,
                                                          const xmlChar *ns);
 
@@ -69,11 +69,11 @@ XMLSEC_EXPORT int               xmlSecReplaceContentAndReturn
                                                          xmlNodePtr newNode,
                                                          xmlNodePtr* replaced);
 XMLSEC_EXPORT int               xmlSecReplaceNodeBuffer (xmlNodePtr node,
-                                                         const xmlSecByte *buffer, 
+                                                         const xmlSecByte *buffer,
                                                          xmlSecSize size);
 XMLSEC_EXPORT int               xmlSecReplaceNodeBufferAndReturn
                                                         (xmlNodePtr node,
-                                                         const xmlSecByte *buffer, 
+                                                         const xmlSecByte *buffer,
                                                          xmlSecSize size,
                                                          xmlNodePtr* replaced);
 XMLSEC_EXPORT int               xmlSecNodeEncodeAndSetContent
@@ -104,7 +104,7 @@ XMLSEC_EXPORT int               xmlSecPrintXmlString    (FILE * fd,
 /**
  * xmlSecIsHex:
  * @c:                  the character.
- * 
+ *
  * Macro. Returns 1 if @c is a hex digit or 0 other wise.
  */
 #define xmlSecIsHex(c) \
@@ -129,12 +129,12 @@ XMLSEC_EXPORT int               xmlSecPrintXmlString    (FILE * fd,
  *
  ************************************************************************/
 
-/** 
+/**
  * xmlSecQName2IntegerInfo:
  * @qnameHref:          the QName href
  * @qnameLocalPart:     the QName local
  * @intValue:           the integer value
- * 
+ *
  * QName <-> Integer conversion definition.
  */
 typedef struct _xmlSecQName2IntegerInfo         xmlSecQName2IntegerInfo, *xmlSecQName2IntegerInfoPtr;
@@ -151,14 +151,14 @@ struct _xmlSecQName2IntegerInfo {
  */
 typedef const xmlSecQName2IntegerInfo *         xmlSecQName2IntegerInfoConstPtr;
 
-XMLSEC_EXPORT xmlSecQName2IntegerInfoConstPtr xmlSecQName2IntegerGetInfo        
+XMLSEC_EXPORT xmlSecQName2IntegerInfoConstPtr xmlSecQName2IntegerGetInfo
                                                                 (xmlSecQName2IntegerInfoConstPtr info,
                                                                  int intValue);
 XMLSEC_EXPORT int               xmlSecQName2IntegerGetInteger   (xmlSecQName2IntegerInfoConstPtr info,
                                                                  const xmlChar* qnameHref,
                                                                  const xmlChar* qnameLocalPart,
                                                                  int* intValue);
-XMLSEC_EXPORT int               xmlSecQName2IntegerGetIntegerFromString 
+XMLSEC_EXPORT int               xmlSecQName2IntegerGetIntegerFromString
                                                                 (xmlSecQName2IntegerInfoConstPtr info,
                                                                  xmlNodePtr node,
                                                                  const xmlChar* qname,
@@ -198,19 +198,19 @@ XMLSEC_EXPORT void              xmlSecQName2IntegerDebugXmlDump(xmlSecQName2Inte
  *
  ************************************************************************/
 
-/** 
+/**
  * xmlSecBitMask:
- * 
+ *
  * Bitmask datatype.
  */
 typedef unsigned int                                    xmlSecBitMask;
 
-/** 
+/**
  * xmlSecQName2BitMaskInfo:
  * @qnameHref:          the QName href
  * @qnameLocalPart:     the QName local
  * @mask:               the bitmask value
- * 
+ *
  * QName <-> Bitmask conversion definition.
  */
 typedef struct _xmlSecQName2BitMaskInfo         xmlSecQName2BitMaskInfo, *xmlSecQName2BitMaskInfoPtr;
@@ -221,14 +221,14 @@ struct _xmlSecQName2BitMaskInfo {
     xmlSecBitMask       mask;
 };
 
-/** 
+/**
  * xmlSecQName2BitMaskInfoConstPtr:
- * 
+ *
  * Pointer to constant QName <-> Bitmask conversion definition.
  */
 typedef const xmlSecQName2BitMaskInfo*          xmlSecQName2BitMaskInfoConstPtr;
 
-XMLSEC_EXPORT xmlSecQName2BitMaskInfoConstPtr xmlSecQName2BitMaskGetInfo        
+XMLSEC_EXPORT xmlSecQName2BitMaskInfoConstPtr xmlSecQName2BitMaskGetInfo
                                                                 (xmlSecQName2BitMaskInfoConstPtr info,
                                                                  xmlSecBitMask mask);
 XMLSEC_EXPORT int               xmlSecQName2BitMaskGetBitMask   (xmlSecQName2BitMaskInfoConstPtr info,
@@ -241,7 +241,7 @@ XMLSEC_EXPORT int               xmlSecQName2BitMaskNodesRead    (xmlSecQName2Bit
                                                                  const xmlChar* nodeNs,
                                                                  int stopOnUnknown,
                                                                  xmlSecBitMask* mask);
-XMLSEC_EXPORT int               xmlSecQName2BitMaskGetBitMaskFromString 
+XMLSEC_EXPORT int               xmlSecQName2BitMaskGetBitMaskFromString
                                                                 (xmlSecQName2BitMaskInfoConstPtr info,
                                                                  xmlNodePtr node,
                                                                  const xmlChar* qname,
@@ -264,7 +264,7 @@ XMLSEC_EXPORT void              xmlSecQName2BitMaskDebugXmlDump(xmlSecQName2BitM
                                                                  const xmlChar* name,
                                                                  FILE* output);
 
-                                                                 
+
 
 
 #ifdef __cplusplus
diff --git a/src/app.c b/src/app.c
index 61d3c27..925c24b 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1,10 +1,10 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -29,7 +29,7 @@
 #include <xmlsec/private.h>
 #include <xmlsec/errors.h>
 
-                        
+
 /******************************************************************************
  *
  * Crypto Init/shutdown
@@ -37,12 +37,12 @@
  *****************************************************************************/
 /**
  * xmlSecCryptoInit:
- * 
- * XMLSec library specific crypto engine initialization. 
+ *
+ * XMLSec library specific crypto engine initialization.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecCryptoInit(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoInit == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -52,18 +52,18 @@ xmlSecCryptoInit(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoInit());
 }
 
 /**
  * xmlSecCryptoShutdown:
- * 
- * XMLSec library specific crypto engine shutdown. 
+ *
+ * XMLSec library specific crypto engine shutdown.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecCryptoShutdown(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoShutdown == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -73,7 +73,7 @@ xmlSecCryptoShutdown(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoShutdown());
 }
 
@@ -85,7 +85,7 @@ xmlSecCryptoShutdown(void) {
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoKeysMngrInit == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -95,7 +95,7 @@ xmlSecCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoKeysMngrInit(mngr));
 }
 
@@ -104,16 +104,16 @@ xmlSecCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) {
  * Key data ids
  *
  *****************************************************************************/
-/** 
+/**
  * xmlSecKeyDataAesGetKlass:
- * 
+ *
  * The AES key data klass.
  *
  * Returns: AES key data klass or NULL if an error occurs
  * (xmlsec-crypto library is not loaded or the AES key data
  * klass is not implemented).
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataAesGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataAesGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -123,20 +123,20 @@ xmlSecKeyDataAesGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecKeyDataIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->keyDataAesGetKlass());
 }
 
-/** 
+/**
  * xmlSecKeyDataDesGetKlass:
- * 
+ *
  * The DES key data klass.
  *
  * Returns: DES key data klass or NULL if an error occurs
  * (xmlsec-crypto library is not loaded or the DES key data
  * klass is not implemented).
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataDesGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataDesGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -146,20 +146,20 @@ xmlSecKeyDataDesGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecKeyDataIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->keyDataDesGetKlass());
 }
 
-/** 
+/**
  * xmlSecKeyDataDsaGetKlass:
- * 
+ *
  * The DSA key data klass.
  *
  * Returns: DSA key data klass or NULL if an error occurs
  * (xmlsec-crypto library is not loaded or the DSA key data
  * klass is not implemented).
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataDsaGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataDsaGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -169,20 +169,20 @@ xmlSecKeyDataDsaGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecKeyDataIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->keyDataDsaGetKlass());
 }
 
-/** 
+/**
  * xmlSecKeyDataGost2001GetKlass:
- * 
+ *
  * The GOST2001 key data klass.
  *
  * Returns: GOST2001 key data klass or NULL if an error occurs
  * (xmlsec-crypto library is not loaded or the GOST2001 key data
  * klass is not implemented).
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataGost2001GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataGost2001GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -192,20 +192,20 @@ xmlSecKeyDataGost2001GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecKeyDataIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->keyDataGost2001GetKlass());
 }
 
-/** 
+/**
  * xmlSecKeyDataHmacGetKlass:
- * 
+ *
  * The HMAC key data klass.
  *
  * Returns: HMAC key data klass or NULL if an error occurs
  * (xmlsec-crypto library is not loaded or the HMAC key data
  * klass is not implemented).
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataHmacGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataHmacGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -215,20 +215,20 @@ xmlSecKeyDataHmacGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecKeyDataIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->keyDataHmacGetKlass());
 }
 
-/** 
+/**
  * xmlSecKeyDataRsaGetKlass:
- * 
+ *
  * The RSA key data klass.
  *
  * Returns: RSA key data klass or NULL if an error occurs
  * (xmlsec-crypto library is not loaded or the RSA key data
  * klass is not implemented).
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataRsaGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataRsaGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -238,20 +238,20 @@ xmlSecKeyDataRsaGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecKeyDataIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->keyDataRsaGetKlass());
 }
 
-/** 
+/**
  * xmlSecKeyDataX509GetKlass:
- * 
+ *
  * The X509 key data klass.
  *
  * Returns: X509 key data klass or NULL if an error occurs
  * (xmlsec-crypto library is not loaded or the X509 key data
  * klass is not implemented).
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataX509GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataX509GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -261,20 +261,20 @@ xmlSecKeyDataX509GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecKeyDataIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->keyDataX509GetKlass());
 }
 
-/** 
+/**
  * xmlSecKeyDataRawX509CertGetKlass:
- * 
+ *
  * The raw X509 cert key data klass.
  *
  * Returns: raw x509 cert key data klass or NULL if an error occurs
  * (xmlsec-crypto library is not loaded or the raw X509 cert key data
  * klass is not implemented).
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataRawX509CertGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataRawX509CertGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -284,7 +284,7 @@ xmlSecKeyDataRawX509CertGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecKeyDataIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->keyDataRawX509CertGetKlass());
 }
 
@@ -293,16 +293,16 @@ xmlSecKeyDataRawX509CertGetKlass(void) {
  * Key data store ids
  *
  *****************************************************************************/
-/** 
+/**
  * xmlSecX509StoreGetKlass:
- * 
+ *
  * The X509 certificates key data store klass.
  *
- * Returns: pointer to X509 certificates key data store klass or NULL if 
- * an error occurs (xmlsec-crypto library is not loaded or the raw X509 
+ * Returns: pointer to X509 certificates key data store klass or NULL if
+ * an error occurs (xmlsec-crypto library is not loaded or the raw X509
  * cert key data klass is not implemented).
  */
-xmlSecKeyDataStoreId 
+xmlSecKeyDataStoreId
 xmlSecX509StoreGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->x509StoreGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -312,7 +312,7 @@ xmlSecX509StoreGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecKeyStoreIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->x509StoreGetKlass());
 }
 
@@ -323,14 +323,14 @@ xmlSecX509StoreGetKlass(void) {
  *****************************************************************************/
 /**
  * xmlSecTransformAes128CbcGetKlass:
- * 
+ *
  * AES 128 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 128 CBC encryption transform or NULL if an error
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecTransformAes128CbcGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformAes128CbcGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -340,20 +340,20 @@ xmlSecTransformAes128CbcGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformAes128CbcGetKlass());
 }
 
 /**
  * xmlSecTransformAes192CbcGetKlass:
- * 
+ *
  * AES 192 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 192 CBC encryption transform or NULL if an error
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecTransformAes192CbcGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformAes192CbcGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -363,20 +363,20 @@ xmlSecTransformAes192CbcGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformAes192CbcGetKlass());
 }
 
 /**
  * xmlSecTransformAes256CbcGetKlass:
- * 
+ *
  * AES 256 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 256 CBC encryption transform or NULL if an error
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecTransformAes256CbcGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformAes256CbcGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -386,11 +386,11 @@ xmlSecTransformAes256CbcGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformAes256CbcGetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformKWAes128GetKlass:
  *
  * The AES-128 kew wrapper transform klass.
@@ -399,8 +399,8 @@ xmlSecTransformAes256CbcGetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformKWAes128GetKlass(void) { 
+xmlSecTransformId
+xmlSecTransformKWAes128GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWAes128GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -409,11 +409,11 @@ xmlSecTransformKWAes128GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformKWAes128GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformKWAes192GetKlass:
  *
  * The AES-192 kew wrapper transform klass.
@@ -422,8 +422,8 @@ xmlSecTransformKWAes128GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformKWAes192GetKlass(void) { 
+xmlSecTransformId
+xmlSecTransformKWAes192GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWAes192GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -432,11 +432,11 @@ xmlSecTransformKWAes192GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformKWAes192GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformKWAes256GetKlass:
  *
  * The AES-256 kew wrapper transform klass.
@@ -445,8 +445,8 @@ xmlSecTransformKWAes192GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformKWAes256GetKlass(void) { 
+xmlSecTransformId
+xmlSecTransformKWAes256GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWAes256GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -455,21 +455,21 @@ xmlSecTransformKWAes256GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformKWAes256GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformDes3CbcGetKlass:
  *
  * Triple DES CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to Triple DES encryption transform or NULL if an error
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformDes3CbcGetKlass(void) {  
+xmlSecTransformId
+xmlSecTransformDes3CbcGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformDes3CbcGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -478,20 +478,20 @@ xmlSecTransformDes3CbcGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformDes3CbcGetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformKWDes3GetKlass:
- * 
+ *
  * The Triple DES key wrapper transform klass.
  *
  * Returns: Triple DES key wrapper transform klass or NULL if an error
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformKWDes3GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWDes3GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -501,21 +501,21 @@ xmlSecTransformKWDes3GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformKWDes3GetKlass());
 }
 
 /**
  * xmlSecTransformDsaSha1GetKlass:
- * 
+ *
  * The DSA-SHA1 signature transform klass.
  *
  * Returns: DSA-SHA1 signature transform klass or NULL if an error
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformDsaSha1GetKlass(void) {  
+xmlSecTransformId
+xmlSecTransformDsaSha1GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformDsaSha1GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -524,21 +524,21 @@ xmlSecTransformDsaSha1GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformDsaSha1GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformGost2001GostR3411_94GetKlass:
- * 
+ *
  * The GOST2001-GOSTR3411_94 signature transform klass.
  *
  * Returns: GOST2001-GOSTR3411_94 signature transform klass or NULL if an error
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformGost2001GostR3411_94GetKlass(void) {     
+xmlSecTransformId
+xmlSecTransformGost2001GostR3411_94GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformGost2001GostR3411_94GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -547,11 +547,11 @@ xmlSecTransformGost2001GostR3411_94GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformGost2001GostR3411_94GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformHmacMd5GetKlass:
  *
  * The HMAC-MD5 transform klass.
@@ -560,8 +560,8 @@ xmlSecTransformGost2001GostR3411_94GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformHmacMd5GetKlass(void) {  
+xmlSecTransformId
+xmlSecTransformHmacMd5GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacMd5GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -570,11 +570,11 @@ xmlSecTransformHmacMd5GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformHmacMd5GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformHmacRipemd160GetKlass:
  *
  * The HMAC-RIPEMD160 transform klass.
@@ -583,7 +583,7 @@ xmlSecTransformHmacMd5GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformHmacRipemd160GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacRipemd160GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -593,11 +593,11 @@ xmlSecTransformHmacRipemd160GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformHmacRipemd160GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformHmacSha1GetKlass:
  *
  * The HMAC-SHA1 transform klass.
@@ -606,8 +606,8 @@ xmlSecTransformHmacRipemd160GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformHmacSha1GetKlass(void) { 
+xmlSecTransformId
+xmlSecTransformHmacSha1GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha1GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -616,11 +616,11 @@ xmlSecTransformHmacSha1GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformHmacSha1GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformHmacSha224GetKlass:
  *
  * The HMAC-SHA224 transform klass.
@@ -629,8 +629,8 @@ xmlSecTransformHmacSha1GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformHmacSha224GetKlass(void) {       
+xmlSecTransformId
+xmlSecTransformHmacSha224GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha224GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -639,11 +639,11 @@ xmlSecTransformHmacSha224GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformHmacSha224GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformHmacSha256GetKlass:
  *
  * The HMAC-SHA256 transform klass.
@@ -652,8 +652,8 @@ xmlSecTransformHmacSha224GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformHmacSha256GetKlass(void) {       
+xmlSecTransformId
+xmlSecTransformHmacSha256GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha256GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -662,11 +662,11 @@ xmlSecTransformHmacSha256GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformHmacSha256GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformHmacSha384GetKlass:
  *
  * The HMAC-SHA384 transform klass.
@@ -675,8 +675,8 @@ xmlSecTransformHmacSha256GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformHmacSha384GetKlass(void) {       
+xmlSecTransformId
+xmlSecTransformHmacSha384GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha384GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -685,11 +685,11 @@ xmlSecTransformHmacSha384GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformHmacSha384GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformHmacSha512GetKlass:
  *
  * The HMAC-SHA512 transform klass.
@@ -698,8 +698,8 @@ xmlSecTransformHmacSha384GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformHmacSha512GetKlass(void) {       
+xmlSecTransformId
+xmlSecTransformHmacSha512GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha512GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -708,11 +708,11 @@ xmlSecTransformHmacSha512GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformHmacSha512GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformMd5GetKlass:
  *
  * MD5 digest transform klass.
@@ -721,7 +721,7 @@ xmlSecTransformHmacSha512GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformMd5GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformMd5GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -731,11 +731,11 @@ xmlSecTransformMd5GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformMd5GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformRipemd160GetKlass:
  *
  * RIPEMD-160 digest transform klass.
@@ -744,7 +744,7 @@ xmlSecTransformMd5GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformRipemd160GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRipemd160GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -754,13 +754,13 @@ xmlSecTransformRipemd160GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformRipemd160GetKlass());
 }
 
 /**
  * xmlSecTransformRsaMd5GetKlass:
- * 
+ *
  * The RSA-MD5 signature transform klass.
  *
  * Returns: RSA-MD5 signature transform klass or NULL if an error
@@ -768,7 +768,7 @@ xmlSecTransformRipemd160GetKlass(void) {
  * implemented).
  */
 xmlSecTransformId
-xmlSecTransformRsaMd5GetKlass(void) {   
+xmlSecTransformRsaMd5GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaMd5GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -777,13 +777,13 @@ xmlSecTransformRsaMd5GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformRsaMd5GetKlass());
 }
 
 /**
  * xmlSecTransformRsaRipemd160GetKlass:
- * 
+ *
  * The RSA-RIPEMD160 signature transform klass.
  *
  * Returns: RSA-RIPEMD160 signature transform klass or NULL if an error
@@ -791,7 +791,7 @@ xmlSecTransformRsaMd5GetKlass(void) {
  * implemented).
  */
 xmlSecTransformId
-xmlSecTransformRsaRipemd160GetKlass(void) {     
+xmlSecTransformRsaRipemd160GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaRipemd160GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -800,13 +800,13 @@ xmlSecTransformRsaRipemd160GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformRsaRipemd160GetKlass());
 }
 
 /**
  * xmlSecTransformRsaSha1GetKlass:
- * 
+ *
  * The RSA-SHA1 signature transform klass.
  *
  * Returns: RSA-SHA1 signature transform klass or NULL if an error
@@ -814,7 +814,7 @@ xmlSecTransformRsaRipemd160GetKlass(void) {
  * implemented).
  */
 xmlSecTransformId
-xmlSecTransformRsaSha1GetKlass(void) {  
+xmlSecTransformRsaSha1GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha1GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -823,13 +823,13 @@ xmlSecTransformRsaSha1GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformRsaSha1GetKlass());
 }
 
 /**
  * xmlSecTransformRsaSha224GetKlass:
- * 
+ *
  * The RSA-SHA224 signature transform klass.
  *
  * Returns: RSA-SHA224 signature transform klass or NULL if an error
@@ -837,7 +837,7 @@ xmlSecTransformRsaSha1GetKlass(void) {
  * implemented).
  */
 xmlSecTransformId
-xmlSecTransformRsaSha224GetKlass(void) {        
+xmlSecTransformRsaSha224GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha224GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -846,13 +846,13 @@ xmlSecTransformRsaSha224GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformRsaSha224GetKlass());
 }
 
 /**
  * xmlSecTransformRsaSha256GetKlass:
- * 
+ *
  * The RSA-SHA256 signature transform klass.
  *
  * Returns: RSA-SHA256 signature transform klass or NULL if an error
@@ -860,7 +860,7 @@ xmlSecTransformRsaSha224GetKlass(void) {
  * implemented).
  */
 xmlSecTransformId
-xmlSecTransformRsaSha256GetKlass(void) {        
+xmlSecTransformRsaSha256GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha256GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -869,13 +869,13 @@ xmlSecTransformRsaSha256GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformRsaSha256GetKlass());
 }
 
 /**
  * xmlSecTransformRsaSha384GetKlass:
- * 
+ *
  * The RSA-SHA384 signature transform klass.
  *
  * Returns: RSA-SHA384 signature transform klass or NULL if an error
@@ -883,7 +883,7 @@ xmlSecTransformRsaSha256GetKlass(void) {
  * implemented).
  */
 xmlSecTransformId
-xmlSecTransformRsaSha384GetKlass(void) {        
+xmlSecTransformRsaSha384GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha384GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -892,13 +892,13 @@ xmlSecTransformRsaSha384GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformRsaSha384GetKlass());
 }
 
 /**
  * xmlSecTransformRsaSha512GetKlass:
- * 
+ *
  * The RSA-SHA512 signature transform klass.
  *
  * Returns: RSA-SHA512 signature transform klass or NULL if an error
@@ -906,7 +906,7 @@ xmlSecTransformRsaSha384GetKlass(void) {
  * implemented).
  */
 xmlSecTransformId
-xmlSecTransformRsaSha512GetKlass(void) {        
+xmlSecTransformRsaSha512GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha512GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -915,11 +915,11 @@ xmlSecTransformRsaSha512GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformRsaSha512GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformRsaPkcs1GetKlass:
  *
  * The RSA-PKCS1 key transport transform klass.
@@ -928,8 +928,8 @@ xmlSecTransformRsaSha512GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformRsaPkcs1GetKlass(void) { 
+xmlSecTransformId
+xmlSecTransformRsaPkcs1GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaPkcs1GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -938,11 +938,11 @@ xmlSecTransformRsaPkcs1GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformRsaPkcs1GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformRsaOaepGetKlass:
  *
  * The RSA-OAEP key transport transform klass.
@@ -951,8 +951,8 @@ xmlSecTransformRsaPkcs1GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
-xmlSecTransformRsaOaepGetKlass(void) {  
+xmlSecTransformId
+xmlSecTransformRsaOaepGetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaOaepGetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -961,11 +961,11 @@ xmlSecTransformRsaOaepGetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformRsaOaepGetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformGostR3411_94GetKlass:
  *
  * GOSTR3411_94 digest transform klass.
@@ -974,7 +974,7 @@ xmlSecTransformRsaOaepGetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformGostR3411_94GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformGostR3411_94GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -984,12 +984,12 @@ xmlSecTransformGostR3411_94GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformGostR3411_94GetKlass());
 }
 
 
-/** 
+/**
  * xmlSecTransformSha1GetKlass:
  *
  * SHA-1 digest transform klass.
@@ -998,7 +998,7 @@ xmlSecTransformGostR3411_94GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformSha1GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha1GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1008,11 +1008,11 @@ xmlSecTransformSha1GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformSha1GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformSha224GetKlass:
  *
  * SHA224 digest transform klass.
@@ -1021,7 +1021,7 @@ xmlSecTransformSha1GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformSha224GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha224GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1031,11 +1031,11 @@ xmlSecTransformSha224GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformSha224GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformSha256GetKlass:
  *
  * SHA256 digest transform klass.
@@ -1044,7 +1044,7 @@ xmlSecTransformSha224GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformSha256GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha256GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1054,11 +1054,11 @@ xmlSecTransformSha256GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformSha256GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformSha384GetKlass:
  *
  * SHA384 digest transform klass.
@@ -1067,7 +1067,7 @@ xmlSecTransformSha256GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformSha384GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha384GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1077,11 +1077,11 @@ xmlSecTransformSha384GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformSha384GetKlass());
 }
 
-/** 
+/**
  * xmlSecTransformSha512GetKlass:
  *
  * SHA512 digest transform klass.
@@ -1090,7 +1090,7 @@ xmlSecTransformSha384GetKlass(void) {
  * occurs (the xmlsec-crypto library is not loaded or this transform is not
  * implemented).
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformSha512GetKlass(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha512GetKlass == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1100,7 +1100,7 @@ xmlSecTransformSha512GetKlass(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(xmlSecTransformIdUnknown);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->transformSha512GetKlass());
 }
 
@@ -1108,18 +1108,18 @@ xmlSecTransformSha512GetKlass(void) {
  *
  * High level routines form xmlsec command line utility
  *
- *****************************************************************************/ 
+ *****************************************************************************/
 /**
  * xmlSecCryptoAppInit:
  * @config:             the path to crypto library configuration.
  *
  * General crypto engine initialization. This function is used
- * by XMLSec command line utility and called before 
+ * by XMLSec command line utility and called before
  * @xmlSecInit function.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecCryptoAppInit(const char* config) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppInit == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1129,21 +1129,21 @@ xmlSecCryptoAppInit(const char* config) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppInit(config));
 }
 
 
 /**
  * xmlSecCryptoAppShutdown:
- * 
+ *
  * General crypto engine shutdown. This function is used
- * by XMLSec command line utility and called after 
+ * by XMLSec command line utility and called after
  * @xmlSecShutdown function.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecCryptoAppShutdown(void) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppShutdown == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1153,7 +1153,7 @@ xmlSecCryptoAppShutdown(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppShutdown());
 }
 
@@ -1165,8 +1165,8 @@ xmlSecCryptoAppShutdown(void) {
  * and a default crypto key data stores.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrInit == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1176,7 +1176,7 @@ xmlSecCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrInit(mngr));
 }
 
@@ -1187,10 +1187,10 @@ xmlSecCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
  *
  * Adds @key to the keys manager @mngr created with #xmlSecCryptoAppDefaultKeysMngrInit
  * function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrAdoptKey == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1200,7 +1200,7 @@ xmlSecCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key)
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrAdoptKey(mngr, key));
 }
 
@@ -1209,12 +1209,12 @@ xmlSecCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key)
  * @mngr:               the pointer to keys manager.
  * @uri:                the uri.
  *
- * Loads XML keys file from @uri to the keys manager @mngr created 
+ * Loads XML keys file from @uri to the keys manager @mngr created
  * with #xmlSecCryptoAppDefaultKeysMngrInit function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrLoad == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1224,7 +1224,7 @@ xmlSecCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrLoad(mngr, uri));
 }
 
@@ -1235,10 +1235,10 @@ xmlSecCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
  * @type:               the type of keys to save (public/private/symmetric).
  *
  * Saves keys from @mngr to  XML keys file.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename,
                                    xmlSecKeyDataType type) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrSave == NULL)) {
@@ -1249,7 +1249,7 @@ xmlSecCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrSave(mngr, filename, type));
 }
 
@@ -1260,14 +1260,14 @@ xmlSecCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename,
  * @format:             the certificate file format.
  * @type:               the flag that indicates is the certificate in @filename
  *                      trusted or not.
- * 
+ *
  * Reads cert from @filename and adds to the list of trusted or known
  * untrusted certs in @store.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
-xmlSecCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename, 
+int
+xmlSecCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
                                 xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeysMngrCertLoad == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1277,7 +1277,7 @@ xmlSecCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppKeysMngrCertLoad(mngr, filename, format, type));
 }
 
@@ -1288,7 +1288,7 @@ xmlSecCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
  * @dataSize:           the certificate binary data size.
  * @format:             the certificate file format.
  * @type:               the flag that indicates is the certificate trusted or not.
- * 
+ *
  * Reads cert from binary buffer @data and adds to the list of trusted or known
  * untrusted certs in @store.
  *
@@ -1296,7 +1296,7 @@ xmlSecCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
  */
 int
 xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
-                                    xmlSecSize dataSize, xmlSecKeyDataFormat format, 
+                                    xmlSecSize dataSize, xmlSecKeyDataFormat format,
                                     xmlSecKeyDataType type) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeysMngrCertLoadMemory == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1306,7 +1306,7 @@ xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppKeysMngrCertLoadMemory(mngr, data, dataSize, format, type));
 }
 
@@ -1322,7 +1322,7 @@ xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr 
+xmlSecKeyPtr
 xmlSecCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                        const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoad == NULL)) {
@@ -1333,7 +1333,7 @@ xmlSecCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoad(filename, format, pwd, pwdCallback, pwdCallbackCtx));
 }
 
@@ -1350,7 +1350,7 @@ xmlSecCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr 
+xmlSecKeyPtr
 xmlSecCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKeyDataFormat format,
                        const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoadMemory == NULL)) {
@@ -1361,10 +1361,10 @@ xmlSecCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSec
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoadMemory(data, dataSize, format, pwd, pwdCallback, pwdCallbackCtx));
 }
-                                
+
 /**
  * xmlSecCryptoAppPkcs12Load:
  * @filename:           the PKCS12 key filename.
@@ -1378,8 +1378,8 @@ xmlSecCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSec
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr 
-xmlSecCryptoAppPkcs12Load(const char* filename, const char* pwd, void* pwdCallback, 
+xmlSecKeyPtr
+xmlSecCryptoAppPkcs12Load(const char* filename, const char* pwd, void* pwdCallback,
                           void* pwdCallbackCtx) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppPkcs12Load == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1389,7 +1389,7 @@ xmlSecCryptoAppPkcs12Load(const char* filename, const char* pwd, void* pwdCallba
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppPkcs12Load(filename, pwd, pwdCallback, pwdCallbackCtx));
 }
 
@@ -1407,9 +1407,9 @@ xmlSecCryptoAppPkcs12Load(const char* filename, const char* pwd, void* pwdCallba
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
-xmlSecCryptoAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, 
-                           const char *pwd, void* pwdCallback, 
+xmlSecKeyPtr
+xmlSecCryptoAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
+                           const char *pwd, void* pwdCallback,
                            void* pwdCallbackCtx) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppPkcs12LoadMemory == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1419,7 +1419,7 @@ xmlSecCryptoAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppPkcs12LoadMemory(data, dataSize, pwd, pwdCallback, pwdCallbackCtx));
 }
 
@@ -1430,10 +1430,10 @@ xmlSecCryptoAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
  * @format:             the certificate file format.
  *
  * Reads the certificate from $ filename and adds it to key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFormat format) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoad == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1443,7 +1443,7 @@ xmlSecCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyData
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoad(key, filename, format));
 }
 
@@ -1455,11 +1455,11 @@ xmlSecCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyData
  * @format:             the certificate file format.
  *
  * Reads the certificate from memory buffer and adds it to key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
-xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize, 
+int
+xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
                                 xmlSecKeyDataFormat format) {
     if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoadMemory == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1469,7 +1469,7 @@ xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSe
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoadMemory(key, data, dataSize, format));
 }
 
@@ -1480,7 +1480,7 @@ xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSe
  *
  * Returns: default password callback.
  */
-void* 
+void*
 xmlSecCryptoAppGetDefaultPwdCallback(void) {
     if(xmlSecCryptoDLGetFunctions() == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1490,7 +1490,7 @@ xmlSecCryptoAppGetDefaultPwdCallback(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(xmlSecCryptoDLGetFunctions()->cryptoAppDefaultPwdCallback);
 }
 
diff --git a/src/base64.c b/src/base64.c
index 33565e0..53e6694 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -5,7 +5,7 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -22,11 +22,11 @@
 #include <xmlsec/base64.h>
 #include <xmlsec/errors.h>
 
-/* 
- * the table to map numbers to base64 
+/*
+ * the table to map numbers to base64
  */
 static const xmlSecByte base64[] =
-{  
+{
 /*   0    1    2    3    4    5    6    7   */
     'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', /* 0 */
     'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', /* 1 */
@@ -48,11 +48,11 @@ static const xmlSecByte base64[] =
 #define xmlSecBase64Decode1(a, b)       (((a) << 2) | (((b) & 0x3F) >> 4))
 #define xmlSecBase64Decode2(b, c)       (((b) << 4) | (((c) & 0x3F) >> 2))
 #define xmlSecBase64Decode3(c, d)       (((c) << 6) | ((d) & 0x3F))
-        
+
 #define xmlSecIsBase64Char(ch)          ((((ch) >= 'A') && ((ch) <= 'Z')) || \
                                          (((ch) >= 'a') && ((ch) <= 'z')) || \
                                          (((ch) >= '0') && ((ch) <= '9')) || \
-                                         ((ch) == '+') || ((ch) == '/')) 
+                                         ((ch) == '+') || ((ch) == '/'))
 #define xmlSecIsBase64Space(ch)         (((ch) == ' ') || ((ch) == '\t') || \
                                          ((ch) == '\x0d') || ((ch) == '\x0a'))
 
@@ -72,39 +72,39 @@ typedef enum {
 } xmlSecBase64Status;
 
 struct _xmlSecBase64Ctx {
-    int                 encode;    
+    int                 encode;
     int                 inByte;
     int                 inPos;
     xmlSecSize          linePos;
-    xmlSecSize          columns;  
+    xmlSecSize          columns;
     int                 finished;
 };
 
-static xmlSecBase64Status       xmlSecBase64CtxEncodeByte       (xmlSecBase64CtxPtr ctx, 
-                                                                 xmlSecByte  inByte, 
+static xmlSecBase64Status       xmlSecBase64CtxEncodeByte       (xmlSecBase64CtxPtr ctx,
+                                                                 xmlSecByte  inByte,
                                                                  xmlSecByte* outByte);
-static xmlSecBase64Status       xmlSecBase64CtxEncodeByteFinal  (xmlSecBase64CtxPtr ctx, 
+static xmlSecBase64Status       xmlSecBase64CtxEncodeByteFinal  (xmlSecBase64CtxPtr ctx,
                                                                  xmlSecByte* outByte);
-static xmlSecBase64Status       xmlSecBase64CtxDecodeByte       (xmlSecBase64CtxPtr ctx, 
-                                                                 xmlSecByte inByte, 
+static xmlSecBase64Status       xmlSecBase64CtxDecodeByte       (xmlSecBase64CtxPtr ctx,
+                                                                 xmlSecByte inByte,
                                                                  xmlSecByte* outByte);
-static int                      xmlSecBase64CtxEncode           (xmlSecBase64CtxPtr ctx, 
-                                                                 const xmlSecByte* inBuf, 
-                                                                 xmlSecSize inBufSize, 
+static int                      xmlSecBase64CtxEncode           (xmlSecBase64CtxPtr ctx,
+                                                                 const xmlSecByte* inBuf,
+                                                                 xmlSecSize inBufSize,
                                                                  xmlSecSize* inBufResSize,
-                                                                 xmlSecByte* outBuf, 
-                                                                 xmlSecSize outBufSize, 
+                                                                 xmlSecByte* outBuf,
+                                                                 xmlSecSize outBufSize,
                                                                  xmlSecSize* outBufResSize);
-static int                      xmlSecBase64CtxEncodeFinal      (xmlSecBase64CtxPtr ctx, 
-                                                                 xmlSecByte* outBuf, 
-                                                                 xmlSecSize outBufSize, 
+static int                      xmlSecBase64CtxEncodeFinal      (xmlSecBase64CtxPtr ctx,
+                                                                 xmlSecByte* outBuf,
+                                                                 xmlSecSize outBufSize,
                                                                  xmlSecSize* outBufResSize);
-static int                      xmlSecBase64CtxDecode           (xmlSecBase64CtxPtr ctx, 
-                                                                 const xmlSecByte* inBuf, 
-                                                                 xmlSecSize inBufSize, 
+static int                      xmlSecBase64CtxDecode           (xmlSecBase64CtxPtr ctx,
+                                                                 const xmlSecByte* inBuf,
+                                                                 xmlSecSize inBufSize,
                                                                  xmlSecSize* inBufResSize,
-                                                                 xmlSecByte* outBuf, 
-                                                                 xmlSecSize outBufSize, 
+                                                                 xmlSecByte* outBuf,
+                                                                 xmlSecSize outBufSize,
                                                                  xmlSecSize* outBufResSize);
 static int                      xmlSecBase64CtxDecodeIsFinished (xmlSecBase64CtxPtr ctx);
 
@@ -113,7 +113,7 @@ static int g_xmlsec_base64_default_line_size = XMLSEC_BASE64_LINESIZE;
 
 /**
  * xmlSecBase64GetDefaultLineSize:
- * 
+ *
  * Gets the current default line size.
  *
  * Returns: the current default line size.
@@ -138,7 +138,7 @@ xmlSecBase64SetDefaultLineSize(int columns)
 
 /**
  * xmlSecBase64CtxCreate:
- * @encode:             the encode/decode flag (1 - encode, 0 - decode) 
+ * @encode:             the encode/decode flag (1 - encode, 0 - decode)
  * @columns:            the max line length.
  *
  * Allocates and initializes new base64 context.
@@ -146,11 +146,11 @@ xmlSecBase64SetDefaultLineSize(int columns)
  * Returns: a pointer to newly created #xmlSecBase64Ctx structure
  * or NULL if an error occurs.
  */
-xmlSecBase64CtxPtr      
+xmlSecBase64CtxPtr
 xmlSecBase64CtxCreate(int encode, int columns) {
     xmlSecBase64CtxPtr ctx;
     int ret;
-    
+
     /*
      * Allocate a new xmlSecBase64CtxPtr and fill the fields.
      */
@@ -160,11 +160,11 @@ xmlSecBase64CtxCreate(int encode, int columns) {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecBase64Ctx)=%d", 
+                    "sizeof(xmlSecBase64Ctx)=%d",
                     sizeof(xmlSecBase64Ctx));
         return(NULL);
     }
-    
+
     ret = xmlSecBase64CtxInitialize(ctx, encode, columns);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -181,13 +181,13 @@ xmlSecBase64CtxCreate(int encode, int columns) {
 /**
  * xmlSecBase64CtxDestroy:
  * @ctx:                the pointer to #xmlSecBase64Ctx structure.
- * 
+ *
  * Destroys base64 context.
  */
 void
 xmlSecBase64CtxDestroy(xmlSecBase64CtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
-    
+
     xmlSecBase64CtxFinalize(ctx);
     xmlFree(ctx);
 }
@@ -195,15 +195,15 @@ xmlSecBase64CtxDestroy(xmlSecBase64CtxPtr ctx) {
 /**
  * xmlSecBase64CtxInitialize:
  * @ctx:                the pointer to #xmlSecBase64Ctx structure,
- * @encode:             the encode/decode flag (1 - encode, 0 - decode) 
+ * @encode:             the encode/decode flag (1 - encode, 0 - decode)
  * @columns:            the max line length.
  *
  * Initializes new base64 context.
  *
  * Returns: 0 on success and a negative value otherwise.
  */
-int 
-xmlSecBase64CtxInitialize(xmlSecBase64CtxPtr ctx, int encode, int columns) {    
+int
+xmlSecBase64CtxInitialize(xmlSecBase64CtxPtr ctx, int encode, int columns) {
     xmlSecAssert2(ctx != NULL, -1);
 
     memset(ctx, 0, sizeof(xmlSecBase64Ctx));
@@ -219,12 +219,12 @@ xmlSecBase64CtxInitialize(xmlSecBase64CtxPtr ctx, int encode, int columns) {
  *
  * Frees all the resources allocated by @ctx.
  */
-void 
-xmlSecBase64CtxFinalize(xmlSecBase64CtxPtr ctx) {    
+void
+xmlSecBase64CtxFinalize(xmlSecBase64CtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
 
-    memset(ctx, 0, sizeof(xmlSecBase64Ctx)); 
-}       
+    memset(ctx, 0, sizeof(xmlSecBase64Ctx));
+}
 
 /**
  * xmlSecBase64CtxUpdate:
@@ -235,26 +235,26 @@ xmlSecBase64CtxFinalize(xmlSecBase64CtxPtr ctx) {
  * @outSize:            the output buffer size
  *
  * Encodes or decodes the next piece of data from input buffer.
- * 
- * Returns: the number of bytes written to output buffer or 
+ *
+ * Returns: the number of bytes written to output buffer or
  * -1 if an error occurs.
  */
 int
 xmlSecBase64CtxUpdate(xmlSecBase64CtxPtr ctx,
-                     const xmlSecByte *in, xmlSecSize inSize, 
+                     const xmlSecByte *in, xmlSecSize inSize,
                      xmlSecByte *out, xmlSecSize outSize) {
     xmlSecSize inResSize = 0, outResSize = 0;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(in != NULL, -1);
     xmlSecAssert2(out != NULL, -1);
 
     if(ctx->encode != 0) {
-        ret = xmlSecBase64CtxEncode(ctx, in, inSize, &inResSize, 
+        ret = xmlSecBase64CtxEncode(ctx, in, inSize, &inResSize,
                                     out, outSize, &outResSize);
         if((ret < 0) || (inResSize != inSize)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlSecBase64CtxEncode",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -262,10 +262,10 @@ xmlSecBase64CtxUpdate(xmlSecBase64CtxPtr ctx,
             return(-1);
         }
     } else {
-        ret = xmlSecBase64CtxDecode(ctx, in, inSize, &inResSize, 
+        ret = xmlSecBase64CtxDecode(ctx, in, inSize, &inResSize,
                                     out, outSize, &outResSize);
         if((ret < 0) || (inResSize != inSize)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlSecBase64CtxDecode",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -286,23 +286,23 @@ xmlSecBase64CtxUpdate(xmlSecBase64CtxPtr ctx,
  * Encodes or decodes the last piece of data stored in the context
  * and finalizes the result.
  *
- * Returns: the number of bytes written to output buffer or 
+ * Returns: the number of bytes written to output buffer or
  * -1 if an error occurs.
  */
 int
-xmlSecBase64CtxFinal(xmlSecBase64CtxPtr ctx, 
+xmlSecBase64CtxFinal(xmlSecBase64CtxPtr ctx,
                     xmlSecByte *out, xmlSecSize outSize) {
     xmlSecSize outResSize = 0;
     int ret;
-        
+
     xmlSecAssert2(ctx != NULL, -1);
-    xmlSecAssert2(out != NULL, -1);    
-    xmlSecAssert2(outSize > 0, -1);    
+    xmlSecAssert2(out != NULL, -1);
+    xmlSecAssert2(outSize > 0, -1);
 
-    if(ctx->encode != 0) {    
+    if(ctx->encode != 0) {
         ret = xmlSecBase64CtxEncodeFinal(ctx, out, outSize, &outResSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlSecBase64CtxEncodeFinal",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -311,15 +311,15 @@ xmlSecBase64CtxFinal(xmlSecBase64CtxPtr ctx,
         }
     } else {
         if(!xmlSecBase64CtxDecodeIsFinished(ctx)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlSecBase64CtxIsFinished",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
+        }
     }
-    
+
     /* add \0 */
     if((outResSize + 1) < outSize) {
         out[outResSize] = '\0';
@@ -363,7 +363,7 @@ xmlSecBase64CtxEncodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
         return(xmlSecBase64StatusConsumeAndNext);
     }
 
-    xmlSecError(XMLSEC_ERRORS_HERE, 
+    xmlSecError(XMLSEC_ERRORS_HERE,
                 NULL,
                 NULL,
                 XMLSEC_ERRORS_R_INVALID_DATA,
@@ -397,7 +397,7 @@ xmlSecBase64CtxEncodeByteFinal(xmlSecBase64CtxPtr ctx, xmlSecByte* outByte) {
         return(xmlSecBase64StatusConsumeAndRepeat);
     }
 
-    xmlSecError(XMLSEC_ERRORS_HERE, 
+    xmlSecError(XMLSEC_ERRORS_HERE,
                 NULL,
                 NULL,
                 XMLSEC_ERRORS_R_INVALID_DATA,
@@ -408,14 +408,14 @@ xmlSecBase64CtxEncodeByteFinal(xmlSecBase64CtxPtr ctx, xmlSecByte* outByte) {
 static xmlSecBase64Status
 xmlSecBase64CtxDecodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte* outByte) {
     xmlSecAssert2(ctx != NULL, xmlSecBase64StatusFailed);
-    xmlSecAssert2(outByte != NULL, xmlSecBase64StatusFailed);    
+    xmlSecAssert2(outByte != NULL, xmlSecBase64StatusFailed);
 
     if((ctx->finished != 0) && (ctx->inPos == 0)) {
         return(xmlSecBase64StatusDone);
     } if(inByte == '=') {
         ctx->finished = 1;
         if(ctx->inPos < 2) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
@@ -423,12 +423,12 @@ xmlSecBase64CtxDecodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
             return(xmlSecBase64StatusFailed);
         } else if(ctx->inPos == 2) {
             ++ctx->inPos;
-            return(xmlSecBase64StatusNext);            
+            return(xmlSecBase64StatusNext);
         } else if(ctx->inPos == 3) {
             ctx->inPos = 0;
             return(xmlSecBase64StatusNext);
         } else {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
@@ -438,7 +438,7 @@ xmlSecBase64CtxDecodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
     } else if(xmlSecIsBase64Space(inByte)) {
         return(xmlSecBase64StatusNext);
     } else if(!xmlSecIsBase64Char(inByte) || (ctx->finished != 0)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_DATA,
@@ -452,13 +452,13 @@ xmlSecBase64CtxDecodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
     } else if((inByte >= 'a') && (inByte <= 'z')) {
         inByte = 26 + (inByte - 'a');
     } else if((inByte >= '0') && (inByte <= '9')) {
-        inByte = 52 + (inByte - '0'); 
+        inByte = 52 + (inByte - '0');
     } else if(inByte == '+') {
         inByte = 62;
     } else if(inByte == '/') {
         inByte = 63;
     }
-        
+
     if(ctx->inPos == 0) {
         ctx->inByte = inByte;
         ++ctx->inPos;
@@ -480,7 +480,7 @@ xmlSecBase64CtxDecodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
         return(xmlSecBase64StatusConsumeAndNext);
     }
 
-    xmlSecError(XMLSEC_ERRORS_HERE, 
+    xmlSecError(XMLSEC_ERRORS_HERE,
                 NULL,
                 NULL,
                 XMLSEC_ERRORS_R_INVALID_DATA,
@@ -490,12 +490,12 @@ xmlSecBase64CtxDecodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
 
 
 static int
-xmlSecBase64CtxEncode(xmlSecBase64CtxPtr ctx, 
+xmlSecBase64CtxEncode(xmlSecBase64CtxPtr ctx,
                      const xmlSecByte* inBuf, xmlSecSize inBufSize, xmlSecSize* inBufResSize,
                      xmlSecByte* outBuf, xmlSecSize outBufSize, xmlSecSize* outBufResSize) {
     xmlSecBase64Status status = xmlSecBase64StatusNext;
     xmlSecSize inPos, outPos;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(inBuf != NULL, -1);
     xmlSecAssert2(inBufResSize != NULL, -1);
@@ -516,7 +516,7 @@ xmlSecBase64CtxEncode(xmlSecBase64CtxPtr ctx,
             case xmlSecBase64StatusNext:
             case xmlSecBase64StatusDone:
             case xmlSecBase64StatusFailed:
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             NULL,
                             "xmlSecBase64CtxEncodeByte",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -532,11 +532,11 @@ xmlSecBase64CtxEncode(xmlSecBase64CtxPtr ctx,
 }
 
 static int
-xmlSecBase64CtxEncodeFinal(xmlSecBase64CtxPtr ctx, 
+xmlSecBase64CtxEncodeFinal(xmlSecBase64CtxPtr ctx,
                      xmlSecByte* outBuf, xmlSecSize outBufSize, xmlSecSize* outBufResSize) {
     xmlSecBase64Status status = xmlSecBase64StatusNext;
     xmlSecSize outPos;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(outBuf != NULL, -1);
     xmlSecAssert2(outBufResSize != NULL, -1);
@@ -553,7 +553,7 @@ xmlSecBase64CtxEncodeFinal(xmlSecBase64CtxPtr ctx,
                 break;
             case xmlSecBase64StatusNext:
             case xmlSecBase64StatusFailed:
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             NULL,
                             "xmlSecBase64CtxEncodeByteFinal",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -563,7 +563,7 @@ xmlSecBase64CtxEncodeFinal(xmlSecBase64CtxPtr ctx,
     }
 
     if(status != xmlSecBase64StatusDone) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_SIZE,
@@ -580,12 +580,12 @@ xmlSecBase64CtxEncodeFinal(xmlSecBase64CtxPtr ctx,
 
 
 static int
-xmlSecBase64CtxDecode(xmlSecBase64CtxPtr ctx, 
+xmlSecBase64CtxDecode(xmlSecBase64CtxPtr ctx,
                      const xmlSecByte* inBuf, xmlSecSize inBufSize, xmlSecSize* inBufResSize,
                      xmlSecByte* outBuf, xmlSecSize outBufSize, xmlSecSize* outBufResSize) {
     xmlSecBase64Status status = xmlSecBase64StatusNext;
     xmlSecSize inPos, outPos;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(inBuf != NULL, -1);
     xmlSecAssert2(inBufResSize != NULL, -1);
@@ -609,7 +609,7 @@ xmlSecBase64CtxDecode(xmlSecBase64CtxPtr ctx,
             case xmlSecBase64StatusDone:
                 break;
             case xmlSecBase64StatusFailed:
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             NULL,
                             "xmlSecBase64CtxDecodeByte",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -647,14 +647,14 @@ xmlSecBase64CtxDecodeIsFinished(xmlSecBase64CtxPtr ctx) {
  * The caller is responsible for freeing returned buffer using
  * xmlFree() function.
  *
- * Returns: newly allocated string with base64 encoded data 
+ * Returns: newly allocated string with base64 encoded data
  * or NULL if an error occurs.
  */
 xmlChar*
 xmlSecBase64Encode(const xmlSecByte *buf, xmlSecSize len, int columns) {
     xmlSecBase64Ctx ctx;
     xmlChar *ptr;
-    xmlSecSize size;    
+    xmlSecSize size;
     int size_update, size_final;
     int ret;
 
@@ -669,7 +669,7 @@ xmlSecBase64Encode(const xmlSecByte *buf, xmlSecSize len, int columns) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     /* create result buffer */
     size = (4 * len) / 3 + 4;
     if(columns > 0) {
@@ -712,7 +712,7 @@ xmlSecBase64Encode(const xmlSecByte *buf, xmlSecSize len, int columns) {
     }
     size_final = ret;
     ptr[size_update + size_final] = '\0';
-    
+
     xmlSecBase64CtxFinalize(&ctx);
     return(ptr);
 }
@@ -726,8 +726,8 @@ xmlSecBase64Encode(const xmlSecByte *buf, xmlSecSize len, int columns) {
  * Decodes input base64 encoded string and puts result into
  * the output buffer.
  *
- * Returns: the number of bytes written to the output buffer or 
- * a negative value if an error occurs 
+ * Returns: the number of bytes written to the output buffer or
+ * a negative value if an error occurs
  */
 int
 xmlSecBase64Decode(const xmlChar* str, xmlSecByte *buf, xmlSecSize len) {
@@ -748,7 +748,7 @@ xmlSecBase64Decode(const xmlChar* str, xmlSecByte *buf, xmlSecSize len) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecBase64CtxUpdate(&ctx, (const xmlSecByte*)str, xmlStrlen(str), buf, len);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -771,7 +771,7 @@ xmlSecBase64Decode(const xmlChar* str, xmlSecByte *buf, xmlSecSize len) {
         xmlSecBase64CtxFinalize(&ctx);
         return(-1);
     }
-    size_final = ret;    
+    size_final = ret;
 
     xmlSecBase64CtxFinalize(&ctx);
     return(size_update + size_final);
@@ -782,7 +782,7 @@ xmlSecBase64Decode(const xmlChar* str, xmlSecByte *buf, xmlSecSize len) {
  * Base64 Transform
  *
  * xmlSecBase64Ctx is located after xmlSecTransform
- * 
+ *
  **************************************************************/
 #define xmlSecBase64Size \
         (sizeof(xmlSecTransform) + sizeof(xmlSecBase64Ctx))
@@ -793,8 +793,8 @@ xmlSecBase64Decode(const xmlChar* str, xmlSecByte *buf, xmlSecSize len) {
 
 static int              xmlSecBase64Initialize          (xmlSecTransformPtr transform);
 static void             xmlSecBase64Finalize            (xmlSecTransformPtr transform);
-static int              xmlSecBase64Execute             (xmlSecTransformPtr transform, 
-                                                         int last, 
+static int              xmlSecBase64Execute             (xmlSecTransformPtr transform,
+                                                         int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 
 static xmlSecTransformKlass xmlSecBase64Klass = {
@@ -829,14 +829,14 @@ static xmlSecTransformKlass xmlSecBase64Klass = {
  *
  * The Base64 transform klass (http://www.w3.org/TR/xmldsig-core/#sec-Base-64).
  * The normative specification for base64 decoding transforms is RFC 2045
- * (http://www.ietf.org/rfc/rfc2045.txt). The base64 Transform element has 
- * no content. The input is decoded by the algorithms. This transform is 
- * useful if an application needs to sign the raw data associated with 
+ * (http://www.ietf.org/rfc/rfc2045.txt). The base64 Transform element has
+ * no content. The input is decoded by the algorithms. This transform is
+ * useful if an application needs to sign the raw data associated with
  * the encoded content of an element.
  *
  * Returns: base64 transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformBase64GetKlass(void) {
     return(&xmlSecBase64Klass);
 }
@@ -851,20 +851,20 @@ xmlSecTransformBase64GetKlass(void) {
 void
 xmlSecTransformBase64SetLineSize(xmlSecTransformPtr transform, xmlSecSize lineSize) {
     xmlSecBase64CtxPtr ctx;
-    
+
     xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformBase64Id));
-    
+
     ctx = xmlSecBase64GetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
-    ctx->columns = lineSize;    
+
+    ctx->columns = lineSize;
 }
 
 static int
 xmlSecBase64Initialize(xmlSecTransformPtr transform) {
     xmlSecBase64CtxPtr ctx;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformBase64Id), -1);
 
     ctx = xmlSecBase64GetCtx(transform);
@@ -880,23 +880,23 @@ xmlSecBase64Initialize(xmlSecTransformPtr transform) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
 static void
 xmlSecBase64Finalize(xmlSecTransformPtr transform) {
     xmlSecBase64CtxPtr ctx;
-    
+
     xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformBase64Id));
 
     ctx = xmlSecBase64GetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     xmlSecBase64CtxFinalize(ctx);
 }
 
-static int 
+static int
 xmlSecBase64Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecBase64CtxPtr ctx;
     xmlSecBufferPtr in, out;
@@ -906,10 +906,10 @@ xmlSecBase64Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPt
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformBase64Id), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncode) || (transform->operation == xmlSecTransformOperationDecode), -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-    
+
     ctx = xmlSecBase64GetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     in = &(transform->inBuf);
     out = &(transform->outBuf);
 
@@ -933,7 +933,7 @@ xmlSecBase64Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPt
                 }
                 ret = xmlSecBufferSetMaxSize(out, outSize + outLen);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferSetMaxSize",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -943,10 +943,10 @@ xmlSecBase64Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPt
 
                 /* encode/decode the next chunk */
                 ret = xmlSecBase64CtxUpdate(ctx, xmlSecBufferGetData(in), inSize,
-                                            xmlSecBufferGetData(out) + outSize, 
+                                            xmlSecBufferGetData(out) + outSize,
                                             outLen);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBase64CtxUpdate",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -954,22 +954,22 @@ xmlSecBase64Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPt
                     return(-1);
                 }
                 outLen = ret;
-                
+
                 /* set correct size */
                 ret = xmlSecBufferSetSize(out, outSize + outLen);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferSetSize",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                                 "size=%d", outSize + outLen);
                     return(-1);
                 }
-                
+
                 /* remove chunk from input */
                 ret = xmlSecBufferRemoveHead(in, inSize);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferRemoveHead",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -977,24 +977,24 @@ xmlSecBase64Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPt
                     return(-1);
                 }
             }
-            
+
             if(last) {
                 outSize = xmlSecBufferGetSize(out);
 
                 ret = xmlSecBufferSetMaxSize(out, outSize + 16);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferSetMaxSize",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                                 "size=%d", outSize + 16);
                     return(-1);
                 }
-        
+
                 /* add from ctx buffer */
                 ret = xmlSecBase64CtxFinal(ctx, xmlSecBufferGetData(out) + outSize, 16);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBase64CtxFinal",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -1002,11 +1002,11 @@ xmlSecBase64Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPt
                     return(-1);
                 }
                 outLen = ret;
-                
+
                 /* set correct size */
                 ret = xmlSecBufferSetSize(out, outSize + outLen);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferSetSize",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -1021,7 +1021,7 @@ xmlSecBase64Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPt
             xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
             break;
         default:
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_STATUS,
diff --git a/src/bn.c b/src/bn.c
index d7b5582..06a31d5 100644
--- a/src/bn.c
+++ b/src/bn.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Big Numbers.
  *
  * 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) 2003 Cordys R&D BV, All rights reserved.
  */
@@ -14,7 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
- 
+
 #include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
@@ -44,10 +44,10 @@ static const int xmlSecBnLookupTable[] =
     -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
 };
 
-static const char xmlSecBnRevLookupTable[] = 
-{ 
-    '0', '1', '2', '3', '4', '5', '6', '7', 
-    '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 
+static const char xmlSecBnRevLookupTable[] =
+{
+    '0', '1', '2', '3', '4', '5', '6', '7',
+    '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
 };
 
 /*****************************************************************************
@@ -64,7 +64,7 @@ static const char xmlSecBnRevLookupTable[] =
  *
  * Returns: the newly BN or a NULL if an error occurs.
  */
-xmlSecBnPtr 
+xmlSecBnPtr
 xmlSecBnCreate(xmlSecSize size) {
     return(xmlSecBufferCreate(size));
 }
@@ -75,7 +75,7 @@ xmlSecBnCreate(xmlSecSize size) {
  *
  * Destroys @bn object created with @xmlSecBnCreate function.
  */
-void 
+void
 xmlSecBnDestroy(xmlSecBnPtr bn) {
     xmlSecBufferDestroy(bn);
 }
@@ -90,7 +90,7 @@ xmlSecBnDestroy(xmlSecBnPtr bn) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBnInitialize(xmlSecBnPtr bn, xmlSecSize size) {
     return(xmlSecBufferInitialize(bn, size));
 }
@@ -101,7 +101,7 @@ xmlSecBnInitialize(xmlSecBnPtr bn, xmlSecSize size) {
  *
  * Destroys @bn object created with @xmlSecBnInitialize function.
  */
-void 
+void
 xmlSecBnFinalize(xmlSecBnPtr bn) {
     xmlSecBufferFinalize(bn);
 }
@@ -111,10 +111,10 @@ xmlSecBnFinalize(xmlSecBnPtr bn) {
  * @bn:         the pointer to BN.
  *
  * Gets pointer to the binary @bn representation.
- * 
+ *
  * Returns: pointer to binary BN data or NULL if an error occurs.
  */
-xmlSecByte* 
+xmlSecByte*
 xmlSecBnGetData(xmlSecBnPtr bn) {
     return(xmlSecBufferGetData(bn));
 }
@@ -129,7 +129,7 @@ xmlSecBnGetData(xmlSecBnPtr bn) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBnSetData(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize size) {
     return(xmlSecBufferSetData(bn, data, size));
 }
@@ -142,7 +142,7 @@ xmlSecBnSetData(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize size) {
  *
  * Returns: the size of binary data.
  */
-xmlSecSize 
+xmlSecSize
 xmlSecBnGetSize(xmlSecBnPtr bn) {
     return(xmlSecBufferGetSize(bn));
 }
@@ -153,7 +153,7 @@ xmlSecBnGetSize(xmlSecBnPtr bn) {
  *
  * Sets the value of @bn to zero.
  */
-void 
+void
 xmlSecBnZero(xmlSecBnPtr bn) {
     xmlSecBufferEmpty(bn);
 }
@@ -168,7 +168,7 @@ xmlSecBnZero(xmlSecBnPtr bn) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
     xmlSecSize i, len, size;
     xmlSecByte ch;
@@ -187,11 +187,11 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
     if(len == 0) {
         return(0);
     }
-    
+
     /* The result size could not exceed the input string length
      * because each char fits inside a byte in all cases :)
      * In truth, it would be likely less than 1/2 input string length
-     * because each byte is represented by 2 chars. If needed, 
+     * because each byte is represented by 2 chars. If needed,
      * buffer size would be increased by Mul/Add functions.
      * Finally, we can add one byte for 00 or 10 prefix.
      */
@@ -214,8 +214,8 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
         /* skip spaces */
         if(isspace(ch)) {
                 continue;
-        } 
-        
+        }
+
         /* check if it is + or - */
         if(ch == '+') {
             positive = 1;
@@ -239,7 +239,7 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
-                        "char=%c;base=%d", 
+                        "char=%c;base=%d",
                         ch, base);
                 return (-1);
         }
@@ -259,7 +259,7 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
-                        "char=%c;base=%d", 
+                        "char=%c;base=%d",
                         ch, base);
                 return (-1);
         }
@@ -282,7 +282,7 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "base=%d", base);
                 return (-1);
-}       
+}
     }
 
     /* check if we need to add 00 prefix, do this for empty bn too */
@@ -308,7 +308,7 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
         for(i = 0; i < size; ++i) {
             data[i] ^= 0xFF;
         }
-        
+
         ret = xmlSecBnAdd(bn, 1);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -328,12 +328,12 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
  * @bn:         the pointer to BN.
  * @base:       the base for returned string.
  *
- * Writes @bn to string with base @base. Caller is responsible for 
+ * Writes @bn to string with base @base. Caller is responsible for
  * freeing returned string with @xmlFree.
  *
  * Returns: the string represenataion if BN or a NULL if an error occurs.
  */
-xmlChar* 
+xmlChar*
 xmlSecBnToString(xmlSecBnPtr bn, xmlSecSize base) {
     xmlSecBn bn2;
     int positive = 1;
@@ -361,7 +361,7 @@ xmlSecBnToString(xmlSecBnPtr bn, xmlSecSize base) {
             "size=%d", size);
         return (NULL);
     }
-    
+
     ret = xmlSecBnSetData(&bn2, data, size);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -399,7 +399,7 @@ xmlSecBnToString(xmlSecBnPtr bn, xmlSecSize base) {
 
     /* Result string len is
      *      len = log base (256) * <bn size>
-     * Since the smallest base == 2 then we can get away with 
+     * Since the smallest base == 2 then we can get away with
      *      len = 8 * <bn size>
      */
     len = 8 * size + 1 + 1;
@@ -461,7 +461,7 @@ xmlSecBnToString(xmlSecBnPtr bn, xmlSecSize base) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBnFromHexString(xmlSecBnPtr bn, const xmlChar* str) {
     return(xmlSecBnFromString(bn, str, 16));
 }
@@ -470,12 +470,12 @@ xmlSecBnFromHexString(xmlSecBnPtr bn, const xmlChar* str) {
  * xmlSecBnToHexString:
  * @bn:         the pointer to BN.
  *
- * Writes @bn to hex string. Caller is responsible for 
+ * Writes @bn to hex string. Caller is responsible for
  * freeing returned string with @xmlFree.
  *
  * Returns: the string represenataion if BN or a NULL if an error occurs.
  */
-xmlChar* 
+xmlChar*
 xmlSecBnToHexString(xmlSecBnPtr bn) {
     return(xmlSecBnToString(bn, 16));
 }
@@ -489,7 +489,7 @@ xmlSecBnToHexString(xmlSecBnPtr bn) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBnFromDecString(xmlSecBnPtr bn, const xmlChar* str) {
     return(xmlSecBnFromString(bn, str, 10));
 }
@@ -498,12 +498,12 @@ xmlSecBnFromDecString(xmlSecBnPtr bn, const xmlChar* str) {
  * xmlSecBnToDecString:
  * @bn:         the pointer to BN.
  *
- * Writes @bn to decimal string. Caller is responsible for 
+ * Writes @bn to decimal string. Caller is responsible for
  * freeing returned string with @xmlFree.
  *
  * Returns: the string represenataion if BN or a NULL if an error occurs.
  */
-xmlChar* 
+xmlChar*
 xmlSecBnToDecString(xmlSecBnPtr bn) {
     return(xmlSecBnToString(bn, 10));
 }
@@ -517,7 +517,7 @@ xmlSecBnToDecString(xmlSecBnPtr bn) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBnMul(xmlSecBnPtr bn, int multiplier) {
     xmlSecByte* data;
     int over;
@@ -534,7 +534,7 @@ xmlSecBnMul(xmlSecBnPtr bn, int multiplier) {
 
     data = xmlSecBufferGetData(bn);
     i = xmlSecBufferGetSize(bn);
-    over = 0; 
+    over = 0;
     while(i > 0) {
         xmlSecAssert2(data != NULL, -1);
 
@@ -542,11 +542,11 @@ xmlSecBnMul(xmlSecBnPtr bn, int multiplier) {
         data[i] = over % 256;
         over    = over / 256;
     }
-    
+
     while(over > 0) {
         ch      = over % 256;
         over    = over / 256;
-        
+
         ret = xmlSecBufferPrepend(bn, &ch, 1);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -557,7 +557,7 @@ xmlSecBnMul(xmlSecBnPtr bn, int multiplier) {
             return (-1);
         }
     }
-    
+
     return(0);
 }
 
@@ -571,7 +571,7 @@ xmlSecBnMul(xmlSecBnPtr bn, int multiplier) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBnDiv(xmlSecBnPtr bn, int divider, int* mod) {
     int over;
     xmlSecSize i, size;
@@ -596,7 +596,7 @@ xmlSecBnDiv(xmlSecBnPtr bn, int divider, int* mod) {
         over    = over % divider;
     }
     (*mod) = over;
-    
+
     /* remove leading zeros */
     for(i = 0; i < size; i++) {
         xmlSecAssert2(data != NULL, -1);
@@ -628,7 +628,7 @@ xmlSecBnDiv(xmlSecBnPtr bn, int divider, int* mod) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBnAdd(xmlSecBnPtr bn, int delta) {
     int over, tmp;
     xmlSecByte* data;
@@ -646,17 +646,17 @@ xmlSecBnAdd(xmlSecBnPtr bn, int delta) {
     if(delta > 0) {
         for(over = delta, i = xmlSecBufferGetSize(bn); (i > 0) && (over > 0) ;) {
                 xmlSecAssert2(data != NULL, -1);
-        
+
             tmp     = data[--i];
                 over   += tmp;
                 data[i] = over % 256;
                 over    = over / 256;
         }
-    
+
         while(over > 0) {
                 ch      = over % 256;
                 over    = over / 256;
-        
+
                 ret = xmlSecBufferPrepend(bn, &ch, 1);
                 if(ret < 0) {
                     xmlSecError(XMLSEC_ERRORS_HERE,
@@ -670,7 +670,7 @@ xmlSecBnAdd(xmlSecBnPtr bn, int delta) {
     } else {
         for(over = -delta, i = xmlSecBufferGetSize(bn); (i > 0) && (over > 0);) {
                 xmlSecAssert2(data != NULL, -1);
-        
+
             tmp     = data[--i];
             if(tmp < over) {
                 data[i] = 0;
@@ -692,7 +692,7 @@ xmlSecBnAdd(xmlSecBnPtr bn, int delta) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBnReverse(xmlSecBnPtr bn) {
     xmlSecByte* data;
     xmlSecSize i, j, size;
@@ -708,7 +708,7 @@ xmlSecBnReverse(xmlSecBnPtr bn) {
         ch       = data[i];
         data[i]  = data[j];
         data[j]  = ch;
-    }    
+    }
 
     return(0);
 }
@@ -724,7 +724,7 @@ xmlSecBnReverse(xmlSecBnPtr bn) {
  * Returns: 0 if data is equal, negative value if @bn is less or positive value if @bn
  * is greater than @data.
  */
-int 
+int
 xmlSecBnCompare(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSize) {
     xmlSecByte* bnData;
     xmlSecSize bnSize;
@@ -754,7 +754,7 @@ xmlSecBnCompare(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSize) {
         return(-1);
     } else if(bnSize > dataSize) {
         return(-1);
-    } 
+    }
 
     xmlSecAssert2(bnData != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
@@ -774,7 +774,7 @@ xmlSecBnCompare(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSize) {
  * Returns: 0 if data is equal, negative value if @bn is less or positive value if @bn
  * is greater than @data.
  */
-int 
+int
 xmlSecBnCompareReverse(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSize) {
     xmlSecByte* bnData;
     xmlSecSize bnSize;
@@ -804,7 +804,7 @@ xmlSecBnCompareReverse(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSi
         return(-1);
     } else if(bnSize > dataSize) {
         return(-1);
-    } 
+    }
 
     xmlSecAssert2(bnData != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
@@ -831,7 +831,7 @@ xmlSecBnCompareReverse(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSi
  *
  * Returns: 0 on success and a negative values if an error occurs.
  */
-int 
+int
 xmlSecBnGetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int reverse) {
     xmlChar* content;
     int ret;
@@ -923,7 +923,7 @@ xmlSecBnGetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int
  *
  * Returns: 0 on success and a negative values if an error occurs.
  */
-int  
+int
 xmlSecBnSetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int reverse, int addLineBreaks) {
     xmlChar* content;
     int ret;
@@ -1003,7 +1003,7 @@ xmlSecBnSetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int
  * @cur:        the poitner to an XML node.
  * @format:     the BN format.
  * @reverse:    the flag that indicates whether to reverse the buffer before writing.
- * @addLineBreaks:  if the flag is equal to 1 then 
+ * @addLineBreaks:  if the flag is equal to 1 then
  *              linebreaks will be added before and after
  *              new buffer content.
  *
@@ -1011,8 +1011,8 @@ xmlSecBnSetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int
  *
  * Returns: 0 on success and a negative values if an error occurs.
  */
-int  
-xmlSecBnBlobSetNodeValue(const xmlSecByte* data, xmlSecSize dataSize, 
+int
+xmlSecBnBlobSetNodeValue(const xmlSecByte* data, xmlSecSize dataSize,
                          xmlNodePtr cur, xmlSecBnFormat format, int reverse,
                          int addLineBreaks) {
     xmlSecBn bn;
diff --git a/src/buffer.c b/src/buffer.c
index e993695..0efbfed 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Memory buffer.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -35,13 +35,13 @@ static xmlSecSize gInitialSize = 1024;
  * xmlSecBufferSetDefaultAllocMode:
  * @defAllocMode:       the new default buffer allocation mode.
  * @defInitialSize:     the new default buffer minimal intial size.
- * 
+ *
  * Sets new global default allocation mode and minimal intial size.
  */
-void 
+void
 xmlSecBufferSetDefaultAllocMode(xmlSecAllocMode defAllocMode, xmlSecSize defInitialSize) {
     xmlSecAssert(defInitialSize > 0);
-    
+
     gAllocMode = defAllocMode;
     gInitialSize = defInitialSize;
 }
@@ -56,11 +56,11 @@ xmlSecBufferSetDefaultAllocMode(xmlSecAllocMode defAllocMode, xmlSecSize defInit
  *
  * Returns: pointer to newly allocated buffer or NULL if an error occurs.
  */
-xmlSecBufferPtr 
+xmlSecBufferPtr
 xmlSecBufferCreate(xmlSecSize size) {
     xmlSecBufferPtr buf;
     int ret;
-    
+
     buf = (xmlSecBufferPtr)xmlMalloc(sizeof(xmlSecBuffer));
     if(buf == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -70,7 +70,7 @@ xmlSecBufferCreate(xmlSecSize size) {
                     "sizeof(xmlSecBuffer)=%d", sizeof(xmlSecBuffer));
         return(NULL);
     }
-    
+
     ret = xmlSecBufferInitialize(buf, size);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -90,10 +90,10 @@ xmlSecBufferCreate(xmlSecSize size) {
  *
  * Desrtoys buffer object created with #xmlSecBufferCreate function.
  */
-void 
+void
 xmlSecBufferDestroy(xmlSecBufferPtr buf) {
     xmlSecAssert(buf != NULL);
-    
+
     xmlSecBufferFinalize(buf);
     xmlFree(buf);
 }
@@ -105,17 +105,17 @@ xmlSecBufferDestroy(xmlSecBufferPtr buf) {
  *
  * Initializes buffer object @buf. Caller is responsible for calling
  * #xmlSecBufferFinalize function to free allocated resources.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBufferInitialize(xmlSecBufferPtr buf, xmlSecSize size) {
     xmlSecAssert2(buf != NULL, -1);
 
     buf->data = NULL;
     buf->size = buf->maxSize = 0;
     buf->allocMode = gAllocMode;
-        
+
     return(xmlSecBufferSetMaxSize(buf, size));
 }
 
@@ -126,11 +126,11 @@ xmlSecBufferInitialize(xmlSecBufferPtr buf, xmlSecSize size) {
  * Frees allocated resource for a buffer intialized with #xmlSecBufferInitialize
  * function.
  */
-void 
+void
 xmlSecBufferFinalize(xmlSecBufferPtr buf) {
     xmlSecAssert(buf != NULL);
 
-    xmlSecBufferEmpty(buf);    
+    xmlSecBufferEmpty(buf);
     if(buf->data != 0) {
         xmlFree(buf->data);
     }
@@ -147,7 +147,7 @@ xmlSecBufferFinalize(xmlSecBufferPtr buf) {
 void
 xmlSecBufferEmpty(xmlSecBufferPtr buf) {
     xmlSecAssert(buf != NULL);
-    
+
     if(buf->data != 0) {
         xmlSecAssert(buf->maxSize > 0);
 
@@ -164,10 +164,10 @@ xmlSecBufferEmpty(xmlSecBufferPtr buf) {
  *
  * Returns: pointer to buffer's data.
  */
-xmlSecByte* 
+xmlSecByte*
 xmlSecBufferGetData(xmlSecBufferPtr buf) {
     xmlSecAssert2(buf != NULL, NULL);
-    
+
     return(buf->data);
 }
 
@@ -181,16 +181,16 @@ xmlSecBufferGetData(xmlSecBufferPtr buf) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBufferSetData(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size) {
     int ret;
-    
+
     xmlSecAssert2(buf != NULL, -1);
 
     xmlSecBufferEmpty(buf);
     if(size > 0) {
         xmlSecAssert2(data != NULL, -1);
-    
+
         ret = xmlSecBufferSetMaxSize(buf, size);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -200,11 +200,11 @@ xmlSecBufferSetData(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size
                         "size=%d", size);
             return(-1);
         }
-        
+
         memcpy(buf->data, data, size);
     }
-    
-    buf->size = size;    
+
+    buf->size = size;
     return(0);
 }
 
@@ -216,7 +216,7 @@ xmlSecBufferSetData(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size
  *
  * Returns: the current data size.
  */
-xmlSecSize 
+xmlSecSize
 xmlSecBufferGetSize(xmlSecBufferPtr buf) {
     xmlSecAssert2(buf != NULL, 0);
 
@@ -228,15 +228,15 @@ xmlSecBufferGetSize(xmlSecBufferPtr buf) {
  * @buf:                the pointer to buffer object.
  * @size:               the new data size.
  *
- * Sets new buffer data size. If necessary, buffer grows to 
- * have at least @size bytes. 
+ * Sets new buffer data size. If necessary, buffer grows to
+ * have at least @size bytes.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBufferSetSize(xmlSecBufferPtr buf, xmlSecSize size) {
     int ret;
-    
+
     xmlSecAssert2(buf != NULL, -1);
 
     ret = xmlSecBufferSetMaxSize(buf, size);
@@ -248,8 +248,8 @@ xmlSecBufferSetSize(xmlSecBufferPtr buf, xmlSecSize size) {
                     "size=%d", size);
         return(-1);
     }
-    
-    
+
+
     buf->size = size;
     return(0);
 }
@@ -262,7 +262,7 @@ xmlSecBufferSetSize(xmlSecBufferPtr buf, xmlSecSize size) {
  *
  * Returns: the maximum (allocated) buffer size.
  */
-xmlSecSize 
+xmlSecSize
 xmlSecBufferGetMaxSize(xmlSecBufferPtr buf) {
     xmlSecAssert2(buf != NULL, 0);
 
@@ -274,21 +274,21 @@ xmlSecBufferGetMaxSize(xmlSecBufferPtr buf) {
  * @buf:                the pointer to buffer object.
  * @size:               the new maximum size.
  *
- * Sets new buffer maximum size. If necessary, buffer grows to 
- * have at least @size bytes. 
+ * Sets new buffer maximum size. If necessary, buffer grows to
+ * have at least @size bytes.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBufferSetMaxSize(xmlSecBufferPtr buf, xmlSecSize size) {
     xmlSecByte* newData;
     xmlSecSize newSize = 0;
-    
+
     xmlSecAssert2(buf != NULL, -1);
     if(size <= buf->maxSize) {
         return(0);
     }
-    
+
     switch(buf->allocMode) {
         case xmlSecAllocModeExact:
             newSize = size + 8;
@@ -301,7 +301,7 @@ xmlSecBufferSetMaxSize(xmlSecBufferPtr buf, xmlSecSize size) {
     if(newSize < gInitialSize) {
         newSize = gInitialSize;
     }
-    
+
 
     if(buf->data != NULL) {
         newData = (xmlSecByte*)xmlRealloc(buf->data, newSize);
@@ -316,7 +316,7 @@ xmlSecBufferSetMaxSize(xmlSecBufferPtr buf, xmlSecSize size) {
                     "size=%d", newSize);
         return(-1);
     }
-    
+
     buf->data = newData;
     buf->maxSize = newSize;
 
@@ -324,7 +324,7 @@ xmlSecBufferSetMaxSize(xmlSecBufferPtr buf, xmlSecSize size) {
         xmlSecAssert2(buf->data != NULL, -1);
         memset(buf->data + buf->size, 0, buf->maxSize - buf->size);
     }
-    
+
     return(0);
 }
 
@@ -338,15 +338,15 @@ xmlSecBufferSetMaxSize(xmlSecBufferPtr buf, xmlSecSize size) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBufferAppend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size) {
     int ret;
-    
+
     xmlSecAssert2(buf != NULL, -1);
 
     if(size > 0) {
         xmlSecAssert2(data != NULL, -1);
-    
+
         ret = xmlSecBufferSetMaxSize(buf, buf->size + size);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -356,11 +356,11 @@ xmlSecBufferAppend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size)
                         "size=%d", buf->size + size);
             return(-1);
         }
-        
+
         memcpy(buf->data + buf->size, data, size);
-        buf->size += size;    
+        buf->size += size;
     }
-    
+
     return(0);
 }
 
@@ -377,12 +377,12 @@ xmlSecBufferAppend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size)
 int
 xmlSecBufferPrepend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size) {
     int ret;
-    
+
     xmlSecAssert2(buf != NULL, -1);
 
     if(size > 0) {
         xmlSecAssert2(data != NULL, -1);
-    
+
         ret = xmlSecBufferSetMaxSize(buf, buf->size + size);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -393,11 +393,11 @@ xmlSecBufferPrepend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size
             return(-1);
         }
 
-        memmove(buf->data + size, buf->data, buf->size);        
+        memmove(buf->data + size, buf->data, buf->size);
         memcpy(buf->data, data, size);
-        buf->size += size;    
+        buf->size += size;
     }
-    
+
     return(0);
 }
 
@@ -410,13 +410,13 @@ xmlSecBufferPrepend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBufferRemoveHead(xmlSecBufferPtr buf, xmlSecSize size) {
     xmlSecAssert2(buf != NULL, -1);
-    
+
     if(size < buf->size) {
         xmlSecAssert2(buf->data != NULL, -1);
-        
+
         buf->size -= size;
         memmove(buf->data, buf->data + size, buf->size);
     } else {
@@ -438,7 +438,7 @@ xmlSecBufferRemoveHead(xmlSecBufferPtr buf, xmlSecSize size) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBufferRemoveTail(xmlSecBufferPtr buf, xmlSecSize size) {
     xmlSecAssert2(buf != NULL, -1);
 
@@ -463,7 +463,7 @@ xmlSecBufferRemoveTail(xmlSecBufferPtr buf, xmlSecSize size) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBufferReadFile(xmlSecBufferPtr buf, const char* filename) {
     xmlSecByte buffer[1024];
     FILE* f;
@@ -478,7 +478,7 @@ xmlSecBufferReadFile(xmlSecBufferPtr buf, const char* filename) {
                     NULL,
                     "fopen",
                     XMLSEC_ERRORS_R_IO_FAILED,
-                    "filename=%s;errno=%d", 
+                    "filename=%s;errno=%d",
                     xmlSecErrorsSafeString(filename),
                     errno);
         return(-1);
@@ -493,7 +493,7 @@ xmlSecBufferReadFile(xmlSecBufferPtr buf, const char* filename) {
                         NULL,
                         "fread",
                         XMLSEC_ERRORS_R_IO_FAILED,
-                        "filename=%s;errno=%d", 
+                        "filename=%s;errno=%d",
                         xmlSecErrorsSafeString(filename),
                         errno);
             fclose(f);
@@ -506,11 +506,11 @@ xmlSecBufferReadFile(xmlSecBufferPtr buf, const char* filename) {
                         NULL,
                         "xmlSecBufferAppend",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "size=%d", 
+                        "size=%d",
                         len);
             fclose(f);
             return(-1);
-        }     
+        }
     }
 
     fclose(f);
@@ -527,12 +527,12 @@ xmlSecBufferReadFile(xmlSecBufferPtr buf, const char* filename) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf, xmlNodePtr node) {
     xmlChar* content;
     xmlSecSize size;
     int ret;
-    
+
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
@@ -543,9 +543,9 @@ xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf, xmlNodePtr node) {
                     xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
                     XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);             
+        return(-1);
     }
-    
+
     /* base64 decode size is less than input size */
     ret = xmlSecBufferSetMaxSize(buf, xmlStrlen(content));
     if(ret < 0) {
@@ -557,7 +557,7 @@ xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf, xmlNodePtr node) {
         xmlFree(content);
         return(-1);
     }
-    
+
     ret = xmlSecBase64Decode(content, xmlSecBufferGetData(buf), xmlSecBufferGetMaxSize(buf));
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -581,7 +581,7 @@ xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf, xmlNodePtr node) {
         return(-1);
     }
     xmlFree(content);
-    
+
     return(0);
 }
 
@@ -595,10 +595,10 @@ xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf, xmlNodePtr node) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecBufferBase64NodeContentWrite(xmlSecBufferPtr buf, xmlNodePtr node, int columns) {
     xmlChar* content;
-    
+
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
@@ -613,7 +613,7 @@ xmlSecBufferBase64NodeContentWrite(xmlSecBufferPtr buf, xmlNodePtr node, int col
     }
     xmlNodeAddContent(node, content);
     xmlFree(content);
-    
+
     return(0);
 }
 
@@ -621,37 +621,37 @@ xmlSecBufferBase64NodeContentWrite(xmlSecBufferPtr buf, xmlNodePtr node, int col
  *
  * IO buffer
  *
- ************************************************************************/ 
+ ************************************************************************/
 static int      xmlSecBufferIOWrite                             (xmlSecBufferPtr buf,
                                                                  const xmlSecByte *data,
-                                                                 xmlSecSize size);              
+                                                                 xmlSecSize size);
 static int      xmlSecBufferIOClose                             (xmlSecBufferPtr buf);
 
 /**
  * xmlSecBufferCreateOutputBuffer:
  * @buf:                the pointer to buffer.
  *
- * Creates new LibXML output buffer to store data in the @buf. Caller is 
- * responsible for destroying @buf when processing is done. 
+ * Creates new LibXML output buffer to store data in the @buf. Caller is
+ * responsible for destroying @buf when processing is done.
  *
  * Returns: pointer to newly allocated output buffer or NULL if an error
  * occurs.
  */
-xmlOutputBufferPtr 
+xmlOutputBufferPtr
 xmlSecBufferCreateOutputBuffer(xmlSecBufferPtr buf) {
     return(xmlOutputBufferCreateIO((xmlOutputWriteCallback)xmlSecBufferIOWrite,
                                      (xmlOutputCloseCallback)xmlSecBufferIOClose,
                                      buf,
-                                     NULL)); 
+                                     NULL));
 }
 
-static int 
+static int
 xmlSecBufferIOWrite(xmlSecBufferPtr buf, const xmlSecByte *data, xmlSecSize size) {
     int ret;
-    
+
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
-    
+
     ret = xmlSecBufferAppend(buf, data, size);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -661,14 +661,14 @@ xmlSecBufferIOWrite(xmlSecBufferPtr buf, const xmlSecByte *data, xmlSecSize size
                     "size=%d", size);
         return(-1);
     }
-    
-    return(size);    
+
+    return(size);
 }
 
-static int 
+static int
 xmlSecBufferIOClose(xmlSecBufferPtr buf) {
     xmlSecAssert2(buf != NULL, -1);
-    
+
     /* just do nothing */
     return(0);
 }
diff --git a/src/c14n.c b/src/c14n.c
index 2025793..5967a35 100644
--- a/src/c14n.c
+++ b/src/c14n.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Canonicalization transforms.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -28,9 +28,9 @@
  *
  * C14N transforms
  *
- * Inclusive namespaces list for ExclC14N (xmlSecStringList) is located 
+ * Inclusive namespaces list for ExclC14N (xmlSecStringList) is located
  * after xmlSecTransform structure
- * 
+ *
  *****************************************************************************/
 #define xmlSecTransformC14NSize \
     (sizeof(xmlSecTransform) + sizeof(xmlSecPtrList))
@@ -60,28 +60,28 @@ static void             xmlSecTransformC14NFinalize     (xmlSecTransformPtr tran
 static int              xmlSecTransformC14NNodeRead     (xmlSecTransformPtr transform,
                                                          xmlNodePtr node,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int              xmlSecTransformC14NPushXml      (xmlSecTransformPtr transform, 
+static int              xmlSecTransformC14NPushXml      (xmlSecTransformPtr transform,
                                                          xmlSecNodeSetPtr nodes,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int              xmlSecTransformC14NPopBin       (xmlSecTransformPtr transform, 
+static int              xmlSecTransformC14NPopBin       (xmlSecTransformPtr transform,
                                                          xmlSecByte* data,
                                                          xmlSecSize maxDataSize,
                                                          xmlSecSize* dataSize,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int              xmlSecTransformC14NExecute      (xmlSecTransformId id, 
-                                                         xmlSecNodeSetPtr nodes, 
+static int              xmlSecTransformC14NExecute      (xmlSecTransformId id,
+                                                         xmlSecNodeSetPtr nodes,
                                                          xmlChar** nsList,
                                                          xmlOutputBufferPtr buf);
 static int
 xmlSecTransformC14NInitialize(xmlSecTransformPtr transform) {
     xmlSecPtrListPtr nsList;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformC14NCheckId(transform), -1);
 
     nsList = xmlSecTransformC14NGetNsList(transform);
     xmlSecAssert2(nsList != NULL, -1);
-    
+
     ret = xmlSecPtrListInitialize(nsList, xmlSecStringListId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -102,7 +102,7 @@ xmlSecTransformC14NFinalize(xmlSecTransformPtr transform) {
 
     nsList = xmlSecTransformC14NGetNsList(transform);
     xmlSecAssert(xmlSecPtrListCheckId(nsList, xmlSecStringListId));
-    
+
     xmlSecPtrListFinalize(nsList);
 }
 
@@ -113,18 +113,18 @@ xmlSecTransformC14NNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSe
     xmlChar *list;
     xmlChar *p, *n, *tmp;
     int ret;
-    
+
     /* we have something to read only for exclusive c14n transforms */
     xmlSecAssert2(xmlSecTransformExclC14NCheckId(transform), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-        
+
     nsList = xmlSecTransformC14NGetNsList(transform);
     xmlSecAssert2(xmlSecPtrListCheckId(nsList, xmlSecStringListId), -1);
     xmlSecAssert2(xmlSecPtrListGetSize(nsList) == 0, -1);
-    
+
     /* there is only one optional node */
-    cur = xmlSecGetNextElementNode(node->children);  
+    cur = xmlSecGetNextElementNode(node->children);
     if(cur != NULL) {
         if(!xmlSecCheckNodeName(cur, xmlSecNodeInclusiveNamespaces, xmlSecNsExcC14N)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -134,10 +134,10 @@ xmlSecTransformC14NNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSe
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-    
+
         list = xmlGetProp(cur, xmlSecAttrPrefixList);
         if(list == NULL) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         xmlSecErrorsSafeString(xmlSecAttrPrefixList),
                         XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
@@ -145,14 +145,14 @@ xmlSecTransformC14NNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSe
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
             return(-1);
         }
-    
+
         /* the list of namespaces is space separated */
         for(p = n = list; ((p != NULL) && ((*p) != '\0')); p = n) {
             n = (xmlChar*)xmlStrchr(p, ' ');
             if(n != NULL) {
                 *(n++) = '\0';
-            }   
-        
+            }
+
             tmp = xmlStrdup(p);
             if(tmp == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -161,9 +161,9 @@ xmlSecTransformC14NNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSe
                             XMLSEC_ERRORS_R_STRDUP_FAILED,
                             "len=%d", xmlStrlen(p));
                 xmlFree(list);
-                return(-1);     
+                return(-1);
             }
-        
+
             ret = xmlSecPtrListAdd(nsList, tmp);
             if(ret < 0) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -189,9 +189,9 @@ xmlSecTransformC14NNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSe
             return(-1);
         }
 
-        cur = xmlSecGetNextElementNode(cur->next);        
+        cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     /* check that we have nothing else */
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -202,16 +202,16 @@ xmlSecTransformC14NNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSe
         return(-1);
     }
 
-    return(0);    
+    return(0);
 }
 
-static int 
+static int
 xmlSecTransformC14NPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
                             xmlSecTransformCtxPtr transformCtx) {
     xmlOutputBufferPtr buf;
     xmlSecPtrListPtr nsList;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformC14NCheckId(transform), -1);
     xmlSecAssert2(nodes != NULL, -1);
     xmlSecAssert2(nodes->doc != NULL, -1);
@@ -226,7 +226,7 @@ xmlSecTransformC14NPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
     case xmlSecTransformStatusFinished:
         return(0);
     default:
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -273,7 +273,7 @@ xmlSecTransformC14NPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
         xmlOutputBufferClose(buf);
         return(-1);
     }
-    
+
     ret = xmlOutputBufferClose(buf);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -287,32 +287,32 @@ xmlSecTransformC14NPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
     return(0);
 }
 
-static int 
+static int
 xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
                             xmlSecSize maxDataSize, xmlSecSize* dataSize,
                             xmlSecTransformCtxPtr transformCtx) {
     xmlSecPtrListPtr nsList;
     xmlSecBufferPtr out;
     int ret;
-        
+
     xmlSecAssert2(xmlSecTransformC14NCheckId(transform), -1);
     xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(dataSize != NULL, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-    
+
     out = &(transform->outBuf);
     if(transform->status == xmlSecTransformStatusNone) {
         xmlOutputBufferPtr buf;
-        
+
         xmlSecAssert2(transform->inNodes == NULL, -1);
-        
+
         /* todo: isn't it an error? */
         if(transform->prev == NULL) {
             (*dataSize) = 0;
             transform->status = xmlSecTransformStatusFinished;
             return(0);
         }
-        
+
         /* get xml data from previous transform */
         ret = xmlSecTransformPopXml(transform->prev, &(transform->inNodes), transformCtx);
         if(ret < 0) {
@@ -323,7 +323,7 @@ xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-                
+
         /* dump everything to internal buffer */
         buf = xmlSecBufferCreateOutputBuffer(out);
         if(buf == NULL) {
@@ -334,7 +334,7 @@ xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-            
+
         /* we are using a semi-hack here: we know that xmlSecPtrList keeps
          * all pointers in the big array */
         nsList = xmlSecTransformC14NGetNsList(transform);
@@ -361,13 +361,13 @@ xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
         }
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if(transform->status == xmlSecTransformStatusWorking) {
         xmlSecSize outSize;
-        
+
         /* return chunk after chunk */
         outSize = xmlSecBufferGetSize(out);
-        if(outSize > maxDataSize) {     
+        if(outSize > maxDataSize) {
             outSize = maxDataSize;
         }
         if(outSize > XMLSEC_TRANSFORM_BINARY_CHUNK) {
@@ -375,7 +375,7 @@ xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
         }
         if(outSize > 0) {
             xmlSecAssert2(xmlSecBufferGetData(&(transform->outBuf)), -1);
-        
+
             memcpy(data, xmlSecBufferGetData(&(transform->outBuf)), outSize);
             ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize);
             if(ret < 0) {
@@ -385,7 +385,7 @@ xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             "size=%d", outSize);
                 return(-1);
-            }   
+            }
         } else if(xmlSecBufferGetSize(out) == 0) {
             transform->status = xmlSecTransformStatusFinished;
         }
@@ -395,73 +395,73 @@ xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
         xmlSecAssert2(xmlSecBufferGetSize(out) == 0, -1);
         (*dataSize) = 0;
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
-static int 
-xmlSecTransformC14NExecute(xmlSecTransformId id, xmlSecNodeSetPtr nodes, xmlChar** nsList, 
+static int
+xmlSecTransformC14NExecute(xmlSecTransformId id, xmlSecNodeSetPtr nodes, xmlChar** nsList,
                            xmlOutputBufferPtr buf) {
-    int ret; 
-    
+    int ret;
+
     xmlSecAssert2(id != xmlSecTransformIdUnknown, -1);
     xmlSecAssert2(nodes != NULL, -1);
     xmlSecAssert2(nodes->doc != NULL, -1);
     xmlSecAssert2(buf != NULL, -1);
 
     /* execute c14n transform */
-    if(id == xmlSecTransformInclC14NId) {    
-        ret = xmlC14NExecute(nodes->doc, 
-                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, 
+    if(id == xmlSecTransformInclC14NId) {
+        ret = xmlC14NExecute(nodes->doc,
+                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
                         nodes, XML_C14N_1_0, NULL, 0, buf);
     } else if(id == xmlSecTransformInclC14NWithCommentsId) {
-         ret = xmlC14NExecute(nodes->doc, 
-                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, 
-                        nodes, XML_C14N_1_0, NULL, 1, buf); 
-    } else if(id == xmlSecTransformInclC14N11Id) {    
-        ret = xmlC14NExecute(nodes->doc, 
-                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, 
+         ret = xmlC14NExecute(nodes->doc,
+                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
+                        nodes, XML_C14N_1_0, NULL, 1, buf);
+    } else if(id == xmlSecTransformInclC14N11Id) {
+        ret = xmlC14NExecute(nodes->doc,
+                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
                         nodes, XML_C14N_1_1, NULL, 0, buf);
     } else if(id == xmlSecTransformInclC14N11WithCommentsId) {
-         ret = xmlC14NExecute(nodes->doc, 
-                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, 
-                        nodes, XML_C14N_1_1, NULL, 1, buf); 
+         ret = xmlC14NExecute(nodes->doc,
+                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
+                        nodes, XML_C14N_1_1, NULL, 1, buf);
     } else if(id == xmlSecTransformExclC14NId) {
-        ret = xmlC14NExecute(nodes->doc, 
-                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, 
+        ret = xmlC14NExecute(nodes->doc,
+                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
                         nodes, XML_C14N_EXCLUSIVE_1_0, nsList, 0, buf);
     } else if(id == xmlSecTransformExclC14NWithCommentsId) {
-        ret = xmlC14NExecute(nodes->doc, 
-                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains, 
+        ret = xmlC14NExecute(nodes->doc,
+                        (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
                         nodes, XML_C14N_EXCLUSIVE_1_0, nsList, 1, buf);
-    } else if(id == xmlSecTransformRemoveXmlTagsC14NId) { 
+    } else if(id == xmlSecTransformRemoveXmlTagsC14NId) {
         ret = xmlSecNodeSetDumpTextNodes(nodes, buf);
     } else {
         /* shoudn't be possible to come here, actually */
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)),
                     "xmlC14NExecute",
                     XMLSEC_ERRORS_R_XML_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -477,7 +477,7 @@ static xmlSecTransformKlass xmlSecTransformInclC14NKlass = {
 
     xmlSecNameC14N,                             /* const xmlChar* name; */
     xmlSecHrefC14N,                             /* const xmlChar* href; */
-    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform, 
+    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
                                                 /* xmlSecAlgorithmUsage usage; */
 
     xmlSecTransformC14NInitialize,              /* xmlSecTransformInitializeMethod initialize; */
@@ -502,16 +502,16 @@ static xmlSecTransformKlass xmlSecTransformInclC14NKlass = {
  * xmlSecTransformInclC14NGetKlass:
  *
  * Inclusive (regular) canonicalization that omits comments transform klass
- * (http://www.w3.org/TR/xmldsig-core/#sec-c14nAlg and 
+ * (http://www.w3.org/TR/xmldsig-core/#sec-c14nAlg and
  * http://www.w3.org/TR/2001/REC-xml-c14n-20010315).
  *
  * Returns: c14n transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformInclC14NGetKlass(void) {
     return(&xmlSecTransformInclC14NKlass);
 }
- 
+
 /***************************************************************************
  *
  * C14N With Comments
@@ -522,10 +522,10 @@ static xmlSecTransformKlass xmlSecTransformInclC14NWithCommentsKlass = {
     sizeof(xmlSecTransformKlass),               /* xmlSecSize klassSize */
     xmlSecTransformC14NSize,                    /* xmlSecSize objSize */
 
-    /* same as xmlSecTransformId */    
+    /* same as xmlSecTransformId */
     xmlSecNameC14NWithComments,                 /* const xmlChar* name; */
     xmlSecHrefC14NWithComments,                 /* const xmlChar* href; */
-    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform, 
+    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
                                                 /* xmlSecAlgorithmUsage usage; */
 
     xmlSecTransformC14NInitialize,              /* xmlSecTransformInitializeMethod initialize; */
@@ -550,12 +550,12 @@ static xmlSecTransformKlass xmlSecTransformInclC14NWithCommentsKlass = {
  * xmlSecTransformInclC14NWithCommentsGetKlass:
  *
  * Inclusive (regular) canonicalization that includes comments transform klass
- * (http://www.w3.org/TR/xmldsig-core/#sec-c14nAlg and 
+ * (http://www.w3.org/TR/xmldsig-core/#sec-c14nAlg and
  * http://www.w3.org/TR/2001/REC-xml-c14n-20010315).
  *
  * Returns: c14n with comments transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformInclC14NWithCommentsGetKlass(void) {
     return(&xmlSecTransformInclC14NWithCommentsKlass);
 }
@@ -572,7 +572,7 @@ static xmlSecTransformKlass xmlSecTransformInclC14N11Klass = {
 
     xmlSecNameC14N11,                           /* const xmlChar* name; */
     xmlSecHrefC14N11,                           /* const xmlChar* href; */
-    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform, 
+    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
                                                 /* xmlSecAlgorithmUsage usage; */
 
     xmlSecTransformC14NInitialize,              /* xmlSecTransformInitializeMethod initialize; */
@@ -600,11 +600,11 @@ static xmlSecTransformKlass xmlSecTransformInclC14N11Klass = {
  *
  * Returns: c14n v1.1 transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformInclC14N11GetKlass(void) {
     return(&xmlSecTransformInclC14N11Klass);
 }
- 
+
 /***************************************************************************
  *
  * C14N v1.1 With Comments
@@ -615,10 +615,10 @@ static xmlSecTransformKlass xmlSecTransformInclC14N11WithCommentsKlass = {
     sizeof(xmlSecTransformKlass),               /* xmlSecSize klassSize */
     xmlSecTransformC14NSize,                    /* xmlSecSize objSize */
 
-    /* same as xmlSecTransformId */    
+    /* same as xmlSecTransformId */
     xmlSecNameC14N11WithComments,               /* const xmlChar* name; */
     xmlSecHrefC14N11WithComments,               /* const xmlChar* href; */
-    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform, 
+    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
                                                 /* xmlSecAlgorithmUsage usage; */
 
     xmlSecTransformC14NInitialize,              /* xmlSecTransformInitializeMethod initialize; */
@@ -646,7 +646,7 @@ static xmlSecTransformKlass xmlSecTransformInclC14N11WithCommentsKlass = {
  *
  * Returns: c14n v1.1 with comments transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformInclC14N11WithCommentsGetKlass(void) {
     return(&xmlSecTransformInclC14N11WithCommentsKlass);
 }
@@ -664,7 +664,7 @@ static xmlSecTransformKlass xmlSecTransformExclC14NKlass = {
 
     xmlSecNameExcC14N,                          /* const xmlChar* name; */
     xmlSecHrefExcC14N,                          /* const xmlChar* href; */
-    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform, 
+    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
                                                 /* xmlSecAlgorithmUsage usage; */
 
     xmlSecTransformC14NInitialize,              /* xmlSecTransformInitializeMethod initialize; */
@@ -680,26 +680,26 @@ static xmlSecTransformKlass xmlSecTransformExclC14NKlass = {
     xmlSecTransformC14NPushXml,                 /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     NULL,                                       /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecTransformExclC14NGetKlass:
- * 
+ *
  * Exclusive canoncicalization that ommits comments transform klass
  * (http://www.w3.org/TR/xml-exc-c14n/).
- * 
+ *
  * Returns: exclusive c14n transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformExclC14NGetKlass(void) {
     return(&xmlSecTransformExclC14NKlass);
 }
 
 /***************************************************************************
- * 
+ *
  * Excl C14N With Comments
  *
  ***************************************************************************/
@@ -710,7 +710,7 @@ static xmlSecTransformKlass xmlSecTransformExclC14NWithCommentsKlass = {
 
     xmlSecNameExcC14NWithComments,              /* const xmlChar* name; */
     xmlSecHrefExcC14NWithComments,              /* const xmlChar* href; */
-    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,         
+    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
                                                 /* xmlSecAlgorithmUsage usage; */
 
     xmlSecTransformC14NInitialize,              /* xmlSecTransformInitializeMethod initialize; */
@@ -731,15 +731,15 @@ static xmlSecTransformKlass xmlSecTransformExclC14NWithCommentsKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecTransformExclC14NWithCommentsGetKlass:
- * 
+ *
  * Exclusive canoncicalization that includes comments transform klass
  * (http://www.w3.org/TR/xml-exc-c14n/).
- * 
+ *
  * Returns: exclusive c14n with comments transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformExclC14NWithCommentsGetKlass(void) {
     return(&xmlSecTransformExclC14NWithCommentsKlass);
 }
@@ -756,7 +756,7 @@ static xmlSecTransformKlass xmlSecTransformRemoveXmlTagsC14NKlass = {
 
     BAD_CAST "remove-xml-tags-transform",       /* const xmlChar* name; */
     NULL,                                       /* const xmlChar* href; */
-    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,         
+    xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
                                                 /* xmlSecAlgorithmUsage usage; */
 
     xmlSecTransformC14NInitialize,              /* xmlSecTransformInitializeMethod initialize; */
@@ -781,20 +781,20 @@ static xmlSecTransformKlass xmlSecTransformRemoveXmlTagsC14NKlass = {
  * xmlSecTransformRemoveXmlTagsC14NGetKlass:
  *
  * The "remove xml tags" transform klass (http://www.w3.org/TR/xmldsig-core/#sec-Base-64):
- * Base64 transform requires an octet stream for input. If an XPath node-set 
- * (or sufficiently functional alternative) is given as input, then it is 
- * converted to an octet stream by performing operations logically equivalent 
- * to 1) applying an XPath transform with expression self::text(), then 2) 
- * taking the string-value of the node-set. Thus, if an XML element is 
- * identified by a barename XPointer in the Reference URI, and its content 
- * consists solely of base64 encoded character data, then this transform 
- * automatically strips away the start and end tags of the identified element 
- * and any of its descendant elements as well as any descendant comments and 
+ * Base64 transform requires an octet stream for input. If an XPath node-set
+ * (or sufficiently functional alternative) is given as input, then it is
+ * converted to an octet stream by performing operations logically equivalent
+ * to 1) applying an XPath transform with expression self::text(), then 2)
+ * taking the string-value of the node-set. Thus, if an XML element is
+ * identified by a barename XPointer in the Reference URI, and its content
+ * consists solely of base64 encoded character data, then this transform
+ * automatically strips away the start and end tags of the identified element
+ * and any of its descendant elements as well as any descendant comments and
  * processing instructions. The output of this transform is an octet stream.
  *
  * Returns: "remove xml tags" transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformRemoveXmlTagsC14NGetKlass(void) {
     return(&xmlSecTransformRemoveXmlTagsC14NKlass);
 }
diff --git a/src/dl.c b/src/dl.c
index ba4c5fc..3bb0ac8 100644
--- a/src/dl.c
+++ b/src/dl.c
@@ -1,10 +1,10 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -67,7 +67,7 @@ static void                     xmlSecCryptoDLLibraryDestroy            (xmlSecC
 static xmlSecCryptoDLLibraryPtr xmlSecCryptoDLLibraryDuplicate          (xmlSecCryptoDLLibraryPtr lib);
 static xmlChar*                 xmlSecCryptoDLLibraryConstructFilename  (const xmlChar* name);
 static xmlChar*                 xmlSecCryptoDLLibraryConstructGetFunctionsName(const xmlChar* name);
-                                                        
+
 
 static xmlSecPtrListKlass xmlSecCryptoDLLibrariesListKlass = {
     BAD_CAST "dl-libraries-list",
@@ -77,20 +77,20 @@ static xmlSecPtrListKlass xmlSecCryptoDLLibrariesListKlass = {
     NULL,                                                       /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
 };
 static xmlSecPtrListId          xmlSecCryptoDLLibrariesListGetKlass     (void);
-static int                      xmlSecCryptoDLLibrariesListFindByName   (xmlSecPtrListPtr list, 
+static int                      xmlSecCryptoDLLibrariesListFindByName   (xmlSecPtrListPtr list,
                                                                          const xmlChar* name);
 
 typedef xmlSecCryptoDLFunctionsPtr (*xmlSecCryptoGetFunctionsCallback)(void);
 
-static xmlSecCryptoDLLibraryPtr 
+static xmlSecCryptoDLLibraryPtr
 xmlSecCryptoDLLibraryCreate(const xmlChar* name) {
     xmlSecCryptoDLLibraryPtr lib;
     xmlSecCryptoGetFunctionsCallback getFunctions;
-    
+
     xmlSecAssert2(name != NULL, NULL);
 
     /* fprintf (stderr, "loading \"library %s\"...\n", name); */
-    
+
     /* Allocate a new xmlSecCryptoDLLibrary and fill the fields. */
     lib = (xmlSecCryptoDLLibraryPtr)xmlMalloc(sizeof(xmlSecCryptoDLLibrary));
     if(lib == NULL) {
@@ -98,18 +98,18 @@ xmlSecCryptoDLLibraryCreate(const xmlChar* name) {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "size=%d", sizeof(lib)); 
+                    "size=%d", sizeof(lib));
         return(NULL);
     }
     memset(lib, 0, sizeof(xmlSecCryptoDLLibrary));
-    
+
     lib->name = xmlStrdup(name);
     if(lib->name == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     "xmlStrdup",
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    XMLSEC_ERRORS_NO_MESSAGE); 
+                    XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecCryptoDLLibraryDestroy(lib);
         return(NULL);
     }
@@ -120,7 +120,7 @@ xmlSecCryptoDLLibraryCreate(const xmlChar* name) {
                     "xmlSecCryptoDLLibraryConstructFilename",
                     NULL,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    XMLSEC_ERRORS_NO_MESSAGE); 
+                    XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecCryptoDLLibraryDestroy(lib);
         return(NULL);
     }
@@ -131,7 +131,7 @@ xmlSecCryptoDLLibraryCreate(const xmlChar* name) {
                     "xmlSecCryptoDLLibraryConstructGetFunctionsName",
                     NULL,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    XMLSEC_ERRORS_NO_MESSAGE); 
+                    XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecCryptoDLLibraryDestroy(lib);
         return(NULL);
     }
@@ -196,7 +196,7 @@ xmlSecCryptoDLLibraryCreate(const xmlChar* name) {
                     "invalid configuration: no way to load library");
         xmlSecCryptoDLLibraryDestroy(lib);
         return(NULL);
-    }    
+    }
 
     lib->functions = getFunctions();
     if(lib->functions == NULL) {
@@ -204,7 +204,7 @@ xmlSecCryptoDLLibraryCreate(const xmlChar* name) {
                     "getFunctions",
                     NULL,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    XMLSEC_ERRORS_NO_MESSAGE); 
+                    XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecCryptoDLLibraryDestroy(lib);
         return(NULL);
     }
@@ -213,7 +213,7 @@ xmlSecCryptoDLLibraryCreate(const xmlChar* name) {
     return(lib);
 }
 
-static void 
+static void
 xmlSecCryptoDLLibraryDestroy(xmlSecCryptoDLLibraryPtr lib) {
     xmlSecAssert(lib != NULL);
 
@@ -225,15 +225,15 @@ xmlSecCryptoDLLibraryDestroy(xmlSecCryptoDLLibraryPtr lib) {
     if(lib->filename != NULL) {
         xmlFree(lib->filename);
     }
-    
+
     if(lib->getFunctionsName != NULL) {
         xmlFree(lib->getFunctionsName);
     }
 
 #ifdef XMLSEC_DL_LIBLTDL
-    if(lib->handle != NULL) {   
+    if(lib->handle != NULL) {
         int ret;
-        
+
         ret = lt_dlclose(lib->handle);
         if(ret != 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -246,7 +246,7 @@ xmlSecCryptoDLLibraryDestroy(xmlSecCryptoDLLibraryPtr lib) {
 #endif /* XMLSEC_DL_LIBLTDL */
 
 #ifdef XMLSEC_DL_WIN32
-    if(lib->handle != NULL) {   
+    if(lib->handle != NULL) {
         BOOL res;
 
         res = FreeLibrary(lib->handle);
@@ -264,7 +264,7 @@ xmlSecCryptoDLLibraryDestroy(xmlSecCryptoDLLibraryPtr lib) {
     xmlFree(lib);
 }
 
-static xmlSecCryptoDLLibraryPtr 
+static xmlSecCryptoDLLibraryPtr
 xmlSecCryptoDLLibraryDuplicate(xmlSecCryptoDLLibraryPtr lib) {
     xmlSecAssert2(lib != NULL, NULL);
     xmlSecAssert2(lib->name != NULL, NULL);
@@ -272,7 +272,7 @@ xmlSecCryptoDLLibraryDuplicate(xmlSecCryptoDLLibraryPtr lib) {
     return(xmlSecCryptoDLLibraryCreate(lib->name));
 }
 
-static xmlChar* 
+static xmlChar*
 xmlSecCryptoDLLibraryConstructFilename(const xmlChar* name) {
     static xmlChar tmpl[] = "lib%s-%s";
     xmlChar* res;
@@ -288,22 +288,22 @@ xmlSecCryptoDLLibraryConstructFilename(const xmlChar* name) {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "size=%d", len + 1); 
+                    "size=%d", len + 1);
         return(NULL);
     }
     xmlSecStrPrintf(res, len, tmpl, PACKAGE, name);
-    
+
     return(res);
 }
 
-static xmlChar* 
+static xmlChar*
 xmlSecCryptoDLLibraryConstructGetFunctionsName(const xmlChar* name) {
     static xmlChar tmpl[] = "xmlSecCryptoGetFunctions_%s";
     xmlChar* res;
     int len;
-    
+
     xmlSecAssert2(name != NULL, NULL);
-    
+
     len = xmlStrlen(name) + xmlStrlen(tmpl) + 1;
     res = (xmlChar*)xmlMalloc(len + 1);
     if(res == NULL) {
@@ -311,15 +311,15 @@ xmlSecCryptoDLLibraryConstructGetFunctionsName(const xmlChar* name) {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "size=%d", len + 1); 
+                    "size=%d", len + 1);
         return(NULL);
     }
     xmlSecStrPrintf(res, len, tmpl, name);
-    
+
     return(res);
 }
 
-static xmlSecPtrListId 
+static xmlSecPtrListId
 xmlSecCryptoDLLibrariesListGetKlass(void) {
     return(&xmlSecCryptoDLLibrariesListKlass);
 }
@@ -328,10 +328,10 @@ static int
 xmlSecCryptoDLLibrariesListFindByName(xmlSecPtrListPtr list, const xmlChar* name) {
     xmlSecSize i, size;
     xmlSecCryptoDLLibraryPtr lib;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecCryptoDLLibrariesListGetKlass()), -1);
     xmlSecAssert2(name != NULL, -1);
-    
+
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(list, i);
@@ -352,16 +352,16 @@ static xmlSecPtrList gXmlSecCryptoDLLibraries;
 
 /**
  * xmlSecCryptoDLInit:
- * 
+ *
  * Initializes dynamic loading engine. This is an internal function
  * and should not be called by application directly.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecCryptoDLInit(void) {
     int ret;
-    
+
     ret = xmlSecPtrListInitialize(&gXmlSecCryptoDLLibraries, xmlSecCryptoDLLibrariesListGetKlass());
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -390,13 +390,13 @@ xmlSecCryptoDLInit(void) {
 
 /**
  * xmlSecCryptoDLShutdown:
- * 
+ *
  * Shutdowns dynamic loading engine. This is an internal function
  * and should not be called by application directly.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecCryptoDLShutdown(void) {
     int ret;
 
@@ -416,21 +416,21 @@ xmlSecCryptoDLShutdown(void) {
     return(0);
 }
 
-/** 
+/**
  * xmlSecCryptoDLLoadLibrary:
  * @crypto:             the desired crypto library name ("openssl", "nss", ...).
  *
- * Loads the xmlsec-<crypto> library. This function is NOT thread safe, 
+ * Loads the xmlsec-<crypto> library. This function is NOT thread safe,
  * application MUST NOT call #xmlSecCryptoDLLoadLibrary, #xmlSecCryptoDLGetLibraryFunctions,
  * and #xmlSecCryptoDLUnloadLibrary functions from multiple threads.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecCryptoDLLoadLibrary(const xmlChar* crypto) {
     xmlSecCryptoDLFunctionsPtr functions;
     int ret;
-    
+
     xmlSecAssert2(crypto != NULL, -1);
 
     functions = xmlSecCryptoDLGetLibraryFunctions(crypto);
@@ -442,7 +442,7 @@ xmlSecCryptoDLLoadLibrary(const xmlChar* crypto) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecCryptoDLSetFunctions(functions);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -455,22 +455,22 @@ xmlSecCryptoDLLoadLibrary(const xmlChar* crypto) {
     return(0);
 }
 
-/** 
+/**
  * xmlSecCryptoDLGetLibraryFunctions:
  * @crypto:             the desired crypto library name ("openssl", "nss", ...).
  *
- * Loads the xmlsec-<crypto> library and gets global crypto functions/transforms/keys data/keys store 
- * table. This function is NOT thread safe, application MUST NOT call #xmlSecCryptoDLLoadLibrary, 
+ * Loads the xmlsec-<crypto> library and gets global crypto functions/transforms/keys data/keys store
+ * table. This function is NOT thread safe, application MUST NOT call #xmlSecCryptoDLLoadLibrary,
  * #xmlSecCryptoDLGetLibraryFunctions, and #xmlSecCryptoDLUnloadLibrary functions from multiple threads.
  *
  * Returns: the table or NULL if an error occurs.
  */
-xmlSecCryptoDLFunctionsPtr 
+xmlSecCryptoDLFunctionsPtr
 xmlSecCryptoDLGetLibraryFunctions(const xmlChar* crypto) {
     xmlSecCryptoDLLibraryPtr lib;
     int pos;
     int ret;
-        
+
     xmlSecAssert2(crypto != NULL, NULL);
 
     pos = xmlSecCryptoDLLibrariesListFindByName(&gXmlSecCryptoDLLibraries, crypto);
@@ -478,7 +478,7 @@ xmlSecCryptoDLGetLibraryFunctions(const xmlChar* crypto) {
         lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(&gXmlSecCryptoDLLibraries, pos);
         xmlSecAssert2(lib != NULL, NULL);
         xmlSecAssert2(lib->functions != NULL, NULL);
-        
+
         return(lib->functions);
     }
 
@@ -493,7 +493,7 @@ xmlSecCryptoDLGetLibraryFunctions(const xmlChar* crypto) {
         return(NULL);
     }
 
-    ret = xmlSecPtrListAdd(&gXmlSecCryptoDLLibraries, lib);    
+    ret = xmlSecPtrListAdd(&gXmlSecCryptoDLLibraries, lib);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -508,23 +508,23 @@ xmlSecCryptoDLGetLibraryFunctions(const xmlChar* crypto) {
     return(lib->functions);
 }
 
-/** 
+/**
  * xmlSecCryptoDLUnloadLibrary:
  * @crypto:             the desired crypto library name ("openssl", "nss", ...).
  *
  * Unloads the xmlsec-<crypto> library. All pointers to this library
- * functions tables became invalid. This function is NOT thread safe, 
+ * functions tables became invalid. This function is NOT thread safe,
  * application MUST NOT call #xmlSecCryptoDLLoadLibrary, #xmlSecCryptoDLGetLibraryFunctions,
  * and #xmlSecCryptoDLUnloadLibrary functions from multiple threads.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecCryptoDLUnloadLibrary(const xmlChar* crypto) {
     xmlSecCryptoDLLibraryPtr lib;
     int pos;
     int ret;
-    
+
     xmlSecAssert2(crypto != NULL, -1);
 
     pos = xmlSecCryptoDLLibrariesListFindByName(&gXmlSecCryptoDLLibraries, crypto);
@@ -532,12 +532,12 @@ xmlSecCryptoDLUnloadLibrary(const xmlChar* crypto) {
         /* todo: is it an error? */
         return(0);
     }
-    
+
     lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(&gXmlSecCryptoDLLibraries, pos);
     if((lib != NULL) && (lib->functions == gXmlSecCryptoDLFunctions)) {
         gXmlSecCryptoDLFunctions = NULL;
     }
-    
+
     ret = xmlSecPtrListRemove(&gXmlSecCryptoDLLibraries, pos);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -551,7 +551,7 @@ xmlSecCryptoDLUnloadLibrary(const xmlChar* crypto) {
     return(0);
 }
 
-/** 
+/**
  * xmlSecCryptoDLSetFunctions:
  * @functions:          the new table
  *
@@ -564,18 +564,18 @@ xmlSecCryptoDLSetFunctions(xmlSecCryptoDLFunctionsPtr functions) {
     xmlSecAssert2(functions != NULL, -1);
 
     gXmlSecCryptoDLFunctions = functions;
-    
+
     return(0);
 }
 
-/** 
+/**
  * xmlSecCryptoDLGetFunctions:
  *
  * Gets global crypto functions/transforms/keys data/keys store table.
  *
  * Returns: the table.
  */
-xmlSecCryptoDLFunctionsPtr 
+xmlSecCryptoDLFunctionsPtr
 xmlSecCryptoDLGetFunctions(void) {
     return(gXmlSecCryptoDLFunctions);
 }
@@ -585,16 +585,16 @@ xmlSecCryptoDLGetFunctions(void) {
 /**
  * xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms:
  * @functions:          the functions table.
- * 
- * Registers the key data and transforms klasses from @functions table in xmlsec. 
+ *
+ * Registers the key data and transforms klasses from @functions table in xmlsec.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFunctions* functions) {
     xmlSecAssert2(functions != NULL, -1);
 
-    /** 
+    /**
      * Register keys
      */
     if((functions->keyDataAesGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataAesGetKlass()) < 0)) {
@@ -663,7 +663,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
     }
 
 
-    /** 
+    /**
      * Register transforms
      */
     if((functions->transformAes128CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformAes128CbcGetKlass()) < 0) {
@@ -673,7 +673,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformAes192CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformAes192CbcGetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -682,7 +682,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformAes256CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformAes256CbcGetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -691,7 +691,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformKWAes128GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWAes128GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -700,7 +700,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformKWAes192GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWAes192GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -709,7 +709,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformKWAes256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWAes256GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -718,7 +718,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformDes3CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformDes3CbcGetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -727,7 +727,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformKWDes3GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWDes3GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -736,7 +736,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformGost2001GostR3411_94GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformGost2001GostR3411_94GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -745,7 +745,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformDsaSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformDsaSha1GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -754,7 +754,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformHmacMd5GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacMd5GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -763,7 +763,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformHmacRipemd160GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacRipemd160GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -772,7 +772,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformHmacSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha1GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -781,7 +781,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformHmacSha224GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha224GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -790,7 +790,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformHmacSha256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha256GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -799,7 +799,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformHmacSha384GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha384GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -808,7 +808,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformHmacSha512GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha512GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -826,7 +826,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformRipemd160GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRipemd160GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -835,7 +835,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformRsaMd5GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaMd5GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -844,7 +844,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformRsaRipemd160GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaRipemd160GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -853,7 +853,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformRsaSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha1GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -862,7 +862,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformRsaSha224GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha224GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -871,7 +871,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformRsaSha256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha256GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -880,7 +880,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformRsaSha384GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha384GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -889,7 +889,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformRsaSha512GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha512GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -907,7 +907,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformRsaOaepGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaOaepGetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -916,7 +916,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformGostR3411_94GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformGostR3411_94GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -925,7 +925,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha1GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -934,7 +934,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformSha224GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha224GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -943,7 +943,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformSha256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha256GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -952,7 +952,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformSha384GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha384GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -961,7 +961,7 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     if((functions->transformSha512GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha512GetKlass()) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -970,9 +970,9 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
-    return(0);     
+    return(0);
 }
 
 
diff --git a/src/enveloped.c b/src/enveloped.c
index 97a7a08..8047d31 100644
--- a/src/enveloped.c
+++ b/src/enveloped.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Enveloped transform.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -25,11 +25,11 @@
 
 /**************************************************************************
  *
- *  Enveloped transform 
+ *  Enveloped transform
  *
  *************************************************************************/
 static int      xmlSecTransformEnvelopedExecute         (xmlSecTransformPtr transform,
-                                                         int last, 
+                                                         int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 
 
@@ -41,11 +41,11 @@ static xmlSecTransformKlass xmlSecTransformEnvelopedKlass = {
     xmlSecNameEnveloped,                        /* const xmlChar* name; */
     xmlSecHrefEnveloped,                        /* const xmlChar* href; */
     xmlSecTransformUsageDSigTransform,          /* xmlSecTransformUsage usage; */
-    
+
     NULL,                                       /* xmlSecTransformInitializeMethod initialize; */
     NULL,                                       /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
-    NULL,                                       /* xmlSecTransformNodeWriteMethod writeNode; */    
+    NULL,                                       /* xmlSecTransformNodeWriteMethod writeNode; */
     NULL,                                       /* xmlSecTransformSetKeyReqMethod setKeyReq; */
     NULL,                                       /* xmlSecTransformSetKeyMethod setKey; */
     NULL,                                       /* xmlSecTransformValidateMethod validate; */
@@ -65,35 +65,35 @@ static xmlSecTransformKlass xmlSecTransformEnvelopedKlass = {
  *
  * The enveloped transform klass (http://www.w3.org/TR/xmldsig-core/#sec-EnvelopedSignature):
  *
- * An enveloped signature transform T removes the whole Signature element 
- * containing T from the digest calculation of the Reference element 
- * containing T. The entire string of characters used by an XML processor 
- * to match the Signature with the XML production element is removed. 
- * The output of the transform is equivalent to the output that would 
- * result from replacing T with an XPath transform containing the following 
+ * An enveloped signature transform T removes the whole Signature element
+ * containing T from the digest calculation of the Reference element
+ * containing T. The entire string of characters used by an XML processor
+ * to match the Signature with the XML production element is removed.
+ * The output of the transform is equivalent to the output that would
+ * result from replacing T with an XPath transform containing the following
  * XPath parameter element:
  *
  * <XPath xmlns:dsig="&dsig;">
  *   count(ancestor-or-self::dsig:Signature |
  *   here()/ancestor::dsig:Signature[1]) >
  *   count(ancestor-or-self::dsig:Signature)</XPath>
- *    
- * The input and output requirements of this transform are identical to 
- * those of the XPath transform, but may only be applied to a node-set from 
- * its parent XML document. Note that it is not necessary to use an XPath 
- * expression evaluator to create this transform. However, this transform 
- * MUST produce output in exactly the same manner as the XPath transform 
+ *
+ * The input and output requirements of this transform are identical to
+ * those of the XPath transform, but may only be applied to a node-set from
+ * its parent XML document. Note that it is not necessary to use an XPath
+ * expression evaluator to create this transform. However, this transform
+ * MUST produce output in exactly the same manner as the XPath transform
  * parameterized by the XPath expression above.
  *
  * Returns: enveloped transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformEnvelopedGetKlass(void) {
     return(&xmlSecTransformEnvelopedKlass);
 }
 
 static int
-xmlSecTransformEnvelopedExecute(xmlSecTransformPtr transform, int last, 
+xmlSecTransformEnvelopedExecute(xmlSecTransformPtr transform, int last,
                                  xmlSecTransformCtxPtr transformCtx) {
     xmlNodePtr node;
     xmlSecNodeSetPtr children;
@@ -103,7 +103,7 @@ xmlSecTransformEnvelopedExecute(xmlSecTransformPtr transform, int last,
     xmlSecAssert2(transform->outNodes == NULL, -1);
     xmlSecAssert2(last != 0, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-    
+
     if((transform->inNodes != NULL) && (transform->inNodes->doc != transform->hereNode->doc)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -112,7 +112,7 @@ xmlSecTransformEnvelopedExecute(xmlSecTransformPtr transform, int last,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     /* find signature node and get all its children in the nodes set */
     node = xmlSecFindParent(transform->hereNode, xmlSecNodeSignature, xmlSecDSigNs);
     if(node == NULL) {
@@ -123,7 +123,7 @@ xmlSecTransformEnvelopedExecute(xmlSecTransformPtr transform, int last,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     children = xmlSecNodeSetGetChildren(node->doc, node, 1, 1);
     if(children == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -140,13 +140,13 @@ xmlSecTransformEnvelopedExecute(xmlSecTransformPtr transform, int last,
     if(transform->outNodes == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
-                    "xmlSecNodeSetAdd",             
+                    "xmlSecNodeSetAdd",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecNodeSetDestroy(children);
         return(-1);
     }
-    
+
     return(0);
 }
 
diff --git a/src/errors.c b/src/errors.c
index 5609e1a..c9886d3 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Error codes and error reporting functions.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -31,76 +31,76 @@ struct _xmlSecErrorDescription {
 };
 
 static xmlSecErrorDescription xmlSecErrorsTable[XMLSEC_ERRORS_MAX_NUMBER + 1] = {
-  { XMLSEC_ERRORS_R_XMLSEC_FAILED,              "xmlsec library function failed" }, 
-  { XMLSEC_ERRORS_R_MALLOC_FAILED,              "malloc function failed" }, 
-  { XMLSEC_ERRORS_R_STRDUP_FAILED,              "strdup function failed" }, 
-  { XMLSEC_ERRORS_R_CRYPTO_FAILED,              "crypto library function failed" }, 
-  { XMLSEC_ERRORS_R_XML_FAILED,                 "libxml2 library function failed" }, 
-  { XMLSEC_ERRORS_R_XSLT_FAILED,                "libxslt library function failed" }, 
-  { XMLSEC_ERRORS_R_IO_FAILED,                  "io function failed" }, 
-  { XMLSEC_ERRORS_R_DISABLED,                   "feature is disabled" }, 
-  { XMLSEC_ERRORS_R_NOT_IMPLEMENTED,            "feature is not implemented" }, 
-  { XMLSEC_ERRORS_R_INVALID_SIZE,               "invalid size" }, 
-  { XMLSEC_ERRORS_R_INVALID_DATA,               "invalid data" }, 
-  { XMLSEC_ERRORS_R_INVALID_RESULT,             "invalid result" }, 
-  { XMLSEC_ERRORS_R_INVALID_TYPE,               "invalid type" }, 
-  { XMLSEC_ERRORS_R_INVALID_OPERATION,          "invalid operation" }, 
-  { XMLSEC_ERRORS_R_INVALID_STATUS,             "invalid status" }, 
-  { XMLSEC_ERRORS_R_INVALID_FORMAT,             "invalid format" }, 
-  { XMLSEC_ERRORS_R_DATA_NOT_MATCH,             "data do not match" }, 
-  { XMLSEC_ERRORS_R_INVALID_NODE,               "invalid node" }, 
-  { XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,       "invalid node content" }, 
-  { XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,     "invalid node attribute" }, 
-  { XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE,     "missing node attribute" }, 
-  { XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,       "node already present" }, 
-  { XMLSEC_ERRORS_R_UNEXPECTED_NODE,            "unexpected node" }, 
-  { XMLSEC_ERRORS_R_NODE_NOT_FOUND,             "node node found" }, 
-  { XMLSEC_ERRORS_R_INVALID_TRANSFORM,          "invalid transform" }, 
-  { XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY,      "invalid transform key" }, 
-  { XMLSEC_ERRORS_R_INVALID_URI_TYPE,           "invalid URI type" }, 
-  { XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED,   "same document is required for transform" }, 
-  { XMLSEC_ERRORS_R_TRANSFORM_DISABLED,         "transform is disabled" }, 
-  { XMLSEC_ERRORS_R_INVALID_KEY_DATA,           "invalid key data" }, 
-  { XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND,         "key data is not found" }, 
-  { XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,     "key data already exist" }, 
-  { XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,      "invalid key data size" }, 
-  { XMLSEC_ERRORS_R_KEY_NOT_FOUND,              "key is not found" }, 
-  { XMLSEC_ERRORS_R_KEYDATA_DISABLED,           "key data is disabled" }, 
-  { XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL,       "maximum key retrieval level" }, 
-  { XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH,"key retrieval type mismatch" }, 
-  { XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL,           "maximum encrypted key level" }, 
-  { XMLSEC_ERRORS_R_CERT_VERIFY_FAILED,         "certificate verification failed" }, 
-  { XMLSEC_ERRORS_R_CERT_NOT_FOUND,             "certificate is not found" }, 
-  { XMLSEC_ERRORS_R_CERT_REVOKED,               "certificate is revoked" }, 
-  { XMLSEC_ERRORS_R_CERT_ISSUER_FAILED,         "certificate issuer check failed" }, 
-  { XMLSEC_ERRORS_R_CERT_NOT_YET_VALID,         "certificate is not yet valid" }, 
-  { XMLSEC_ERRORS_R_CERT_HAS_EXPIRED,           "certificate has expirred" }, 
-  { XMLSEC_ERRORS_R_DSIG_NO_REFERENCES,         "Reference nodes are not found" }, 
-  { XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE,     "Reference verification failed" }, 
-  { XMLSEC_ERRORS_R_ASSERTION,                  "assertion" }, 
+  { XMLSEC_ERRORS_R_XMLSEC_FAILED,              "xmlsec library function failed" },
+  { XMLSEC_ERRORS_R_MALLOC_FAILED,              "malloc function failed" },
+  { XMLSEC_ERRORS_R_STRDUP_FAILED,              "strdup function failed" },
+  { XMLSEC_ERRORS_R_CRYPTO_FAILED,              "crypto library function failed" },
+  { XMLSEC_ERRORS_R_XML_FAILED,                 "libxml2 library function failed" },
+  { XMLSEC_ERRORS_R_XSLT_FAILED,                "libxslt library function failed" },
+  { XMLSEC_ERRORS_R_IO_FAILED,                  "io function failed" },
+  { XMLSEC_ERRORS_R_DISABLED,                   "feature is disabled" },
+  { XMLSEC_ERRORS_R_NOT_IMPLEMENTED,            "feature is not implemented" },
+  { XMLSEC_ERRORS_R_INVALID_SIZE,               "invalid size" },
+  { XMLSEC_ERRORS_R_INVALID_DATA,               "invalid data" },
+  { XMLSEC_ERRORS_R_INVALID_RESULT,             "invalid result" },
+  { XMLSEC_ERRORS_R_INVALID_TYPE,               "invalid type" },
+  { XMLSEC_ERRORS_R_INVALID_OPERATION,          "invalid operation" },
+  { XMLSEC_ERRORS_R_INVALID_STATUS,             "invalid status" },
+  { XMLSEC_ERRORS_R_INVALID_FORMAT,             "invalid format" },
+  { XMLSEC_ERRORS_R_DATA_NOT_MATCH,             "data do not match" },
+  { XMLSEC_ERRORS_R_INVALID_NODE,               "invalid node" },
+  { XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,       "invalid node content" },
+  { XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,     "invalid node attribute" },
+  { XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE,     "missing node attribute" },
+  { XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,       "node already present" },
+  { XMLSEC_ERRORS_R_UNEXPECTED_NODE,            "unexpected node" },
+  { XMLSEC_ERRORS_R_NODE_NOT_FOUND,             "node node found" },
+  { XMLSEC_ERRORS_R_INVALID_TRANSFORM,          "invalid transform" },
+  { XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY,      "invalid transform key" },
+  { XMLSEC_ERRORS_R_INVALID_URI_TYPE,           "invalid URI type" },
+  { XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED,   "same document is required for transform" },
+  { XMLSEC_ERRORS_R_TRANSFORM_DISABLED,         "transform is disabled" },
+  { XMLSEC_ERRORS_R_INVALID_KEY_DATA,           "invalid key data" },
+  { XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND,         "key data is not found" },
+  { XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,     "key data already exist" },
+  { XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,      "invalid key data size" },
+  { XMLSEC_ERRORS_R_KEY_NOT_FOUND,              "key is not found" },
+  { XMLSEC_ERRORS_R_KEYDATA_DISABLED,           "key data is disabled" },
+  { XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL,       "maximum key retrieval level" },
+  { XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH,"key retrieval type mismatch" },
+  { XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL,           "maximum encrypted key level" },
+  { XMLSEC_ERRORS_R_CERT_VERIFY_FAILED,         "certificate verification failed" },
+  { XMLSEC_ERRORS_R_CERT_NOT_FOUND,             "certificate is not found" },
+  { XMLSEC_ERRORS_R_CERT_REVOKED,               "certificate is revoked" },
+  { XMLSEC_ERRORS_R_CERT_ISSUER_FAILED,         "certificate issuer check failed" },
+  { XMLSEC_ERRORS_R_CERT_NOT_YET_VALID,         "certificate is not yet valid" },
+  { XMLSEC_ERRORS_R_CERT_HAS_EXPIRED,           "certificate has expirred" },
+  { XMLSEC_ERRORS_R_DSIG_NO_REFERENCES,         "Reference nodes are not found" },
+  { XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE,     "Reference verification failed" },
+  { XMLSEC_ERRORS_R_ASSERTION,                  "assertion" },
   { 0,                                          NULL}
 };
 
 static xmlSecErrorsCallback xmlSecErrorsClbk = xmlSecErrorsDefaultCallback;
 static int  xmlSecPrintErrorMessages = 1;       /* whether the error messages will be printed immidiatelly */
 
-/** 
+/**
  * xmlSecErrorsInit:
  *
  * Initializes the errors reporting. It is called from #xmlSecInit function.
  * and applications must not call this function directly.
  */
-void 
+void
 xmlSecErrorsInit(void) {
 }
 
-/** 
+/**
  * xmlSecErrorsShutdown:
  *
  * Cleanups the errors reporting. It is called from #xmlSecShutdown function.
  * and applications must not call this function directly.
  */
-void 
+void
 xmlSecErrorsShutdown(void) {
 }
 
@@ -108,10 +108,10 @@ xmlSecErrorsShutdown(void) {
  * xmlSecErrorsSetCallback:
  * @callback:           the new errors callback function.
  *
- * Sets the errors callback function to @callback that will be called 
+ * Sets the errors callback function to @callback that will be called
  * every time an error occurs.
  */
-void 
+void
 xmlSecErrorsSetCallback(xmlSecErrorsCallback callback) {
     xmlSecErrorsClbk = callback;
 }
@@ -121,7 +121,7 @@ xmlSecErrorsSetCallback(xmlSecErrorsCallback callback) {
  * @file:               the error location file name (__FILE__ macro).
  * @line:               the error location line number (__LINE__ macro).
  * @func:               the error location function name (__FUNCTION__ macro).
- * @errorObject:        the error specific error object 
+ * @errorObject:        the error specific error object
  * @errorSubject:       the error specific error subject.
  * @reason:             the error code.
  * @msg:                the additional error message.
@@ -129,11 +129,11 @@ xmlSecErrorsSetCallback(xmlSecErrorsCallback callback) {
  * The default error reporting callback that utilizes LibXML
  * error reporting #xmlGenericError function.
  */
-void 
+void
 xmlSecErrorsDefaultCallback(const char* file, int line, const char* func,
                             const char* errorObject, const char* errorSubject,
                             int reason, const char* msg) {
-    if(xmlSecPrintErrorMessages) {    
+    if(xmlSecPrintErrorMessages) {
         const char* error_msg = NULL;
         xmlSecSize i;
 
@@ -159,11 +159,11 @@ xmlSecErrorsDefaultCallback(const char* file, int line, const char* func,
 /**
  * xmlSecErrorsDefaultCallbackEnableOutput:
  * @enabled:            the flag.
- * 
+ *
  * Enables or disables calling LibXML2 callback from the default
  * errors callback.
  */
-void 
+void
 xmlSecErrorsDefaultCallbackEnableOutput(int enabled) {
     xmlSecPrintErrorMessages = enabled;
 }
@@ -171,13 +171,13 @@ xmlSecErrorsDefaultCallbackEnableOutput(int enabled) {
 /**
  * xmlSecErrorsGetCode:
  * @pos:                the error position.
- * 
+ *
  * Gets the known error code at position @pos.
  *
- * Returns: the known error code or 0 if @pos is greater than 
+ * Returns: the known error code or 0 if @pos is greater than
  * total number of known error codes.
  */
-int 
+int
 xmlSecErrorsGetCode(xmlSecSize pos) {
     /* could not use asserts here! */
     if(pos < sizeof(xmlSecErrorsTable) / sizeof(xmlSecErrorsTable[0])) {
@@ -192,10 +192,10 @@ xmlSecErrorsGetCode(xmlSecSize pos) {
  *
  * Gets the known error message at position @pos.
  *
- * Returns: the known error message or NULL if @pos is greater than 
+ * Returns: the known error message or NULL if @pos is greater than
  * total number of known error codes.
  */
-const char* 
+const char*
 xmlSecErrorsGetMsg(xmlSecSize pos) {
     /* could not use asserts here! */
     if(pos < sizeof(xmlSecErrorsTable) / sizeof(xmlSecErrorsTable[0])) {
@@ -209,34 +209,34 @@ xmlSecErrorsGetMsg(xmlSecSize pos) {
  * @file:               the error location filename (__FILE__).
  * @line:               the error location line number (__LINE__).
  * @func:               the error location function (__FUNCTIION__).
- * @errorObject:        the error specific error object 
- * @errorSubject:       the error specific error subject. 
+ * @errorObject:        the error specific error object
+ * @errorSubject:       the error specific error subject.
  * @reason:             the error code.
  * @msg:                the error message in printf format.
  * @...:                the parameters for the @msg.
  *
- * Reports an error to the default (#xmlSecErrorsDefaultCallback) or 
- * application specific callback installed using #xmlSecErrorsSetCallback 
+ * Reports an error to the default (#xmlSecErrorsDefaultCallback) or
+ * application specific callback installed using #xmlSecErrorsSetCallback
  * function.
  */
-void    
-xmlSecError(const char* file, int line, const char* func, 
+void
+xmlSecError(const char* file, int line, const char* func,
             const char* errorObject, const char* errorSubject,
             int reason, const char* msg, ...) {
-            
+
     if(xmlSecErrorsClbk != NULL) {
         xmlChar error_msg[XMLSEC_ERRORS_BUFFER_SIZE];
-        
+
         if(msg != NULL) {
             va_list va;
 
             va_start(va, msg);
             xmlSecStrVPrintf(error_msg, sizeof(error_msg), BAD_CAST msg, va);
             error_msg[sizeof(error_msg) - 1] = '\0';
-            va_end(va); 
+            va_end(va);
         } else {
-            error_msg[0] = '\0';            
+            error_msg[0] = '\0';
         }
         xmlSecErrorsClbk(file, line, func, errorObject, errorSubject, reason, (char*)error_msg);
-    }   
+    }
 }
diff --git a/src/globals.h b/src/globals.h
index 35a238c..31a57d6 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -5,7 +5,7 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 
@@ -13,7 +13,7 @@
 #define __XMLSEC_GLOBALS_H__
 
 /**
- * Use autoconf defines if present. 
+ * Use autoconf defines if present.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/src/gnutls/README b/src/gnutls/README
index 02c5fbb..23f7d8a 100644
--- a/src/gnutls/README
+++ b/src/gnutls/README
@@ -1,4 +1,4 @@
-The xmlsec-gnutls implementation is really limited and is not ready 
+The xmlsec-gnutls implementation is really limited and is not ready
 for production use. The only supported crypto transforms are:
 
     - HMAC
@@ -6,4 +6,4 @@ for production use. The only supported crypto transforms are:
     - AES [128|192|256]
     - SHA1
 
-    
\ No newline at end of file
+
diff --git a/src/gnutls/app.c b/src/gnutls/app.c
index 349b388..5b98c17 100644
--- a/src/gnutls/app.c
+++ b/src/gnutls/app.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -23,9 +23,9 @@
 /**
  * xmlSecGnuTLSAppInit:
  * @config:             the path to GnuTLS configuration (unused).
- * 
+ *
  * General crypto engine initialization. This function is used
- * by XMLSec command line utility and called before 
+ * by XMLSec command line utility and called before
  * @xmlSecInit function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -48,9 +48,9 @@ xmlSecGnuTLSAppInit(const char* config ATTRIBUTE_UNUSED) {
 
 /**
  * xmlSecGnuTLSAppShutdown:
- * 
+ *
  * General crypto engine shutdown. This function is used
- * by XMLSec command line utility and called after 
+ * by XMLSec command line utility and called after
  * @xmlSecShutdown function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -80,7 +80,7 @@ xmlSecGnuTLSAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                         void* pwdCallbackCtx) {
     xmlSecAssert2(filename != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
-    
+
 
     if (format == xmlSecKeyDataFormatPkcs12) {
         return (xmlSecGnuTLSAppPkcs12Load(filename, pwd, pwdCallback,
@@ -110,14 +110,14 @@ xmlSecGnuTLSAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
  * Returns: pointer to the key or NULL if an error occurs.
  */
 xmlSecKeyPtr
-xmlSecGnuTLSAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, 
-                        xmlSecKeyDataFormat format, const char *pwd, 
+xmlSecGnuTLSAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
+                        xmlSecKeyDataFormat format, const char *pwd,
                         void* pwdCallback, void* pwdCallbackCtx) {
     xmlSecAssert2(data != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
 
     if (format == xmlSecKeyDataFormatPkcs12) {
-        return (xmlSecGnuTLSAppPkcs12LoadMemory(data, dataSize, pwd, 
+        return (xmlSecGnuTLSAppPkcs12LoadMemory(data, dataSize, pwd,
                                         pwdCallback, pwdCallbackCtx));
     }
 
@@ -139,16 +139,16 @@ xmlSecGnuTLSAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
  *
  * Reads the certificate from $ filename and adds it to key
  * (not implemented yet).
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
-xmlSecGnuTLSAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, 
+int
+xmlSecGnuTLSAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
                           xmlSecKeyDataFormat format) {
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
-    
+
     /* TODO */
     xmlSecError(XMLSEC_ERRORS_HERE,
                 NULL,
@@ -166,11 +166,11 @@ xmlSecGnuTLSAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
  * @format:             the certificate file format.
  *
  * Reads the certificate from memory buffer and adds it to key (not implemented yet).
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
-xmlSecGnuTLSAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize, 
+int
+xmlSecGnuTLSAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
                                 xmlSecKeyDataFormat format) {
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
@@ -199,10 +199,10 @@ xmlSecGnuTLSAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSe
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
-xmlSecGnuTLSAppPkcs12Load(const char *filename, 
+xmlSecKeyPtr
+xmlSecGnuTLSAppPkcs12Load(const char *filename,
                           const char *pwd ATTRIBUTE_UNUSED,
-                          void* pwdCallback ATTRIBUTE_UNUSED, 
+                          void* pwdCallback ATTRIBUTE_UNUSED,
                           void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
     xmlSecAssert2(filename != NULL, NULL);
 
@@ -212,7 +212,7 @@ xmlSecGnuTLSAppPkcs12Load(const char *filename,
                 "xmlSecGnuTLSAppPkcs12Load",
                 XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
                 XMLSEC_ERRORS_NO_MESSAGE);
-    return(NULL); 
+    return(NULL);
 }
 
 /**
@@ -229,9 +229,9 @@ xmlSecGnuTLSAppPkcs12Load(const char *filename,
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
-xmlSecGnuTLSAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, 
-                           const char *pwd, void* pwdCallback, 
+xmlSecKeyPtr
+xmlSecGnuTLSAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
+                           const char *pwd, void* pwdCallback,
                            void* pwdCallbackCtx) {
     xmlSecAssert2(data != NULL, NULL);
     /* TODO */
@@ -240,7 +240,7 @@ xmlSecGnuTLSAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
                 "xmlSecGnuTLSAppPkcs12LoadMemory",
                 XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
                 XMLSEC_ERRORS_NO_MESSAGE);
-    return(NULL); 
+    return(NULL);
 }
 
 /**
@@ -250,15 +250,15 @@ xmlSecGnuTLSAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
  * @format:             the certificate file format.
  * @type:               the flag that indicates is the certificate in @filename
  *                      trusted or not.
- * 
+ *
  * Reads cert from @filename and adds to the list of trusted or known
  * untrusted certs in @store (not implemented yet).
  *
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecGnuTLSAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename, 
-                                xmlSecKeyDataFormat format, 
+xmlSecGnuTLSAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
+                                xmlSecKeyDataFormat format,
                                 xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
@@ -280,7 +280,7 @@ xmlSecGnuTLSAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
  * @dataSize:           the certificate binary data size.
  * @format:             the certificate file format.
  * @type:               the flag that indicates is the certificate trusted or not.
- * 
+ *
  * Reads cert from binary buffer @data and adds to the list of trusted or known
  * untrusted certs in @store (not implemented yet).
  *
@@ -288,7 +288,7 @@ xmlSecGnuTLSAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
  */
 int
 xmlSecGnuTLSAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
-                                    xmlSecSize dataSize, xmlSecKeyDataFormat format, 
+                                    xmlSecSize dataSize, xmlSecKeyDataFormat format,
                                     xmlSecKeyDataType type) {
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
@@ -313,14 +313,14 @@ xmlSecGnuTLSAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
  * and a default GnuTLS crypto key data stores.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 int
 xmlSecGnuTLSAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
 
-    /* create simple keys store if needed */        
+    /* create simple keys store if needed */
     if(xmlSecKeysMngrGetKeysStore(mngr) == NULL) {
         xmlSecKeyStorePtr keysStore;
 
@@ -333,7 +333,7 @@ xmlSecGnuTLSAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         "xmlSecSimpleKeysStoreId");
             return(-1);
         }
-        
+
         ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -342,20 +342,20 @@ xmlSecGnuTLSAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecKeyStoreDestroy(keysStore);
-            return(-1);        
+            return(-1);
         }
     }
 
-    ret = xmlSecGnuTLSKeysMngrInit(mngr);    
+    ret = xmlSecGnuTLSKeysMngrInit(mngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecGnuTLSKeysMngrInit",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1); 
+        return(-1);
     }
-    
+
     /* TODO */
     mngr->getKey = xmlSecKeysMngrGetKey;
     return(0);
@@ -368,17 +368,17 @@ xmlSecGnuTLSAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
  *
  * Adds @key to the keys manager @mngr created with #xmlSecGnuTLSAppDefaultKeysMngrInit
  * function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecGnuTLSAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -388,7 +388,7 @@ xmlSecGnuTLSAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key)
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecSimpleKeysStoreAdoptKey(store, key);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -398,7 +398,7 @@ xmlSecGnuTLSAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key)
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -407,19 +407,19 @@ xmlSecGnuTLSAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key)
  * @mngr:               the pointer to keys manager.
  * @uri:                the uri.
  *
- * Loads XML keys file from @uri to the keys manager @mngr created 
+ * Loads XML keys file from @uri to the keys manager @mngr created
  * with #xmlSecGnuTLSAppDefaultKeysMngrInit function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecGnuTLSAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(uri != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -429,7 +429,7 @@ xmlSecGnuTLSAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecSimpleKeysStoreLoad(store, uri, mngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -439,7 +439,7 @@ xmlSecGnuTLSAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     "uri=%s", xmlSecErrorsSafeString(uri));
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -450,17 +450,17 @@ xmlSecGnuTLSAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
  * @type:               the type of keys to save (public/private/symmetric).
  *
  * Saves keys from @mngr to  XML keys file.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecGnuTLSAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename, xmlSecKeyDataType type) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -470,18 +470,18 @@ xmlSecGnuTLSAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecSimpleKeysStoreSave(store, filename, type);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecSimpleKeysStoreSave",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s", 
+                    "filename=%s",
                     xmlSecErrorsSafeString(filename));
         return(-1);
     }
-    
+
     return(0);
 }
 
diff --git a/src/gnutls/ciphers.c b/src/gnutls/ciphers.c
index 4a4eedd..b594a1f 100644
--- a/src/gnutls/ciphers.c
+++ b/src/gnutls/ciphers.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -54,7 +54,7 @@ static int      xmlSecGnuTLSBlockCipherCtxFinal         (xmlSecGnuTLSBlockCipher
                                                          int encrypt,
                                                          const xmlChar* cipherName,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int 
+static int
 xmlSecGnuTLSBlockCipherCtxInit(xmlSecGnuTLSBlockCipherCtxPtr ctx,
                                 xmlSecBufferPtr in, xmlSecBufferPtr out,
                                 int encrypt,
@@ -75,16 +75,16 @@ xmlSecGnuTLSBlockCipherCtxInit(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     /* iv len == block len */
     blockLen = gcry_cipher_get_algo_blklen(ctx->cipher);
     xmlSecAssert2(blockLen > 0, -1);
-    
+
     if(encrypt) {
         xmlSecByte* iv;
         xmlSecSize outSize;
-        
-        /* allocate space for IV */     
+
+        /* allocate space for IV */
         outSize = xmlSecBufferGetSize(out);
         ret = xmlSecBufferSetSize(out, outSize + blockLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferSetSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -92,12 +92,12 @@ xmlSecGnuTLSBlockCipherCtxInit(xmlSecGnuTLSBlockCipherCtxPtr ctx,
             return(-1);
         }
         iv = xmlSecBufferGetData(out) + outSize;
-        
+
         /* generate and use random iv */
         gcry_randomize(iv, blockLen, GCRY_STRONG_RANDOM);
         ret = gcry_cipher_setiv(ctx->cipherCtx, iv, blockLen);
         if(ret != 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "gcry_cipher_setiv",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -105,7 +105,7 @@ xmlSecGnuTLSBlockCipherCtxInit(xmlSecGnuTLSBlockCipherCtxPtr ctx,
             return(-1);
         }
     } else {
-        /* if we don't have enough data, exit and hope that 
+        /* if we don't have enough data, exit and hope that
          * we'll have iv next time */
         if(xmlSecBufferGetSize(in) < (xmlSecSize)blockLen) {
             return(0);
@@ -115,18 +115,18 @@ xmlSecGnuTLSBlockCipherCtxInit(xmlSecGnuTLSBlockCipherCtxPtr ctx,
         /* set iv */
         ret = gcry_cipher_setiv(ctx->cipherCtx, xmlSecBufferGetData(in), blockLen);
         if(ret != 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "gcry_cipher_setiv",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "ret=%d", ret);
             return(-1);
         }
-        
+
         /* and remove from input */
         ret = xmlSecBufferRemoveHead(in, blockLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -139,7 +139,7 @@ xmlSecGnuTLSBlockCipherCtxInit(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     return(0);
 }
 
-static int 
+static int
 xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
                                   xmlSecBufferPtr in, xmlSecBufferPtr out,
                                   int encrypt,
@@ -149,7 +149,7 @@ xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     int blockLen;
     xmlSecByte* outBuf;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->cipher != 0, -1);
     xmlSecAssert2(ctx->cipherCtx != NULL, -1);
@@ -163,7 +163,7 @@ xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
 
     inSize = xmlSecBufferGetSize(in);
     outSize = xmlSecBufferGetSize(out);
-    
+
     if(inSize < (xmlSecSize)blockLen) {
         return(0);
     }
@@ -171,7 +171,7 @@ xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     if(encrypt) {
         inBlocks = inSize / ((xmlSecSize)blockLen);
     } else {
-        /* we want to have the last block in the input buffer 
+        /* we want to have the last block in the input buffer
          * for padding check */
         inBlocks = (inSize - 1) / ((xmlSecSize)blockLen);
     }
@@ -180,7 +180,7 @@ xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     /* we write out the input size plus may be one block */
     ret = xmlSecBufferSetMaxSize(out, outSize + inSize + blockLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -188,12 +188,12 @@ xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
         return(-1);
     }
     outBuf = xmlSecBufferGetData(out) + outSize;
-    
+
     if(encrypt) {
         ret = gcry_cipher_encrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
                                 xmlSecBufferGetData(in), inSize);
         if(ret != 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "gcry_cipher_encrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -204,7 +204,7 @@ xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
         ret = gcry_cipher_decrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
                                 xmlSecBufferGetData(in), inSize);
         if(ret != 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "gcry_cipher_decrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -216,18 +216,18 @@ xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     /* set correct output buffer size */
     ret = xmlSecBufferSetSize(out, outSize + inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", outSize + inSize);
         return(-1);
     }
-        
+
     /* remove the processed block from input */
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -237,7 +237,7 @@ xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     return(0);
 }
 
-static int 
+static int
 xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
                                  xmlSecBufferPtr in,
                                  xmlSecBufferPtr out,
@@ -249,7 +249,7 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     xmlSecByte* inBuf;
     xmlSecByte* outBuf;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->cipher != 0, -1);
     xmlSecAssert2(ctx->cipherCtx != NULL, -1);
@@ -265,12 +265,12 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     outSize = xmlSecBufferGetSize(out);
 
     if(encrypt != 0) {
-        xmlSecAssert2(inSize < (xmlSecSize)blockLen, -1);        
-    
+        xmlSecAssert2(inSize < (xmlSecSize)blockLen, -1);
+
         /* create padding */
         ret = xmlSecBufferSetMaxSize(in, blockLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferSetMaxSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -281,14 +281,14 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
 
         /* create random padding */
         if((xmlSecSize)blockLen > (inSize + 1)) {
-            gcry_randomize(inBuf + inSize, blockLen - inSize - 1, 
+            gcry_randomize(inBuf + inSize, blockLen - inSize - 1,
                         GCRY_STRONG_RANDOM); /* as usual, we are paranoid */
         }
         inBuf[blockLen - 1] = blockLen - inSize;
         inSize = blockLen;
     } else {
         if(inSize != (xmlSecSize)blockLen) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
@@ -296,11 +296,11 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
             return(-1);
         }
     }
-    
+
     /* process last block */
     ret = xmlSecBufferSetMaxSize(out, outSize + 2 * blockLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -313,7 +313,7 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
         ret = gcry_cipher_encrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
                                 xmlSecBufferGetData(in), inSize);
         if(ret != 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "gcry_cipher_encrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -324,7 +324,7 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
         ret = gcry_cipher_decrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
                                 xmlSecBufferGetData(in), inSize);
         if(ret != 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "gcry_cipher_decrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -342,7 +342,7 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
                         XMLSEC_ERRORS_R_INVALID_DATA,
                         "padding=%d;buffer=%d",
                         outBuf[blockLen - 1], inSize);
-            return(-1); 
+            return(-1);
         }
         outLen = inSize - outBuf[blockLen - 1];
     } else {
@@ -352,30 +352,30 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     /* set correct output buffer size */
     ret = xmlSecBufferSetSize(out, outSize + outLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", outSize + outLen);
         return(-1);
     }
-        
+
     /* remove the processed block from input */
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", inSize);
         return(-1);
     }
-    
+
 
     /* set correct output buffer size */
     ret = xmlSecBufferSetSize(out, outSize + outLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -386,7 +386,7 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
     /* remove the processed block from input */
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -403,7 +403,7 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
  *  Block Cipher transforms
  *
  * xmlSecGnuTLSBlockCipherCtx block is located after xmlSecTransform structure
- * 
+ *
  *****************************************************************************/
 #define xmlSecGnuTLSBlockCipherSize     \
     (sizeof(xmlSecTransform) + sizeof(xmlSecGnuTLSBlockCipherCtx))
@@ -412,7 +412,7 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
 
 static int      xmlSecGnuTLSBlockCipherInitialize       (xmlSecTransformPtr transform);
 static void     xmlSecGnuTLSBlockCipherFinalize         (xmlSecTransformPtr transform);
-static int      xmlSecGnuTLSBlockCipherSetKeyReq        (xmlSecTransformPtr transform, 
+static int      xmlSecGnuTLSBlockCipherSetKeyReq        (xmlSecTransformPtr transform,
                                                          xmlSecKeyReqPtr keyReq);
 static int      xmlSecGnuTLSBlockCipherSetKey           (xmlSecTransformPtr transform,
                                                          xmlSecKeyPtr key);
@@ -420,7 +420,7 @@ static int      xmlSecGnuTLSBlockCipherExecute          (xmlSecTransformPtr tran
                                                          int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 static int      xmlSecGnuTLSBlockCipherCheckId          (xmlSecTransformPtr transform);
-                                                         
+
 
 
 static int
@@ -435,27 +435,27 @@ xmlSecGnuTLSBlockCipherCheckId(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformAes128CbcId) ||
        xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformAes192CbcId) ||
        xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformAes256CbcId)) {
-       
+
        return(1);
     }
 #endif /* XMLSEC_NO_AES */
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecGnuTLSBlockCipherInitialize(xmlSecTransformPtr transform) {
     xmlSecGnuTLSBlockCipherCtxPtr ctx;
 #ifndef XMLSEC_GNUTLS_OLD
     gpg_err_code_t ret;
 #endif /* XMLSEC_GNUTLS_OLD */
-    
+
     xmlSecAssert2(xmlSecGnuTLSBlockCipherCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecGnuTLSBlockCipherSize), -1);
 
     ctx = xmlSecGnuTLSBlockCipherGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecGnuTLSBlockCipherCtx));
 
 #ifndef XMLSEC_NO_DES
@@ -463,42 +463,42 @@ xmlSecGnuTLSBlockCipherInitialize(xmlSecTransformPtr transform) {
         ctx->cipher     = GCRY_CIPHER_3DES;
         ctx->mode       = GCRY_CIPHER_MODE_CBC;
         ctx->keyId      = xmlSecGnuTLSKeyDataDesId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_DES */
 
 #ifndef XMLSEC_NO_AES
     if(transform->id == xmlSecGnuTLSTransformAes128CbcId) {
-        ctx->cipher     = GCRY_CIPHER_AES128;   
+        ctx->cipher     = GCRY_CIPHER_AES128;
         ctx->mode       = GCRY_CIPHER_MODE_CBC;
         ctx->keyId      = xmlSecGnuTLSKeyDataAesId;
     } else if(transform->id == xmlSecGnuTLSTransformAes192CbcId) {
-        ctx->cipher     = GCRY_CIPHER_AES192;   
+        ctx->cipher     = GCRY_CIPHER_AES192;
         ctx->mode       = GCRY_CIPHER_MODE_CBC;
         ctx->keyId      = xmlSecGnuTLSKeyDataAesId;
     } else if(transform->id == xmlSecGnuTLSTransformAes256CbcId) {
-        ctx->cipher     = GCRY_CIPHER_AES256;   
+        ctx->cipher     = GCRY_CIPHER_AES256;
         ctx->mode       = GCRY_CIPHER_MODE_CBC;
         ctx->keyId      = xmlSecGnuTLSKeyDataAesId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_AES */
 
     if(1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }        
+    }
 
 #ifndef XMLSEC_GNUTLS_OLD
     ret = gcry_cipher_open(&ctx->cipherCtx, ctx->cipher, ctx->mode, GCRY_CIPHER_SECURE); /* we are paranoid */
     if(ret != GPG_ERR_NO_ERROR) {
-#else /* XMLSEC_GNUTLS_OLD */ 
+#else /* XMLSEC_GNUTLS_OLD */
     ctx->cipherCtx = gcry_cipher_open(ctx->cipher, ctx->mode, GCRY_CIPHER_SECURE); /* we are paranoid */
     if(ctx->cipherCtx == NULL) {
 #endif /* XMLSEC_GNUTLS_OLD */
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "gcry_cipher_open",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -508,7 +508,7 @@ xmlSecGnuTLSBlockCipherInitialize(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static void 
+static void
 xmlSecGnuTLSBlockCipherFinalize(xmlSecTransformPtr transform) {
     xmlSecGnuTLSBlockCipherCtxPtr ctx;
 
@@ -521,11 +521,11 @@ xmlSecGnuTLSBlockCipherFinalize(xmlSecTransformPtr transform) {
     if(ctx->cipherCtx != NULL) {
         gcry_cipher_close(ctx->cipherCtx);
     }
-    
+
     memset(ctx, 0, sizeof(xmlSecGnuTLSBlockCipherCtx));
 }
 
-static int  
+static int
 xmlSecGnuTLSBlockCipherSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecGnuTLSBlockCipherCtxPtr ctx;
 
@@ -557,7 +557,7 @@ xmlSecGnuTLSBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecBufferPtr buffer;
     xmlSecSize keySize;
     int ret;
-    
+
     xmlSecAssert2(xmlSecGnuTLSBlockCipherCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecGnuTLSBlockCipherSize), -1);
@@ -586,28 +586,28 @@ xmlSecGnuTLSBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                     xmlSecBufferGetSize(buffer), keySize);
         return(-1);
     }
-    
+
     xmlSecAssert2(xmlSecBufferGetData(buffer) != NULL, -1);
     ret = gcry_cipher_setkey(ctx->cipherCtx, xmlSecBufferGetData(buffer), keySize);
     if(ret != 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "gcry_cipher_setkey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "ret=%d", ret);
         return(-1);
     }
-    
+
     ctx->keyInitialized = 1;
     return(0);
 }
 
-static int 
+static int
 xmlSecGnuTLSBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecGnuTLSBlockCipherCtxPtr ctx;
     xmlSecBufferPtr in, out;
     int ret;
-    
+
     xmlSecAssert2(xmlSecGnuTLSBlockCipherCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecGnuTLSBlockCipherSize), -1);
@@ -625,11 +625,11 @@ xmlSecGnuTLSBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTra
 
     if(transform->status == xmlSecTransformStatusWorking) {
         if(ctx->ctxInitialized == 0) {
-            ret = xmlSecGnuTLSBlockCipherCtxInit(ctx, in, out, 
+            ret = xmlSecGnuTLSBlockCipherCtxInit(ctx, in, out,
                         (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
                         xmlSecTransformGetName(transform), transformCtx);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecGnuTLSBlockCipherCtxInit",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -638,7 +638,7 @@ xmlSecGnuTLSBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTra
             }
         }
         if((ctx->ctxInitialized == 0) && (last != 0)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
@@ -646,11 +646,11 @@ xmlSecGnuTLSBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTra
             return(-1);
         }
         if(ctx->ctxInitialized != 0) {
-            ret = xmlSecGnuTLSBlockCipherCtxUpdate(ctx, in, out, 
+            ret = xmlSecGnuTLSBlockCipherCtxUpdate(ctx, in, out,
                         (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
                         xmlSecTransformGetName(transform), transformCtx);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecGnuTLSBlockCipherCtxUpdate",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -658,13 +658,13 @@ xmlSecGnuTLSBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTra
                 return(-1);
             }
         }
-        
+
         if(last) {
-            ret = xmlSecGnuTLSBlockCipherCtxFinal(ctx, in, out, 
+            ret = xmlSecGnuTLSBlockCipherCtxFinal(ctx, in, out,
                         (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
                         xmlSecTransformGetName(transform), transformCtx);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecGnuTLSBlockCipherCtxFinal",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -672,7 +672,7 @@ xmlSecGnuTLSBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTra
                 return(-1);
             }
             transform->status = xmlSecTransformStatusFinished;
-        } 
+        }
     } else if(transform->status == xmlSecTransformStatusFinished) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
@@ -680,14 +680,14 @@ xmlSecGnuTLSBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTra
         /* the only way we can get here is if there is no enough data in the input */
         xmlSecAssert2(last == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -727,12 +727,12 @@ static xmlSecTransformKlass xmlSecGnuTLSAes128CbcKlass = {
 
 /**
  * xmlSecGnuTLSTransformAes128CbcGetKlass:
- * 
+ *
  * AES 128 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 128 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecGnuTLSTransformAes128CbcGetKlass(void) {
     return(&xmlSecGnuTLSAes128CbcKlass);
 }
@@ -759,19 +759,19 @@ static xmlSecTransformKlass xmlSecGnuTLSAes192CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecGnuTLSBlockCipherExecute,             /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecGnuTLSTransformAes192CbcGetKlass:
- * 
+ *
  * AES 192 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 192 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecGnuTLSTransformAes192CbcGetKlass(void) {
     return(&xmlSecGnuTLSAes192CbcKlass);
 }
@@ -798,19 +798,19 @@ static xmlSecTransformKlass xmlSecGnuTLSAes256CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecGnuTLSBlockCipherExecute,             /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecGnuTLSTransformAes256CbcGetKlass:
- * 
+ *
  * AES 256 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 256 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecGnuTLSTransformAes256CbcGetKlass(void) {
     return(&xmlSecGnuTLSAes256CbcKlass);
 }
@@ -840,19 +840,19 @@ static xmlSecTransformKlass xmlSecGnuTLSDes3CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecGnuTLSBlockCipherExecute,             /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecGnuTLSTransformDes3CbcGetKlass:
  *
  * Triple DES CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to Triple DES encryption transform.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecGnuTLSTransformDes3CbcGetKlass(void) {
     return(&xmlSecGnuTLSDes3CbcKlass);
 }
diff --git a/src/gnutls/crypto.c b/src/gnutls/crypto.c
index 42e696c..2acdf34 100644
--- a/src/gnutls/crypto.c
+++ b/src/gnutls/crypto.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -35,7 +35,7 @@ static xmlSecCryptoDLFunctionsPtr gXmlSecGnuTLSFunctions = NULL;
 xmlSecCryptoDLFunctionsPtr
 xmlSecCryptoGetFunctions_gnutls(void) {
     static xmlSecCryptoDLFunctions functions;
-    
+
     if(gXmlSecGnuTLSFunctions != NULL) {
         return(gXmlSecGnuTLSFunctions);
     }
@@ -43,7 +43,7 @@ xmlSecCryptoGetFunctions_gnutls(void) {
     memset(&functions, 0, sizeof(functions));
     gXmlSecGnuTLSFunctions = &functions;
 
-    /**  
+    /**
      * Crypto Init/shutdown
      */
     gXmlSecGnuTLSFunctions->cryptoInit                  = xmlSecGnuTLSInit;
@@ -53,17 +53,17 @@ xmlSecCryptoGetFunctions_gnutls(void) {
     /**
      * Key data ids
      */
-#ifndef XMLSEC_NO_AES    
+#ifndef XMLSEC_NO_AES
     gXmlSecGnuTLSFunctions->keyDataAesGetKlass          = xmlSecGnuTLSKeyDataAesGetKlass;
 #endif /* XMLSEC_NO_AES */
 
-#ifndef XMLSEC_NO_DES    
+#ifndef XMLSEC_NO_DES
     gXmlSecGnuTLSFunctions->keyDataDesGetKlass          = xmlSecGnuTLSKeyDataDesGetKlass;
 #endif /* XMLSEC_NO_DES */
 
-#ifndef XMLSEC_NO_HMAC  
+#ifndef XMLSEC_NO_HMAC
     gXmlSecGnuTLSFunctions->keyDataHmacGetKlass         = xmlSecGnuTLSKeyDataHmacGetKlass;
-#endif /* XMLSEC_NO_HMAC */    
+#endif /* XMLSEC_NO_HMAC */
 
     /**
      * Key data store ids
@@ -72,13 +72,13 @@ xmlSecCryptoGetFunctions_gnutls(void) {
     /**
      * Crypto transforms ids
      */
-#ifndef XMLSEC_NO_AES    
+#ifndef XMLSEC_NO_AES
     gXmlSecGnuTLSFunctions->transformAes128CbcGetKlass          = xmlSecGnuTLSTransformAes128CbcGetKlass;
     gXmlSecGnuTLSFunctions->transformAes192CbcGetKlass          = xmlSecGnuTLSTransformAes192CbcGetKlass;
     gXmlSecGnuTLSFunctions->transformAes256CbcGetKlass          = xmlSecGnuTLSTransformAes256CbcGetKlass;
 #endif /* XMLSEC_NO_AES */
 
-#ifndef XMLSEC_NO_DES    
+#ifndef XMLSEC_NO_DES
     gXmlSecGnuTLSFunctions->transformDes3CbcGetKlass            = xmlSecGnuTLSTransformDes3CbcGetKlass;
 #endif /* XMLSEC_NO_DES */
 
@@ -88,13 +88,13 @@ xmlSecCryptoGetFunctions_gnutls(void) {
     gXmlSecGnuTLSFunctions->transformHmacMd5GetKlass            = xmlSecGnuTLSTransformHmacMd5GetKlass;
 #endif /* XMLSEC_NO_HMAC */
 
-#ifndef XMLSEC_NO_SHA1    
+#ifndef XMLSEC_NO_SHA1
     gXmlSecGnuTLSFunctions->transformSha1GetKlass               = xmlSecGnuTLSTransformSha1GetKlass;
 #endif /* XMLSEC_NO_SHA1 */
 
     /**
      * High level routines form xmlsec command line utility
-     */ 
+     */
     gXmlSecGnuTLSFunctions->cryptoAppInit                       = xmlSecGnuTLSAppInit;
     gXmlSecGnuTLSFunctions->cryptoAppShutdown                   = xmlSecGnuTLSAppShutdown;
     gXmlSecGnuTLSFunctions->cryptoAppDefaultKeysMngrInit        = xmlSecGnuTLSAppDefaultKeysMngrInit;
@@ -103,10 +103,10 @@ xmlSecCryptoGetFunctions_gnutls(void) {
     gXmlSecGnuTLSFunctions->cryptoAppDefaultKeysMngrSave        = xmlSecGnuTLSAppDefaultKeysMngrSave;
 #ifndef XMLSEC_NO_X509
     gXmlSecGnuTLSFunctions->cryptoAppKeysMngrCertLoad           = xmlSecGnuTLSAppKeysMngrCertLoad;
-    gXmlSecGnuTLSFunctions->cryptoAppPkcs12Load                 = xmlSecGnuTLSAppPkcs12Load; 
+    gXmlSecGnuTLSFunctions->cryptoAppPkcs12Load                 = xmlSecGnuTLSAppPkcs12Load;
     gXmlSecGnuTLSFunctions->cryptoAppKeyCertLoad                = xmlSecGnuTLSAppKeyCertLoad;
 #endif /* XMLSEC_NO_X509 */
-    gXmlSecGnuTLSFunctions->cryptoAppKeyLoad                    = xmlSecGnuTLSAppKeyLoad; 
+    gXmlSecGnuTLSFunctions->cryptoAppKeyLoad                    = xmlSecGnuTLSAppKeyLoad;
     gXmlSecGnuTLSFunctions->cryptoAppDefaultPwdCallback         = (void*)xmlSecGnuTLSAppGetDefaultPwdCallback();
 
     return(gXmlSecGnuTLSFunctions);
@@ -115,12 +115,12 @@ xmlSecCryptoGetFunctions_gnutls(void) {
 
 /**
  * xmlSecGnuTLSInit:
- * 
- * XMLSec library specific crypto engine initialization. 
+ *
+ * XMLSec library specific crypto engine initialization.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecGnuTLSInit (void)  {
     /* Check loaded xmlsec library version */
     if(xmlSecCheckVersionExact() != 1) {
@@ -141,18 +141,18 @@ xmlSecGnuTLSInit (void)  {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
 /**
  * xmlSecGnuTLSShutdown:
- * 
- * XMLSec library specific crypto engine shutdown. 
+ *
+ * XMLSec library specific crypto engine shutdown.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecGnuTLSShutdown(void) {
     return(0);
 }
@@ -183,22 +183,22 @@ xmlSecGnuTLSKeysMngrInit(xmlSecKeysMngrPtr mngr) {
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecGnuTLSGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {   
+xmlSecGnuTLSGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
     int ret;
-    
+
     xmlSecAssert2(buffer != NULL, -1);
     xmlSecAssert2(size > 0, -1);
 
     ret = xmlSecBufferSetSize(buffer, size);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", size);
         return(-1);
     }
-        
+
     /* get random data */
     gcry_randomize(xmlSecBufferGetData(buffer), size, GCRY_STRONG_RANDOM);
     return(0);
diff --git a/src/gnutls/digests.c b/src/gnutls/digests.c
index 5b4b4a5..1a2dd89 100644
--- a/src/gnutls/digests.c
+++ b/src/gnutls/digests.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -34,7 +34,7 @@ struct _xmlSecGnuTLSDigestCtx {
     GcryMDHd            digestCtx;
     xmlSecByte          dgst[XMLSEC_GNUTLS_MAX_DIGEST_SIZE];
     xmlSecSize          dgstSize;       /* dgst size in bytes */
-};          
+};
 
 /******************************************************************************
  *
@@ -44,18 +44,18 @@ struct _xmlSecGnuTLSDigestCtx {
  *
  *****************************************************************************/
 #define xmlSecGnuTLSDigestSize  \
-    (sizeof(xmlSecTransform) + sizeof(xmlSecGnuTLSDigestCtx))   
+    (sizeof(xmlSecTransform) + sizeof(xmlSecGnuTLSDigestCtx))
 #define xmlSecGnuTLSDigestGetCtx(transform) \
     ((xmlSecGnuTLSDigestCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
 
 static int      xmlSecGnuTLSDigestInitialize            (xmlSecTransformPtr transform);
 static void     xmlSecGnuTLSDigestFinalize              (xmlSecTransformPtr transform);
-static int      xmlSecGnuTLSDigestVerify                (xmlSecTransformPtr transform, 
-                                                         const xmlSecByte* data, 
+static int      xmlSecGnuTLSDigestVerify                (xmlSecTransformPtr transform,
+                                                         const xmlSecByte* data,
                                                          xmlSecSize dataSize,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecGnuTLSDigestExecute               (xmlSecTransformPtr transform, 
-                                                         int last, 
+static int      xmlSecGnuTLSDigestExecute               (xmlSecTransformPtr transform,
+                                                         int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 static int      xmlSecGnuTLSDigestCheckId               (xmlSecTransformPtr transform);
 
@@ -66,12 +66,12 @@ xmlSecGnuTLSDigestCheckId(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformSha1Id)) {
         return(1);
     }
-#endif /* XMLSEC_NO_SHA1 */    
+#endif /* XMLSEC_NO_SHA1 */
 
     return(0);
 }
 
-static int 
+static int
 xmlSecGnuTLSDigestInitialize(xmlSecTransformPtr transform) {
     xmlSecGnuTLSDigestCtxPtr ctx;
 #ifndef XMLSEC_GNUTLS_OLD
@@ -91,17 +91,17 @@ xmlSecGnuTLSDigestInitialize(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformSha1Id)) {
         ctx->digest = GCRY_MD_SHA1;
     } else
-#endif /* XMLSEC_NO_SHA1 */     
+#endif /* XMLSEC_NO_SHA1 */
 
     if(1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
 #ifndef XMLSEC_GNUTLS_OLD
     ret = gcry_md_open(&ctx->digestCtx, ctx->digest, GCRY_MD_FLAG_SECURE); /* we are paranoid */
     if(ret != GPG_ERR_NO_ERROR) {
@@ -109,7 +109,7 @@ xmlSecGnuTLSDigestInitialize(xmlSecTransformPtr transform) {
     ctx->digestCtx = gcry_md_open(ctx->digest, GCRY_MD_FLAG_SECURE); /* we are paranoid */
     if(ctx->digestCtx == NULL) {
 #endif /* XMLSEC_GNUTLS_OLD */
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "gcry_md_open",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -119,7 +119,7 @@ xmlSecGnuTLSDigestInitialize(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static void 
+static void
 xmlSecGnuTLSDigestFinalize(xmlSecTransformPtr transform) {
     xmlSecGnuTLSDigestCtxPtr ctx;
 
@@ -128,7 +128,7 @@ xmlSecGnuTLSDigestFinalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecGnuTLSDigestGetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     if(ctx->digestCtx != NULL) {
         gcry_md_close(ctx->digestCtx);
     }
@@ -136,11 +136,11 @@ xmlSecGnuTLSDigestFinalize(xmlSecTransformPtr transform) {
 }
 
 static int
-xmlSecGnuTLSDigestVerify(xmlSecTransformPtr transform, 
+xmlSecGnuTLSDigestVerify(xmlSecTransformPtr transform,
                         const xmlSecByte* data, xmlSecSize dataSize,
                         xmlSecTransformCtxPtr transformCtx) {
     xmlSecGnuTLSDigestCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecGnuTLSDigestCheckId(transform), -1);
     xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecGnuTLSDigestSize), -1);
@@ -151,20 +151,20 @@ xmlSecGnuTLSDigestVerify(xmlSecTransformPtr transform,
     ctx = xmlSecGnuTLSDigestGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->dgstSize > 0, -1);
-    
+
     if(dataSize != ctx->dgstSize) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_DATA,
-                    "data and digest sizes are different (data=%d, dgst=%d)", 
+                    "data and digest sizes are different (data=%d, dgst=%d)",
                     dataSize, ctx->dgstSize);
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-    
+
     if(memcmp(ctx->dgst, data, dataSize) != 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_DATA,
@@ -172,17 +172,17 @@ xmlSecGnuTLSDigestVerify(xmlSecTransformPtr transform,
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-    
+
     transform->status = xmlSecTransformStatusOk;
     return(0);
 }
 
-static int 
+static int
 xmlSecGnuTLSDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecGnuTLSDigestCtxPtr ctx;
     xmlSecBufferPtr in, out;
     int ret;
-    
+
     xmlSecAssert2(xmlSecGnuTLSDigestCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(transformCtx != NULL, -1);
@@ -199,17 +199,17 @@ xmlSecGnuTLSDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if(transform->status == xmlSecTransformStatusWorking) {
         xmlSecSize inSize;
 
         inSize = xmlSecBufferGetSize(in);
         if(inSize > 0) {
             gcry_md_write(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
-            
+
             ret = xmlSecBufferRemoveHead(in, inSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferRemoveHead",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -219,19 +219,19 @@ xmlSecGnuTLSDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
         }
         if(last) {
             xmlSecByte* buf;
-            
+
             /* get the final digest */
             gcry_md_final(ctx->digestCtx);
             buf = gcry_md_read(ctx->digestCtx, ctx->digest);
             if(buf == NULL) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "gcry_md_read",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-            
+
             /* copy it to our internal buffer */
             ctx->dgstSize = gcry_md_get_algo_dlen(ctx->digest);
             xmlSecAssert2(ctx->dgstSize > 0, -1);
@@ -242,7 +242,7 @@ xmlSecGnuTLSDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
             if(transform->operation == xmlSecTransformOperationSign) {
                 ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferAppend",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -256,14 +256,14 @@ xmlSecGnuTLSDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -282,7 +282,7 @@ static xmlSecTransformKlass xmlSecGnuTLSSha1Klass = {
     xmlSecNameSha1,                             /* const xmlChar* name; */
     xmlSecHrefSha1,                             /* const xmlChar* href; */
     xmlSecTransformUsageDigestMethod,           /* xmlSecTransformUsage usage; */
-    
+
     /* methods */
     xmlSecGnuTLSDigestInitialize,               /* xmlSecTransformInitializeMethod initialize; */
     xmlSecGnuTLSDigestFinalize,                 /* xmlSecTransformFinalizeMethod finalize; */
@@ -297,19 +297,19 @@ static xmlSecTransformKlass xmlSecGnuTLSSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecGnuTLSDigestExecute,                  /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecGnuTLSTransformSha1GetKlass:
  *
  * SHA-1 digest transform klass.
  *
  * Returns: pointer to SHA-1 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecGnuTLSTransformSha1GetKlass(void) {
     return(&xmlSecGnuTLSSha1Klass);
 }
diff --git a/src/gnutls/globals.h b/src/gnutls/globals.h
index 272a27b..770b6db 100644
--- a/src/gnutls/globals.h
+++ b/src/gnutls/globals.h
@@ -5,14 +5,14 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_GLOBALS_H__
 #define __XMLSEC_GLOBALS_H__
 
 /**
- * Use autoconf defines if present. 
+ * Use autoconf defines if present.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/src/gnutls/hmac.c b/src/gnutls/hmac.c
index 4f0e935..4df4342 100644
--- a/src/gnutls/hmac.c
+++ b/src/gnutls/hmac.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef XMLSEC_NO_HMAC
@@ -35,10 +35,10 @@
 static int g_xmlsec_gnutls_hmac_min_length = XMLSEC_GNUTLS_MIN_HMAC_SIZE;
 
 /**
- * xmlSecGnuTLSHmacGetMinOutputLength: 
- * 
+ * xmlSecGnuTLSHmacGetMinOutputLength:
+ *
  * Gets the value of min HMAC length.
- * 
+ *
  * Returns: the min HMAC output length
  */
 int xmlSecGnuTLSHmacGetMinOutputLength(void)
@@ -47,9 +47,9 @@ int xmlSecGnuTLSHmacGetMinOutputLength(void)
 }
 
 /**
- * xmlSecGnuTLSHmacSetMinOutputLength: 
- * @min_length: the new min length 
- * 
+ * xmlSecGnuTLSHmacSetMinOutputLength:
+ * @min_length: the new min length
+ *
  * Sets the min HMAC output length
  */
 void xmlSecGnuTLSHmacSetMinOutputLength(int min_length)
@@ -68,7 +68,7 @@ struct _xmlSecGnuTLSHmacCtx {
     GcryMDHd            digestCtx;
     xmlSecByte          dgst[XMLSEC_GNUTLS_MAX_HMAC_SIZE / 8];
     xmlSecSize          dgstSize;       /* dgst size in bits */
-};          
+};
 
 /******************************************************************************
  *
@@ -91,19 +91,19 @@ static void     xmlSecGnuTLSHmacFinalize                (xmlSecTransformPtr tran
 static int      xmlSecGnuTLSHmacNodeRead                (xmlSecTransformPtr transform,
                                                          xmlNodePtr node,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecGnuTLSHmacSetKeyReq               (xmlSecTransformPtr transform, 
+static int      xmlSecGnuTLSHmacSetKeyReq               (xmlSecTransformPtr transform,
                                                          xmlSecKeyReqPtr keyReq);
-static int      xmlSecGnuTLSHmacSetKey                  (xmlSecTransformPtr transform, 
+static int      xmlSecGnuTLSHmacSetKey                  (xmlSecTransformPtr transform,
                                                          xmlSecKeyPtr key);
-static int      xmlSecGnuTLSHmacVerify                  (xmlSecTransformPtr transform, 
-                                                         const xmlSecByte* data, 
+static int      xmlSecGnuTLSHmacVerify                  (xmlSecTransformPtr transform,
+                                                         const xmlSecByte* data,
                                                          xmlSecSize dataSize,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecGnuTLSHmacExecute                 (xmlSecTransformPtr transform, 
-                                                         int last, 
+static int      xmlSecGnuTLSHmacExecute                 (xmlSecTransformPtr transform,
+                                                         int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 
-static int 
+static int
 xmlSecGnuTLSHmacInitialize(xmlSecTransformPtr transform) {
     xmlSecGnuTLSHmacCtxPtr ctx;
 #ifndef XMLSEC_GNUTLS_OLD
@@ -115,7 +115,7 @@ xmlSecGnuTLSHmacInitialize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecGnuTLSHmacGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecGnuTLSHmacCtx));
     if(xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformHmacSha1Id)) {
         ctx->digest = GCRY_MD_SHA1;
@@ -124,14 +124,14 @@ xmlSecGnuTLSHmacInitialize(xmlSecTransformPtr transform) {
     } else if(xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformHmacRipemd160Id)) {
         ctx->digest = GCRY_MD_RMD160;
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
 #ifndef XMLSEC_GNUTLS_OLD
     ret = gcry_md_open(&ctx->digestCtx, ctx->digest, GCRY_MD_FLAG_HMAC | GCRY_MD_FLAG_SECURE); /* we are paranoid */
     if(ret != GPG_ERR_NO_ERROR) {
@@ -139,22 +139,22 @@ xmlSecGnuTLSHmacInitialize(xmlSecTransformPtr transform) {
     ctx->digestCtx = gcry_md_open(ctx->digest, GCRY_MD_FLAG_HMAC | GCRY_MD_FLAG_SECURE); /* we are paranoid */
     if(ctx->digestCtx == NULL) {
 #endif /* XMLSEC_GNUTLS_OLD */
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "gcry_md_open",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
-static void 
+static void
 xmlSecGnuTLSHmacFinalize(xmlSecTransformPtr transform) {
     xmlSecGnuTLSHmacCtxPtr ctx;
 
-    xmlSecAssert(xmlSecGnuTLSHmacCheckId(transform));    
+    xmlSecAssert(xmlSecGnuTLSHmacCheckId(transform));
     xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecGnuTLSHmacSize));
 
     ctx = xmlSecGnuTLSHmacGetCtx(transform);
@@ -171,21 +171,21 @@ xmlSecGnuTLSHmacFinalize(xmlSecTransformPtr transform) {
  *
  * HMAC (http://www.w3.org/TR/xmldsig-core/#sec-HMAC):
  *
- * The HMAC algorithm (RFC2104 [HMAC]) takes the truncation length in bits 
- * as a parameter; if the parameter is not specified then all the bits of the 
- * hash are output. An example of an HMAC SignatureMethod element:  
+ * The HMAC algorithm (RFC2104 [HMAC]) takes the truncation length in bits
+ * as a parameter; if the parameter is not specified then all the bits of the
+ * hash are output. An example of an HMAC SignatureMethod element:
  * <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1";>
  *   <HMACOutputLength>128</HMACOutputLength>
  * </SignatureMethod>
- * 
+ *
  * Schema Definition:
- * 
+ *
  * <simpleType name="HMACOutputLengthType">
  *   <restriction base="integer"/>
  * </simpleType>
- *     
+ *
  * DTD:
- *     
+ *
  * <!ELEMENT HMACOutputLength (#PCDATA)>
  */
 static int
@@ -201,18 +201,18 @@ xmlSecGnuTLSHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTr
     ctx = xmlSecGnuTLSHmacGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
 
-    cur = xmlSecGetNextElementNode(node->children); 
-    if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) {  
+    cur = xmlSecGetNextElementNode(node->children);
+    if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) {
         xmlChar *content;
-        
+
         content = xmlNodeGetContent(cur);
         if(content != NULL) {
-            ctx->dgstSize = atoi((char*)content);           
+            ctx->dgstSize = atoi((char*)content);
             xmlFree(content);
         }
-        
+
         /* Ensure that HMAC length is greater than min specified.
-           Otherwise, an attacker can set this lenght to 0 or very 
+           Otherwise, an attacker can set this lenght to 0 or very
            small value
         */
         if((int)ctx->dgstSize < xmlSecGnuTLSHmacGetMinOutputLength()) {
@@ -226,7 +226,7 @@ xmlSecGnuTLSHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTr
 
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -235,11 +235,11 @@ xmlSecGnuTLSHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTr
                     "no nodes expected");
         return(-1);
     }
-    return(0); 
+    return(0);
 }
 
 
-static int  
+static int
 xmlSecGnuTLSHmacSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecGnuTLSHmacCtxPtr ctx;
 
@@ -258,7 +258,7 @@ xmlSecGnuTLSHmacSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq)
     } else {
         keyReq->keyUsage = xmlSecKeyUsageVerify;
     }
-    
+
     return(0);
 }
 
@@ -266,9 +266,9 @@ static int
 xmlSecGnuTLSHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecGnuTLSHmacCtxPtr ctx;
     xmlSecKeyDataPtr value;
-    xmlSecBufferPtr buffer;    
+    xmlSecBufferPtr buffer;
     int ret;
-    
+
     xmlSecAssert2(xmlSecGnuTLSHmacCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecGnuTLSHmacSize), -1);
@@ -277,7 +277,7 @@ xmlSecGnuTLSHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     ctx = xmlSecGnuTLSHmacGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->digestCtx != NULL, -1);
-    
+
     value = xmlSecKeyGetValue(key);
     xmlSecAssert2(xmlSecKeyDataCheckId(value, xmlSecGnuTLSKeyDataHmacId), -1);
 
@@ -285,18 +285,18 @@ xmlSecGnuTLSHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecAssert2(buffer != NULL, -1);
 
     if(xmlSecBufferGetSize(buffer) == 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
                     "key is empty");
-        return(-1);    
+        return(-1);
     }
-    
-    ret = gcry_md_setkey(ctx->digestCtx, xmlSecBufferGetData(buffer), 
+
+    ret = gcry_md_setkey(ctx->digestCtx, xmlSecBufferGetData(buffer),
                         xmlSecBufferGetSize(buffer));
     if(ret != 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "gcry_md_setkey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -307,15 +307,15 @@ xmlSecGnuTLSHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
 }
 
 static int
-xmlSecGnuTLSHmacVerify(xmlSecTransformPtr transform, 
+xmlSecGnuTLSHmacVerify(xmlSecTransformPtr transform,
                         const xmlSecByte* data, xmlSecSize dataSize,
                         xmlSecTransformCtxPtr transformCtx) {
-    static xmlSecByte last_byte_masks[] =       
+    static xmlSecByte last_byte_masks[] =
                 { 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
 
     xmlSecGnuTLSHmacCtxPtr ctx;
     xmlSecByte mask;
-        
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecGnuTLSHmacSize), -1);
     xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1);
@@ -327,10 +327,10 @@ xmlSecGnuTLSHmacVerify(xmlSecTransformPtr transform,
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->digestCtx != NULL, -1);
     xmlSecAssert2(ctx->dgstSize > 0, -1);
-    
+
     /* compare the digest size in bytes */
     if(dataSize != ((ctx->dgstSize + 7) / 8)){
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_SIZE,
@@ -344,7 +344,7 @@ xmlSecGnuTLSHmacVerify(xmlSecTransformPtr transform,
     xmlSecAssert2(dataSize > 0, -1);
     mask = last_byte_masks[ctx->dgstSize % 8];
     if((ctx->dgst[dataSize - 1] & mask) != (data[dataSize - 1]  & mask)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_DATA_NOT_MATCH,
@@ -355,7 +355,7 @@ xmlSecGnuTLSHmacVerify(xmlSecTransformPtr transform,
 
     /* now check the rest of the digest */
     if((dataSize > 1) && (memcmp(ctx->dgst, data, dataSize - 1) != 0)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_DATA_NOT_MATCH,
@@ -363,19 +363,19 @@ xmlSecGnuTLSHmacVerify(xmlSecTransformPtr transform,
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-    
+
     transform->status = xmlSecTransformStatusOk;
     return(0);
 }
 
-static int 
+static int
 xmlSecGnuTLSHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecGnuTLSHmacCtxPtr ctx;
     xmlSecBufferPtr in, out;
     xmlSecByte* dgst;
     xmlSecSize dgstSize;
     int ret;
-    
+
     xmlSecAssert2(xmlSecGnuTLSHmacCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecGnuTLSHmacSize), -1);
@@ -391,17 +391,17 @@ xmlSecGnuTLSHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformC
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if(transform->status == xmlSecTransformStatusWorking) {
         xmlSecSize inSize;
 
         inSize = xmlSecBufferGetSize(in);
         if(inSize > 0) {
             gcry_md_write(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
-            
+
             ret = xmlSecBufferRemoveHead(in, inSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferRemoveHead",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -409,19 +409,19 @@ xmlSecGnuTLSHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformC
                 return(-1);
             }
         }
-        if(last) {          
+        if(last) {
             /* get the final digest */
             gcry_md_final(ctx->digestCtx);
             dgst = gcry_md_read(ctx->digestCtx, ctx->digest);
             if(dgst == NULL) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "gcry_md_read",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-            
+
             /* copy it to our internal buffer */
             dgstSize = gcry_md_get_algo_dlen(ctx->digest);
             xmlSecAssert2(dgstSize > 0, -1);
@@ -434,7 +434,7 @@ xmlSecGnuTLSHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformC
             } else if(ctx->dgstSize <= 8 * dgstSize) {
                 dgstSize = ((ctx->dgstSize + 7) / 8); /* we need to truncate result digest */
             } else {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             NULL,
                             XMLSEC_ERRORS_R_INVALID_SIZE,
@@ -446,7 +446,7 @@ xmlSecGnuTLSHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformC
             if(transform->operation == xmlSecTransformOperationSign) {
                 ret = xmlSecBufferAppend(out, ctx->dgst, dgstSize);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferAppend",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -460,18 +460,18 @@ xmlSecGnuTLSHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformC
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "size=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
-/** 
+/**
  * HMAC SHA1
  */
 static xmlSecTransformKlass xmlSecGnuTLSHmacSha1Klass = {
@@ -482,7 +482,7 @@ static xmlSecTransformKlass xmlSecGnuTLSHmacSha1Klass = {
     xmlSecNameHmacSha1,                         /* const xmlChar* name; */
     xmlSecHrefHmacSha1,                         /* const xmlChar *href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecGnuTLSHmacInitialize,                 /* xmlSecTransformInitializeMethod initialize; */
     xmlSecGnuTLSHmacFinalize,                   /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecGnuTLSHmacNodeRead,                   /* xmlSecTransformNodeReadMethod readNode; */
@@ -496,24 +496,24 @@ static xmlSecTransformKlass xmlSecGnuTLSHmacSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecGnuTLSHmacExecute,                    /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecGnuTLSTransformHmacSha1GetKlass:
  *
  * The HMAC-SHA1 transform klass.
  *
  * Returns: the HMAC-SHA1 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecGnuTLSTransformHmacSha1GetKlass(void) {
     return(&xmlSecGnuTLSHmacSha1Klass);
 }
 
-/** 
+/**
  * HMAC Ripemd160
  */
 static xmlSecTransformKlass xmlSecGnuTLSHmacRipemd160Klass = {
@@ -524,7 +524,7 @@ static xmlSecTransformKlass xmlSecGnuTLSHmacRipemd160Klass = {
     xmlSecNameHmacRipemd160,                    /* const xmlChar* name; */
     xmlSecHrefHmacRipemd160,                    /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecGnuTLSHmacInitialize,                 /* xmlSecTransformInitializeMethod initialize; */
     xmlSecGnuTLSHmacFinalize,                   /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecGnuTLSHmacNodeRead,                   /* xmlSecTransformNodeReadMethod readNode; */
@@ -538,24 +538,24 @@ static xmlSecTransformKlass xmlSecGnuTLSHmacRipemd160Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecGnuTLSHmacExecute,                    /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecGnuTLSTransformHmacRipemd160GetKlass:
  *
  * The HMAC-RIPEMD160 transform klass.
  *
  * Returns: the HMAC-RIPEMD160 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecGnuTLSTransformHmacRipemd160GetKlass(void) {
     return(&xmlSecGnuTLSHmacRipemd160Klass);
 }
 
-/** 
+/**
  * HMAC Md5
  */
 static xmlSecTransformKlass xmlSecGnuTLSHmacMd5Klass = {
@@ -566,7 +566,7 @@ static xmlSecTransformKlass xmlSecGnuTLSHmacMd5Klass = {
     xmlSecNameHmacMd5,                          /* const xmlChar* name; */
     xmlSecHrefHmacMd5,                          /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecGnuTLSHmacInitialize,                 /* xmlSecTransformInitializeMethod initialize; */
     xmlSecGnuTLSHmacFinalize,                   /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecGnuTLSHmacNodeRead,                   /* xmlSecTransformNodeReadMethod readNode; */
@@ -580,19 +580,19 @@ static xmlSecTransformKlass xmlSecGnuTLSHmacMd5Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecGnuTLSHmacExecute,                    /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecGnuTLSTransformHmacMd5GetKlass:
  *
  * The HMAC-MD5 transform klass.
  *
  * Returns: the HMAC-MD5 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecGnuTLSTransformHmacMd5GetKlass(void) {
     return(&xmlSecGnuTLSHmacMd5Klass);
 }
diff --git a/src/gnutls/symkeys.c b/src/gnutls/symkeys.c
index b44744a..d2ea284 100644
--- a/src/gnutls/symkeys.c
+++ b/src/gnutls/symkeys.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * DES Algorithm support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -25,7 +25,7 @@
 #include <xmlsec/gnutls/crypto.h>
 
 /*****************************************************************************
- * 
+ *
  * Symmetic (binary) keys - just a wrapper for xmlSecKeyDataBinary
  *
  ****************************************************************************/
@@ -70,7 +70,7 @@ static int      xmlSecGnuTLSSymKeyDataKlassCheck        (xmlSecKeyDataKlass* kla
 static int
 xmlSecGnuTLSSymKeyDataInitialize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecGnuTLSSymKeyDataCheckId(data), -1);
-    
+
     return(xmlSecKeyDataBinaryValueInitialize(data));
 }
 
@@ -79,14 +79,14 @@ xmlSecGnuTLSSymKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     xmlSecAssert2(xmlSecGnuTLSSymKeyDataCheckId(dst), -1);
     xmlSecAssert2(xmlSecGnuTLSSymKeyDataCheckId(src), -1);
     xmlSecAssert2(dst->id == src->id, -1);
-        
+
     return(xmlSecKeyDataBinaryValueDuplicate(dst, src));
 }
 
 static void
 xmlSecGnuTLSSymKeyDataFinalize(xmlSecKeyDataPtr data) {
     xmlSecAssert(xmlSecGnuTLSSymKeyDataCheckId(data));
-    
+
     xmlSecKeyDataBinaryValueFinalize(data);
 }
 
@@ -94,15 +94,15 @@ static int
 xmlSecGnuTLSSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecGnuTLSSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueXmlRead(id, key, node, keyInfoCtx));
 }
 
-static int 
+static int
 xmlSecGnuTLSSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                     xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecGnuTLSSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueXmlWrite(id, key, node, keyInfoCtx));
 }
 
@@ -111,7 +111,7 @@ xmlSecGnuTLSSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                     const xmlSecByte* buf, xmlSecSize bufSize,
                                     xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecGnuTLSSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueBinRead(id, key, buf, bufSize, keyInfoCtx));
 }
 
@@ -120,7 +120,7 @@ xmlSecGnuTLSSymKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                     xmlSecByte** buf, xmlSecSize* bufSize,
                                     xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecGnuTLSSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueBinWrite(id, key, buf, bufSize, keyInfoCtx));
 }
 
@@ -133,7 +133,7 @@ xmlSecGnuTLSSymKeyDataGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlSe
 
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecGnuTLSGenerateRandom(buffer, (sizeBits + 7) / 8));
 }
 
@@ -149,29 +149,29 @@ xmlSecGnuTLSSymKeyDataGetType(xmlSecKeyDataPtr data) {
     return((xmlSecBufferGetSize(buffer) > 0) ? xmlSecKeyDataTypeSymmetric : xmlSecKeyDataTypeUnknown);
 }
 
-static xmlSecSize 
+static xmlSecSize
 xmlSecGnuTLSSymKeyDataGetSize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecGnuTLSSymKeyDataCheckId(data), 0);
-    
+
     return(xmlSecKeyDataBinaryValueGetSize(data));
 }
 
-static void 
+static void
 xmlSecGnuTLSSymKeyDataDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecGnuTLSSymKeyDataCheckId(data));
-    
-    xmlSecKeyDataBinaryValueDebugDump(data, output);    
+
+    xmlSecKeyDataBinaryValueDebugDump(data, output);
 }
 
 static void
 xmlSecGnuTLSSymKeyDataDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecGnuTLSSymKeyDataCheckId(data));
-    
-    xmlSecKeyDataBinaryValueDebugXmlDump(data, output);    
+
+    xmlSecKeyDataBinaryValueDebugXmlDump(data, output);
 }
 
-static int 
-xmlSecGnuTLSSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {    
+static int
+xmlSecGnuTLSSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {
 #ifndef XMLSEC_NO_DES
     if(klass == xmlSecGnuTLSKeyDataDesId) {
         return(1);
@@ -205,18 +205,18 @@ static xmlSecKeyDataKlass xmlSecGnuTLSKeyDataAesKlass = {
 
     /* data */
     xmlSecNameAESKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefAESKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeAESKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecGnuTLSSymKeyDataInitialize,           /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecGnuTLSSymKeyDataDuplicate,            /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecGnuTLSSymKeyDataFinalize,             /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecGnuTLSSymKeyDataGenerate,             /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecGnuTLSSymKeyDataGetType,              /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecGnuTLSSymKeyDataGetSize,              /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -237,14 +237,14 @@ static xmlSecKeyDataKlass xmlSecGnuTLSKeyDataAesKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecGnuTLSKeyDataAesGetKlass:
- * 
+ *
  * The AES key data klass.
  *
  * Returns: AES key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecGnuTLSKeyDataAesGetKlass(void) {
     return(&xmlSecGnuTLSKeyDataAesKlass);
 }
@@ -262,14 +262,14 @@ xmlSecGnuTLSKeyDataAesGetKlass(void) {
 int
 xmlSecGnuTLSKeyDataAesSet(xmlSecKeyDataPtr data, const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecGnuTLSKeyDataAesId), -1);
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(bufSize > 0, -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecBufferSetData(buffer, buf, bufSize));
 }
 #endif /* XMLSEC_NO_AES */
@@ -286,18 +286,18 @@ static xmlSecKeyDataKlass xmlSecGnuTLSKeyDataDesKlass = {
 
     /* data */
     xmlSecNameDESKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefDESKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeDESKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecGnuTLSSymKeyDataInitialize,           /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecGnuTLSSymKeyDataDuplicate,            /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecGnuTLSSymKeyDataFinalize,             /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecGnuTLSSymKeyDataGenerate,             /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecGnuTLSSymKeyDataGetType,              /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecGnuTLSSymKeyDataGetSize,              /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -318,14 +318,14 @@ static xmlSecKeyDataKlass xmlSecGnuTLSKeyDataDesKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecGnuTLSKeyDataDesGetKlass:
- * 
+ *
  * The DES key data klass.
  *
  * Returns: DES key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecGnuTLSKeyDataDesGetKlass(void) {
     return(&xmlSecGnuTLSKeyDataDesKlass);
 }
@@ -343,14 +343,14 @@ xmlSecGnuTLSKeyDataDesGetKlass(void) {
 int
 xmlSecGnuTLSKeyDataDesSet(xmlSecKeyDataPtr data, const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecGnuTLSKeyDataDesId), -1);
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(bufSize > 0, -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecBufferSetData(buffer, buf, bufSize));
 }
 
@@ -368,18 +368,18 @@ static xmlSecKeyDataKlass xmlSecGnuTLSKeyDataHmacKlass = {
 
     /* data */
     xmlSecNameHMACKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefHMACKeyValue,                     /* const xmlChar* href; */
     xmlSecNodeHMACKeyValue,                     /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecGnuTLSSymKeyDataInitialize,           /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecGnuTLSSymKeyDataDuplicate,            /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecGnuTLSSymKeyDataFinalize,             /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecGnuTLSSymKeyDataGenerate,             /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecGnuTLSSymKeyDataGetType,              /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecGnuTLSSymKeyDataGetSize,              /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -400,14 +400,14 @@ static xmlSecKeyDataKlass xmlSecGnuTLSKeyDataHmacKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecGnuTLSKeyDataHmacGetKlass:
- * 
+ *
  * The HMAC key data klass.
  *
  * Returns: HMAC key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecGnuTLSKeyDataHmacGetKlass(void) {
     return(&xmlSecGnuTLSKeyDataHmacKlass);
 }
@@ -425,14 +425,14 @@ xmlSecGnuTLSKeyDataHmacGetKlass(void) {
 int
 xmlSecGnuTLSKeyDataHmacSet(xmlSecKeyDataPtr data, const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecGnuTLSKeyDataHmacId), -1);
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(bufSize > 0, -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecBufferSetData(buffer, buf, bufSize));
 }
 
diff --git a/src/io.c b/src/io.c
index 1b90fcf..42e9133 100644
--- a/src/io.c
+++ b/src/io.c
@@ -1,17 +1,17 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Input uri transform and utility functions.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
 
 #include <stdlib.h>
-#include <string.h> 
+#include <string.h>
 #include <errno.h>
 
 #include <libxml/uri.h>
@@ -22,7 +22,7 @@
 #include <libxml/nanohttp.h>
 #endif /* LIBXML_HTTP_ENABLED */
 
-#ifdef LIBXML_FTP_ENABLED 
+#ifdef LIBXML_FTP_ENABLED
 #include <libxml/nanoftp.h>
 #endif /* LIBXML_FTP_ENABLED */
 
@@ -46,18 +46,18 @@ typedef struct _xmlSecIOCallback {
 } xmlSecIOCallback, *xmlSecIOCallbackPtr;
 
 static xmlSecIOCallbackPtr      xmlSecIOCallbackCreate  (xmlInputMatchCallback matchFunc,
-                                                         xmlInputOpenCallback openFunc, 
+                                                         xmlInputOpenCallback openFunc,
                                                          xmlInputReadCallback readFunc,
                                                          xmlInputCloseCallback closeFunc);
 static void                     xmlSecIOCallbackDestroy (xmlSecIOCallbackPtr callbacks);
 
-static xmlSecIOCallbackPtr 
-xmlSecIOCallbackCreate(xmlInputMatchCallback matchFunc, xmlInputOpenCallback openFunc, 
+static xmlSecIOCallbackPtr
+xmlSecIOCallbackCreate(xmlInputMatchCallback matchFunc, xmlInputOpenCallback openFunc,
                        xmlInputReadCallback readFunc, xmlInputCloseCallback closeFunc) {
     xmlSecIOCallbackPtr callbacks;
-    
+
     xmlSecAssert2(matchFunc != NULL, NULL);
-    
+
     /* Allocate a new xmlSecIOCallback and fill the fields. */
     callbacks = (xmlSecIOCallbackPtr)xmlMalloc(sizeof(xmlSecIOCallback));
     if(callbacks == NULL) {
@@ -65,26 +65,26 @@ xmlSecIOCallbackCreate(xmlInputMatchCallback matchFunc, xmlInputOpenCallback ope
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecIOCallback)=%d", 
+                    "sizeof(xmlSecIOCallback)=%d",
                     sizeof(xmlSecIOCallback));
         return(NULL);
     }
-    memset(callbacks, 0, sizeof(xmlSecIOCallback));    
+    memset(callbacks, 0, sizeof(xmlSecIOCallback));
 
     callbacks->matchcallback = matchFunc;
     callbacks->opencallback  = openFunc;
     callbacks->readcallback  = readFunc;
     callbacks->closecallback = closeFunc;
-    
+
     return(callbacks);
 }
 
-static void 
+static void
 xmlSecIOCallbackDestroy(xmlSecIOCallbackPtr callbacks) {
     xmlSecAssert(callbacks != NULL);
 
-    memset(callbacks, 0, sizeof(xmlSecIOCallback));    
-    xmlFree(callbacks);    
+    memset(callbacks, 0, sizeof(xmlSecIOCallback));
+    xmlFree(callbacks);
 }
 
 /*******************************************************************
@@ -106,18 +106,18 @@ static xmlSecIOCallbackPtr              xmlSecIOCallbackPtrListFind     (xmlSecP
                                                                          const char* uri);
 
 /**
- * xmlSecIOCallbackPtrListGetKlass: 
+ * xmlSecIOCallbackPtrListGetKlass:
  *
  * The keys list klass.
  *
  * Returns: keys list id.
  */
-static xmlSecPtrListId 
+static xmlSecPtrListId
 xmlSecIOCallbackPtrListGetKlass(void) {
     return(&xmlSecIOCallbackPtrListKlass);
 }
 
-static xmlSecIOCallbackPtr 
+static xmlSecIOCallbackPtr
 xmlSecIOCallbackPtrListFind(xmlSecPtrListPtr list, const char* uri) {
     xmlSecIOCallbackPtr callbacks;
     xmlSecSize i, size;
@@ -128,9 +128,9 @@ xmlSecIOCallbackPtrListFind(xmlSecPtrListPtr list, const char* uri) {
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         callbacks = (xmlSecIOCallbackPtr)xmlSecPtrListGetItem(list, i);
-        xmlSecAssert2(callbacks != NULL, NULL); 
-        xmlSecAssert2(callbacks->matchcallback != NULL, NULL);  
-        
+        xmlSecAssert2(callbacks != NULL, NULL);
+        xmlSecAssert2(callbacks->matchcallback != NULL, NULL);
+
         if((callbacks->matchcallback(uri)) != 0) {
             return(callbacks);
         }
@@ -147,11 +147,11 @@ static xmlSecPtrList xmlSecAllIOCallbacks;
  * Applications should not call this function directly.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 int
-xmlSecIOInit(void) {    
+xmlSecIOInit(void) {
     int ret;
-    
+
     ret = xmlSecPtrListInitialize(&xmlSecAllIOCallbacks, xmlSecIOCallbackPtrListId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -166,9 +166,9 @@ xmlSecIOInit(void) {
     xmlNanoHTTPInit();
 #endif /* LIBXML_HTTP_ENABLED */
 
-#ifdef LIBXML_FTP_ENABLED       
+#ifdef LIBXML_FTP_ENABLED
     xmlNanoFTPInit();
-#endif /* LIBXML_FTP_ENABLED */ 
+#endif /* LIBXML_FTP_ENABLED */
 
     return(xmlSecIORegisterDefaultCallbacks());
 }
@@ -178,7 +178,7 @@ xmlSecIOInit(void) {
  *
  * The IO clenaup (called from #xmlSecShutdown function).
  * Applications should not call this function directly.
- */ 
+ */
 void
 xmlSecIOShutdown(void) {
 
@@ -186,9 +186,9 @@ xmlSecIOShutdown(void) {
     xmlNanoHTTPCleanup();
 #endif /* LIBXML_HTTP_ENABLED */
 
-#ifdef LIBXML_FTP_ENABLED       
+#ifdef LIBXML_FTP_ENABLED
     xmlNanoFTPCleanup();
-#endif /* LIBXML_FTP_ENABLED */ 
+#endif /* LIBXML_FTP_ENABLED */
 
     xmlSecPtrListFinalize(&xmlSecAllIOCallbacks);
 }
@@ -197,7 +197,7 @@ xmlSecIOShutdown(void) {
  * xmlSecIOCleanupCallbacks:
  *
  * Clears the entire input callback table. this includes the
- * compiled-in I/O. 
+ * compiled-in I/O.
  */
 void
 xmlSecIOCleanupCallbacks(void) {
@@ -221,9 +221,9 @@ xmlSecIORegisterCallbacks(xmlInputMatchCallback matchFunc,
         xmlInputCloseCallback closeFunc) {
     xmlSecIOCallbackPtr callbacks;
     int ret;
-    
+
     xmlSecAssert2(matchFunc != NULL, -1);
-    
+
     callbacks = xmlSecIOCallbackCreate(matchFunc, openFunc, readFunc, closeFunc);
     if(callbacks == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -233,7 +233,7 @@ xmlSecIORegisterCallbacks(xmlInputMatchCallback matchFunc,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecPtrListAdd(&xmlSecAllIOCallbacks, callbacks);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -258,7 +258,7 @@ xmlSecIORegisterCallbacks(xmlInputMatchCallback matchFunc,
 int
 xmlSecIORegisterDefaultCallbacks(void) {
     int ret;
-    
+
 #ifdef LIBXML_HTTP_ENABLED
     ret = xmlSecIORegisterCallbacks(xmlIOHTTPMatch, xmlIOHTTPOpen,
                               xmlIOHTTPRead, xmlIOHTTPClose);
@@ -301,13 +301,13 @@ xmlSecIORegisterDefaultCallbacks(void) {
 
 
 
-                                                                
+
 /**************************************************************
  *
  * Input URI Transform
  *
  * xmlSecInputURICtx is located after xmlSecTransform
- * 
+ *
  **************************************************************/
 typedef struct _xmlSecInputURICtx                               xmlSecInputURICtx,
                                                                 *xmlSecInputURICtxPtr;
@@ -324,7 +324,7 @@ struct _xmlSecInputURICtx {
 
 static int              xmlSecTransformInputURIInitialize       (xmlSecTransformPtr transform);
 static void             xmlSecTransformInputURIFinalize         (xmlSecTransformPtr transform);
-static int              xmlSecTransformInputURIPopBin           (xmlSecTransformPtr transform, 
+static int              xmlSecTransformInputURIPopBin           (xmlSecTransformPtr transform,
                                                                  xmlSecByte* data,
                                                                  xmlSecSize maxDataSize,
                                                                  xmlSecSize* dataSize,
@@ -352,7 +352,7 @@ static xmlSecTransformKlass xmlSecTransformInputURIKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     NULL,                                       /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
@@ -364,12 +364,12 @@ static xmlSecTransformKlass xmlSecTransformInputURIKlass = {
  *
  * Returns: input URI transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformInputURIGetKlass(void) {
     return(&xmlSecTransformInputURIKlass);
 }
 
-/** 
+/**
  * xmlSecTransformInputURIOpen:
  * @transform:          the pointer to IO transform.
  * @uri:                the URL to open.
@@ -381,7 +381,7 @@ xmlSecTransformInputURIGetKlass(void) {
 int
 xmlSecTransformInputURIOpen(xmlSecTransformPtr transform, const xmlChar *uri) {
     xmlSecInputURICtxPtr ctx;
-        
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformInputURIId), -1);
     xmlSecAssert2(uri != NULL, -1);
 
@@ -397,7 +397,7 @@ xmlSecTransformInputURIOpen(xmlSecTransformPtr transform, const xmlChar *uri) {
      */
     if(ctx->clbks == NULL) {
         char *unescaped;
-    
+
         unescaped = xmlURIUnescapeString((char*)uri, 0, NULL);
         if (unescaped != NULL) {
             ctx->clbks = xmlSecIOCallbackPtrListFind(&xmlSecAllIOCallbacks, unescaped);
@@ -424,12 +424,12 @@ xmlSecTransformInputURIOpen(xmlSecTransformPtr transform, const xmlChar *uri) {
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "opencallback",
                     XMLSEC_ERRORS_R_IO_FAILED,
-                    "uri=%s;errno=%d", 
+                    "uri=%s;errno=%d",
                     xmlSecErrorsSafeString(uri),
                     errno);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -441,7 +441,7 @@ xmlSecTransformInputURIInitialize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecTransformInputUriGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecInputURICtx));
     return(0);
 }
@@ -461,14 +461,14 @@ xmlSecTransformInputURIFinalize(xmlSecTransformPtr transform) {
     memset(ctx, 0, sizeof(xmlSecInputURICtx));
 }
 
-static int 
+static int
 xmlSecTransformInputURIPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
-                              xmlSecSize maxDataSize, xmlSecSize* dataSize, 
+                              xmlSecSize maxDataSize, xmlSecSize* dataSize,
                               xmlSecTransformCtxPtr transformCtx) {
     xmlSecInputURICtxPtr ctx;
 
     int ret;
-                            
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformInputURIId), -1);
     xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(dataSize != NULL, -1);
@@ -476,7 +476,7 @@ xmlSecTransformInputURIPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
 
     ctx = xmlSecTransformInputUriGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     if((ctx->clbksCtx != NULL) && (ctx->clbks != NULL) && (ctx->clbks->readcallback != NULL)) {
         ret = (ctx->clbks->readcallback)(ctx->clbksCtx, (char*)data, (int)maxDataSize);
         if(ret < 0) {
diff --git a/src/keyinfo.c b/src/keyinfo.c
index 3b76ec9..7b327d1 100644
--- a/src/keyinfo.c
+++ b/src/keyinfo.c
@@ -1,26 +1,26 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
- * <dsig:KeyInfo/> element processing 
+ * <dsig:KeyInfo/> element processing
  * (http://www.w3.org/TR/xmlSec-core/#sec-KeyInfo:
  *
  * The KeyInfo Element
  *
- * KeyInfo is an optional element that enables the recipient(s) to obtain 
- * the key needed to validate the signature.  KeyInfo may contain keys, 
- * names, certificates and other public key management information, such as 
- * in-band key distribution or key agreement data. 
- * 
+ * KeyInfo is an optional element that enables the recipient(s) to obtain
+ * the key needed to validate the signature.  KeyInfo may contain keys,
+ * names, certificates and other public key management information, such as
+ * in-band key distribution or key agreement data.
+ *
  *  Schema Definition:
  *
- *  <element name="KeyInfo" type="ds:KeyInfoType"/> 
+ *  <element name="KeyInfo" type="ds:KeyInfoType"/>
  *  <complexType name="KeyInfoType" mixed="true">
- *    <choice maxOccurs="unbounded"> 
- *       <element ref="ds:KeyName"/> 
- *       <element ref="ds:KeyValue"/> 
- *       <element ref="ds:RetrievalMethod"/> 
- *       <element ref="ds:X509Data"/> 
- *       <element ref="ds:PGPData"/> 
+ *    <choice maxOccurs="unbounded">
+ *       <element ref="ds:KeyName"/>
+ *       <element ref="ds:KeyValue"/>
+ *       <element ref="ds:RetrievalMethod"/>
+ *       <element ref="ds:X509Data"/>
+ *       <element ref="ds:PGPData"/>
  *       <element ref="ds:SPKIData"/>
  *       <element ref="ds:MgmtData"/>
  *       <any processContents="lax" namespace="##other"/>
@@ -28,24 +28,24 @@
  *    </choice>
  *    <attribute name="Id" type="ID" use="optional"/>
  *  </complexType>
- *    
+ *
  * DTD:
- *    
+ *
  * <!ELEMENT KeyInfo (#PCDATA|KeyName|KeyValue|RetrievalMethod|
- *                    X509Data|PGPData|SPKIData|MgmtData %KeyInfo.ANY;)* >      
+ *                    X509Data|PGPData|SPKIData|MgmtData %KeyInfo.ANY;)* >
  * <!ATTLIST KeyInfo  Id  ID   #IMPLIED >
- *  
+ *
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
 
 #include <stdlib.h>
 #include <string.h>
- 
+
 #include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
@@ -82,28 +82,28 @@ xmlSecKeyInfoNodeRead(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCtx
     xmlSecKeyDataId dataId;
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(keyInfoNode != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
     xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeRead, -1);
 
-    for(cur = xmlSecGetNextElementNode(keyInfoNode->children); 
-        (cur != NULL) && 
-        (((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND) != 0) || 
-         (xmlSecKeyIsValid(key) == 0) || 
+    for(cur = xmlSecGetNextElementNode(keyInfoNode->children);
+        (cur != NULL) &&
+        (((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND) != 0) ||
+         (xmlSecKeyIsValid(key) == 0) ||
          (xmlSecKeyMatch(key, NULL, &(keyInfoCtx->keyReq)) == 0));
         cur = xmlSecGetNextElementNode(cur->next)) {
-    
+
         /* find data id */
         nodeName = cur->name;
         nodeNs = xmlSecGetNodeNsHref(cur);
-        
+
         /* use global list only if we don't have a local one */
         if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
             dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
                             nodeName, nodeNs, xmlSecKeyDataUsageKeyInfoNodeRead);
-        } else {        
+        } else {
             dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
                             nodeName, nodeNs, xmlSecKeyDataUsageKeyInfoNodeRead);
         }
@@ -115,7 +115,7 @@ xmlSecKeyInfoNodeRead(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCtx
                             xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
                             "xmlSecKeyDataXmlRead",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                            "node=%s", 
+                            "node=%s",
                             xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
                 return(-1);
             }
@@ -130,8 +130,8 @@ xmlSecKeyInfoNodeRead(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCtx
             return(-1);
         }
     }
-    
-    return(0);    
+
+    return(0);
 }
 
 /**
@@ -144,23 +144,23 @@ xmlSecKeyInfoNodeRead(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCtx
  *
  * Returns: 0 on success or -1 if an error occurs.
  */
-int 
+int
 xmlSecKeyInfoNodeWrite(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     const xmlChar* nodeName;
     const xmlChar* nodeNs;
     xmlSecKeyDataId dataId;
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(keyInfoNode != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
     xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeWrite, -1);
 
-    for(cur = xmlSecGetNextElementNode(keyInfoNode->children); 
+    for(cur = xmlSecGetNextElementNode(keyInfoNode->children);
         cur != NULL;
         cur = xmlSecGetNextElementNode(cur->next)) {
-    
+
         /* find data id */
         nodeName = cur->name;
         nodeNs = xmlSecGetNodeNsHref(cur);
@@ -168,11 +168,11 @@ xmlSecKeyInfoNodeWrite(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCt
         /* use global list only if we don't have a local one */
         if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
                 dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
-                            nodeName, nodeNs, 
+                            nodeName, nodeNs,
                             xmlSecKeyDataUsageKeyInfoNodeWrite);
         } else {
                 dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
-                            nodeName, nodeNs, 
+                            nodeName, nodeNs,
                             xmlSecKeyDataUsageKeyInfoNodeWrite);
         }
         if(dataId != xmlSecKeyDataIdUnknown) {
@@ -182,7 +182,7 @@ xmlSecKeyInfoNodeWrite(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCt
                             xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
                             "xmlSecKeyDataXmlWrite",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                            "node=%s", 
+                            "node=%s",
                             xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
                 return(-1);
             }
@@ -196,9 +196,9 @@ xmlSecKeyInfoNodeWrite(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCt
             return(-1);
         }
     }
-    
+
     return(0);
-} 
+}
 
 /**************************************************************************
  *
@@ -210,16 +210,16 @@ xmlSecKeyInfoNodeWrite(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCt
  * @keysMngr:           the pointer to keys manager (may be NULL).
  *
  * Allocates and initializes <dsig:KeyInfo/> element processing context.
- * Caller is responsible for freeing it by calling #xmlSecKeyInfoCtxDestroy 
+ * Caller is responsible for freeing it by calling #xmlSecKeyInfoCtxDestroy
  * function.
  *
  * Returns: pointer to newly allocated object or NULL if an error occurs.
  */
-xmlSecKeyInfoCtxPtr 
+xmlSecKeyInfoCtxPtr
 xmlSecKeyInfoCtxCreate(xmlSecKeysMngrPtr keysMngr) {
     xmlSecKeyInfoCtxPtr keyInfoCtx;
     int ret;
-    
+
     /* Allocate a new xmlSecKeyInfoCtx and fill the fields. */
     keyInfoCtx = (xmlSecKeyInfoCtxPtr)xmlMalloc(sizeof(xmlSecKeyInfoCtx));
     if(keyInfoCtx == NULL) {
@@ -227,10 +227,10 @@ xmlSecKeyInfoCtxCreate(xmlSecKeysMngrPtr keysMngr) {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "size=%d", sizeof(xmlSecKeyInfoCtx)); 
+                    "size=%d", sizeof(xmlSecKeyInfoCtx));
         return(NULL);
     }
-    
+
     ret = xmlSecKeyInfoCtxInitialize(keyInfoCtx, keysMngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -241,43 +241,43 @@ xmlSecKeyInfoCtxCreate(xmlSecKeysMngrPtr keysMngr) {
         xmlSecKeyInfoCtxDestroy(keyInfoCtx);
         return(NULL);
     }
-    
+
     return(keyInfoCtx);
 }
 
-/** 
+/**
  * xmlSecKeyInfoCtxDestroy:
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
  *
  * Destroys @keyInfoCtx object created with #xmlSecKeyInfoCtxCreate function.
  */
-void 
+void
 xmlSecKeyInfoCtxDestroy(xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert(keyInfoCtx != NULL);
-    
+
     xmlSecKeyInfoCtxFinalize(keyInfoCtx);
     xmlFree(keyInfoCtx);
 }
 
-/** 
+/**
  * xmlSecKeyInfoCtxInitialize:
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
  * @keysMngr:           the pointer to keys manager (may be NULL).
  *
- * Initializes <dsig:KeyInfo/> element processing context. Caller is 
+ * Initializes <dsig:KeyInfo/> element processing context. Caller is
  * responsible for cleaning it up by #xmlSecKeyInfoCtxFinalize function.
- * 
+ *
  * Returns: 0 on success and a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyInfoCtxInitialize(xmlSecKeyInfoCtxPtr keyInfoCtx, xmlSecKeysMngrPtr keysMngr) {
     int ret;
-    
+
     xmlSecAssert2(keyInfoCtx != NULL, -1);
-    
+
     memset(keyInfoCtx, 0, sizeof(xmlSecKeyInfoCtx));
     keyInfoCtx->keysMngr = keysMngr;
-    keyInfoCtx->base64LineSize = xmlSecBase64GetDefaultLineSize();    
+    keyInfoCtx->base64LineSize = xmlSecBase64GetDefaultLineSize();
     ret = xmlSecPtrListInitialize(&(keyInfoCtx->enabledKeyData), xmlSecKeyDataIdListId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -316,21 +316,21 @@ xmlSecKeyInfoCtxInitialize(xmlSecKeyInfoCtxPtr keyInfoCtx, xmlSecKeysMngrPtr key
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyInfoCtxFinalize:
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
  *
  * Cleans up the @keyInfoCtx initialized with #xmlSecKeyInfoCtxInitialize
  * function.
  */
-void 
+void
 xmlSecKeyInfoCtxFinalize(xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert(keyInfoCtx != NULL);
-    
+
     xmlSecPtrListFinalize(&(keyInfoCtx->enabledKeyData));
     xmlSecTransformCtxFinalize(&(keyInfoCtx->retrievalMethodCtx));
     xmlSecKeyReqFinalize(&(keyInfoCtx->keyReq));
@@ -344,48 +344,48 @@ xmlSecKeyInfoCtxFinalize(xmlSecKeyInfoCtxPtr keyInfoCtx) {
     memset(keyInfoCtx, 0, sizeof(xmlSecKeyInfoCtx));
 }
 
-/** 
+/**
  * xmlSecKeyInfoCtxReset:
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
- * 
+ *
  * Resets the @keyInfoCtx state. User settings are not changed.
  */
-void 
+void
 xmlSecKeyInfoCtxReset(xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert(keyInfoCtx != NULL);
-    
+
     xmlSecTransformCtxReset(&(keyInfoCtx->retrievalMethodCtx));
     keyInfoCtx->curRetrievalMethodLevel = 0;
 
 #ifndef XMLSEC_NO_XMLENC
-    if(keyInfoCtx->encCtx != NULL) {       
+    if(keyInfoCtx->encCtx != NULL) {
         xmlSecEncCtxReset(keyInfoCtx->encCtx);
     }
     keyInfoCtx->curEncryptedKeyLevel = 0;
 #endif /* XMLSEC_NO_XMLENC */
-    
+
     xmlSecKeyReqReset(&(keyInfoCtx->keyReq));
 }
 
-/** 
+/**
  * xmlSecKeyInfoCtxCreateEncCtx:
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
- * 
+ *
  * Creates encryption context form processing <enc:EncryptedKey/> child
  * of <dsig:KeyInfo/> element.
- * 
+ *
  * Returns: 0 on success and a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyInfoCtxCreateEncCtx(xmlSecKeyInfoCtxPtr keyInfoCtx) {
 #ifndef XMLSEC_NO_XMLENC
     xmlSecEncCtxPtr tmp;
     int ret;
-    
+
     xmlSecAssert2(keyInfoCtx != NULL, -1);
     xmlSecAssert2(keyInfoCtx->encCtx == NULL, -1);
 
-    /* we have to use tmp variable to avoid a recursive loop */ 
+    /* we have to use tmp variable to avoid a recursive loop */
     tmp = xmlSecEncCtxCreate(keyInfoCtx->keysMngr);
     if(tmp == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -396,7 +396,7 @@ xmlSecKeyInfoCtxCreateEncCtx(xmlSecKeyInfoCtxPtr keyInfoCtx) {
         return(-1);
     }
     tmp->mode = xmlEncCtxModeEncryptedKey;
-        
+
     /* copy user preferences from our current ctx */
     switch(keyInfoCtx->mode) {
         case xmlSecKeyInfoModeRead:
@@ -409,7 +409,7 @@ xmlSecKeyInfoCtxCreateEncCtx(xmlSecKeyInfoCtxPtr keyInfoCtx) {
                             XMLSEC_ERRORS_NO_MESSAGE);
                 xmlSecEncCtxDestroy(tmp);
                 return(-1);
-            }    
+            }
             break;
         case xmlSecKeyInfoModeWrite:
             ret = xmlSecKeyInfoCtxCopyUserPref(&(tmp->keyInfoWriteCtx), keyInfoCtx);
@@ -423,36 +423,36 @@ xmlSecKeyInfoCtxCreateEncCtx(xmlSecKeyInfoCtxPtr keyInfoCtx) {
                 return(-1);
             }
             break;
-    }    
+    }
     keyInfoCtx->encCtx = tmp;
-        
+
     return(0);
-#else /* XMLSEC_NO_XMLENC */    
+#else /* XMLSEC_NO_XMLENC */
     xmlSecError(XMLSEC_ERRORS_HERE,
                 NULL,
                 "xml encryption",
                 XMLSEC_ERRORS_R_DISABLED,
                 XMLSEC_ERRORS_NO_MESSAGE);
     return(-1);
-#endif /* XMLSEC_NO_XMLENC */    
+#endif /* XMLSEC_NO_XMLENC */
 }
 
-/** 
+/**
  * xmlSecKeyInfoCtxCopyUserPref:
  * @dst:                the pointer to destination context object.
  * @src:                the pointer to source context object.
  *
  * Copies user preferences from @src context to @dst context.
- *  
+ *
  * Returns: 0 on success and a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyInfoCtxCopyUserPref(xmlSecKeyInfoCtxPtr dst, xmlSecKeyInfoCtxPtr src) {
     int ret;
-    
+
     xmlSecAssert2(dst != NULL, -1);
     xmlSecAssert2(src != NULL, -1);
-    
+
     dst->userData       = src->userData;
     dst->flags          = src->flags;
     dst->flags2         = src->flags2;
@@ -466,27 +466,27 @@ xmlSecKeyInfoCtxCopyUserPref(xmlSecKeyInfoCtxPtr dst, xmlSecKeyInfoCtxPtr src) {
                     NULL,
                     "xmlSecPtrListCopy",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "enabledKeyData");    
+                    "enabledKeyData");
         return(-1);
     }
-    
+
     /* <dsig:RetrievalMethod/> */
     dst->maxRetrievalMethodLevel= src->maxRetrievalMethodLevel;
-    ret = xmlSecTransformCtxCopyUserPref(&(dst->retrievalMethodCtx), 
+    ret = xmlSecTransformCtxCopyUserPref(&(dst->retrievalMethodCtx),
                                          &(src->retrievalMethodCtx));
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecTransformCtxCopyUserPref",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "enabledKeyData");    
+                    "enabledKeyData");
         return(-1);
     }
 
-    /* <enc:EncryptedContext /> */    
+    /* <enc:EncryptedContext /> */
 #ifndef XMLSEC_NO_XMLENC
     xmlSecAssert2(dst->encCtx == NULL, -1);
-    if(src->encCtx != NULL) {           
+    if(src->encCtx != NULL) {
         dst->encCtx = xmlSecEncCtxCreate(dst->keysMngr);
         if(dst->encCtx == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -496,7 +496,7 @@ xmlSecKeyInfoCtxCopyUserPref(xmlSecKeyInfoCtxPtr dst, xmlSecKeyInfoCtxPtr src) {
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-        
+
         dst->encCtx->mode = xmlEncCtxModeEncryptedKey;
         ret = xmlSecEncCtxCopyUserPref(dst->encCtx, src->encCtx);
         if(ret < 0) {
@@ -511,23 +511,23 @@ xmlSecKeyInfoCtxCopyUserPref(xmlSecKeyInfoCtxPtr dst, xmlSecKeyInfoCtxPtr src) {
     dst->maxEncryptedKeyLevel   = src->maxEncryptedKeyLevel;
 #endif /* XMLSEC_NO_XMLENC */
 
-    /* <dsig:X509Data /> */    
+    /* <dsig:X509Data /> */
 #ifndef XMLSEC_NO_X509
     dst->certsVerificationTime  = src->certsVerificationTime;
     dst->certsVerificationDepth = src->certsVerificationDepth;
 #endif /* XMLSEC_NO_X509 */
-    
+
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyInfoCtxDebugDump:
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
  * @output:             the output file pointer.
  *
  * Prints user settings and current context state to @output.
  */
-void 
+void
 xmlSecKeyInfoCtxDebugDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
     xmlSecAssert(keyInfoCtx != NULL);
     xmlSecAssert(output != NULL);
@@ -540,7 +540,7 @@ xmlSecKeyInfoCtxDebugDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
             fprintf(output, "= KEY INFO WRITE CONTEXT\n");
             break;
     }
-    
+
     fprintf(output, "== flags: 0x%08x\n", keyInfoCtx->flags);
     fprintf(output, "== flags2: 0x%08x\n", keyInfoCtx->flags2);
     if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
@@ -550,13 +550,13 @@ xmlSecKeyInfoCtxDebugDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
         fprintf(output, "== enabled key data: all\n");
     }
     fprintf(output, "== RetrievalMethod level (cur/max): %d/%d\n",
-            keyInfoCtx->curRetrievalMethodLevel, 
+            keyInfoCtx->curRetrievalMethodLevel,
             keyInfoCtx->maxRetrievalMethodLevel);
     xmlSecTransformCtxDebugDump(&(keyInfoCtx->retrievalMethodCtx), output);
-    
+
 #ifndef XMLSEC_NO_XMLENC
     fprintf(output, "== EncryptedKey level (cur/max): %d/%d\n",
-            keyInfoCtx->curEncryptedKeyLevel, 
+            keyInfoCtx->curEncryptedKeyLevel,
             keyInfoCtx->maxEncryptedKeyLevel);
     if(keyInfoCtx->encCtx != NULL) {
         xmlSecEncCtxDebugDump(keyInfoCtx->encCtx, output);
@@ -566,14 +566,14 @@ xmlSecKeyInfoCtxDebugDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
     xmlSecKeyReqDebugDump(&(keyInfoCtx->keyReq), output);
 }
 
-/** 
+/**
  * xmlSecKeyInfoCtxDebugXmlDump:
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
  * @output:             the output file pointer.
  *
- * Prints user settings and current context state in XML format to @output. 
+ * Prints user settings and current context state in XML format to @output.
  */
-void 
+void
 xmlSecKeyInfoCtxDebugXmlDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
     xmlSecAssert(keyInfoCtx != NULL);
     xmlSecAssert(output != NULL);
@@ -586,7 +586,7 @@ xmlSecKeyInfoCtxDebugXmlDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
             fprintf(output, "<KeyInfoWriteContext>\n");
             break;
     }
-            
+
     fprintf(output, "<Flags>%08x</Flags>\n", keyInfoCtx->flags);
     fprintf(output, "<Flags2>%08x</Flags2>\n", keyInfoCtx->flags2);
     if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
@@ -598,19 +598,19 @@ xmlSecKeyInfoCtxDebugXmlDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
     }
 
     fprintf(output, "<RetrievalMethodLevel cur=\"%d\" max=\"%d\" />\n",
-            keyInfoCtx->curRetrievalMethodLevel, 
+            keyInfoCtx->curRetrievalMethodLevel,
             keyInfoCtx->maxRetrievalMethodLevel);
     xmlSecTransformCtxDebugXmlDump(&(keyInfoCtx->retrievalMethodCtx), output);
 
 #ifndef XMLSEC_NO_XMLENC
     fprintf(output, "<EncryptedKeyLevel cur=\"%d\" max=\"%d\" />\n",
-            keyInfoCtx->curEncryptedKeyLevel, 
+            keyInfoCtx->curEncryptedKeyLevel,
             keyInfoCtx->maxEncryptedKeyLevel);
     if(keyInfoCtx->encCtx != NULL) {
         xmlSecEncCtxDebugXmlDump(keyInfoCtx->encCtx, output);
     }
 #endif /* XMLSEC_NO_XMLENC */
-    
+
     xmlSecKeyReqDebugXmlDump(&(keyInfoCtx->keyReq), output);
     switch(keyInfoCtx->mode) {
         case xmlSecKeyInfoModeRead:
@@ -646,17 +646,17 @@ static xmlSecKeyDataKlass xmlSecKeyDataNameKlass = {
     NULL,                                       /* const xmlChar* href; */
     xmlSecNodeKeyName,                          /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     NULL,                                       /* xmlSecKeyDataInitializeMethod initialize; */
     NULL,                                       /* xmlSecKeyDataDuplicateMethod duplicate; */
     NULL,                                       /* xmlSecKeyDataFinalizeMethod finalize; */
     NULL,                                       /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     NULL,                                       /* xmlSecKeyDataGetTypeMethod getType; */
     NULL,                                       /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecKeyDataNameXmlRead,                   /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -673,28 +673,28 @@ static xmlSecKeyDataKlass xmlSecKeyDataNameKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecKeyDataNameGetKlass:
  *
- * The <dsig:KeyName/> element key data klass 
+ * The <dsig:KeyName/> element key data klass
  * (http://www.w3.org/TR/xmldsig-core/#sec-KeyName):
  *
- * The KeyName element contains a string value (in which white space is 
- * significant) which may be used by the signer to communicate a key 
- * identifier to the recipient. Typically, KeyName contains an identifier 
- * related to the key pair used to sign the message, but it may contain 
- * other protocol-related information that indirectly identifies a key pair. 
- * (Common uses of KeyName include simple string names for keys, a key index, 
- * a distinguished name (DN), an email address, etc.) 
+ * The KeyName element contains a string value (in which white space is
+ * significant) which may be used by the signer to communicate a key
+ * identifier to the recipient. Typically, KeyName contains an identifier
+ * related to the key pair used to sign the message, but it may contain
+ * other protocol-related information that indirectly identifies a key pair.
+ * (Common uses of KeyName include simple string names for keys, a key index,
+ * a distinguished name (DN), an email address, etc.)
  *
  * Returns: the <dsig:KeyName/> element processing key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataNameGetKlass(void) {
     return(&xmlSecKeyDataNameKlass);
 }
 
-static int 
+static int
 xmlSecKeyDataNameXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     const xmlChar* oldName;
     xmlChar* newName;
@@ -717,7 +717,7 @@ xmlSecKeyDataNameXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
         return(-1);
     }
     /* TODO: do we need to decode the name? */
-    
+
     /* compare name values */
     if((oldName != NULL) && !xmlStrEqual(oldName, newName)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -740,9 +740,9 @@ xmlSecKeyDataNameXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
 
             /* TODO: since we will destroy tmpKey anyway, we can easily
              * just re-assign key data values. It'll save use some memory
-             * malloc/free 
+             * malloc/free
              */
-             
+
             /* and copy what we've found */
             ret = xmlSecKeyCopy(key, tmpKey);
             if(ret < 0) {
@@ -750,15 +750,15 @@ xmlSecKeyDataNameXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
                             xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                             "xmlSecKeyCopy",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                            XMLSEC_ERRORS_NO_MESSAGE); 
+                            XMLSEC_ERRORS_NO_MESSAGE);
                 xmlSecKeyDestroy(tmpKey);
                 xmlFree(newName);
                 return(-1);
             }
             xmlSecKeyDestroy(tmpKey);
         }
-    }           
-    
+    }
+
     /* finally set key name if it is not there */
     if(xmlSecKeyGetName(key) == NULL) {
         xmlSecKeySetName(key, newName);
@@ -767,7 +767,7 @@ xmlSecKeyDataNameXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
     return(0);
 }
 
-static int 
+static int
 xmlSecKeyDataNameXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     const xmlChar* name;
 
@@ -808,17 +808,17 @@ static xmlSecKeyDataKlass xmlSecKeyDataValueKlass = {
     NULL,                                       /* const xmlChar* href; */
     xmlSecNodeKeyValue,                         /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     NULL,                                       /* xmlSecKeyDataInitializeMethod initialize; */
     NULL,                                       /* xmlSecKeyDataDuplicateMethod duplicate; */
     NULL,                                       /* xmlSecKeyDataFinalizeMethod finalize; */
     NULL,                                       /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     NULL,                                       /* xmlSecKeyDataGetTypeMethod getType; */
     NULL,                                       /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecKeyDataValueXmlRead,                  /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -835,23 +835,23 @@ static xmlSecKeyDataKlass xmlSecKeyDataValueKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecKeyDataValueGetKlass:
  *
- * The <dsig:KeyValue/> element key data klass 
+ * The <dsig:KeyValue/> element key data klass
  * (http://www.w3.org/TR/xmldsig-core/#sec-KeyValue):
  *
- * The KeyValue element contains a single public key that may be useful in 
- * validating the signature. 
- * 
+ * The KeyValue element contains a single public key that may be useful in
+ * validating the signature.
+ *
  * Returns: the <dsig:KeyValue/> element processing key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataValueGetKlass(void) {
     return(&xmlSecKeyDataValueKlass);
 }
 
-static int 
+static int
 xmlSecKeyDataValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     const xmlChar* nodeName;
     const xmlChar* nodeNs;
@@ -879,7 +879,7 @@ xmlSecKeyDataValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
     if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
         dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
                             nodeName, nodeNs, xmlSecKeyDataUsageKeyValueNodeRead);
-    } else {    
+    } else {
         dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
                             nodeName, nodeNs, xmlSecKeyDataUsageKeyValueNodeRead);
     }
@@ -902,11 +902,11 @@ xmlSecKeyDataValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     /* <dsig:KeyValue/> might have only one node */
-    cur = xmlSecGetNextElementNode(cur->next);  
+    cur = xmlSecGetNextElementNode(cur->next);
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
@@ -915,29 +915,29 @@ xmlSecKeyDataValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecKeyDataValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     const xmlChar* nodeName;
-    const xmlChar* nodeNs;  
+    const xmlChar* nodeNs;
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecKeyDataValueId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
     xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeWrite, -1);
 
-    if(!xmlSecKeyDataIsValid(key->value) || 
+    if(!xmlSecKeyDataIsValid(key->value) ||
        !xmlSecKeyDataCheckUsage(key->value, xmlSecKeyDataUsageKeyValueNodeWrite)){
         /* nothing to write */
         return(0);
     }
-    if((xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) && 
+    if((xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) &&
         (xmlSecKeyDataIdListFind(&(keyInfoCtx->enabledKeyData), id) != 1)) {
 
         /* we are not enabled to write out key data with this id */
@@ -951,10 +951,10 @@ xmlSecKeyDataValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node
     nodeName = key->value->id->dataNodeName;
     nodeNs = key->value->id->dataNodeNs;
     xmlSecAssert2(nodeName != NULL, -1);
-    
+
     /* remove all existing key value */
     xmlNodeSetContent(node, NULL);
-    
+
     /* create key node */
     cur = xmlSecAddChild(node, nodeName, nodeNs);
     if(cur == NULL) {
@@ -964,7 +964,7 @@ xmlSecKeyDataValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
-        return(-1);     
+        return(-1);
     }
 
     ret = xmlSecKeyDataXmlWrite(key->value->id, key, cur, keyInfoCtx);
@@ -975,7 +975,7 @@ xmlSecKeyDataValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
-        return(-1);     
+        return(-1);
     }
 
     return(0);
@@ -1007,17 +1007,17 @@ static xmlSecKeyDataKlass xmlSecKeyDataRetrievalMethodKlass = {
     NULL,                                       /* const xmlChar* href; */
     xmlSecNodeRetrievalMethod,                  /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     NULL,                                       /* xmlSecKeyDataInitializeMethod initialize; */
     NULL,                                       /* xmlSecKeyDataDuplicateMethod duplicate; */
     NULL,                                       /* xmlSecKeyDataFinalizeMethod finalize; */
     NULL,                                       /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     NULL,                                       /* xmlSecKeyDataGetTypeMethod getType; */
     NULL,                                       /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecKeyDataRetrievalMethodXmlRead,        /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -1040,30 +1040,30 @@ static int                      xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSec
                                                                  xmlSecSize bufferSize,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
 
-/** 
+/**
  * xmlSecKeyDataRetrievalMethodGetKlass:
  *
- * The <dsig:RetrievalMethod/> element key data klass 
+ * The <dsig:RetrievalMethod/> element key data klass
  * (http://www.w3.org/TR/xmldsig-core/#sec-RetrievalMethod):
- * A RetrievalMethod element within KeyInfo is used to convey a reference to 
- * KeyInfo information that is stored at another location. For example, 
- * several signatures in a document might use a key verified by an X.509v3 
- * certificate chain appearing once in the document or remotely outside the 
- * document; each signature's KeyInfo can reference this chain using a single 
- * RetrievalMethod element instead of including the entire chain with a 
+ * A RetrievalMethod element within KeyInfo is used to convey a reference to
+ * KeyInfo information that is stored at another location. For example,
+ * several signatures in a document might use a key verified by an X.509v3
+ * certificate chain appearing once in the document or remotely outside the
+ * document; each signature's KeyInfo can reference this chain using a single
+ * RetrievalMethod element instead of including the entire chain with a
  * sequence of X509Certificate elements.
  *
- * RetrievalMethod uses the same syntax and dereferencing behavior as 
+ * RetrievalMethod uses the same syntax and dereferencing behavior as
  * Reference's URI and The Reference Processing Model.
- * 
+ *
  * Returns: the <dsig:RetrievalMethod/> element processing key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataRetrievalMethodGetKlass(void) {
     return(&xmlSecKeyDataRetrievalMethodKlass);
 }
 
-static int 
+static int
 xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataId dataId = xmlSecKeyDataIdUnknown;
     xmlChar *retrType = NULL;
@@ -1071,7 +1071,7 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
     xmlNodePtr cur;
     int res = -1;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecKeyDataRetrievalMethodId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -1085,7 +1085,7 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     NULL,
                     XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL,
-                    "cur=%d;max=%d", 
+                    "cur=%d;max=%d",
                     keyInfoCtx->curRetrievalMethodLevel,
                     keyInfoCtx->maxRetrievalMethodLevel);
         goto done;
@@ -1098,7 +1098,7 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
         if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
             dataId = xmlSecKeyDataIdListFindByHref(&(keyInfoCtx->enabledKeyData),
                             retrType, xmlSecKeyDataUsageRetrievalMethodNode);
-        } else {        
+        } else {
             dataId = xmlSecKeyDataIdListFindByHref(xmlSecKeyDataIdsGet(),
                             retrType, xmlSecKeyDataUsageRetrievalMethodNode);
         }
@@ -1137,7 +1137,7 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
     /* the only one node is optional Transforms node */
     cur = xmlSecGetNextElementNode(node->children);
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeTransforms, xmlSecDSigNs))) {
-        ret = xmlSecTransformCtxNodesListRead(&(keyInfoCtx->retrievalMethodCtx), 
+        ret = xmlSecTransformCtxNodesListRead(&(keyInfoCtx->retrievalMethodCtx),
                                             cur, xmlSecTransformUsageDSigTransform);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1147,7 +1147,7 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
             goto done;
-        }       
+        }
         cur = xmlSecGetNextElementNode(cur->next);
     }
 
@@ -1162,7 +1162,7 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
 
     /* finally get transforms results */
     ret = xmlSecTransformCtxExecute(&(keyInfoCtx->retrievalMethodCtx), node->doc);
-    if((ret < 0) || 
+    if((ret < 0) ||
        (keyInfoCtx->retrievalMethodCtx.result == NULL) ||
        (xmlSecBufferGetData(keyInfoCtx->retrievalMethodCtx.result) == NULL)) {
 
@@ -1175,8 +1175,8 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
     }
 
 
-    /* assume that the data is in XML if we could not find id */    
-    if((dataId == xmlSecKeyDataIdUnknown) || 
+    /* assume that the data is in XML if we could not find id */
+    if((dataId == xmlSecKeyDataIdUnknown) ||
        ((dataId->usage & xmlSecKeyDataUsageRetrievalMethodNodeXml) != 0)) {
 
         ret = xmlSecKeyDataRetrievalMethodReadXmlResult(dataId, key,
@@ -1190,9 +1190,9 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             goto done;
-        }    
+        }
     } else {
-        ret = xmlSecKeyDataBinRead(dataId, key, 
+        ret = xmlSecKeyDataBinRead(dataId, key,
                     xmlSecBufferGetData(keyInfoCtx->retrievalMethodCtx.result),
                     xmlSecBufferGetSize(keyInfoCtx->retrievalMethodCtx.result),
                     keyInfoCtx);
@@ -1203,11 +1203,11 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             goto done;
-        }    
+        }
     }
     --keyInfoCtx->curRetrievalMethodLevel;
-    
-    res = 0;    
+
+    res = 0;
 done:
     if(uri != NULL) {
         xmlFree(uri);
@@ -1218,7 +1218,7 @@ done:
     return(res);
 }
 
-static int 
+static int
 xmlSecKeyDataRetrievalMethodXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(id == xmlSecKeyDataRetrievalMethodId, -1);
     xmlSecAssert2(key != NULL, -1);
@@ -1240,10 +1240,10 @@ xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr k
     const xmlChar* nodeNs;
     xmlSecKeyDataId dataId;
     int ret;
-    
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(buffer != NULL, -1);
-    xmlSecAssert2(bufferSize > 0, -1); 
+    xmlSecAssert2(bufferSize > 0, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
     xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeRead, -1);
 
@@ -1256,7 +1256,7 @@ xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr k
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     cur = xmlDocGetRootElement(doc);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1265,7 +1265,7 @@ xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr k
                     XMLSEC_ERRORS_R_XML_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFreeDoc(doc);
-        return(-1);     
+        return(-1);
     }
 
     nodeName = cur->name;
@@ -1275,7 +1275,7 @@ xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr k
     if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
         dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
                             nodeName, nodeNs, xmlSecKeyDataUsageRetrievalMethodNodeXml);
-    } else {    
+    } else {
         dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
                             nodeName, nodeNs, xmlSecKeyDataUsageRetrievalMethodNodeXml);
     }
@@ -1294,10 +1294,10 @@ xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr k
         return(0);
     } else if((typeId != xmlSecKeyDataIdUnknown) && (typeId != dataId) &&
               ((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF) != 0)) {
-        
+
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
-                    xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),              
+                    xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
                     XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFreeDoc(doc);
@@ -1316,7 +1316,7 @@ xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr k
         xmlFreeDoc(doc);
         return(-1);
     }
-    
+
     xmlFreeDoc(doc);
     return(0);
 }
@@ -1345,22 +1345,22 @@ static xmlSecKeyDataKlass xmlSecKeyDataEncryptedKeyKlass = {
 
     /* data */
     xmlSecNameEncryptedKey,
-    xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,           
+    xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefEncryptedKey,                     /* const xmlChar* href; */
     xmlSecNodeEncryptedKey,                     /* const xmlChar* dataNodeName; */
     xmlSecEncNs,                                /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     NULL,                                       /* xmlSecKeyDataInitializeMethod initialize; */
     NULL,                                       /* xmlSecKeyDataDuplicateMethod duplicate; */
     NULL,                                       /* xmlSecKeyDataFinalizeMethod finalize; */
     NULL,                                       /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     NULL,                                       /* xmlSecKeyDataGetTypeMethod getType; */
     NULL,                                       /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecKeyDataEncryptedKeyXmlRead,           /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -1377,28 +1377,28 @@ static xmlSecKeyDataKlass xmlSecKeyDataEncryptedKeyKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecKeyDataEncryptedKeyGetKlass:
  *
- * The <enc:EncryptedKey/> element key data klass 
+ * The <enc:EncryptedKey/> element key data klass
  * (http://www.w3.org/TR/xmlenc-core/#sec-EncryptedKey):
  *
- * The EncryptedKey element is used to transport encryption keys from 
- * the originator to a known recipient(s). It may be used as a stand-alone 
- * XML document, be placed within an application document, or appear inside 
- * an EncryptedData element as a child of a ds:KeyInfo element. The key value 
- * is always encrypted to the recipient(s). When EncryptedKey is decrypted the 
- * resulting octets are made available to the EncryptionMethod algorithm 
+ * The EncryptedKey element is used to transport encryption keys from
+ * the originator to a known recipient(s). It may be used as a stand-alone
+ * XML document, be placed within an application document, or appear inside
+ * an EncryptedData element as a child of a ds:KeyInfo element. The key value
+ * is always encrypted to the recipient(s). When EncryptedKey is decrypted the
+ * resulting octets are made available to the EncryptionMethod algorithm
  * without any additional processing.
- * 
+ *
  * Returns: the <enc:EncryptedKey/> element processing key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecKeyDataEncryptedKeyGetKlass(void) {
     return(&xmlSecKeyDataEncryptedKeyKlass);
 }
 
-static int 
+static int
 xmlSecKeyDataEncryptedKeyXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecBufferPtr result;
     int ret;
@@ -1409,20 +1409,20 @@ xmlSecKeyDataEncryptedKeyXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePt
     xmlSecAssert2(keyInfoCtx != NULL, -1);
     xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeRead, -1);
 
-    /* check the enc level */    
+    /* check the enc level */
     if(keyInfoCtx->curEncryptedKeyLevel >= keyInfoCtx->maxEncryptedKeyLevel) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     NULL,
                     XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL,
-                    "cur=%d;max=%d", 
+                    "cur=%d;max=%d",
                     keyInfoCtx->curEncryptedKeyLevel,
                     keyInfoCtx->maxEncryptedKeyLevel);
         return(-1);
     }
     ++keyInfoCtx->curEncryptedKeyLevel;
 
-    /* init Enc context */    
+    /* init Enc context */
     if(keyInfoCtx->encCtx != NULL) {
         xmlSecEncCtxReset(keyInfoCtx->encCtx);
     } else {
@@ -1433,14 +1433,14 @@ xmlSecKeyDataEncryptedKeyXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePt
                         "xmlSecKeyInfoCtxCreateEncCtx",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1);         
+            return(-1);
         }
     }
     xmlSecAssert2(keyInfoCtx->encCtx != NULL, -1);
-    
+
     result = xmlSecEncCtxDecryptToBuffer(keyInfoCtx->encCtx, node);
     if((result == NULL) || (xmlSecBufferGetData(result) == NULL)) {
-        /* We might have multiple EncryptedKey elements, encrypted 
+        /* We might have multiple EncryptedKey elements, encrypted
          * for different receipints but application can enforce
          * correct enc key.
          */
@@ -1454,7 +1454,7 @@ xmlSecKeyDataEncryptedKeyXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePt
         }
         return(0);
     }
-         
+
     ret = xmlSecKeyDataBinRead(keyInfoCtx->keyReq.keyId, key,
                            xmlSecBufferGetData(result),
                            xmlSecBufferGetSize(result),
@@ -1466,13 +1466,13 @@ xmlSecKeyDataEncryptedKeyXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePt
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }                      
+    }
     --keyInfoCtx->curEncryptedKeyLevel;
 
     return(0);
 }
 
-static int 
+static int
 xmlSecKeyDataEncryptedKeyXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyInfoCtx keyInfoCtx2;
     xmlSecByte *keyBuf = NULL;
@@ -1486,7 +1486,7 @@ xmlSecKeyDataEncryptedKeyXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodeP
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
     xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeWrite, -1);
-    
+
     /* dump key to a binary buffer */
     ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx2, NULL);
     if(ret < 0) {
@@ -1497,7 +1497,7 @@ xmlSecKeyDataEncryptedKeyXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodeP
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
     }
-    
+
     ret = xmlSecKeyInfoCtxCopyUserPref(&keyInfoCtx2, keyInfoCtx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1521,8 +1521,8 @@ xmlSecKeyDataEncryptedKeyXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodeP
         goto done;
     }
     xmlSecKeyInfoCtxFinalize(&keyInfoCtx2);
-    
-    /* init Enc context */    
+
+    /* init Enc context */
     if(keyInfoCtx->encCtx != NULL) {
         xmlSecEncCtxReset(keyInfoCtx->encCtx);
     } else {
@@ -1533,7 +1533,7 @@ xmlSecKeyDataEncryptedKeyXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodeP
                         "xmlSecKeyInfoCtxCreateEncCtx",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            goto done;  
+            goto done;
         }
     }
     xmlSecAssert2(keyInfoCtx->encCtx != NULL, -1);
@@ -1545,9 +1545,9 @@ xmlSecKeyDataEncryptedKeyXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodeP
                     "xmlSecEncCtxBinaryEncrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        goto done;      
+        goto done;
     }
-    
+
     res = 0;
 done:
     if(keyBuf != NULL) {
diff --git a/src/keys.c b/src/keys.c
index 4acd5d9..1d2f733 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -1,18 +1,18 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Keys.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
 
 #include <stdlib.h>
 #include <string.h>
- 
+
 #include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
@@ -29,15 +29,15 @@
  * xmlSecKeyUseWith
  *
  *************************************************************************/
-/** 
+/**
  * xmlSecKeyUseWithInitialize:
  * @keyUseWith:         the pointer to information about key application/user.
- * 
+ *
  * Initializes @keyUseWith object.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyUseWithInitialize(xmlSecKeyUseWithPtr keyUseWith) {
     xmlSecAssert2(keyUseWith != NULL, -1);
 
@@ -45,34 +45,34 @@ xmlSecKeyUseWithInitialize(xmlSecKeyUseWithPtr keyUseWith) {
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyUseWithFinalize:
  * @keyUseWith:         the pointer to information about key application/user.
  *
  * Finalizes @keyUseWith object.
  */
-void 
+void
 xmlSecKeyUseWithFinalize(xmlSecKeyUseWithPtr keyUseWith) {
     xmlSecAssert(keyUseWith != NULL);
-    
+
     xmlSecKeyUseWithReset(keyUseWith);
     memset(keyUseWith, 0, sizeof(xmlSecKeyUseWith));
 }
 
-/** 
+/**
  * xmlSecKeyUseWithReset:
  * @keyUseWith:         the pointer to information about key application/user.
- * 
+ *
  * Resets the @keyUseWith to its state after initialization.
  */
-void 
+void
 xmlSecKeyUseWithReset(xmlSecKeyUseWithPtr keyUseWith) {
     xmlSecAssert(keyUseWith != NULL);
 
     xmlSecKeyUseWithSet(keyUseWith, NULL, NULL);
 }
 
-/** 
+/**
  * xmlSecKeyUseWithCopy:
  * @dst:         the pointer to destination object.
  * @src:         the pointer to source object.
@@ -81,15 +81,15 @@ xmlSecKeyUseWithReset(xmlSecKeyUseWithPtr keyUseWith) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyUseWithCopy(xmlSecKeyUseWithPtr dst, xmlSecKeyUseWithPtr src) {
     xmlSecAssert2(dst != NULL, -1);
     xmlSecAssert2(src != NULL, -1);
-    
+
     return(xmlSecKeyUseWithSet(dst, src->application, src->identifier));
 }
 
-/** 
+/**
  * xmlSecKeyUseWithCreate:
  * @application:        the application value.
  * @identifier:         the identifier value.
@@ -99,7 +99,7 @@ xmlSecKeyUseWithCopy(xmlSecKeyUseWithPtr dst, xmlSecKeyUseWithPtr src) {
  *
  * Returns: pointer to newly created object or NULL if an error occurs.
  */
-xmlSecKeyUseWithPtr 
+xmlSecKeyUseWithPtr
 xmlSecKeyUseWithCreate(const xmlChar* application, const xmlChar* identifier) {
     xmlSecKeyUseWithPtr keyUseWith;
     int ret;
@@ -111,11 +111,11 @@ xmlSecKeyUseWithCreate(const xmlChar* application, const xmlChar* identifier) {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecKeyUseWith)=%d", 
+                    "sizeof(xmlSecKeyUseWith)=%d",
                     sizeof(xmlSecKeyUseWith));
         return(NULL);
     }
-    memset(keyUseWith, 0, sizeof(xmlSecKeyUseWith));    
+    memset(keyUseWith, 0, sizeof(xmlSecKeyUseWith));
 
     ret = xmlSecKeyUseWithInitialize(keyUseWith);
     if(ret < 0) {
@@ -125,7 +125,7 @@ xmlSecKeyUseWithCreate(const xmlChar* application, const xmlChar* identifier) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyUseWithDestroy(keyUseWith);
-        return(NULL);        
+        return(NULL);
     }
 
     ret = xmlSecKeyUseWithSet(keyUseWith, application, identifier);
@@ -136,13 +136,13 @@ xmlSecKeyUseWithCreate(const xmlChar* application, const xmlChar* identifier) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyUseWithDestroy(keyUseWith);
-        return(NULL);        
+        return(NULL);
     }
 
     return(keyUseWith);
 }
 
-/** 
+/**
  * xmlSecKeyUseWithDuplicate:
  * @keyUseWith:         the pointer to information about key application/user.
  *
@@ -151,7 +151,7 @@ xmlSecKeyUseWithCreate(const xmlChar* application, const xmlChar* identifier) {
  *
  * Returns: pointer to newly created object or NULL if an error occurs.
  */
-xmlSecKeyUseWithPtr 
+xmlSecKeyUseWithPtr
 xmlSecKeyUseWithDuplicate(xmlSecKeyUseWithPtr keyUseWith) {
     int ret;
 
@@ -166,7 +166,7 @@ xmlSecKeyUseWithDuplicate(xmlSecKeyUseWithPtr keyUseWith) {
                     "xmlSecKeyUseWithCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);        
+        return(NULL);
     }
 
     ret = xmlSecKeyUseWithCopy(newKeyUseWith, keyUseWith);
@@ -177,20 +177,20 @@ xmlSecKeyUseWithDuplicate(xmlSecKeyUseWithPtr keyUseWith) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyUseWithDestroy(keyUseWith);
-        return(NULL);        
+        return(NULL);
     }
 
     return(newKeyUseWith);
 }
 
-/** 
+/**
  * xmlSecKeyUseWithDestroy:
  * @keyUseWith:         the pointer to information about key application/user.
  *
  * Destroys @keyUseWith created with @xmlSecKeyUseWithCreate or @xmlSecKeyUseWithDuplicate
  * functions.
  */
-void 
+void
 xmlSecKeyUseWithDestroy(xmlSecKeyUseWithPtr keyUseWith) {
     xmlSecAssert(keyUseWith != NULL);
 
@@ -198,29 +198,29 @@ xmlSecKeyUseWithDestroy(xmlSecKeyUseWithPtr keyUseWith) {
     xmlFree(keyUseWith);
 }
 
-/** 
+/**
  * xmlSecKeyUseWithSet:
  * @keyUseWith:         the pointer to information about key application/user.
  * @application:        the new application value.
  * @identifier:         the new identifier value.
- * 
+ *
  * Sets @application and @identifier in the @keyUseWith.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyUseWithSet(xmlSecKeyUseWithPtr keyUseWith, const xmlChar* application, const xmlChar* identifier) {
     xmlSecAssert2(keyUseWith != NULL, -1);
-    
+
     if(keyUseWith->application != NULL) {
-        xmlFree(keyUseWith->application); 
+        xmlFree(keyUseWith->application);
         keyUseWith->application = NULL;
     }
     if(keyUseWith->identifier != NULL) {
-        xmlFree(keyUseWith->identifier); 
+        xmlFree(keyUseWith->identifier);
         keyUseWith->identifier = NULL;
     }
-    
+
     if(application != NULL) {
         keyUseWith->application = xmlStrdup(application);
         if(keyUseWith->application == NULL) {
@@ -228,7 +228,7 @@ xmlSecKeyUseWithSet(xmlSecKeyUseWithPtr keyUseWith, const xmlChar* application,
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_MALLOC_FAILED,
-                        "xmlStrlen(application)=%d", 
+                        "xmlStrlen(application)=%d",
                         xmlStrlen(application));
             return(-1);
         }
@@ -240,40 +240,40 @@ xmlSecKeyUseWithSet(xmlSecKeyUseWithPtr keyUseWith, const xmlChar* application,
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_MALLOC_FAILED,
-                        "xmlStrlen(identifier)=%d", 
+                        "xmlStrlen(identifier)=%d",
                         xmlStrlen(identifier));
             return(-1);
         }
     }
-    
+
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyUseWithDebugDump:
  * @keyUseWith:         the pointer to information about key application/user.
  * @output:             the pointer to output FILE.
  *
  * Prints xmlSecKeyUseWith debug information to a file @output.
  */
-void 
+void
 xmlSecKeyUseWithDebugDump(xmlSecKeyUseWithPtr keyUseWith, FILE* output) {
     xmlSecAssert(keyUseWith != NULL);
     xmlSecAssert(output != NULL);
 
-    fprintf(output, "=== KeyUseWith: application=\"%s\",identifier=\"%s\"\n", 
+    fprintf(output, "=== KeyUseWith: application=\"%s\",identifier=\"%s\"\n",
                 (keyUseWith->application) ? keyUseWith->application : BAD_CAST "",
-                (keyUseWith->identifier) ? keyUseWith->identifier : BAD_CAST "");    
+                (keyUseWith->identifier) ? keyUseWith->identifier : BAD_CAST "");
 }
 
-/** 
+/**
  * xmlSecKeyUseWithDebugXmlDump:
  * @keyUseWith:         the pointer to information about key application/user.
  * @output:             the pointer to output FILE.
  *
  * Prints xmlSecKeyUseWith debug information to a file @output in XML format.
  */
-void 
+void
 xmlSecKeyUseWithDebugXmlDump(xmlSecKeyUseWithPtr keyUseWith, FILE* output) {
     xmlSecAssert(keyUseWith != NULL);
     xmlSecAssert(output != NULL);
@@ -287,7 +287,7 @@ xmlSecKeyUseWithDebugXmlDump(xmlSecKeyUseWithPtr keyUseWith, FILE* output) {
     fprintf(output, "<Identifier>");
     xmlSecPrintXmlString(output, keyUseWith->identifier);
     fprintf(output, "</Identifier>");
-    
+
     fprintf(output, "</KeyUseWith>\n");
 }
 
@@ -306,12 +306,12 @@ static xmlSecPtrListKlass xmlSecKeyUseWithPtrListKlass = {
 
 /**
  * xmlSecKeyUseWithPtrListGetKlass:
- * 
+ *
  * The key data list klass.
  *
  * Returns: pointer to the key data list klass.
  */
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecKeyUseWithPtrListGetKlass(void) {
     return(&xmlSecKeyUseWithPtrListKlass);
 }
@@ -321,7 +321,7 @@ xmlSecKeyUseWithPtrListGetKlass(void) {
  * xmlSecKeyReq - what key are we looking for?
  *
  *************************************************************************/
-/** 
+/**
  * xmlSecKeyReqInitialize:
  * @keyReq:             the pointer to key requirements object.
  *
@@ -330,16 +330,16 @@ xmlSecKeyUseWithPtrListGetKlass(void) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyReqInitialize(xmlSecKeyReqPtr keyReq) {
     int ret;
-    
+
     xmlSecAssert2(keyReq != NULL, -1);
-    
+
     memset(keyReq, 0, sizeof(xmlSecKeyReq));
-    
+
     keyReq->keyUsage    = xmlSecKeyUsageAny;    /* by default you can do whatever you want with the key */
-    ret = xmlSecPtrListInitialize(&keyReq->keyUseWithList, xmlSecKeyUseWithPtrListId);    
+    ret = xmlSecPtrListInitialize(&keyReq->keyUseWithList, xmlSecKeyUseWithPtrListId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -349,7 +349,7 @@ xmlSecKeyReqInitialize(xmlSecKeyReqPtr keyReq) {
         return(-1);
     }
 
-    
+
     return(0);
 }
 
@@ -364,17 +364,17 @@ void
 xmlSecKeyReqFinalize(xmlSecKeyReqPtr keyReq) {
     xmlSecAssert(keyReq != NULL);
 
-    xmlSecPtrListFinalize(&keyReq->keyUseWithList);    
+    xmlSecPtrListFinalize(&keyReq->keyUseWithList);
     memset(keyReq, 0, sizeof(xmlSecKeyReq));
 }
 
-/** 
+/**
  * xmlSecKeyReqReset:
  * @keyReq:             the pointer to key requirements object.
  *
  * Resets key requirements object for new key search.
  */
-void 
+void
 xmlSecKeyReqReset(xmlSecKeyReqPtr keyReq) {
     xmlSecAssert(keyReq != NULL);
 
@@ -391,13 +391,13 @@ xmlSecKeyReqReset(xmlSecKeyReqPtr keyReq) {
  * @src:                the pointer to source object.
  *
  * Copies key requirements from @src object to @dst object.
- * 
+ *
  * Returns: 0 on success and a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyReqCopy(xmlSecKeyReqPtr dst, xmlSecKeyReqPtr src) {
     int ret;
-    
+
     xmlSecAssert2(dst != NULL, -1);
     xmlSecAssert2(src != NULL, -1);
 
@@ -429,7 +429,7 @@ xmlSecKeyReqCopy(xmlSecKeyReqPtr dst, xmlSecKeyReqPtr src) {
  * Returns: 1 if key matches requirements, 0 if not and a negative value
  * if an error occurs.
  */
-int 
+int
 xmlSecKeyReqMatchKey(xmlSecKeyReqPtr keyReq, xmlSecKeyPtr key) {
     xmlSecAssert2(keyReq != NULL, -1);
     xmlSecAssert2(xmlSecKeyIsValid(key), -1);
@@ -454,41 +454,41 @@ xmlSecKeyReqMatchKey(xmlSecKeyReqPtr keyReq, xmlSecKeyPtr key) {
  * Returns: 1 if key value matches requirements, 0 if not and a negative value
  * if an error occurs.
  */
-int 
+int
 xmlSecKeyReqMatchKeyValue(xmlSecKeyReqPtr keyReq, xmlSecKeyDataPtr value) {
     xmlSecAssert2(keyReq != NULL, -1);
     xmlSecAssert2(value != NULL, -1);
-    
-    if((keyReq->keyId != xmlSecKeyDataIdUnknown) && 
+
+    if((keyReq->keyId != xmlSecKeyDataIdUnknown) &&
        (!xmlSecKeyDataCheckId(value, keyReq->keyId))) {
 
         return(0);
     }
-    if((keyReq->keyBitsSize > 0) && 
-       (xmlSecKeyDataGetSize(value) > 0) && 
+    if((keyReq->keyBitsSize > 0) &&
+       (xmlSecKeyDataGetSize(value) > 0) &&
        (xmlSecKeyDataGetSize(value) < keyReq->keyBitsSize)) {
-        
+
         return(0);
     }
     return(1);
 }
 
-/** 
+/**
  * xmlSecKeyReqDebugDump:
  * @keyReq:             the pointer to key requirements object.
  * @output:             the pointer to output FILE.
  *
  * Prints debug information about @keyReq into @output.
- */ 
-void 
+ */
+void
 xmlSecKeyReqDebugDump(xmlSecKeyReqPtr keyReq, FILE* output) {
     xmlSecAssert(keyReq != NULL);
     xmlSecAssert(output != NULL);
 
     fprintf(output, "=== KeyReq:\n");
-    fprintf(output, "==== keyId: %s\n", 
-            (xmlSecKeyDataKlassGetName(keyReq->keyId)) ? 
-                xmlSecKeyDataKlassGetName(keyReq->keyId) : 
+    fprintf(output, "==== keyId: %s\n",
+            (xmlSecKeyDataKlassGetName(keyReq->keyId)) ?
+                xmlSecKeyDataKlassGetName(keyReq->keyId) :
                 BAD_CAST "NULL");
     fprintf(output, "==== keyType: 0x%08x\n", keyReq->keyType);
     fprintf(output, "==== keyUsage: 0x%08x\n", keyReq->keyUsage);
@@ -496,14 +496,14 @@ xmlSecKeyReqDebugDump(xmlSecKeyReqPtr keyReq, FILE* output) {
     xmlSecPtrListDebugDump(&(keyReq->keyUseWithList), output);
 }
 
-/** 
+/**
  * xmlSecKeyReqDebugXmlDump:
  * @keyReq:             the pointer to key requirements object.
  * @output:             the pointer to output FILE.
  *
  * Prints debug information about @keyReq into @output in XML format.
- */ 
-void 
+ */
+void
 xmlSecKeyReqDebugXmlDump(xmlSecKeyReqPtr keyReq, FILE* output) {
     xmlSecAssert(keyReq != NULL);
     xmlSecAssert(output != NULL);
@@ -530,16 +530,16 @@ xmlSecKeyReqDebugXmlDump(xmlSecKeyReqPtr keyReq, FILE* output) {
 /**
  * xmlSecKeyCreate:
  *
- * Allocates and initializes new key. Caller is responsible for 
+ * Allocates and initializes new key. Caller is responsible for
  * freeing returned object with #xmlSecKeyDestroy function.
  *
  * Returns: the pointer to newly allocated @xmlSecKey structure
  * or NULL if an error occurs.
  */
-xmlSecKeyPtr    
+xmlSecKeyPtr
 xmlSecKeyCreate(void)  {
     xmlSecKeyPtr key;
-    
+
     /* Allocate a new xmlSecKey and fill the fields. */
     key = (xmlSecKeyPtr)xmlMalloc(sizeof(xmlSecKey));
     if(key == NULL) {
@@ -547,12 +547,12 @@ xmlSecKeyCreate(void)  {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecKey)=%d", 
+                    "sizeof(xmlSecKey)=%d",
                     sizeof(xmlSecKey));
         return(NULL);
     }
-    memset(key, 0, sizeof(xmlSecKey));    
-    key->usage = xmlSecKeyUsageAny;     
+    memset(key, 0, sizeof(xmlSecKey));
+    key->usage = xmlSecKeyUsageAny;
     return(key);
 }
 
@@ -564,8 +564,8 @@ xmlSecKeyCreate(void)  {
  */
 void
 xmlSecKeyEmpty(xmlSecKeyPtr key) {
-    xmlSecAssert(key != NULL);    
-    
+    xmlSecAssert(key != NULL);
+
     if(key->value != NULL) {
         xmlSecKeyDataDestroy(key->value);
     }
@@ -575,7 +575,7 @@ xmlSecKeyEmpty(xmlSecKeyPtr key) {
     if(key->dataList != NULL) {
         xmlSecPtrListDestroy(key->dataList);
     }
-    
+
     memset(key, 0, sizeof(xmlSecKey));
 }
 
@@ -583,17 +583,17 @@ xmlSecKeyEmpty(xmlSecKeyPtr key) {
  * xmlSecKeyDestroy:
  * @key:                the pointer to key.
  *
- * Destroys the key created using #xmlSecKeyCreate function. 
+ * Destroys the key created using #xmlSecKeyCreate function.
  */
 void
 xmlSecKeyDestroy(xmlSecKeyPtr key) {
-    xmlSecAssert(key != NULL);    
+    xmlSecAssert(key != NULL);
 
     xmlSecKeyEmpty(key);
     xmlFree(key);
 }
 
-/** 
+/**
  * xmlSecKeyCopy:
  * @keyDst:             the destination key.
  * @keySrc:             the source key.
@@ -602,15 +602,15 @@ xmlSecKeyDestroy(xmlSecKeyPtr key) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyCopy(xmlSecKeyPtr keyDst, xmlSecKeyPtr keySrc) {
-    xmlSecAssert2(keyDst != NULL, -1);    
-    xmlSecAssert2(keySrc != NULL, -1);    
-    
+    xmlSecAssert2(keyDst != NULL, -1);
+    xmlSecAssert2(keySrc != NULL, -1);
+
     /* empty destination */
     xmlSecKeyEmpty(keyDst);
 
-    /* copy everything */    
+    /* copy everything */
     if(keySrc->name != NULL) {
         keyDst->name = xmlStrdup(keySrc->name);
         if(keyDst->name == NULL) {
@@ -619,7 +619,7 @@ xmlSecKeyCopy(xmlSecKeyPtr keyDst, xmlSecKeyPtr keySrc) {
                         NULL,
                         XMLSEC_ERRORS_R_STRDUP_FAILED,
                         "len=%d", xmlStrlen(keySrc->name));
-            return(-1); 
+            return(-1);
         }
     }
 
@@ -631,10 +631,10 @@ xmlSecKeyCopy(xmlSecKeyPtr keyDst, xmlSecKeyPtr keySrc) {
                         "xmlSecKeyDataDuplicate",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1); 
+            return(-1);
         }
     }
-    
+
     if(keySrc->dataList != NULL) {
         keyDst->dataList = xmlSecPtrListDuplicate(keySrc->dataList);
         if(keyDst->dataList == NULL) {
@@ -646,7 +646,7 @@ xmlSecKeyCopy(xmlSecKeyPtr keyDst, xmlSecKeyPtr keySrc) {
             return(-1);
         }
     }
-    
+
     keyDst->usage          = keySrc->usage;
     keyDst->notValidBefore = keySrc->notValidBefore;
     keyDst->notValidAfter  = keySrc->notValidAfter;
@@ -662,13 +662,13 @@ xmlSecKeyCopy(xmlSecKeyPtr keyDst, xmlSecKeyPtr keySrc) {
  * Returns: the pointer to newly allocated #xmlSecKey structure
  * or NULL if an error occurs.
  */
-xmlSecKeyPtr    
+xmlSecKeyPtr
 xmlSecKeyDuplicate(xmlSecKeyPtr key) {
     xmlSecKeyPtr newKey;
     int ret;
-    
+
     xmlSecAssert2(key != NULL, NULL);
-    
+
     newKey = xmlSecKeyCreate();
     if(newKey == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -676,9 +676,9 @@ xmlSecKeyDuplicate(xmlSecKeyPtr key) {
                     "xmlSecKeyCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
-    
+
     ret = xmlSecKeyCopy(newKey, key);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -687,9 +687,9 @@ xmlSecKeyDuplicate(xmlSecKeyPtr key) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDestroy(newKey);
-        return(NULL);   
+        return(NULL);
     }
-    
+
     return(newKey);
 }
 
@@ -698,7 +698,7 @@ xmlSecKeyDuplicate(xmlSecKeyPtr key) {
  * @key:                the pointer to key.
  * @name:               the pointer to key name (may be NULL).
  * @keyReq:             the pointer to key requirements.
- * 
+ *
  * Checks whether the @key matches the given criteria.
  *
  * Returns: 1 if the key satisfies the given criteria or 0 otherwise.
@@ -707,14 +707,14 @@ int
 xmlSecKeyMatch(xmlSecKeyPtr key, const xmlChar *name, xmlSecKeyReqPtr keyReq) {
     xmlSecAssert2(xmlSecKeyIsValid(key), -1);
     xmlSecAssert2(keyReq != NULL, -1);
-    
+
     if((name != NULL) && (!xmlStrEqual(xmlSecKeyGetName(key), name))) {
         return(0);
     }
     return(xmlSecKeyReqMatchKey(keyReq, key));
 }
 
-/** 
+/**
  * xmlSecKeyGetType:
  * @key:                the pointer to key.
  *
@@ -722,10 +722,10 @@ xmlSecKeyMatch(xmlSecKeyPtr key, const xmlChar *name, xmlSecKeyReqPtr keyReq) {
  *
  * Returns: key type.
  */
-xmlSecKeyDataType 
+xmlSecKeyDataType
 xmlSecKeyGetType(xmlSecKeyPtr key) {
     xmlSecKeyDataPtr data;
-    
+
     xmlSecAssert2(key != NULL, xmlSecKeyDataTypeUnknown);
 
     data = xmlSecKeyGetValue(key);
@@ -735,7 +735,7 @@ xmlSecKeyGetType(xmlSecKeyPtr key) {
     return(xmlSecKeyDataGetType(data));
 }
 
-/** 
+/**
  * xmlSecKeyGetName:
  * @key:                the pointer to key.
  *
@@ -743,14 +743,14 @@ xmlSecKeyGetType(xmlSecKeyPtr key) {
  *
  * Returns: key name.
  */
-const xmlChar*  
+const xmlChar*
 xmlSecKeyGetName(xmlSecKeyPtr key) {
     xmlSecAssert2(key != NULL, NULL);
 
     return(key->name);
 }
 
-/** 
+/**
  * xmlSecKeySetName:
  * @key:                the pointer to key.
  * @name:               the new key name.
@@ -759,7 +759,7 @@ xmlSecKeyGetName(xmlSecKeyPtr key) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeySetName(xmlSecKeyPtr key, const xmlChar* name) {
     xmlSecAssert2(key != NULL, -1);
 
@@ -767,7 +767,7 @@ xmlSecKeySetName(xmlSecKeyPtr key, const xmlChar* name) {
         xmlFree(key->name);
         key->name = NULL;
     }
-    
+
     if(name != NULL) {
         key->name = xmlStrdup(name);
         if(key->name == NULL) {
@@ -776,14 +776,14 @@ xmlSecKeySetName(xmlSecKeyPtr key, const xmlChar* name) {
                         NULL,
                         XMLSEC_ERRORS_R_STRDUP_FAILED,
                         "len=%d", xmlStrlen(name));
-            return(-1);     
-        }       
+            return(-1);
+        }
     }
-    
+
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyGetValue:
  * @key:                the pointer to key.
  *
@@ -791,14 +791,14 @@ xmlSecKeySetName(xmlSecKeyPtr key, const xmlChar* name) {
  *
  * Returns: key value (crypto material).
  */
-xmlSecKeyDataPtr 
+xmlSecKeyDataPtr
 xmlSecKeyGetValue(xmlSecKeyPtr key) {
     xmlSecAssert2(key != NULL, NULL);
 
     return(key->value);
 }
 
-/** 
+/**
  * xmlSecKeySetValue:
  * @key:                the pointer to key.
  * @value:              the new value.
@@ -807,7 +807,7 @@ xmlSecKeyGetValue(xmlSecKeyPtr key) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeySetValue(xmlSecKeyPtr key, xmlSecKeyDataPtr value) {
     xmlSecAssert2(key != NULL, -1);
 
@@ -816,23 +816,23 @@ xmlSecKeySetValue(xmlSecKeyPtr key, xmlSecKeyDataPtr value) {
         key->value = NULL;
     }
     key->value = value;
-    
+
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyGetData:
  * @key:                the pointer to key.
  * @dataId:             the requested data klass.
  *
  * Gets key's data.
  *
- * Returns: additional data associated with the @key (see also 
+ * Returns: additional data associated with the @key (see also
  * #xmlSecKeyAdoptData function).
  */
-xmlSecKeyDataPtr 
+xmlSecKeyDataPtr
 xmlSecKeyGetData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) {
-    
+
     xmlSecAssert2(key != NULL, NULL);
     xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, NULL);
 
@@ -842,11 +842,11 @@ xmlSecKeyGetData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) {
     } else if(key->dataList != NULL) {
         xmlSecKeyDataPtr tmp;
         xmlSecSize pos, size;
-        
+
         size = xmlSecPtrListGetSize(key->dataList);
         for(pos = 0; pos < size; ++pos) {
             tmp = (xmlSecKeyDataPtr)xmlSecPtrListGetItem(key->dataList, pos);
-            if((tmp != NULL) && (tmp->id == dataId)) {  
+            if((tmp != NULL) && (tmp->id == dataId)) {
                 return(tmp);
             }
         }
@@ -858,16 +858,16 @@ xmlSecKeyGetData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) {
  * xmlSecKeyEnsureData:
  * @key:                the pointer to key.
  * @dataId:             the requested data klass.
- * 
+ *
  * If necessary, creates key data of @dataId klass and adds to @key.
  *
  * Returns: pointer to key data or NULL if an error occurs.
  */
-xmlSecKeyDataPtr 
+xmlSecKeyDataPtr
 xmlSecKeyEnsureData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) {
     xmlSecKeyDataPtr data;
     int ret;
-        
+
     xmlSecAssert2(key != NULL, NULL);
     xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, NULL);
 
@@ -875,30 +875,30 @@ xmlSecKeyEnsureData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) {
     if(data != NULL) {
         return(data);
     }
-    
+
     data = xmlSecKeyDataCreate(dataId);
     if(data == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecKeyDataCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "dataId=%s", 
+                    "dataId=%s",
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)));
         return(NULL);
     }
-        
+
     ret = xmlSecKeyAdoptData(key, data);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecKeyAdoptData",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "dataId=%s", 
+                    "dataId=%s",
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)));
         xmlSecKeyDataDestroy(data);
         return(NULL);
     }
-    
+
     return(data);
 }
 
@@ -912,11 +912,11 @@ xmlSecKeyEnsureData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) {
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecKeyAdoptData(xmlSecKeyPtr key, xmlSecKeyDataPtr data) {
     xmlSecKeyDataPtr tmp;
     xmlSecSize pos, size;
-    
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataIsValid(data), -1);
 
@@ -928,7 +928,7 @@ xmlSecKeyAdoptData(xmlSecKeyPtr key, xmlSecKeyDataPtr data) {
         key->value = data;
         return(0);
     }
-    
+
     if(key->dataList == NULL) {
         key->dataList = xmlSecPtrListCreate(xmlSecKeyDataListId);
         if(key->dataList == NULL) {
@@ -941,19 +941,19 @@ xmlSecKeyAdoptData(xmlSecKeyPtr key, xmlSecKeyDataPtr data) {
         }
     }
 
-        
+
     size = xmlSecPtrListGetSize(key->dataList);
     for(pos = 0; pos < size; ++pos) {
         tmp = (xmlSecKeyDataPtr)xmlSecPtrListGetItem(key->dataList, pos);
-        if((tmp != NULL) && (tmp->id == data->id)) {    
+        if((tmp != NULL) && (tmp->id == data->id)) {
             return(xmlSecPtrListSet(key->dataList, data, pos));
         }
     }
-    
+
     return(xmlSecPtrListAdd(key->dataList, data));
 }
 
-/** 
+/**
  * xmlSecKeyDebugDump:
  * @key:                the pointer to key.
  * @output:             the pointer to output FILE.
@@ -964,11 +964,11 @@ void
 xmlSecKeyDebugDump(xmlSecKeyPtr key, FILE *output) {
     xmlSecAssert(xmlSecKeyIsValid(key));
     xmlSecAssert(output != NULL);
-    
+
     fprintf(output, "== KEY\n");
-    fprintf(output, "=== method: %s\n", 
-            (key->value->id->dataNodeName != NULL) ? 
-            (char*)(key->value->id->dataNodeName) : "NULL"); 
+    fprintf(output, "=== method: %s\n",
+            (key->value->id->dataNodeName != NULL) ?
+            (char*)(key->value->id->dataNodeName) : "NULL");
 
     fprintf(output, "=== key type: ");
     if((xmlSecKeyGetType(key) & xmlSecKeyDataTypeSymmetric) != 0) {
@@ -979,7 +979,7 @@ xmlSecKeyDebugDump(xmlSecKeyPtr key, FILE *output) {
         fprintf(output, "Public\n");
     } else {
         fprintf(output, "Unknown\n");
-    } 
+    }
 
     if(key->name != NULL) {
         fprintf(output, "=== key name: %s\n", key->name);
@@ -997,7 +997,7 @@ xmlSecKeyDebugDump(xmlSecKeyPtr key, FILE *output) {
     }
 }
 
-/** 
+/**
  * xmlSecKeyDebugXmlDump:
  * @key:                the pointer to key.
  * @output:             the pointer to output FILE.
@@ -1008,11 +1008,11 @@ void
 xmlSecKeyDebugXmlDump(xmlSecKeyPtr key, FILE *output) {
     xmlSecAssert(xmlSecKeyIsValid(key));
     xmlSecAssert(output != NULL);
-    
+
     fprintf(output, "<KeyInfo>\n");
 
     fprintf(output, "<KeyMethod>");
-    xmlSecPrintXmlString(output, key->value->id->dataNodeName); 
+    xmlSecPrintXmlString(output, key->value->id->dataNodeName);
     fprintf(output, "</KeyMethod>\n");
 
     fprintf(output, "<KeyType>");
@@ -1024,7 +1024,7 @@ xmlSecKeyDebugXmlDump(xmlSecKeyPtr key, FILE *output) {
         fprintf(output, "Public\n");
     } else {
         fprintf(output, "Unknown\n");
-    } 
+    }
     fprintf(output, "</KeyType>\n");
 
     fprintf(output, "<KeyName>");
@@ -1033,7 +1033,7 @@ xmlSecKeyDebugXmlDump(xmlSecKeyPtr key, FILE *output) {
 
     if(key->notValidBefore < key->notValidAfter) {
         fprintf(output, "<KeyValidity notValidBefore=\"%ld\" notValidAfter=\"%ld\"/>\n",
-                (unsigned long)key->notValidBefore, 
+                (unsigned long)key->notValidBefore,
                 (unsigned long)key->notValidAfter);
     }
 
@@ -1044,10 +1044,10 @@ xmlSecKeyDebugXmlDump(xmlSecKeyPtr key, FILE *output) {
         xmlSecPtrListDebugXmlDump(key->dataList, output);
     }
 
-    fprintf(output, "</KeyInfo>\n"); 
+    fprintf(output, "</KeyInfo>\n");
 }
 
-/** 
+/**
  * xmlSecKeyGenerate:
  * @dataId:             the requested key klass (rsa, dsa, aes, ...).
  * @sizeBits:           the new key size (in bits!).
@@ -1064,7 +1064,7 @@ xmlSecKeyGenerate(xmlSecKeyDataId dataId, xmlSecSize sizeBits, xmlSecKeyDataType
     int ret;
 
     xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, NULL);
-    
+
     data = xmlSecKeyDataCreate(dataId);
     if(data == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1072,7 +1072,7 @@ xmlSecKeyGenerate(xmlSecKeyDataId dataId, xmlSecSize sizeBits, xmlSecKeyDataType
                     "xmlSecKeyDataCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);    
+        return(NULL);
     }
 
     ret = xmlSecKeyDataGenerate(data, sizeBits, type);
@@ -1083,9 +1083,9 @@ xmlSecKeyGenerate(xmlSecKeyDataId dataId, xmlSecSize sizeBits, xmlSecKeyDataType
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d;type=%d", sizeBits, type);
         xmlSecKeyDataDestroy(data);
-        return(NULL);    
+        return(NULL);
     }
-        
+
     key = xmlSecKeyCreate();
     if(key == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1094,9 +1094,9 @@ xmlSecKeyGenerate(xmlSecKeyDataId dataId, xmlSecSize sizeBits, xmlSecKeyDataType
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDataDestroy(data);
-        return(NULL);    
+        return(NULL);
     }
-    
+
     ret = xmlSecKeySetValue(key, data);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1106,13 +1106,13 @@ xmlSecKeyGenerate(xmlSecKeyDataId dataId, xmlSecSize sizeBits, xmlSecKeyDataType
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDataDestroy(data);
         xmlSecKeyDestroy(key);
-        return(NULL);    
+        return(NULL);
     }
-    
+
     return(key);
 }
 
-/** 
+/**
  * xmlSecKeyGenerateByName:
  * @name:               the requested key klass name (rsa, dsa, aes, ...).
  * @sizeBits:           the new key size (in bits!).
@@ -1127,7 +1127,7 @@ xmlSecKeyGenerateByName(const xmlChar* name, xmlSecSize sizeBits, xmlSecKeyDataT
     xmlSecKeyDataId dataId;
 
     xmlSecAssert2(name != NULL, NULL);
-    
+
     dataId = xmlSecKeyDataIdListFindByName(xmlSecKeyDataIdsGet(), name, xmlSecKeyDataUsageAny);
     if(dataId == xmlSecKeyDataIdUnknown) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1135,9 +1135,9 @@ xmlSecKeyGenerateByName(const xmlChar* name, xmlSecSize sizeBits, xmlSecKeyDataT
                     xmlSecErrorsSafeString(name),
                     XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);    
+        return(NULL);
     }
-    
+
     return(xmlSecKeyGenerate(dataId, sizeBits, type));
 }
 
@@ -1150,7 +1150,7 @@ xmlSecKeyGenerateByName(const xmlChar* name, xmlSecSize sizeBits, xmlSecKeyDataT
  *
  * Returns: pointer to newly created key or NULL if an error occurs.
  */
-xmlSecKeyPtr 
+xmlSecKeyPtr
 xmlSecKeyReadBuffer(xmlSecKeyDataId dataId, xmlSecBuffer* buffer) {
     xmlSecKeyInfoCtx keyInfoCtx;
     xmlSecKeyPtr key;
@@ -1167,10 +1167,10 @@ xmlSecKeyReadBuffer(xmlSecKeyDataId dataId, xmlSecBuffer* buffer) {
                     "xmlSecKeyCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);    
+        return(NULL);
     }
 
-    ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);    
+    ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
@@ -1178,14 +1178,14 @@ xmlSecKeyReadBuffer(xmlSecKeyDataId dataId, xmlSecBuffer* buffer) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDestroy(key);
-        return(NULL);    
+        return(NULL);
     }
-    
+
     keyInfoCtx.keyReq.keyType = xmlSecKeyDataTypeAny;
-    ret = xmlSecKeyDataBinRead(dataId, key, 
+    ret = xmlSecKeyDataBinRead(dataId, key,
                         xmlSecBufferGetData(buffer),
                         xmlSecBufferGetSize(buffer),
-                        &keyInfoCtx);   
+                        &keyInfoCtx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
@@ -1194,10 +1194,10 @@ xmlSecKeyReadBuffer(xmlSecKeyDataId dataId, xmlSecBuffer* buffer) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
         xmlSecKeyDestroy(key);
-        return(NULL);    
+        return(NULL);
     }
     xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
-    
+
     return(key);
 }
 
@@ -1210,12 +1210,12 @@ xmlSecKeyReadBuffer(xmlSecKeyDataId dataId, xmlSecBuffer* buffer) {
  *
  * Returns: pointer to newly created key or NULL if an error occurs.
  */
-xmlSecKeyPtr 
+xmlSecKeyPtr
 xmlSecKeyReadBinaryFile(xmlSecKeyDataId dataId, const char* filename) {
     xmlSecKeyPtr key;
     xmlSecBuffer buffer;
     int ret;
-    
+
     xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, NULL);
     xmlSecAssert2(filename != NULL, NULL);
 
@@ -1227,7 +1227,7 @@ xmlSecKeyReadBinaryFile(xmlSecKeyDataId dataId, const char* filename) {
                     "xmlSecBufferInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
 
     ret = xmlSecBufferReadFile(&buffer, filename);
@@ -1236,7 +1236,7 @@ xmlSecKeyReadBinaryFile(xmlSecKeyDataId dataId, const char* filename) {
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
                     "xmlSecBufferReadFile",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s", 
+                    "filename=%s",
                     xmlSecErrorsSafeString(filename));
         xmlSecBufferFinalize(&buffer);
         return(NULL);
@@ -1248,10 +1248,10 @@ xmlSecKeyReadBinaryFile(xmlSecKeyDataId dataId, const char* filename) {
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
                     "xmlSecKeyReadBuffer",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s", 
+                    "filename=%s",
                     xmlSecErrorsSafeString(filename));
         xmlSecBufferFinalize(&buffer);
-        return(NULL);   
+        return(NULL);
     }
 
     xmlSecBufferFinalize(&buffer);
@@ -1268,7 +1268,7 @@ xmlSecKeyReadBinaryFile(xmlSecKeyDataId dataId, const char* filename) {
  *
  * Returns: pointer to newly created key or NULL if an error occurs.
  */
-xmlSecKeyPtr 
+xmlSecKeyPtr
 xmlSecKeyReadMemory(xmlSecKeyDataId dataId, const xmlSecByte* data, xmlSecSize dataSize) {
     xmlSecBuffer buffer;
     xmlSecKeyPtr key;
@@ -1286,7 +1286,7 @@ xmlSecKeyReadMemory(xmlSecKeyDataId dataId, const xmlSecByte* data, xmlSecSize d
                     "xmlSecBufferInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
 
     if (xmlSecBufferAppend(&buffer, data, dataSize) < 0) {
@@ -1296,7 +1296,7 @@ xmlSecKeyReadMemory(xmlSecKeyDataId dataId, const xmlSecByte* data, xmlSecSize d
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecBufferFinalize(&buffer);
-        return(NULL);   
+        return(NULL);
     }
 
     key = xmlSecKeyReadBuffer(dataId, &buffer);
@@ -1307,7 +1307,7 @@ xmlSecKeyReadMemory(xmlSecKeyDataId dataId, const xmlSecByte* data, xmlSecSize d
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecBufferFinalize(&buffer);
-        return(NULL);   
+        return(NULL);
     }
 
     xmlSecBufferFinalize(&buffer);
@@ -1317,21 +1317,21 @@ xmlSecKeyReadMemory(xmlSecKeyDataId dataId, const xmlSecByte* data, xmlSecSize d
 /**
  * xmlSecKeysMngrGetKey:
  * @keyInfoNode:        the pointer to <dsig:KeyInfo/> node.
- * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> node processing context. 
- * 
+ * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> node processing context.
+ *
  * Reads the <dsig:KeyInfo/> node @keyInfoNode and extracts the key.
  *
- * Returns: the pointer to key or NULL if the key is not found or 
+ * Returns: the pointer to key or NULL if the key is not found or
  * an error occurs.
  */
-xmlSecKeyPtr            
+xmlSecKeyPtr
 xmlSecKeysMngrGetKey(xmlNodePtr keyInfoNode, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyPtr key;
     int ret;
-    
+
     xmlSecAssert2(keyInfoCtx != NULL, NULL);
 
-    
+
     /* first try to read data from <dsig:KeyInfo/> node */
     key = xmlSecKeyCreate();
     if(key == NULL) {
@@ -1360,9 +1360,9 @@ xmlSecKeysMngrGetKey(xmlNodePtr keyInfoNode, xmlSecKeyInfoCtxPtr keyInfoCtx) {
            (xmlSecKeyMatch(key, NULL, &(keyInfoCtx->keyReq)) != 0)) {
             return(key);
         }
-    }   
+    }
     xmlSecKeyDestroy(key);
-    
+
     /* if we have keys manager, try it */
     if(keyInfoCtx->keysMngr != NULL) {
         key = xmlSecKeysMngrFindKey(keyInfoCtx->keysMngr, NULL, keyInfoCtx);
@@ -1379,12 +1379,12 @@ xmlSecKeysMngrGetKey(xmlNodePtr keyInfoNode, xmlSecKeyInfoCtxPtr keyInfoCtx) {
         }
         xmlSecKeyDestroy(key);
     }
-    
+
     xmlSecError(XMLSEC_ERRORS_HERE,
                 NULL,
                 NULL,
                 XMLSEC_ERRORS_R_KEY_NOT_FOUND,
-                XMLSEC_ERRORS_NO_MESSAGE);    
+                XMLSEC_ERRORS_NO_MESSAGE);
     return(NULL);
 }
 
@@ -1402,13 +1402,13 @@ static xmlSecPtrListKlass xmlSecKeyPtrListKlass = {
 };
 
 /**
- * xmlSecKeyPtrListGetKlass: 
+ * xmlSecKeyPtrListGetKlass:
  *
  * The keys list klass.
  *
  * Returns: keys list id.
  */
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecKeyPtrListGetKlass(void) {
     return(&xmlSecKeyPtrListKlass);
 }
diff --git a/src/keysdata.c b/src/keysdata.c
index 608c3ff..7deb19a 100644
--- a/src/keysdata.c
+++ b/src/keysdata.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Key data.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 
@@ -13,7 +13,7 @@
 
 #include <stdlib.h>
 #include <string.h>
- 
+
 #include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
@@ -33,11 +33,11 @@
  *************************************************************************/
 static xmlSecPtrList xmlSecAllKeyDataIds;
 
-/** 
+/**
  * xmlSecKeyDataIdsGet:
  *
  * Gets global registered key data klasses list.
- * 
+ *
  * Returns: the pointer to list of all registered key data klasses.
  */
 xmlSecPtrListPtr
@@ -45,18 +45,18 @@ xmlSecKeyDataIdsGet(void) {
     return(&xmlSecAllKeyDataIds);
 }
 
-/** 
+/**
  * xmlSecKeyDataIdsInit:
  *
- * Initializes the key data klasses. This function is called from the 
+ * Initializes the key data klasses. This function is called from the
  * #xmlSecInit function and the application should not call it directly.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyDataIdsInit(void) {
     int ret;
-    
+
     ret = xmlSecPtrListInitialize(xmlSecKeyDataIdsGet(), xmlSecKeyDataIdListId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -66,7 +66,7 @@ xmlSecKeyDataIdsInit(void) {
                     "xmlSecKeyDataIdListId");
         return(-1);
     }
-    
+
     ret = xmlSecKeyDataIdsRegisterDefault();
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -76,14 +76,14 @@ xmlSecKeyDataIdsInit(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
 /**
  * xmlSecKeyDataIdsShutdown:
- * 
- * Shuts down the keys data klasses. This function is called from the 
+ *
+ * Shuts down the keys data klasses. This function is called from the
  * #xmlSecShutdown function and the application should not call it directly.
  */
 void
@@ -91,7 +91,7 @@ xmlSecKeyDataIdsShutdown(void) {
     xmlSecPtrListFinalize(xmlSecKeyDataIdsGet());
 }
 
-/** 
+/**
  * xmlSecKeyDataIdsRegister:
  * @id:                 the key data klass.
  *
@@ -99,12 +99,12 @@ xmlSecKeyDataIdsShutdown(void) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyDataIdsRegister(xmlSecKeyDataId id) {
     int ret;
-        
+
     xmlSecAssert2(id != xmlSecKeyDataIdUnknown, -1);
-    
+
     ret = xmlSecPtrListAdd(xmlSecKeyDataIdsGet(), (xmlSecPtr)id);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -115,20 +115,20 @@ xmlSecKeyDataIdsRegister(xmlSecKeyDataId id) {
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)));
         return(-1);
     }
-    
-    return(0);    
+
+    return(0);
 }
 
 /**
  * xmlSecKeyDataIdsRegisterDefault:
  *
  * Registers default (implemented by XML Security Library)
- * key data klasses: <dsig:KeyName/> element processing klass, 
+ * key data klasses: <dsig:KeyName/> element processing klass,
  * <dsig:KeyValue/> element processing klass, ...
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecKeyDataIdsRegisterDefault(void) {
     if(xmlSecKeyDataIdsRegister(xmlSecKeyDataNameId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -136,7 +136,7 @@ xmlSecKeyDataIdsRegisterDefault(void) {
                     "xmlSecKeyDataIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "xmlSecKeyDataNameId");
-        return(-1);     
+        return(-1);
     }
 
     if(xmlSecKeyDataIdsRegister(xmlSecKeyDataValueId) < 0) {
@@ -145,7 +145,7 @@ xmlSecKeyDataIdsRegisterDefault(void) {
                     "xmlSecKeyDataIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "xmlSecKeyDataValueId");
-        return(-1);     
+        return(-1);
     }
 
     if(xmlSecKeyDataIdsRegister(xmlSecKeyDataRetrievalMethodId) < 0) {
@@ -154,7 +154,7 @@ xmlSecKeyDataIdsRegisterDefault(void) {
                     "xmlSecKeyDataIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "xmlSecKeyDataRetrievalMethodId");
-        return(-1);     
+        return(-1);
     }
 
 #ifndef XMLSEC_NO_XMLENC
@@ -164,10 +164,10 @@ xmlSecKeyDataIdsRegisterDefault(void) {
                     "xmlSecKeyDataIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "xmlSecKeyDataEncryptedKeyId");
-        return(-1);     
+        return(-1);
     }
 #endif /* XMLSEC_NO_XMLENC */
-    
+
     return(0);
 }
 
@@ -181,22 +181,22 @@ xmlSecKeyDataIdsRegisterDefault(void) {
  * @id:                 the data id.
  *
  * Allocates and initializes new key data of the specified type @id.
- * Caller is responsible for destroing returend object with 
+ * Caller is responsible for destroing returend object with
  * #xmlSecKeyDataDestroy function.
  *
  * Returns: the pointer to newly allocated key data structure
  * or NULL if an error occurs.
  */
-xmlSecKeyDataPtr        
+xmlSecKeyDataPtr
 xmlSecKeyDataCreate(xmlSecKeyDataId id)  {
     xmlSecKeyDataPtr data;
     int ret;
-        
+
     xmlSecAssert2(id != NULL, NULL);
     xmlSecAssert2(id->klassSize >= sizeof(xmlSecKeyDataKlass), NULL);
     xmlSecAssert2(id->objSize >= sizeof(xmlSecKeyData), NULL);
     xmlSecAssert2(id->name != NULL, NULL);
-        
+
     /* Allocate a new xmlSecKeyData and fill the fields. */
     data = (xmlSecKeyDataPtr)xmlMalloc(id->objSize);
     if(data == NULL) {
@@ -204,10 +204,10 @@ xmlSecKeyDataCreate(xmlSecKeyDataId id)  {
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "size=%d", id->objSize); 
+                    "size=%d", id->objSize);
         return(NULL);
     }
-    memset(data, 0, id->objSize);    
+    memset(data, 0, id->objSize);
     data->id = id;
 
     if(id->initialize != NULL) {
@@ -222,7 +222,7 @@ xmlSecKeyDataCreate(xmlSecKeyDataId id)  {
             return(NULL);
         }
     }
-    
+
     return(data);
 }
 
@@ -230,13 +230,13 @@ xmlSecKeyDataCreate(xmlSecKeyDataId id)  {
  * xmlSecKeyDataDuplicate:
  * @data:               the pointer to the key data.
  *
- * Creates a duplicate of the given @data. Caller is responsible for 
+ * Creates a duplicate of the given @data. Caller is responsible for
  * destroing returend object with #xmlSecKeyDataDestroy function.
  *
  * Returns: the pointer to newly allocated key data structure
  * or NULL if an error occurs.
  */
-xmlSecKeyDataPtr        
+xmlSecKeyDataPtr
 xmlSecKeyDataDuplicate(xmlSecKeyDataPtr data) {
     xmlSecKeyDataPtr newData;
     int ret;
@@ -250,7 +250,7 @@ xmlSecKeyDataDuplicate(xmlSecKeyDataPtr data) {
                     xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                     "xmlSecKeyDataCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    XMLSEC_ERRORS_NO_MESSAGE); 
+                    XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
 
@@ -262,9 +262,9 @@ xmlSecKeyDataDuplicate(xmlSecKeyDataPtr data) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDataDestroy(newData);
-        return(NULL);   
+        return(NULL);
     }
-    
+
     return(newData);
 }
 
@@ -272,14 +272,14 @@ xmlSecKeyDataDuplicate(xmlSecKeyDataPtr data) {
  * xmlSecKeyDataDestroy:
  * @data:               the pointer to the key data.
  *
- * Destroys the data and frees all allocated memory. 
+ * Destroys the data and frees all allocated memory.
  */
 void
 xmlSecKeyDataDestroy(xmlSecKeyDataPtr data) {
-    xmlSecAssert(xmlSecKeyDataIsValid(data));    
+    xmlSecAssert(xmlSecKeyDataIsValid(data));
     xmlSecAssert(data->id->objSize > 0);
-    
-    if(data->id->finalize != NULL) { 
+
+    if(data->id->finalize != NULL) {
         (data->id->finalize)(data);
     }
     memset(data, 0, data->id->objSize);
@@ -293,7 +293,7 @@ xmlSecKeyDataDestroy(xmlSecKeyDataPtr data) {
  * @key:                the destination key.
  * @node:               the pointer to an XML node.
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
- * 
+ *
  * Reads the key data of klass @id from XML @node and adds them to @key.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -314,7 +314,7 @@ xmlSecKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlS
  * @key:                the source key.
  * @node:               the pointer to an XML node.
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
- * 
+ *
  * Writes the key data of klass @id from @key to an XML @node.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -329,7 +329,7 @@ xmlSecKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xml
     return((id->xmlWrite)(id, key, node, keyInfoCtx));
 }
 
-/** 
+/**
  * xmlSecKeyDataBinRead:
  * @id:                 the data klass.
  * @key:                the destination key.
@@ -338,12 +338,12 @@ xmlSecKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xml
  * @keyInfoCtx:         the <dsig:KeyInfo/> node processing context.
  *
  * Reads the key data of klass @id from binary buffer @buf to @key.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs.
  */
 int
-xmlSecKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key, 
-                    const xmlSecByte* buf, xmlSecSize bufSize, 
+xmlSecKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
+                    const xmlSecByte* buf, xmlSecSize bufSize,
                     xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(id != NULL, -1);
     xmlSecAssert2(id->binRead != NULL, -1);
@@ -353,7 +353,7 @@ xmlSecKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     return((id->binRead)(id, key, buf, bufSize, keyInfoCtx));
 }
 
-/** 
+/**
  * xmlSecKeyDataBinWrite:
  * @id:                 the data klass.
  * @key:                the source key.
@@ -361,13 +361,13 @@ xmlSecKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
  * @bufSize:            the output buffer size.
  * @keyInfoCtx:         the <dsig:KeyInfo/> node processing context.
  *
- * Writes the key data of klass @id from the @key to a binary buffer @buf. 
- * 
+ * Writes the key data of klass @id from the @key to a binary buffer @buf.
+ *
  * Returns: 0 on success or a negative value if an error occurs.
  */
 int
-xmlSecKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, 
-                    xmlSecByte** buf, xmlSecSize* bufSize, 
+xmlSecKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
+                    xmlSecByte** buf, xmlSecSize* bufSize,
                     xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(id != NULL, -1);
     xmlSecAssert2(id->binWrite != NULL, -1);
@@ -377,7 +377,7 @@ xmlSecKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     return((id->binWrite)(id, key, buf, bufSize, keyInfoCtx));
 }
 
-/** 
+/**
  * xmlSecKeyDataGenerate:
  * @data:               the pointer to key data.
  * @sizeBits:           the desired key data size (in bits).
@@ -388,13 +388,13 @@ xmlSecKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecKeyDataGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, 
+xmlSecKeyDataGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
                       xmlSecKeyDataType type) {
     int ret;
 
     xmlSecAssert2(xmlSecKeyDataIsValid(data), -1);
     xmlSecAssert2(data->id->generate != NULL, -1);
-    
+
     /* write data */
     ret = data->id->generate(data, sizeBits, type);
     if(ret < 0) {
@@ -403,28 +403,28 @@ xmlSecKeyDataGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
                     "id->generate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", sizeBits);
-        return(-1);         
+        return(-1);
     }
-    return(0);    
+    return(0);
 }
 
-/** 
+/**
  * xmlSecKeyDataGetType:
  * @data:               the pointer to key data.
  *
  * Gets key data type.
  *
  * Returns: key data type.
- */  
-xmlSecKeyDataType       
+ */
+xmlSecKeyDataType
 xmlSecKeyDataGetType(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataIsValid(data), xmlSecKeyDataTypeUnknown);
     xmlSecAssert2(data->id->getType != NULL, xmlSecKeyDataTypeUnknown);
-    
+
     return(data->id->getType(data));
 }
 
-/** 
+/**
  * xmlSecKeyDataGetSize:
  * @data:               the pointer to key data.
  *
@@ -436,14 +436,14 @@ xmlSecSize
 xmlSecKeyDataGetSize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataIsValid(data), 0);
     xmlSecAssert2(data->id->getSize != NULL, 0);
-    
+
     return(data->id->getSize(data));
 }
 
 /**
  * xmlSecKeyDataGetIdentifier:
  * @data:               the pointer to key data.
- * 
+ *
  * Gets key data identifier string.
  *
  * Returns: key data id string.
@@ -452,11 +452,11 @@ const xmlChar*
 xmlSecKeyDataGetIdentifier(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataIsValid(data), NULL);
     xmlSecAssert2(data->id->getIdentifier != NULL, NULL);
-    
+
     return(data->id->getIdentifier(data));
 }
 
-/** 
+/**
  * xmlSecKeyDataDebugDump:
  * @data:               the pointer to key data.
  * @output:             the pointer to output FILE.
@@ -468,23 +468,23 @@ xmlSecKeyDataDebugDump(xmlSecKeyDataPtr data, FILE *output) {
     xmlSecAssert(xmlSecKeyDataIsValid(data));
     xmlSecAssert(data->id->debugDump != NULL);
     xmlSecAssert(output != NULL);
-    
+
     data->id->debugDump(data, output);
 }
 
-/** 
+/**
  * xmlSecKeyDataDebugXmlDump:
  * @data:               the pointer to key data.
  * @output:             the pointer to output FILE.
  *
  * Prints key data debug info in XML format.
- */ 
-void 
+ */
+void
 xmlSecKeyDataDebugXmlDump(xmlSecKeyDataPtr data, FILE *output) {
     xmlSecAssert(xmlSecKeyDataIsValid(data));
     xmlSecAssert(data->id->debugXmlDump != NULL);
     xmlSecAssert(output != NULL);
-    
+
     data->id->debugXmlDump(data, output);
 }
 
@@ -495,26 +495,26 @@ xmlSecKeyDataDebugXmlDump(xmlSecKeyDataPtr data, FILE *output) {
  * key (xmlSecBuffer) is located after xmlSecKeyData structure
  *
  *************************************************************************/
-/** 
+/**
  * xmlSecKeyDataBinaryValueInitialize:
  * @data:               the pointer to binary key data.
  *
  * Initializes key data.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
 int
 xmlSecKeyDataBinaryValueInitialize(xmlSecKeyDataPtr data) {
     xmlSecBufferPtr buffer;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataIsValid(data), -1);
     xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize), -1);
-        
+
     /* initialize buffer */
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     ret = xmlSecBufferInitialize(buffer, 0);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -524,24 +524,24 @@ xmlSecKeyDataBinaryValueInitialize(xmlSecKeyDataPtr data) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
-    return(0);    
+
+    return(0);
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueDuplicate:
  * @dst:                the pointer to destination binary key data.
  * @src:                the pointer to source binary key data.
  *
  * Copies binary key data from @src to @dst.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
 int
 xmlSecKeyDataBinaryValueDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     xmlSecBufferPtr buffer;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataIsValid(dst), -1);
     xmlSecAssert2(xmlSecKeyDataCheckSize(dst, xmlSecKeyDataBinarySize), -1);
     xmlSecAssert2(xmlSecKeyDataIsValid(src), -1);
@@ -549,7 +549,7 @@ xmlSecKeyDataBinaryValueDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
 
     buffer = xmlSecKeyDataBinaryValueGetBuffer(src);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     /* copy data */
     ret = xmlSecKeyDataBinaryValueSetBuffer(dst,
                     xmlSecBufferGetData(buffer),
@@ -566,27 +566,27 @@ xmlSecKeyDataBinaryValueDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueFinalize:
  * @data:               the pointer to binary key data.
  *
  * Cleans up binary key data.
  */
-void 
+void
 xmlSecKeyDataBinaryValueFinalize(xmlSecKeyDataPtr data) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert(xmlSecKeyDataIsValid(data));
     xmlSecAssert(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize));
-    
+
     /* initialize buffer */
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert(buffer != NULL);
-    
-    xmlSecBufferFinalize(buffer);    
+
+    xmlSecBufferFinalize(buffer);
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueXmlRead:
  * @id:                 the data klass.
  * @key:                the pointer to destination key.
@@ -594,17 +594,17 @@ xmlSecKeyDataBinaryValueFinalize(xmlSecKeyDataPtr data) {
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
  *
  * Reads binary key data from @node to the key by base64 decoding the @node content.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
-xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, 
+int
+xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlChar* str;
     xmlSecSize len;
     xmlSecKeyDataPtr data;
     int ret;
-    
+
     xmlSecAssert2(id != xmlSecKeyDataIdUnknown, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -612,7 +612,7 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
 
     str = xmlNodeGetContent(node);
     if(str == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
                     XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
@@ -623,7 +623,7 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     /* usual trick: decode into the same buffer */
     ret = xmlSecBase64Decode(str, (xmlSecByte*)str, xmlStrlen(str));
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecBase64Decode",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -637,7 +637,7 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     data = xmlSecKeyGetValue(key);
     if(data != NULL) {
         xmlSecBufferPtr buffer;
-        
+
         if(!xmlSecKeyDataCheckId(data, id)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
@@ -645,10 +645,10 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlFree(str);
-            return(-1); 
+            return(-1);
         }
-        
-        buffer = xmlSecKeyDataBinaryValueGetBuffer(data);       
+
+        buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
         if((buffer != NULL) && ((xmlSecSize)xmlSecBufferGetSize(buffer) != len)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
@@ -657,7 +657,7 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         "cur-data-size=%d;new-data-size=%d",
                         xmlSecBufferGetSize(buffer), len);
             xmlFree(str);
-            return(-1);         
+            return(-1);
         }
         if((buffer != NULL) && (len > 0) && (memcmp(xmlSecBufferGetData(buffer), str, len) != 0)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -666,18 +666,18 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
                         "key already has a different value");
             xmlFree(str);
-            return(-1);         
+            return(-1);
         }
         if(buffer != NULL) {
             /* we already have exactly the same key */
             xmlFree(str);
             return(0);
         }
-        
+
         /* we have binary key value with empty buffer */
     }
 
-    
+
     data = xmlSecKeyDataCreate(id);
     if(data == NULL ) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -688,7 +688,7 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
         xmlFree(str);
         return(-1);
     }
-        
+
     ret = xmlSecKeyDataBinaryValueSetBuffer(data, (xmlSecByte*)str, len);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -711,7 +711,7 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
         xmlSecKeyDataDestroy(data);
         return(0);
     }
-    
+
     ret = xmlSecKeySetValue(key, data);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -726,25 +726,25 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueXmlWrite:
  * @id:                 the data klass.
  * @key:                the pointer to source key.
  * @node:               the pointer to an XML node.
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
  *
- * Base64 encodes binary key data of klass @id from the @key and 
- * sets to the @node content. 
- * 
+ * Base64 encodes binary key data of klass @id from the @key and
+ * sets to the @node content.
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
-xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, 
+int
+xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                             xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecBufferPtr buffer;
     xmlSecKeyDataPtr value;
     xmlChar* str;
-    
+
     xmlSecAssert2(id != xmlSecKeyDataIdUnknown, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -753,7 +753,7 @@ xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     if((xmlSecKeyDataTypeSymmetric & keyInfoCtx->keyReq.keyType) == 0) {
         /* we can have only symmetric key */
         return(0);
-    }    
+    }
 
     value = xmlSecKeyGetValue(key);
     xmlSecAssert2(xmlSecKeyDataIsValid(value), -1);
@@ -765,19 +765,19 @@ xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                              xmlSecBufferGetSize(buffer),
                              keyInfoCtx->base64LineSize);
     if(str == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecBase64Encode",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
     xmlNodeSetContent(node, str);
     xmlFree(str);
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueBinRead:
  * @id:                 the data klass.
  * @key:                the pointer to destination key.
@@ -786,16 +786,16 @@ xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
  *
  * Reads binary key data of the klass @id from @buf to the @key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
-xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key, 
-                                const xmlSecByte* buf, xmlSecSize bufSize, 
+int
+xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
+                                const xmlSecByte* buf, xmlSecSize bufSize,
                                 xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataPtr data;
     int ret;
-    
+
     xmlSecAssert2(id != xmlSecKeyDataIdUnknown, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(buf != NULL, -1);
@@ -806,17 +806,17 @@ xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     data = xmlSecKeyGetValue(key);
     if(data != NULL) {
         xmlSecBufferPtr buffer;
-        
+
         if(!xmlSecKeyDataCheckId(data, id)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                         XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1); 
+            return(-1);
         }
-        
-        buffer = xmlSecKeyDataBinaryValueGetBuffer(data);       
+
+        buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
         if((buffer != NULL) && ((xmlSecSize)xmlSecBufferGetSize(buffer) != bufSize)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
@@ -824,7 +824,7 @@ xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
                         "cur-data-size=%d;new-data-size=%d",
                         xmlSecBufferGetSize(buffer), bufSize);
-            return(-1);         
+            return(-1);
         }
         if((buffer != NULL) && (bufSize > 0) && (memcmp(xmlSecBufferGetData(buffer), buf, bufSize) != 0)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -832,16 +832,16 @@ xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                         XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
                         "key already has a different value");
-            return(-1);         
+            return(-1);
         }
         if(buffer != NULL) {
             /* we already have exactly the same key */
             return(0);
         }
-        
+
         /* we have binary key value with empty buffer */
     }
-    
+
     data = xmlSecKeyDataCreate(id);
     if(data == NULL ) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -851,7 +851,7 @@ xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     ret = xmlSecKeyDataBinaryValueSetBuffer(data, buf, bufSize);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -872,7 +872,7 @@ xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
         xmlSecKeyDataDestroy(data);
         return(0);
     }
-    
+
     ret = xmlSecKeySetValue(key, data);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -887,7 +887,7 @@ xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueBinWrite:
  * @id:                 the data klass.
  * @key:                the pointer to source key.
@@ -896,12 +896,12 @@ xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> element processing context.
  *
  * Writes binary key data of klass @id from the @key to @buf.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
-xmlSecKeyDataBinaryValueBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, 
-                                xmlSecByte** buf, xmlSecSize* bufSize, 
+int
+xmlSecKeyDataBinaryValueBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
+                                xmlSecByte** buf, xmlSecSize* bufSize,
                                 xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataPtr value;
     xmlSecBufferPtr buffer;
@@ -915,7 +915,7 @@ xmlSecKeyDataBinaryValueBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     if((xmlSecKeyDataTypeSymmetric & keyInfoCtx->keyReq.keyType) == 0) {
         /* we can have only symmetric key */
         return(0);
-    }    
+    }
 
     value = xmlSecKeyGetValue(key);
     xmlSecAssert2(xmlSecKeyDataIsValid(value), -1);
@@ -933,21 +933,21 @@ xmlSecKeyDataBinaryValueBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    memcpy((*buf), xmlSecBufferGetData(buffer), (*bufSize));    
+    memcpy((*buf), xmlSecBufferGetData(buffer), (*bufSize));
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueDebugDump:
  * @data:               the pointer to binary key data.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints binary key data debug information to @output.
  */
-void 
+void
 xmlSecKeyDataBinaryValueDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert(xmlSecKeyDataIsValid(data));
     xmlSecAssert(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize));
     xmlSecAssert(data->id->dataNodeName != NULL);
@@ -956,19 +956,19 @@ xmlSecKeyDataBinaryValueDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert(buffer != NULL);
 
-    /* print only size, everything else is sensitive */    
-    fprintf(output, "=== %s: size=%d\n", data->id->dataNodeName, 
+    /* print only size, everything else is sensitive */
+    fprintf(output, "=== %s: size=%d\n", data->id->dataNodeName,
                                          xmlSecKeyDataGetSize(data));
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueDebugXmlDump:
  * @data:               the pointer to binary key data.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints binary key data debug information to @output in XML format.
  */
-void 
+void
 xmlSecKeyDataBinaryValueDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecBufferPtr buffer;
 
@@ -979,13 +979,13 @@ xmlSecKeyDataBinaryValueDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
 
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert(buffer != NULL);
-    
-    /* print only size, everything else is sensitive */    
-    fprintf(output, "<%s size=\"%d\" />\n", data->id->dataNodeName, 
+
+    /* print only size, everything else is sensitive */
+    fprintf(output, "<%s size=\"%d\" />\n", data->id->dataNodeName,
                                             xmlSecKeyDataGetSize(data));
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueGetSize:
  * @data:               the pointer to binary key data.
  *
@@ -1003,11 +1003,11 @@ xmlSecKeyDataBinaryValueGetSize(xmlSecKeyDataPtr data) {
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, 0);
 
-    /* return size in bits */    
-    return(8 * xmlSecBufferGetSize(buffer));    
+    /* return size in bits */
+    return(8 * xmlSecBufferGetSize(buffer));
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueGetBuffer:
  * @data:               the pointer to binary key data.
  *
@@ -1015,7 +1015,7 @@ xmlSecKeyDataBinaryValueGetSize(xmlSecKeyDataPtr data) {
  *
  * Returns: pointer to binary key data buffer.
  */
-xmlSecBufferPtr 
+xmlSecBufferPtr
 xmlSecKeyDataBinaryValueGetBuffer(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataIsValid(data), NULL);
     xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecKeyDataBinarySize), NULL);
@@ -1024,18 +1024,18 @@ xmlSecKeyDataBinaryValueGetBuffer(xmlSecKeyDataPtr data) {
     return((xmlSecBufferPtr)(((xmlSecByte*)data) + sizeof(xmlSecKeyData)));
 }
 
-/** 
+/**
  * xmlSecKeyDataBinaryValueSetBuffer:
  * @data:               the pointer to binary key data.
  * @buf:                the pointer to binary buffer.
  * @bufSize:            the binary buffer size.
  *
  * Sets the value of @data to @buf.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecKeyDataBinaryValueSetBuffer(xmlSecKeyDataPtr data, 
+xmlSecKeyDataBinaryValueSetBuffer(xmlSecKeyDataPtr data,
                         const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
 
@@ -1065,12 +1065,12 @@ static xmlSecPtrListKlass xmlSecKeyDataListKlass = {
 
 /**
  * xmlSecKeyDataListGetKlass:
- * 
+ *
  * The key data list klass.
  *
  * Returns: pointer to the key data list klass.
  */
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecKeyDataListGetKlass(void) {
     return(&xmlSecKeyDataListKlass);
 }
@@ -1091,12 +1091,12 @@ static xmlSecPtrListKlass xmlSecKeyDataIdListKlass = {
 
 /**
  * xmlSecKeyDataIdListGetKlass:
- * 
+ *
  * The key data id list klass.
  *
  * Returns: pointer to the key data id list klass.
  */
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecKeyDataIdListGetKlass(void) {
     return(&xmlSecKeyDataIdListKlass);
 }
@@ -1111,13 +1111,13 @@ xmlSecKeyDataIdListGetKlass(void) {
  * Returns: 1 if @dataId is found in the @list, 0 if not and a negative
  * value if an error occurs.
  */
-int 
+int
 xmlSecKeyDataIdListFind(xmlSecPtrListPtr list, xmlSecKeyDataId dataId) {
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId), 0);
     xmlSecAssert2(dataId != NULL, 0);
-    
+
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         if((xmlSecKeyDataId)xmlSecPtrListGetItem(list, i) == dataId) {
@@ -1127,27 +1127,27 @@ xmlSecKeyDataIdListFind(xmlSecPtrListPtr list, xmlSecKeyDataId dataId) {
     return(0);
 }
 
-/** 
+/**
  * xmlSecKeyDataIdListFindByNode:
  * @list:               the pointer to key data ids list.
  * @nodeName:           the desired key data klass XML node name.
  * @nodeNs:             the desired key data klass XML node namespace.
  * @usage:              the desired key data usage.
  *
- * Lookups data klass in the list with given @nodeName, @nodeNs and 
+ * Lookups data klass in the list with given @nodeName, @nodeNs and
  * @usage in the @list.
  *
  * Returns: key data klass is found and NULL otherwise.
- */ 
-xmlSecKeyDataId 
+ */
+xmlSecKeyDataId
 xmlSecKeyDataIdListFindByNode(xmlSecPtrListPtr list, const xmlChar* nodeName,
                             const xmlChar* nodeNs, xmlSecKeyDataUsage usage) {
     xmlSecKeyDataId dataId;
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId), xmlSecKeyDataIdUnknown);
     xmlSecAssert2(nodeName != NULL, xmlSecKeyDataIdUnknown);
-    
+
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
@@ -1156,14 +1156,14 @@ xmlSecKeyDataIdListFindByNode(xmlSecPtrListPtr list, const xmlChar* nodeName,
         if(((usage & dataId->usage) != 0) &&
            xmlStrEqual(nodeName, dataId->dataNodeName) &&
            xmlStrEqual(nodeNs, dataId->dataNodeNs)) {
-            
-           return(dataId);         
+
+           return(dataId);
         }
     }
     return(xmlSecKeyDataIdUnknown);
 }
 
-/** 
+/**
  * xmlSecKeyDataIdListFindByHref:
  * @list:               the pointer to key data ids list.
  * @href:               the desired key data klass href.
@@ -1172,16 +1172,16 @@ xmlSecKeyDataIdListFindByNode(xmlSecPtrListPtr list, const xmlChar* nodeName,
  * Lookups data klass in the list with given @href and @usage in @list.
  *
  * Returns: key data klass is found and NULL otherwise.
- */ 
-xmlSecKeyDataId 
+ */
+xmlSecKeyDataId
 xmlSecKeyDataIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href,
                             xmlSecKeyDataUsage usage) {
     xmlSecKeyDataId dataId;
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId), xmlSecKeyDataIdUnknown);
     xmlSecAssert2(href != NULL, xmlSecKeyDataIdUnknown);
-    
+
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
@@ -1189,14 +1189,14 @@ xmlSecKeyDataIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href,
 
         if(((usage & dataId->usage) != 0) && (dataId->href != NULL) &&
            xmlStrEqual(href, dataId->href)) {
-           
-           return(dataId);         
+
+           return(dataId);
         }
     }
     return(xmlSecKeyDataIdUnknown);
 }
 
-/** 
+/**
  * xmlSecKeyDataIdListFindByName:
  * @list:               the pointer to key data ids list.
  * @name:               the desired key data klass name.
@@ -1205,42 +1205,42 @@ xmlSecKeyDataIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href,
  * Lookups data klass in the list with given @name and @usage in @list.
  *
  * Returns: key data klass is found and NULL otherwise.
- */ 
-xmlSecKeyDataId 
-xmlSecKeyDataIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name, 
+ */
+xmlSecKeyDataId
+xmlSecKeyDataIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name,
                             xmlSecKeyDataUsage usage) {
     xmlSecKeyDataId dataId;
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId), xmlSecKeyDataIdUnknown);
     xmlSecAssert2(name != NULL, xmlSecKeyDataIdUnknown);
-    
+
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
         xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, xmlSecKeyDataIdUnknown);
 
-        if(((usage & dataId->usage) != 0) && (dataId->name != NULL) && 
+        if(((usage & dataId->usage) != 0) && (dataId->name != NULL) &&
            xmlStrEqual(name, BAD_CAST dataId->name)) {
-           
-           return(dataId);         
+
+           return(dataId);
         }
     }
     return(xmlSecKeyDataIdUnknown);
 }
 
-/** 
+/**
  * xmlSecKeyDataIdListDebugDump:
  * @list:               the pointer to key data ids list.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints binary key data debug information to @output.
  */
-void 
+void
 xmlSecKeyDataIdListDebugDump(xmlSecPtrListPtr list, FILE* output) {
     xmlSecKeyDataId dataId;
     xmlSecSize i, size;
-    
+
     xmlSecAssert(xmlSecPtrListCheckId(list, xmlSecKeyDataIdListId));
     xmlSecAssert(output != NULL);
 
@@ -1249,24 +1249,24 @@ xmlSecKeyDataIdListDebugDump(xmlSecPtrListPtr list, FILE* output) {
         dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
         xmlSecAssert(dataId != NULL);
         xmlSecAssert(dataId->name != NULL);
-            
+
         if(i > 0) {
             fprintf(output, ",\"%s\"", dataId->name);
         } else {
             fprintf(output, "\"%s\"", dataId->name);
-        }           
+        }
     }
     fprintf(output, "\n");
 }
 
-/** 
+/**
  * xmlSecKeyDataIdListDebugXmlDump:
  * @list:               the pointer to key data ids list.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints binary key data debug information to @output in XML format.
  */
-void 
+void
 xmlSecKeyDataIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
     xmlSecKeyDataId dataId;
     xmlSecSize i, size;
@@ -1280,7 +1280,7 @@ xmlSecKeyDataIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
         dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
         xmlSecAssert(dataId != NULL);
         xmlSecAssert(dataId->name != NULL);
-            
+
         fprintf(output, "<DataId name=\"");
         xmlSecPrintXmlString(output, dataId->name);
         fprintf(output, "\"/>");
@@ -1303,14 +1303,14 @@ xmlSecKeyDataIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
  * Returns: the pointer to newly allocated key data store structure
  * or NULL if an error occurs.
  */
-xmlSecKeyDataStorePtr   
+xmlSecKeyDataStorePtr
 xmlSecKeyDataStoreCreate(xmlSecKeyDataStoreId id)  {
     xmlSecKeyDataStorePtr store;
     int ret;
-        
+
     xmlSecAssert2(id != NULL, NULL);
     xmlSecAssert2(id->objSize > 0, NULL);
-        
+
     /* Allocate a new xmlSecKeyDataStore and fill the fields. */
     store = (xmlSecKeyDataStorePtr)xmlMalloc(id->objSize);
     if(store == NULL) {
@@ -1318,10 +1318,10 @@ xmlSecKeyDataStoreCreate(xmlSecKeyDataStoreId id)  {
                     xmlSecErrorsSafeString(xmlSecKeyDataStoreKlassGetName(id)),
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "size=%d", id->objSize); 
+                    "size=%d", id->objSize);
         return(NULL);
     }
-    memset(store, 0, id->objSize);    
+    memset(store, 0, id->objSize);
     store->id = id;
 
     if(id->initialize != NULL) {
@@ -1336,7 +1336,7 @@ xmlSecKeyDataStoreCreate(xmlSecKeyDataStoreId id)  {
             return(NULL);
         }
     }
-    
+
     return(store);
 }
 
@@ -1349,10 +1349,10 @@ xmlSecKeyDataStoreCreate(xmlSecKeyDataStoreId id)  {
  */
 void
 xmlSecKeyDataStoreDestroy(xmlSecKeyDataStorePtr store) {
-    xmlSecAssert(xmlSecKeyDataStoreIsValid(store));    
+    xmlSecAssert(xmlSecKeyDataStoreIsValid(store));
     xmlSecAssert(store->id->objSize > 0);
-    
-    if(store->id->finalize != NULL) {  
+
+    if(store->id->finalize != NULL) {
         (store->id->finalize)(store);
     }
     memset(store, 0, store->id->objSize);
@@ -1374,12 +1374,12 @@ static xmlSecPtrListKlass xmlSecKeyDataStorePtrListKlass = {
 
 /**
  * xmlSecKeyDataStorePtrListGetKlass:
- * 
+ *
  * Key data stores list.
  *
  * Returns: key data stores list klass.
  */
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecKeyDataStorePtrListGetKlass(void) {
     return(&xmlSecKeyDataStorePtrListKlass);
 }
diff --git a/src/keysmngr.c b/src/keysmngr.c
index 6d79b71..9eef64d 100644
--- a/src/keysmngr.c
+++ b/src/keysmngr.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Keys Manager
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -31,20 +31,20 @@
  * Keys Manager
  *
  ***************************************************************************/
-/** 
+/**
  * xmlSecKeysMngrCreate:
- * 
- * Creates new keys manager. Caller is responsible for freeing it with 
+ *
+ * Creates new keys manager. Caller is responsible for freeing it with
  * #xmlSecKeysMngrDestroy function.
- * 
- * Returns: the pointer to newly allocated keys manager or NULL if 
+ *
+ * Returns: the pointer to newly allocated keys manager or NULL if
  * an error occurs.
  */
-xmlSecKeysMngrPtr 
+xmlSecKeysMngrPtr
 xmlSecKeysMngrCreate(void) {
     xmlSecKeysMngrPtr mngr;
     int ret;
-    
+
     /* Allocate a new xmlSecKeysMngr and fill the fields. */
     mngr = (xmlSecKeysMngrPtr)xmlMalloc(sizeof(xmlSecKeysMngr));
     if(mngr == NULL) {
@@ -52,11 +52,11 @@ xmlSecKeysMngrCreate(void) {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecKeysMngr)=%d", 
+                    "sizeof(xmlSecKeysMngr)=%d",
                     sizeof(xmlSecKeysMngr));
         return(NULL);
     }
-    memset(mngr, 0, sizeof(xmlSecKeysMngr));    
+    memset(mngr, 0, sizeof(xmlSecKeysMngr));
 
     ret = xmlSecPtrListInitialize(&(mngr->storesList), xmlSecKeyDataStorePtrListId);
     if(ret < 0) {
@@ -68,10 +68,10 @@ xmlSecKeysMngrCreate(void) {
         return(NULL);
     }
 
-    return(mngr);    
+    return(mngr);
 }
 
-/** 
+/**
  * xmlSecKeysMngrDestroy:
  * @mngr:               the pointer to keys manager.
  *
@@ -85,12 +85,12 @@ xmlSecKeysMngrDestroy(xmlSecKeysMngrPtr mngr) {
     if(mngr->keysStore != NULL) {
         xmlSecKeyStoreDestroy(mngr->keysStore);
     }
-    
+
     /* destroy other data stores */
     xmlSecPtrListFinalize(&(mngr->storesList));
 
-    memset(mngr, 0, sizeof(xmlSecKeysMngr));    
-    xmlFree(mngr);    
+    memset(mngr, 0, sizeof(xmlSecKeysMngr));
+    xmlFree(mngr);
 }
 
 /**
@@ -99,7 +99,7 @@ xmlSecKeysMngrDestroy(xmlSecKeysMngrPtr mngr) {
  * @name:               the desired key name.
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> node processing context.
  *
- * Lookups key in the keys manager keys store. The caller is responsible 
+ * Lookups key in the keys manager keys store. The caller is responsible
  * for destroying the returned key using #xmlSecKeyDestroy method.
  *
  * Returns: the pointer to a key or NULL if key is not found or an error occurs.
@@ -107,16 +107,16 @@ xmlSecKeysMngrDestroy(xmlSecKeysMngrPtr mngr) {
 xmlSecKeyPtr
 xmlSecKeysMngrFindKey(xmlSecKeysMngrPtr mngr, const xmlChar* name, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyStorePtr store;
-    
+
     xmlSecAssert2(mngr != NULL, NULL);
     xmlSecAssert2(keyInfoCtx != NULL, NULL);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         /* no store. is it an error? */
         return(NULL);
     }
-    
+
     return(xmlSecKeyStoreFindKey(store, name, keyInfoCtx));
 }
 
@@ -133,12 +133,12 @@ int
 xmlSecKeysMngrAdoptKeysStore(xmlSecKeysMngrPtr mngr, xmlSecKeyStorePtr store) {
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(xmlSecKeyStoreIsValid(store), -1);
-    
+
     if(mngr->keysStore != NULL) {
         xmlSecKeyStoreDestroy(mngr->keysStore);
     }
     mngr->keysStore = store;
-    
+
     return(0);
 }
 
@@ -148,13 +148,13 @@ xmlSecKeysMngrAdoptKeysStore(xmlSecKeysMngrPtr mngr, xmlSecKeyStorePtr store) {
  *
  * Gets the keys store.
  *
- * Returns: the keys store in the keys manager @mngr or NULL if 
+ * Returns: the keys store in the keys manager @mngr or NULL if
  * there is no store or an error occurs.
  */
 xmlSecKeyStorePtr
 xmlSecKeysMngrGetKeysStore(xmlSecKeysMngrPtr mngr) {
     xmlSecAssert2(mngr != NULL, NULL);
-    
+
     return(mngr->keysStore);
 }
 
@@ -171,18 +171,18 @@ int
 xmlSecKeysMngrAdoptDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStorePtr store) {
     xmlSecKeyDataStorePtr tmp;
     xmlSecSize pos, size;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataStoreIsValid(store), -1);
 
     size = xmlSecPtrListGetSize(&(mngr->storesList));
     for(pos = 0; pos < size; ++pos) {
         tmp = (xmlSecKeyDataStorePtr)xmlSecPtrListGetItem(&(mngr->storesList), pos);
-        if((tmp != NULL) && (tmp->id == store->id)) {   
+        if((tmp != NULL) && (tmp->id == store->id)) {
             return(xmlSecPtrListSet(&(mngr->storesList), store, pos));
         }
     }
-    
+
     return(xmlSecPtrListAdd(&(mngr->storesList), store));
 }
 
@@ -197,22 +197,22 @@ xmlSecKeysMngrAdoptDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStorePtr store
  * Returns: pointer to data store or NULL if it is not found or an error
  * occurs.
  */
-xmlSecKeyDataStorePtr 
+xmlSecKeyDataStorePtr
 xmlSecKeysMngrGetDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStoreId id) {
     xmlSecKeyDataStorePtr tmp;
     xmlSecSize pos, size;
-    
+
     xmlSecAssert2(mngr != NULL, NULL);
     xmlSecAssert2(id != xmlSecKeyDataStoreIdUnknown, NULL);
 
     size = xmlSecPtrListGetSize(&(mngr->storesList));
     for(pos = 0; pos < size; ++pos) {
         tmp = (xmlSecKeyDataStorePtr)xmlSecPtrListGetItem(&(mngr->storesList), pos);
-        if((tmp != NULL) && (tmp->id == id)) {  
+        if((tmp != NULL) && (tmp->id == id)) {
             return(tmp);
         }
     }
-    
+
     return(NULL);
 }
 
@@ -230,14 +230,14 @@ xmlSecKeysMngrGetDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStoreId id) {
  *
  * Returns: the pointer to newly allocated keys store or NULL if an error occurs.
  */
-xmlSecKeyStorePtr       
+xmlSecKeyStorePtr
 xmlSecKeyStoreCreate(xmlSecKeyStoreId id)  {
     xmlSecKeyStorePtr store;
     int ret;
-        
+
     xmlSecAssert2(id != NULL, NULL);
     xmlSecAssert2(id->objSize > 0, NULL);
-        
+
     /* Allocate a new xmlSecKeyStore and fill the fields. */
     store = (xmlSecKeyStorePtr)xmlMalloc(id->objSize);
     if(store == NULL) {
@@ -245,10 +245,10 @@ xmlSecKeyStoreCreate(xmlSecKeyStoreId id)  {
                     xmlSecErrorsSafeString(xmlSecKeyStoreKlassGetName(id)),
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "size=%d", id->objSize); 
+                    "size=%d", id->objSize);
         return(NULL);
     }
-    memset(store, 0, id->objSize);    
+    memset(store, 0, id->objSize);
     store->id = id;
 
     if(id->initialize != NULL) {
@@ -263,22 +263,22 @@ xmlSecKeyStoreCreate(xmlSecKeyStoreId id)  {
             return(NULL);
         }
     }
-    
+
     return(store);
 }
 
 /**
  * xmlSecKeyStoreDestroy:
- * @store:              the pointer to keys store. 
+ * @store:              the pointer to keys store.
  *
  * Destroys the store created with #xmlSecKeyStoreCreate function.
  */
 void
 xmlSecKeyStoreDestroy(xmlSecKeyStorePtr store) {
-    xmlSecAssert(xmlSecKeyStoreIsValid(store));    
+    xmlSecAssert(xmlSecKeyStoreIsValid(store));
     xmlSecAssert(store->id->objSize > 0);
-    
-    if(store->id->finalize != NULL) {  
+
+    if(store->id->finalize != NULL) {
         (store->id->finalize)(store);
     }
     memset(store, 0, store->id->objSize);
@@ -291,14 +291,14 @@ xmlSecKeyStoreDestroy(xmlSecKeyStorePtr store) {
  * @name:               the desired key name.
  * @keyInfoCtx:         the pointer to <dsig:KeyInfo/> node processing context.
  *
- * Lookups key in the store. The caller is responsible for destroying 
+ * Lookups key in the store. The caller is responsible for destroying
  * the returned key using #xmlSecKeyDestroy method.
  *
  * Returns: the pointer to a key or NULL if key is not found or an error occurs.
  */
 xmlSecKeyPtr
 xmlSecKeyStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name, xmlSecKeyInfoCtxPtr keyInfoCtx) {
-    xmlSecAssert2(xmlSecKeyStoreIsValid(store), NULL);    
+    xmlSecAssert2(xmlSecKeyStoreIsValid(store), NULL);
     xmlSecAssert2(store->id->findKey != NULL, NULL);
     xmlSecAssert2(keyInfoCtx != NULL, NULL);
 
@@ -308,7 +308,7 @@ xmlSecKeyStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name, xmlSecKeyInf
 /****************************************************************************
  *
  * Simple Keys Store
- * 
+ *
  * keys list (xmlSecPtrList) is located after xmlSecKeyStore
  *
  ***************************************************************************/
@@ -321,8 +321,8 @@ xmlSecKeyStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name, xmlSecKeyInf
 
 static int                      xmlSecSimpleKeysStoreInitialize (xmlSecKeyStorePtr store);
 static void                     xmlSecSimpleKeysStoreFinalize   (xmlSecKeyStorePtr store);
-static xmlSecKeyPtr             xmlSecSimpleKeysStoreFindKey    (xmlSecKeyStorePtr store, 
-                                                                 const xmlChar* name, 
+static xmlSecKeyPtr             xmlSecSimpleKeysStoreFindKey    (xmlSecKeyStorePtr store,
+                                                                 const xmlChar* name,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
 
 static xmlSecKeyStoreKlass xmlSecSimpleKeysStoreKlass = {
@@ -330,8 +330,8 @@ static xmlSecKeyStoreKlass xmlSecSimpleKeysStoreKlass = {
     xmlSecSimpleKeysStoreSize,
 
     /* data */
-    BAD_CAST "simple-keys-store",               /* const xmlChar* name; */ 
-        
+    BAD_CAST "simple-keys-store",               /* const xmlChar* name; */
+
     /* constructors/destructor */
     xmlSecSimpleKeysStoreInitialize,            /* xmlSecKeyStoreInitializeMethod initialize; */
     xmlSecSimpleKeysStoreFinalize,              /* xmlSecKeyStoreFinalizeMethod finalize; */
@@ -344,12 +344,12 @@ static xmlSecKeyStoreKlass xmlSecSimpleKeysStoreKlass = {
 
 /**
  * xmlSecSimpleKeysStoreGetKlass:
- * 
+ *
  * The simple list based keys store klass.
  *
  * Returns: simple list based keys store klass.
  */
-xmlSecKeyStoreId 
+xmlSecKeyStoreId
 xmlSecSimpleKeysStoreGetKlass(void) {
     return(&xmlSecSimpleKeysStoreKlass);
 }
@@ -358,16 +358,16 @@ xmlSecSimpleKeysStoreGetKlass(void) {
  * xmlSecSimpleKeysStoreAdoptKey:
  * @store:              the pointer to simple keys store.
  * @key:                the pointer to key.
- * 
- * Adds @key to the @store. 
+ *
+ * Adds @key to the @store.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecSimpleKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
     xmlSecPtrListPtr list;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId), -1);
     xmlSecAssert2(key != NULL, -1);
 
@@ -387,18 +387,18 @@ xmlSecSimpleKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
     return(0);
 }
 
-/** 
+/**
  * xmlSecSimpleKeysStoreLoad:
  * @store:              the pointer to simple keys store.
  * @uri:                the filename.
- * @keysMngr:           the pointer to associated keys manager. 
- * 
+ * @keysMngr:           the pointer to associated keys manager.
+ *
  * Reads keys from an XML file.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
 int
-xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri, 
+xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
                             xmlSecKeysMngrPtr keysMngr) {
     xmlDocPtr doc;
     xmlNodePtr root;
@@ -408,7 +408,7 @@ xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
     int ret;
 
     xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId), -1);
-    xmlSecAssert2(uri != NULL, -1);    
+    xmlSecAssert2(uri != NULL, -1);
 
     doc = xmlParseFile(uri);
     if(doc == NULL) {
@@ -416,11 +416,11 @@ xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
                     xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
                     "xmlParseFile",
                     XMLSEC_ERRORS_R_XML_FAILED,
-                    "uri=%s", 
+                    "uri=%s",
                     xmlSecErrorsSafeString(uri));
         return(-1);
     }
-    
+
     root = xmlDocGetRootElement(doc);
     if(!xmlSecCheckNodeName(root, BAD_CAST "Keys", xmlSecNs)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -431,9 +431,9 @@ xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
         xmlFreeDoc(doc);
         return(-1);
     }
-        
+
     cur = xmlSecGetNextElementNode(root->children);
-    while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {  
+    while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {
         key = xmlSecKeyCreate();
         if(key == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -457,7 +457,7 @@ xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
             xmlFreeDoc(doc);
             return(-1);
         }
-        
+
         keyInfoCtx.mode           = xmlSecKeyInfoModeRead;
         keyInfoCtx.keysMngr       = keysMngr;
         keyInfoCtx.flags          = XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND |
@@ -479,7 +479,7 @@ xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
             return(-1);
         }
         xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
-        
+
         if(xmlSecKeyIsValid(key)) {
             ret = xmlSecSimpleKeysStoreAdoptKey(store, key);
             if(ret < 0) {
@@ -498,7 +498,7 @@ xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
         }
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
@@ -506,20 +506,20 @@ xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
                     XMLSEC_ERRORS_R_UNEXPECTED_NODE,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFreeDoc(doc);
-        return(-1);         
+        return(-1);
     }
-    
+
     xmlFreeDoc(doc);
     return(0);
 
 }
 
-/** 
+/**
  * xmlSecSimpleKeysStoreSave:
  * @store:              the pointer to simple keys store.
  * @filename:           the filename.
  * @type:               the saved keys type (public, private, ...).
- * 
+ *
  * Writes keys from @store to an XML file.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -529,7 +529,7 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
     xmlSecKeyInfoCtx keyInfoCtx;
     xmlSecPtrListPtr list;
     xmlSecKeyPtr key;
-    xmlSecSize i, keysSize;    
+    xmlSecSize i, keysSize;
     xmlDocPtr doc;
     xmlNodePtr cur;
     xmlSecKeyDataPtr data;
@@ -539,7 +539,7 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
     int ret;
 
     xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId), -1);
-    xmlSecAssert2(filename != NULL, -1);    
+    xmlSecAssert2(filename != NULL, -1);
 
     list = xmlSecSimpleKeysStoreGetList(store);
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecKeyPtrListId), -1);
@@ -554,16 +554,16 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
-    idsList = xmlSecKeyDataIdsGet();    
+
+    idsList = xmlSecKeyDataIdsGet();
     xmlSecAssert2(idsList != NULL, -1);
-        
+
     keysSize = xmlSecPtrListGetSize(list);
     idsSize = xmlSecPtrListGetSize(idsList);
     for(i = 0; i < keysSize; ++i) {
         key = (xmlSecKeyPtr)xmlSecPtrListGetItem(list, i);
         xmlSecAssert2(key != NULL, -1);
-            
+
         cur = xmlSecAddChild(xmlDocGetRootElement(doc), xmlSecNodeKeyInfo, xmlSecDSigNs);
         if(cur == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -572,7 +572,7 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
-            xmlFreeDoc(doc); 
+            xmlFreeDoc(doc);
             return(-1);
         }
 
@@ -585,11 +585,11 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             "node=%s",
                             xmlSecErrorsSafeString(xmlSecNodeKeyName));
-                xmlFreeDoc(doc); 
+                xmlFreeDoc(doc);
                 return(-1);
             }
         }
-    
+
         /* create nodes for other keys data */
         for(j = 0; j < idsSize; ++j) {
             dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(idsList, j);
@@ -598,7 +598,7 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
             if(dataId->dataNodeName == NULL) {
                 continue;
             }
-            
+
             data = xmlSecKeyGetData(key, dataId);
             if(data == NULL) {
                 continue;
@@ -609,9 +609,9 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
                             xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
                             "xmlSecAddChild",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                            "node=%s", 
+                            "node=%s",
                             xmlSecErrorsSafeString(dataId->dataNodeName));
-                xmlFreeDoc(doc); 
+                xmlFreeDoc(doc);
                 return(-1);
             }
         }
@@ -641,12 +641,12 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
-            xmlFreeDoc(doc); 
+            xmlFreeDoc(doc);
             return(-1);
-        }               
+        }
         xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
     }
-    
+
     /* now write result */
     ret = xmlSaveFormatFile(filename, doc, 1);
     if(ret < 0) {
@@ -654,26 +654,26 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
                     xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
                     "xmlSaveFormatFile",
                     XMLSEC_ERRORS_R_XML_FAILED,
-                    "filename=%s", 
+                    "filename=%s",
                     xmlSecErrorsSafeString(filename));
-        xmlFreeDoc(doc); 
+        xmlFreeDoc(doc);
         return(-1);
-    }      
-    
+    }
+
     xmlFreeDoc(doc);
     return(0);
 }
 
-/** 
+/**
  * xmlSecSimpleKeysStoreGetKeys:
  * @store:              the pointer to simple keys store.
- * 
+ *
  * Gets list of keys from simple keys store.
- * 
+ *
  * Returns: pointer to the list of keys stored in the keys store or NULL
  * if an error occurs.
  */
-xmlSecPtrListPtr 
+xmlSecPtrListPtr
 xmlSecSimpleKeysStoreGetKeys(xmlSecKeyStorePtr store) {
     xmlSecPtrListPtr list;
 
@@ -694,7 +694,7 @@ xmlSecSimpleKeysStoreInitialize(xmlSecKeyStorePtr store) {
 
     list = xmlSecSimpleKeysStoreGetList(store);
     xmlSecAssert2(list != NULL, -1);
-    
+
     ret = xmlSecPtrListInitialize(list, xmlSecKeyPtrListId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -705,23 +705,23 @@ xmlSecSimpleKeysStoreInitialize(xmlSecKeyStorePtr store) {
         return(-1);
     }
 
-    return(0);    
+    return(0);
 }
 
 static void
 xmlSecSimpleKeysStoreFinalize(xmlSecKeyStorePtr store) {
     xmlSecPtrListPtr list;
-    
+
     xmlSecAssert(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId));
-    
+
     list = xmlSecSimpleKeysStoreGetList(store);
     xmlSecAssert(list != NULL);
-    
+
     xmlSecPtrListFinalize(list);
 }
 
-static xmlSecKeyPtr 
-xmlSecSimpleKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name, 
+static xmlSecKeyPtr
+xmlSecSimpleKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
                             xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecPtrListPtr list;
     xmlSecKeyPtr key;
diff --git a/src/list.c b/src/list.c
index 10e2e2d..4ab2677 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1,18 +1,18 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * List of pointers.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
 
 #include <stdlib.h>
 #include <string.h>
- 
+
 #include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
@@ -22,21 +22,21 @@
 
 static int              xmlSecPtrListEnsureSize                 (xmlSecPtrListPtr list,
                                                                  xmlSecSize size);
-                                                                 
+
 static xmlSecAllocMode gAllocMode = xmlSecAllocModeDouble;
 static xmlSecSize gInitialSize = 64;
 
-/** 
+/**
  * xmlSecPtrListSetDefaultAllocMode:
  * @defAllocMode:       the new default memory allocation mode.
  * @defInitialSize:     the new default minimal initial size.
  *
  * Sets new default allocation mode and minimal initial list size.
  */
-void 
+void
 xmlSecPtrListSetDefaultAllocMode(xmlSecAllocMode defAllocMode, xmlSecSize defInitialSize) {
     xmlSecAssert(defInitialSize > 0);
-    
+
     gAllocMode = defAllocMode;
     gInitialSize = defInitialSize;
 }
@@ -44,19 +44,19 @@ xmlSecPtrListSetDefaultAllocMode(xmlSecAllocMode defAllocMode, xmlSecSize defIni
 /**
  * xmlSecPtrListCreate:
  * @id:                 the list klass.
- * 
+ *
  * Creates new list object. Caller is responsible for freeing returned list
  * by calling #xmlSecPtrListDestroy function.
  *
  * Returns: pointer to newly allocated list or NULL if an error occurs.
  */
-xmlSecPtrListPtr 
+xmlSecPtrListPtr
 xmlSecPtrListCreate(xmlSecPtrListId id) {
     xmlSecPtrListPtr list;
     int ret;
-    
+
     xmlSecAssert2(id != xmlSecPtrListIdUnknown, NULL);
-    
+
     /* Allocate a new xmlSecPtrList and fill the fields. */
     list = (xmlSecPtrListPtr)xmlMalloc(sizeof(xmlSecPtrList));
     if(list == NULL) {
@@ -64,11 +64,11 @@ xmlSecPtrListCreate(xmlSecPtrListId id) {
                     xmlSecErrorsSafeString(xmlSecPtrListKlassGetName(id)),
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecPtrList)=%d", 
+                    "sizeof(xmlSecPtrList)=%d",
                     sizeof(xmlSecPtrList));
         return(NULL);
     }
-    
+
     ret = xmlSecPtrListInitialize(list, id);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -79,8 +79,8 @@ xmlSecPtrListCreate(xmlSecPtrListId id) {
         xmlFree(list);
         return(NULL);
     }
-    
-    return(list);    
+
+    return(list);
 }
 
 /**
@@ -89,7 +89,7 @@ xmlSecPtrListCreate(xmlSecPtrListId id) {
  *
  * Destroys @list created with #xmlSecPtrListCreate function.
  */
-void 
+void
 xmlSecPtrListDestroy(xmlSecPtrListPtr list) {
     xmlSecAssert(xmlSecPtrListIsValid(list));
     xmlSecPtrListFinalize(list);
@@ -101,27 +101,27 @@ xmlSecPtrListDestroy(xmlSecPtrListPtr list) {
  * @list:               the pointer to list.
  * @id:                 the list klass.
  *
- * Initializes the list of given klass. Caller is responsible 
+ * Initializes the list of given klass. Caller is responsible
  * for cleaning up by calling #xmlSecPtrListFinalize function.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecPtrListInitialize(xmlSecPtrListPtr list, xmlSecPtrListId id) {
     xmlSecAssert2(id != xmlSecPtrListIdUnknown, -1);
     xmlSecAssert2(list != NULL, -1);
 
-    memset(list, 0, sizeof(xmlSecPtrList));    
+    memset(list, 0, sizeof(xmlSecPtrList));
     list->id = id;
     list->allocMode = gAllocMode;
-    
+
     return(0);
 }
 
 /**
  * xmlSecPtrListFinalize:
  * @list:               the pointer to list.
- *  
+ *
  * Cleans up the list initialized with #xmlSecPtrListInitialize
  * function.
  */
@@ -130,7 +130,7 @@ xmlSecPtrListFinalize(xmlSecPtrListPtr list) {
     xmlSecAssert(xmlSecPtrListIsValid(list));
 
     xmlSecPtrListEmpty(list);
-    memset(list, 0, sizeof(xmlSecPtrList));    
+    memset(list, 0, sizeof(xmlSecPtrList));
 }
 
 /**
@@ -139,13 +139,13 @@ xmlSecPtrListFinalize(xmlSecPtrListPtr list) {
  *
  * Remove all items from @list (if any).
  */
-void 
+void
 xmlSecPtrListEmpty(xmlSecPtrListPtr list) {
     xmlSecAssert(xmlSecPtrListIsValid(list));
 
     if(list->id->destroyItem != NULL) {
         xmlSecSize pos;
-        
+
         for(pos = 0; pos < list->use; ++pos) {
             xmlSecAssert(list->data != NULL);
             if(list->data[pos] != NULL) {
@@ -169,7 +169,7 @@ xmlSecPtrListEmpty(xmlSecPtrListPtr list) {
  * @src:                the pointer to source list.
  *
  * Copies @src list items to @dst list using #duplicateItem method
- * of the list klass. If #duplicateItem method is NULL then 
+ * of the list klass. If #duplicateItem method is NULL then
  * we jsut copy pointers to items.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -178,11 +178,11 @@ int
 xmlSecPtrListCopy(xmlSecPtrListPtr dst, xmlSecPtrListPtr src) {
     xmlSecSize i;
     int ret;
-    
+
     xmlSecAssert2(xmlSecPtrListIsValid(dst), -1);
     xmlSecAssert2(xmlSecPtrListIsValid(src), -1);
     xmlSecAssert2(dst->id == src->id, -1);
-    
+
     /* allocate memory */
     ret = xmlSecPtrListEnsureSize(dst, dst->use + src->use);
     if(ret < 0) {
@@ -194,11 +194,11 @@ xmlSecPtrListCopy(xmlSecPtrListPtr dst, xmlSecPtrListPtr src) {
         return(-1);
     }
 
-    /* copy one item after another */    
+    /* copy one item after another */
     for(i = 0; i < src->use; ++i, ++dst->use) {
         xmlSecAssert2(src->data != NULL, -1);
         xmlSecAssert2(dst->data != NULL, -1);
-        
+
         if((dst->id->duplicateItem != NULL) && (src->data[i] != NULL)) {
             dst->data[dst->use] = dst->id->duplicateItem(src->data[i]);
             if(dst->data[dst->use] == NULL) {
@@ -213,25 +213,25 @@ xmlSecPtrListCopy(xmlSecPtrListPtr dst, xmlSecPtrListPtr src) {
             dst->data[dst->use] = src->data[i];
         }
     }
-    
+
     return(0);
 }
 
 /**
  * xmlSecPtrListDuplicate:
  * @list:               the pointer to list.
- *  
+ *
  * Creates a new copy of @list and all its items.
  *
  * Returns: pointer to newly allocated list or NULL if an error occurs.
  */
-xmlSecPtrListPtr 
+xmlSecPtrListPtr
 xmlSecPtrListDuplicate(xmlSecPtrListPtr list) {
     xmlSecPtrListPtr newList;
     int ret;
-    
+
     xmlSecAssert2(xmlSecPtrListIsValid(list), NULL);
-    
+
     newList = xmlSecPtrListCreate(list->id);
     if(newList == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -241,7 +241,7 @@ xmlSecPtrListDuplicate(xmlSecPtrListPtr list) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     ret = xmlSecPtrListCopy(newList, list);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -260,13 +260,13 @@ xmlSecPtrListDuplicate(xmlSecPtrListPtr list) {
  * @list:               the pointer to list.
  *
  * Gets list size.
- * 
+ *
  * Returns: the number of itmes in @list.
  */
-xmlSecSize      
+xmlSecSize
 xmlSecPtrListGetSize(xmlSecPtrListPtr list) {
     xmlSecAssert2(xmlSecPtrListIsValid(list), 0);
-    
+
     return(list->use);
 }
 
@@ -280,7 +280,7 @@ xmlSecPtrListGetSize(xmlSecPtrListPtr list) {
  * Returns: the list item at position @pos or NULL if @pos is greater
  * than the number of items in the list or an error occurs.
  */
-xmlSecPtr 
+xmlSecPtr
 xmlSecPtrListGetItem(xmlSecPtrListPtr list, xmlSecSize pos) {
     xmlSecAssert2(xmlSecPtrListIsValid(list), NULL);
     xmlSecAssert2(list->data != NULL, NULL);
@@ -298,12 +298,12 @@ xmlSecPtrListGetItem(xmlSecPtrListPtr list, xmlSecSize pos) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecPtrListAdd(xmlSecPtrListPtr list, xmlSecPtr item) {
     int ret;
-    
+
     xmlSecAssert2(xmlSecPtrListIsValid(list), -1);
-    
+
     ret = xmlSecPtrListEnsureSize(list, list->use + 1);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -313,7 +313,7 @@ xmlSecPtrListAdd(xmlSecPtrListPtr list, xmlSecPtr item) {
                     "size=%d", list->use + 1);
         return(-1);
     }
-    
+
     list->data[list->use++] = item;
     return(0);
 }
@@ -329,7 +329,7 @@ xmlSecPtrListAdd(xmlSecPtrListPtr list, xmlSecPtr item) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecPtrListSet(xmlSecPtrListPtr list, xmlSecPtr item, xmlSecSize pos) {
     xmlSecAssert2(xmlSecPtrListIsValid(list), -1);
     xmlSecAssert2(list->data != NULL, -1);
@@ -351,7 +351,7 @@ xmlSecPtrListSet(xmlSecPtrListPtr list, xmlSecPtr item, xmlSecSize pos) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecPtrListRemove(xmlSecPtrListPtr list, xmlSecSize pos) {
     xmlSecAssert2(xmlSecPtrListIsValid(list), -1);
     xmlSecAssert2(list->data != NULL, -1);
@@ -374,21 +374,21 @@ xmlSecPtrListRemove(xmlSecPtrListPtr list, xmlSecSize pos) {
  *
  * Prints debug information about @list to the @output.
  */
-void 
+void
 xmlSecPtrListDebugDump(xmlSecPtrListPtr list, FILE* output) {
     xmlSecAssert(xmlSecPtrListIsValid(list));
     xmlSecAssert(output != NULL);
 
-    fprintf(output, "=== list size: %d\n", list->use);    
+    fprintf(output, "=== list size: %d\n", list->use);
     if(list->id->debugDumpItem != NULL) {
         xmlSecSize pos;
-        
+
         for(pos = 0; pos < list->use; ++pos) {
             xmlSecAssert(list->data != NULL);
             if(list->data[pos] != NULL) {
                 list->id->debugDumpItem(list->data[pos], output);
             }
-        }       
+        }
     }
 }
 
@@ -399,32 +399,32 @@ xmlSecPtrListDebugDump(xmlSecPtrListPtr list, FILE* output) {
  *
  * Prints debug information about @list to the @output in XML format.
  */
-void 
+void
 xmlSecPtrListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
     xmlSecAssert(xmlSecPtrListIsValid(list));
     xmlSecAssert(output != NULL);
-    
-    fprintf(output, "<List size=\"%d\">\n", list->use);    
+
+    fprintf(output, "<List size=\"%d\">\n", list->use);
     if(list->id->debugXmlDumpItem != NULL) {
         xmlSecSize pos;
-        
+
         for(pos = 0; pos < list->use; ++pos) {
             xmlSecAssert(list->data != NULL);
             if(list->data[pos] != NULL) {
                 list->id->debugXmlDumpItem(list->data[pos], output);
             }
-        }       
+        }
     }
-    fprintf(output, "</List>\n");    
+    fprintf(output, "</List>\n");
 }
 
-static int 
+static int
 xmlSecPtrListEnsureSize(xmlSecPtrListPtr list, xmlSecSize size) {
     xmlSecPtr* newData;
     xmlSecSize newSize = 0;
 
     xmlSecAssert2(xmlSecPtrListIsValid(list), -1);
-    
+
     if(size < list->max) {
         return(0);
     }
@@ -437,11 +437,11 @@ xmlSecPtrListEnsureSize(xmlSecPtrListPtr list, xmlSecSize size) {
             newSize = 2 * size + 32;
             break;
     }
-    
+
     if(newSize < gInitialSize) {
         newSize = gInitialSize;
     }
-    
+
     if(list->data != NULL) {
         newData = (xmlSecPtr*)xmlRealloc(list->data, sizeof(xmlSecPtr) * newSize);
     } else {
@@ -452,14 +452,14 @@ xmlSecPtrListEnsureSize(xmlSecPtrListPtr list, xmlSecSize size) {
                     xmlSecErrorsSafeString(xmlSecPtrListGetName(list)),
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecPtr)*%d=%d", 
+                    "sizeof(xmlSecPtr)*%d=%d",
                     newSize, sizeof(xmlSecPtr) * newSize);
         return(-1);
     }
-    
+
     list->data = newData;
     list->max = newSize;
-    
+
     return(0);
 }
 
@@ -481,27 +481,27 @@ static xmlSecPtrListKlass xmlSecStringListKlass = {
 
 /**
  * xmlSecStringListGetKlass:
- * 
+ *
  * The strins list class.
  *
  * Returns: strings list klass.
  */
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecStringListGetKlass(void) {
     return(&xmlSecStringListKlass);
 }
 
-static xmlSecPtr 
+static xmlSecPtr
 xmlSecStringListDuplicateItem(xmlSecPtr ptr) {
     xmlSecAssert2(ptr != NULL, NULL);
-    
+
     return(xmlStrdup((xmlChar*)ptr));
 }
 
-static void 
+static void
 xmlSecStringListDestroyItem(xmlSecPtr ptr) {
     xmlSecAssert(ptr != NULL);
-    
+
     xmlFree(ptr);
 }
 
diff --git a/src/membuf.c b/src/membuf.c
index 56391a0..eb78156 100644
--- a/src/membuf.c
+++ b/src/membuf.c
@@ -1,18 +1,18 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Memory buffer transform
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
 
 #include <stdlib.h>
 #include <string.h>
- 
+
 #include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
@@ -28,9 +28,9 @@
 /*****************************************************************************
  *
  * Memory Buffer Transform
- * 
+ *
  * xmlSecBuffer is located after xmlSecTransform
- * 
+ *
  ****************************************************************************/
 #define xmlSecTransformMemBufSize \
         (sizeof(xmlSecTransform) + sizeof(xmlSecBuffer))
@@ -41,7 +41,7 @@
 
 static int              xmlSecTransformMemBufInitialize         (xmlSecTransformPtr transform);
 static void             xmlSecTransformMemBufFinalize           (xmlSecTransformPtr transform);
-static int              xmlSecTransformMemBufExecute            (xmlSecTransformPtr transform, 
+static int              xmlSecTransformMemBufExecute            (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
 static xmlSecTransformKlass xmlSecTransformMemBufKlass = {
@@ -73,12 +73,12 @@ static xmlSecTransformKlass xmlSecTransformMemBufKlass = {
 
 /**
  * xmlSecTransformMemBufGetKlass:
- * 
+ *
  * The memory buffer transorm (used to store the data that go through it).
  *
  * Returns: memory buffer transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformMemBufGetKlass(void) {
     return(&xmlSecTransformMemBufKlass);
 }
@@ -86,20 +86,20 @@ xmlSecTransformMemBufGetKlass(void) {
 /**
  * xmlSecTransformMemBufGetBuffer:
  * @transform:          the pointer to memory buffer transform.
- * 
- * Gets the pointer to memory buffer transform buffer. 
  *
- * Returns: pointer to the transform's #xmlSecBuffer. 
+ * Gets the pointer to memory buffer transform buffer.
+ *
+ * Returns: pointer to the transform's #xmlSecBuffer.
  */
 xmlSecBufferPtr
 xmlSecTransformMemBufGetBuffer(xmlSecTransformPtr transform) {
     xmlSecBufferPtr buffer;
 
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformMemBufId), NULL);
-    
+
     buffer = xmlSecTransformMemBufGetBuf(transform);
     xmlSecAssert2(buffer != NULL, NULL);
-    
+
     return(buffer);
 }
 
@@ -107,7 +107,7 @@ static int
 xmlSecTransformMemBufInitialize(xmlSecTransformPtr transform) {
     xmlSecBufferPtr buffer;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformMemBufId), -1);
 
     buffer = xmlSecTransformMemBufGetBuf(transform);
@@ -122,7 +122,7 @@ xmlSecTransformMemBufInitialize(xmlSecTransformPtr transform) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    return(0);    
+    return(0);
 }
 
 static void
@@ -133,11 +133,11 @@ xmlSecTransformMemBufFinalize(xmlSecTransformPtr transform) {
 
     buffer = xmlSecTransformMemBufGetBuf(transform);
     xmlSecAssert(buffer != NULL);
-    
-    xmlSecBufferFinalize(xmlSecTransformMemBufGetBuf(transform)); 
+
+    xmlSecBufferFinalize(xmlSecTransformMemBufGetBuf(transform));
 }
 
-static int 
+static int
 xmlSecTransformMemBufExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecBufferPtr buffer;
     xmlSecBufferPtr in, out;
@@ -149,47 +149,47 @@ xmlSecTransformMemBufExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
 
     buffer = xmlSecTransformMemBufGetBuf(transform);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     in = &(transform->inBuf);
-    out = &(transform->outBuf);    
+    out = &(transform->outBuf);
     inSize = xmlSecBufferGetSize(in);
 
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
     }
-    
-    if(transform->status == xmlSecTransformStatusWorking) {     
+
+    if(transform->status == xmlSecTransformStatusWorking) {
         /* just copy everything from in to our buffer and out */
         ret = xmlSecBufferAppend(buffer, xmlSecBufferGetData(in), inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferAppend",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", inSize);
             return(-1);
         }
-        
+
         ret = xmlSecBufferAppend(out, xmlSecBufferGetData(in), inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferAppend",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", inSize);
             return(-1);
         }
-        
+
         ret = xmlSecBufferRemoveHead(in, inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", inSize);
             return(-1);
         }
-            
+
         if(last != 0) {
             transform->status = xmlSecTransformStatusFinished;
         }
@@ -197,7 +197,7 @@ xmlSecTransformMemBufExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(inSize == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
diff --git a/src/mscrypto/README b/src/mscrypto/README
index f7d4563..51734e2 100644
--- a/src/mscrypto/README
+++ b/src/mscrypto/README
@@ -1,28 +1,28 @@
 WHAT VERSION OF WINDOWS?
 ------------------------------------------------------------------------
 
-The xmlsec-mscrypto lib is developed on a windows XP machine with MS Visual 
-Studio (6 and .NET). The MS Crypto API has been evolving a lot with the 
+The xmlsec-mscrypto lib is developed on a windows XP machine with MS Visual
+Studio (6 and .NET). The MS Crypto API has been evolving a lot with the
 new releases of windows and internet explorer. MS CryptoAPI libraries
-are distributed with ie and with the windows OS. Full functionality will 
-only be achieved on windows XP. AES is for example not supported on pre 
-XP versions of Windows (workarounds for this are possible, I believe). 
-Direct RSA de/encryption, used by xmlsec-mscrypto, is only possible from 
-Win 2000 (possibly also with a newer version of ie, with strong encryption 
+are distributed with ie and with the windows OS. Full functionality will
+only be achieved on windows XP. AES is for example not supported on pre
+XP versions of Windows (workarounds for this are possible, I believe).
+Direct RSA de/encryption, used by xmlsec-mscrypto, is only possible from
+Win 2000 (possibly also with a newer version of ie, with strong encryption
 patch installed). It's very likely more of these issues are lying around, a
 nd until it is tested on older windows systems it is uncertain what will work.
 
-KEYS MANAGER with MS Certificate store support. 
+KEYS MANAGER with MS Certificate store support.
 ------------------------------------------------------------------------
 
-The default xmlsec-mscrypto keys manager is based upon the simple keys 
-store, found in the xmlsec core library. If keys are not found in the 
-simple keys store, than MS Certificate store is used to lookup keys. 
-The certificate store is only used on a READONLY base, so it is not possible 
-to store keys via the keys store into the MS certificate store. There are enough 
+The default xmlsec-mscrypto keys manager is based upon the simple keys
+store, found in the xmlsec core library. If keys are not found in the
+simple keys store, than MS Certificate store is used to lookup keys.
+The certificate store is only used on a READONLY base, so it is not possible
+to store keys via the keys store into the MS certificate store. There are enough
 other tools that can do that for you.
 
-When the xmlsec application is started, with the config parameter the name of 
+When the xmlsec application is started, with the config parameter the name of
 the (system) keystore can be given. That keystore will be used for certificates
 and keys lookup. With the keyname now two types of values can be given:
     - simple name (called friendly name with MS);
@@ -34,9 +34,9 @@ KNOWN ISSUES.
 (http://bugzilla.gnome.org/show_bug.cgi?id=123668).
 
 2) Missing crypto functionality:
-  - HMAC (http://bugzilla.gnome.org/show_bug.cgi?id=123670): does not look 
+  - HMAC (http://bugzilla.gnome.org/show_bug.cgi?id=123670): does not look
   like MS would support it soon.
-  - RSA-OAEP (http://bugzilla.gnome.org/show_bug.cgi?id=123671): MS says 
+  - RSA-OAEP (http://bugzilla.gnome.org/show_bug.cgi?id=123671): MS says
   that they will support this in the near future.
   - AES KW (http://bugzilla.gnome.org/show_bug.cgi?id=123672): no native
   support, might be possible to implement on top of AES cipher itself
diff --git a/src/mscrypto/app.c b/src/mscrypto/app.c
index 7f3f921..3752de9 100644
--- a/src/mscrypto/app.c
+++ b/src/mscrypto/app.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  * Copyright (C) 2003 Aleksey Sanin <aleksey aleksey com>
  */
@@ -30,17 +30,17 @@
 #endif
 
 
-/* I don't see any other way then to use a global var to get the 
- * config info to the mscrypto keysstore :(  WK 
+/* I don't see any other way then to use a global var to get the
+ * config info to the mscrypto keysstore :(  WK
  */
 static char *gXmlSecMSCryptoAppCertStoreName = NULL;
 
 /**
  * xmlSecMSCryptoAppInit:
  * @config:             the name of another then the default ms certificate store.
- * 
+ *
  * General crypto engine initialization. This function is used
- * by XMLSec command line utility and called before 
+ * by XMLSec command line utility and called before
  * @xmlSecInit function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -49,7 +49,7 @@ int
 xmlSecMSCryptoAppInit(const char* config) {
     /* initialize MSCrypto crypto engine */
 
-    /* config parameter can contain *another* ms certs store name 
+    /* config parameter can contain *another* ms certs store name
      * then the default (MY)
      */
     if (NULL != config && strlen(config) > 0) {
@@ -59,7 +59,7 @@ xmlSecMSCryptoAppInit(const char* config) {
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                        "config=%s, config already set", 
+                        "config=%s, config already set",
                         xmlSecErrorsSafeString(config));
             return (-1);
         }
@@ -71,9 +71,9 @@ xmlSecMSCryptoAppInit(const char* config) {
 
 /**
  * xmlSecMSCryptoAppShutdown:
- * 
+ *
  * General crypto engine shutdown. This function is used
- * by XMLSec command line utility and called after 
+ * by XMLSec command line utility and called after
  * @xmlSecShutdown function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -101,7 +101,7 @@ xmlSecMSCryptoAppGetCertStoreName(void) {
 }
 
 /*************************************************************************************
- * Keys 
+ * Keys
  *************************************************************************************/
 
 /**
@@ -121,11 +121,11 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                          const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
     xmlSecBuffer buffer;
     xmlSecKeyPtr key = NULL;
-    int ret;    
-    
+    int ret;
+
     xmlSecAssert2(filename != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
-    
+
     switch (format) {
     case xmlSecKeyDataFormatPkcs12:
         key = xmlSecMSCryptoAppPkcs12Load(filename, pwd, pwdCallback, pwdCallbackCtx);
@@ -135,7 +135,7 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                         "xmlSecMSCryptoAppPkcs12Load",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);       
+            return(NULL);
         }
         break;
     case xmlSecKeyDataFormatCertDer:
@@ -146,7 +146,7 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                         "xmlSecBufferInitialize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);       
+            return(NULL);
         }
 
         ret = xmlSecBufferReadFile(&buffer, filename);
@@ -155,12 +155,12 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                         NULL,
                         "xmlSecBufferReadFile",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "filename=%s", 
+                        "filename=%s",
                         xmlSecErrorsSafeString(filename));
             xmlSecBufferFinalize(&buffer);
             return (NULL);
         }
-        
+
         key = xmlSecMSCryptoAppKeyLoadMemory(xmlSecBufferGetData(&buffer),
                                         xmlSecBufferGetSize(&buffer), format,
                                         pwd, pwdCallback, pwdCallbackCtx);
@@ -171,7 +171,7 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecBufferFinalize(&buffer);
-            return(NULL);       
+            return(NULL);
         }
         xmlSecBufferFinalize(&buffer);
         break;
@@ -201,7 +201,7 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
+xmlSecKeyPtr
 xmlSecMSCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKeyDataFormat format,
                                const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
     PCCERT_CONTEXT pCert = NULL;
@@ -270,7 +270,7 @@ xmlSecMSCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlS
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
     }
-    pCert = NULL;    
+    pCert = NULL;
 
     key = xmlSecKeyCreate();
     if(key == NULL) {
@@ -280,8 +280,8 @@ xmlSecMSCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlS
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                 XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
-    }    
-    
+    }
+
     ret = xmlSecKeySetValue(key, keyData);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -325,7 +325,7 @@ done:
     if(key != NULL) {
         xmlSecKeyDestroy(key);
     }
-    return(res); 
+    return(res);
 }
 
 
@@ -342,12 +342,12 @@ done:
  * @format:             the certificate file format.
  *
  * Reads the certificate from $ filename and adds it to key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
 
-int             
-xmlSecMSCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, 
+int
+xmlSecMSCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
                              xmlSecKeyDataFormat format) {
     xmlSecBuffer buffer;
     int ret;
@@ -355,7 +355,7 @@ xmlSecMSCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
-                                                                        
+
     ret = xmlSecBufferInitialize(&buffer, 0);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -363,7 +363,7 @@ xmlSecMSCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
                     "xmlSecBufferInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     ret = xmlSecBufferReadFile(&buffer, filename);
@@ -372,26 +372,26 @@ xmlSecMSCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
                     NULL,
                     "xmlSecBufferReadFile",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s", 
+                    "filename=%s",
                     xmlSecErrorsSafeString(filename));
         xmlSecBufferFinalize(&buffer);
         return (-1);
     }
-    
-    ret = xmlSecMSCryptoAppKeyCertLoadMemory(key, xmlSecBufferGetData(&buffer), 
+
+    ret = xmlSecMSCryptoAppKeyCertLoadMemory(key, xmlSecBufferGetData(&buffer),
                     xmlSecBufferGetSize(&buffer), format);
     if (ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecMSCryptoAppKeyCertLoadMemory",                   
+                    "xmlSecMSCryptoAppKeyCertLoadMemory",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecBufferFinalize(&buffer);
         return(-1);
     }
-    
+
     xmlSecBufferFinalize(&buffer);
-    return(0);        
+    return(0);
 }
 
 /**
@@ -402,16 +402,16 @@ xmlSecMSCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
  * @format:             the certificate file format.
  *
  * Reads the certificate from $ data and adds it to key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
-xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize, 
+int
+xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
                                    xmlSecKeyDataFormat format) {
     PCCERT_CONTEXT pCert;
     xmlSecKeyDataPtr kdata;
     int ret;
-        
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
@@ -420,7 +420,7 @@ xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
     if(kdata == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecKeyEnsureData",                  
+                    "xmlSecKeyEnsureData",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecMSCryptoKeyDataX509Id)));
@@ -436,11 +436,11 @@ xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
         if (NULL == pCert) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "CertCreateCertificateContext", 
+                        "CertCreateCertificateContext",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "format=%d", format);
-            return(-1);    
-        }       
+            return(-1);
+        }
 
         ret = xmlSecMSCryptoKeyDataX509AdoptCert(kdata, pCert);
         if(ret < 0) {
@@ -451,7 +451,7 @@ xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
                         "data=%s",
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(kdata)));
             CertFreeCertificateContext(pCert);
-            return(-1);    
+            return(-1);
         }
         break;
     default:
@@ -462,8 +462,8 @@ xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
                     "format=%d", (int)format);
         return(-1);
     }
-    
-    return(0);        
+
+    return(0);
 }
 
 /**
@@ -477,10 +477,10 @@ xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
-xmlSecMSCryptoAppPkcs12Load(const char *filename, 
+xmlSecKeyPtr
+xmlSecMSCryptoAppPkcs12Load(const char *filename,
                             const char *pwd,
-                            void* pwdCallback ATTRIBUTE_UNUSED, 
+                            void* pwdCallback ATTRIBUTE_UNUSED,
                             void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
     xmlSecBuffer buffer;
     xmlSecKeyPtr key;
@@ -496,7 +496,7 @@ xmlSecMSCryptoAppPkcs12Load(const char *filename,
                     "xmlSecBufferInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
 
     ret = xmlSecBufferReadFile(&buffer, filename);
@@ -505,7 +505,7 @@ xmlSecMSCryptoAppPkcs12Load(const char *filename,
                     NULL,
                     "xmlSecBufferReadFile",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s", 
+                    "filename=%s",
                     xmlSecErrorsSafeString(filename));
         xmlSecBufferFinalize(&buffer);
         return (NULL);
@@ -520,21 +520,21 @@ xmlSecMSCryptoAppPkcs12Load(const char *filename,
         return(NULL);
     }
 
-    key = xmlSecMSCryptoAppPkcs12LoadMemory(xmlSecBufferGetData(&buffer), 
+    key = xmlSecMSCryptoAppPkcs12LoadMemory(xmlSecBufferGetData(&buffer),
                                             xmlSecBufferGetSize(&buffer), pwd,
                                             pwdCallback, pwdCallbackCtx);
     if (key == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecMSCryptoAppPkcs12LoadMemory",                    
+                    "xmlSecMSCryptoAppPkcs12LoadMemory",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecBufferFinalize(&buffer);
         return(NULL);
     }
-    
+
     xmlSecBufferFinalize(&buffer);
-    return(key);        
+    return(key);
 }
 
 /**
@@ -549,11 +549,11 @@ xmlSecMSCryptoAppPkcs12Load(const char *filename,
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
+xmlSecKeyPtr
 xmlSecMSCryptoAppPkcs12LoadMemory(const xmlSecByte* data,
-                                  xmlSecSize dataSize, 
+                                  xmlSecSize dataSize,
                                   const char *pwd,
-                                  void* pwdCallback ATTRIBUTE_UNUSED, 
+                                  void* pwdCallback ATTRIBUTE_UNUSED,
                                   void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
     CRYPT_DATA_BLOB pfx;
     HCERTSTORE hCertStore = NULL;
@@ -611,7 +611,7 @@ xmlSecMSCryptoAppPkcs12LoadMemory(const xmlSecByte* data,
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
     }
-    
+
     x509Data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataX509Id);
     if(x509Data == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -650,7 +650,7 @@ xmlSecMSCryptoAppPkcs12LoadMemory(const xmlSecByte* data,
                 goto done;
             }
         tmpcert = NULL;
-        
+
             tmpcert = CertDuplicateCertificateContext(pCert);
             if(tmpcert == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -684,7 +684,7 @@ xmlSecMSCryptoAppPkcs12LoadMemory(const xmlSecByte* data,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "data=%s",
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
-            goto done;  
+            goto done;
         }
 
         ret = xmlSecMSCryptoKeyDataX509AdoptCert(x509Data, tmpcert);
@@ -717,8 +717,8 @@ xmlSecMSCryptoAppPkcs12LoadMemory(const xmlSecByte* data,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
-    }    
-    
+    }
+
     ret = xmlSecKeySetValue(key, keyData);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -763,7 +763,7 @@ done:
     if(tmpcert != NULL) {
         CertFreeCertificateContext(tmpcert);
     }
-    return(key); 
+    return(key);
 }
 
 /**
@@ -773,19 +773,19 @@ done:
  * @format:             the certificate file format.
  * @type:               the flag that indicates is the certificate in @filename
  *                      trusted or not.
- * 
+ *
  * Reads cert from @filename and adds to the list of trusted or known
  * untrusted certs in @store (not implemented yet).
  *
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecMSCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename, 
-                                xmlSecKeyDataFormat format, 
+xmlSecMSCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
+                                xmlSecKeyDataFormat format,
                                 xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
     xmlSecBuffer buffer;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
@@ -797,7 +797,7 @@ xmlSecMSCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
                     "xmlSecBufferInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     ret = xmlSecBufferReadFile(&buffer, filename);
@@ -806,7 +806,7 @@ xmlSecMSCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
                     NULL,
                     "xmlSecBufferReadFile",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s", 
+                    "filename=%s",
                     xmlSecErrorsSafeString(filename));
         xmlSecBufferFinalize(&buffer);
         return (-1);
@@ -819,14 +819,14 @@ xmlSecMSCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
                     NULL,
                     "xmlSecMSCryptoAppKeysMngrCertLoadMemory",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s", 
+                    "filename=%s",
                     xmlSecErrorsSafeString(filename));
         xmlSecBufferFinalize(&buffer);
         return(-1);
     }
-    
+
     xmlSecBufferFinalize(&buffer);
-    return(ret);                         
+    return(ret);
 }
 
 /**
@@ -845,7 +845,7 @@ xmlSecMSCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
  */
 int
 xmlSecMSCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
-                                        xmlSecSize dataSize, xmlSecKeyDataFormat format, 
+                                        xmlSecSize dataSize, xmlSecKeyDataFormat format,
                                         xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
     xmlSecKeyDataStorePtr x509Store;
     PCCERT_CONTEXT pCert = NULL;
@@ -885,7 +885,7 @@ xmlSecMSCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_FORMAT,
-                        "format=%d", format); 
+                        "format=%d", format);
             return(-1);
     }
 
@@ -904,8 +904,8 @@ xmlSecMSCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte
     return(0);
 }
 
-/** 
- * xmlSecMSCryptoAppDefaultKeysMngrAdoptKeyStore: 
+/**
+ * xmlSecMSCryptoAppDefaultKeysMngrAdoptKeyStore:
  * @mngr:                       the keys manager.
  * @keyStore:           the pointer to keys store.
  *
@@ -913,7 +913,7 @@ xmlSecMSCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecMSCryptoAppDefaultKeysMngrAdoptKeyStore(xmlSecKeysMngrPtr mngr, HCERTSTORE keyStore)
 {
         xmlSecKeyDataStorePtr x509Store ;
@@ -943,8 +943,8 @@ xmlSecMSCryptoAppDefaultKeysMngrAdoptKeyStore(xmlSecKeysMngrPtr mngr, HCERTSTORE
         return (0) ;
 }
 
-/** 
- * xmlSecMSCryptoAppDefaultKeysMngrAdoptTrustedStore: 
+/**
+ * xmlSecMSCryptoAppDefaultKeysMngrAdoptTrustedStore:
  * @mngr:                       the keys manager.
  * @trustedStore:       the pointer to certs store.
  *
@@ -982,8 +982,8 @@ xmlSecMSCryptoAppDefaultKeysMngrAdoptTrustedStore(xmlSecKeysMngrPtr mngr, HCERTS
         return(0);
 }
 
-/** 
- * xmlSecMSCryptoAppDefaultKeysMngrAdoptUntrustedStore: 
+/**
+ * xmlSecMSCryptoAppDefaultKeysMngrAdoptUntrustedStore:
  * @mngr:                       the keys manager.
  * @untrustedStore:     the pointer to certs store.
  *
@@ -1031,14 +1031,14 @@ xmlSecMSCryptoAppDefaultKeysMngrAdoptUntrustedStore(xmlSecKeysMngrPtr mngr, HCER
  * and a default MSCrypto crypto key data stores.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 int
 xmlSecMSCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
 
-    /* create MSCrypto keys store if needed */        
+    /* create MSCrypto keys store if needed */
     if(xmlSecKeysMngrGetKeysStore(mngr) == NULL) {
         xmlSecKeyStorePtr keysStore;
 
@@ -1051,7 +1051,7 @@ xmlSecMSCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         "xmlSecMSCryptoKeysStoreId");
             return(-1);
         }
-        
+
         ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1060,20 +1060,20 @@ xmlSecMSCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecKeyStoreDestroy(keysStore);
-            return(-1);        
+            return(-1);
         }
     }
 
-    ret = xmlSecMSCryptoKeysMngrInit(mngr);    
+    ret = xmlSecMSCryptoKeysMngrInit(mngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlSecMSCryptoKeysMngrInit",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1); 
+        return(-1);
     }
-    
+
     mngr->getKey = xmlSecKeysMngrGetKey;
     return(0);
 }
@@ -1085,17 +1085,17 @@ xmlSecMSCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
  *
  * Adds @key to the keys manager @mngr created with #xmlSecMSCryptoAppDefaultKeysMngrInit
  * function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecMSCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1105,7 +1105,7 @@ xmlSecMSCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr ke
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecMSCryptoKeysStoreAdoptKey(store, key);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1115,7 +1115,7 @@ xmlSecMSCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr ke
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1124,19 +1124,19 @@ xmlSecMSCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr ke
  * @mngr:               the pointer to keys manager.
  * @uri:                the uri.
  *
- * Loads XML keys file from @uri to the keys manager @mngr created 
+ * Loads XML keys file from @uri to the keys manager @mngr created
  * with #xmlSecMSCryptoAppDefaultKeysMngrInit function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecMSCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(uri != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1146,7 +1146,7 @@ xmlSecMSCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecMSCryptoKeysStoreLoad(store, uri, mngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1156,7 +1156,7 @@ xmlSecMSCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     "uri=%s", xmlSecErrorsSafeString(uri));
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1167,17 +1167,17 @@ xmlSecMSCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
  * @type:               the type of keys to save (public/private/symmetric).
  *
  * Saves keys from @mngr to  XML keys file.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecMSCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename, xmlSecKeyDataType type) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1187,7 +1187,7 @@ xmlSecMSCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filenam
                         XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecMSCryptoKeysStoreSave(store, filename, type);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1197,7 +1197,7 @@ xmlSecMSCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filenam
                         "filename%s", xmlSecErrorsSafeString(filename));
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1205,11 +1205,11 @@ xmlSecMSCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filenam
  * xmlSecMSCryptoAppDefaultKeysMngrPrivateKeyLoad:
  * @mngr:               the pointer to keys manager.
  * @hKey:       the key handle.
- *  
+ *
  * Adds private key @hKey to the keys manager @mngr.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 int
 xmlSecMSCryptoAppDefaultKeysMngrPrivateKeyLoad(xmlSecKeysMngrPtr mngr, HCRYPTKEY hKey) {
     xmlSecAssert2(mngr != NULL, -1);
@@ -1223,12 +1223,12 @@ xmlSecMSCryptoAppDefaultKeysMngrPrivateKeyLoad(xmlSecKeysMngrPtr mngr, HCRYPTKEY
  * xmlSecMSCryptoAppDefaultKeysMngrPublicKeyLoad:
  * @mngr:               the pointer to keys manager.
  * @hKey:       the key handle.
- *  
+ *
  * Adds public key @hKey to the keys manager @mngr.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecMSCryptoAppDefaultKeysMngrPublicKeyLoad(xmlSecKeysMngrPtr mngr, HCRYPTKEY hKey) {
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(hKey != 0, -1);
@@ -1241,12 +1241,12 @@ xmlSecMSCryptoAppDefaultKeysMngrPublicKeyLoad(xmlSecKeysMngrPtr mngr, HCRYPTKEY
  * xmlSecMSCryptoAppDefaultKeysMngrSymKeyLoad:
  * @mngr:               the pointer to keys manager.
  * @hKey:       the key handle.
- *  
+ *
  * Adds symmetric key @hKey to the keys manager @mngr.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecMSCryptoAppDefaultKeysMngrSymKeyLoad(xmlSecKeysMngrPtr mngr, HCRYPTKEY hKey) {
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(hKey != 0, -1);
diff --git a/src/mscrypto/certkeys.c b/src/mscrypto/certkeys.c
index 02545e3..6fe3aa4 100644
--- a/src/mscrypto/certkeys.c
+++ b/src/mscrypto/certkeys.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  * Copyright (C) 2003 Aleksey Sanin <aleksey aleksey com>
  */
@@ -49,7 +49,7 @@
  * Internal MSCrypto PCCERT_CONTEXT key CTX
  *
  *************************************************************************/
-typedef struct _xmlSecMSCryptoKeyDataCtx xmlSecMSCryptoKeyDataCtx, 
+typedef struct _xmlSecMSCryptoKeyDataCtx xmlSecMSCryptoKeyDataCtx,
                                                 *xmlSecMSCryptoKeyDataCtxPtr;
 
 #ifdef XMLSEC_MSCRYPTO_NT4
@@ -89,14 +89,14 @@ struct _xmlSecMSCryptoKeyDataCtx {
     HCRYPTKEY           hKey;
 #else /* XMLSEC_MSCRYPTO_NT4 */
         struct _mscrypt_prov* p_prov ;
-    struct _mscrypt_key*  p_key ;   
+    struct _mscrypt_key*  p_key ;
 #endif /* XMLSEC_MSCRYPTO_NT4 */
     PCCERT_CONTEXT      pCert;
     LPCTSTR                 providerName;
     DWORD                   providerType;
     DWORD                   dwKeySpec;
     xmlSecKeyDataType   type;
-};          
+};
 
 #ifndef XMLSEC_MSCRYPTO_NT4
 
@@ -114,7 +114,7 @@ xmlSecMSCryptoKeyDataCtxCreateProvider(xmlSecMSCryptoKeyDataCtxPtr ctx) {
 static void
 xmlSecMSCryptoKeyDataCtxDestroyProvider(xmlSecMSCryptoKeyDataCtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
- 
+
     if ((ctx->hProv != 0) && (ctx->fCallerFreeProv)) {
             CryptReleaseContext(ctx->hProv, 0);
     }
@@ -126,7 +126,7 @@ static void
 xmlSecMSCryptoKeyDataCtxSetProvider(xmlSecMSCryptoKeyDataCtxPtr ctx, HCRYPTPROV hProv, BOOL fCallerFreeProv)
 {
     xmlSecAssert(ctx != NULL);
- 
+
     xmlSecMSCryptoKeyDataCtxDestroyProvider(ctx);
     ctx->hProv               = hProv;
     ctx->fCallerFreeProv = fCallerFreeProv;
@@ -168,7 +168,7 @@ xmlSecMSCryptoKeyDataCtxCreateKey(xmlSecMSCryptoKeyDataCtxPtr ctx) {
 static void
 xmlSecMSCryptoKeyDataCtxDestroyKey(xmlSecMSCryptoKeyDataCtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
-    
+
     if (ctx->hKey != 0) {
             CryptDestroyKey(ctx->hKey);
     }
@@ -227,7 +227,7 @@ xmlSecMSCryptoKeyDataCtxCreateProvider(xmlSecMSCryptoKeyDataCtxPtr ctx) {
 static void
 xmlSecMSCryptoKeyDataCtxDestroyProvider(xmlSecMSCryptoKeyDataCtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
- 
+
         if(ctx->p_prov != NULL) {
                 if(InterlockedDecrement(&(ctx->p_prov->refcnt)) <= 0) {
                         if((ctx->p_prov->hProv != 0) && (ctx->p_prov->fCallerFreeProv)) {
@@ -244,7 +244,7 @@ static void
 xmlSecMSCryptoKeyDataCtxSetProvider(xmlSecMSCryptoKeyDataCtxPtr ctx, HCRYPTPROV hProv, BOOL fCallerFreeProv)
 {
     xmlSecAssert(ctx != NULL);
- 
+
     xmlSecMSCryptoKeyDataCtxDestroyProvider(ctx);
 
     if((ctx->p_prov != NULL) && (ctx->p_prov->refcnt == 1)) {
@@ -299,7 +299,7 @@ xmlSecMSCryptoKeyDataCtxCreateKey(xmlSecMSCryptoKeyDataCtxPtr ctx) {
 static void
 xmlSecMSCryptoKeyDataCtxDestroyKey(xmlSecMSCryptoKeyDataCtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
-    
+
         if(ctx->p_key != NULL) {
                 if(InterlockedDecrement(&(ctx->p_key->refcnt)) <= 0) {
                         if(ctx->p_key->hKey != 0) {
@@ -358,7 +358,7 @@ xmlSecMSCryptoKeyDataCtxCreateCert(xmlSecMSCryptoKeyDataCtxPtr ctx) {
 static void
 xmlSecMSCryptoKeyDataCtxDestroyCert(xmlSecMSCryptoKeyDataCtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
-    
+
     if(ctx->pCert != NULL) {
             CertFreeCertificateContext(ctx->pCert);
     }
@@ -378,7 +378,7 @@ xmlSecMSCryptoKeyDataCtxDuplicateCert(xmlSecMSCryptoKeyDataCtxPtr ctxDst, xmlSec
     xmlSecAssert2(ctxDst != NULL, -1);
     xmlSecAssert2(ctxSrc != NULL, -1);
 
-    xmlSecMSCryptoKeyDataCtxDestroyCert(ctxDst);  
+    xmlSecMSCryptoKeyDataCtxDestroyCert(ctxDst);
     if(ctxSrc->pCert != NULL) {
             ctxDst->pCert = xmlSecMSCryptoCertDup(ctxSrc->pCert);
             if(ctxDst->pCert == NULL) {
@@ -389,7 +389,7 @@ xmlSecMSCryptoKeyDataCtxDuplicateCert(xmlSecMSCryptoKeyDataCtxPtr ctxDst, xmlSec
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-    } 
+    }
     return(0);
 }
 
@@ -399,7 +399,7 @@ xmlSecMSCryptoKeyDataCtxDuplicateCert(xmlSecMSCryptoKeyDataCtxPtr ctxDst, xmlSec
  *
  *****************************************************************************/
 #define xmlSecMSCryptoKeyDataSize       \
-    (sizeof(xmlSecKeyData) + sizeof(xmlSecMSCryptoKeyDataCtx))  
+    (sizeof(xmlSecKeyData) + sizeof(xmlSecMSCryptoKeyDataCtx))
 #define xmlSecMSCryptoKeyDataGetCtx(data) \
     ((xmlSecMSCryptoKeyDataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
 
@@ -416,7 +416,7 @@ static int              xmlSecMSCryptoKeyDataGetSize    (xmlSecKeyDataPtr data);
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-static int 
+static int
 xmlSecMSCryptoKeyDataAdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
     xmlSecMSCryptoKeyDataCtxPtr ctx;
     HCRYPTKEY hKey = 0;
@@ -443,11 +443,11 @@ xmlSecMSCryptoKeyDataAdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT pCert, xmlS
         HCRYPTPROV hProv = 0;
         BOOL fCallerFreeProv = FALSE;
 
-        if (!CryptAcquireCertificatePrivateKey(pCert, 
-                                               CRYPT_ACQUIRE_COMPARE_KEY_FLAG, 
-                                               NULL, 
-                                               &hProv, 
-                                               &(ctx->dwKeySpec), 
+        if (!CryptAcquireCertificatePrivateKey(pCert,
+                                               CRYPT_ACQUIRE_COMPARE_KEY_FLAG,
+                                               NULL,
+                                               &hProv,
+                                               &(ctx->dwKeySpec),
                                                &fCallerFreeProv)) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
                             NULL,
@@ -459,10 +459,10 @@ xmlSecMSCryptoKeyDataAdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT pCert, xmlS
         xmlSecMSCryptoKeyDataCtxSetProvider(ctx, hProv, fCallerFreeProv);
     } else if((type & xmlSecKeyDataTypePublic) != 0){
         HCRYPTPROV hProv = 0;
-        if (!CryptAcquireContext(&hProv, 
-                                    NULL, 
+        if (!CryptAcquireContext(&hProv,
+                                    NULL,
                                     NULL, /* ctx->providerName, */
-                                    ctx->providerType, 
+                                    ctx->providerType,
                                     CRYPT_VERIFYCONTEXT)) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
                             NULL,
@@ -489,9 +489,9 @@ xmlSecMSCryptoKeyDataAdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT pCert, xmlS
      * so no unnessecary calls to CryptImportPublicKeyInfo are being
      * made. WK
      */
-    if(!CryptImportPublicKeyInfo(xmlSecMSCryptoKeyDataCtxGetProvider(ctx), 
-                X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 
-                &(pCert->pCertInfo->SubjectPublicKeyInfo), 
+    if(!CryptImportPublicKeyInfo(xmlSecMSCryptoKeyDataCtxGetProvider(ctx),
+                X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+                &(pCert->pCertInfo->SubjectPublicKeyInfo),
                 &hKey)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -500,17 +500,17 @@ xmlSecMSCryptoKeyDataAdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT pCert, xmlS
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
     }
-    
+
     xmlSecMSCryptoKeyDataCtxSetKey(ctx, hKey);
     xmlSecMSCryptoKeyDataCtxSetCert(ctx, pCert);
     return(0);
 }
 
-static int 
-xmlSecMSCryptoKeyDataAdoptKey(xmlSecKeyDataPtr data, 
+static int
+xmlSecMSCryptoKeyDataAdoptKey(xmlSecKeyDataPtr data,
                               HCRYPTPROV hProv,
                               BOOL fCallerFreeProv,
-                              HCRYPTKEY hKey, 
+                              HCRYPTKEY hKey,
                               DWORD dwKeySpec,
                               xmlSecKeyDataType type) {
     xmlSecMSCryptoKeyDataCtxPtr ctx;
@@ -519,7 +519,7 @@ xmlSecMSCryptoKeyDataAdoptKey(xmlSecKeyDataPtr data,
     xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecMSCryptoKeyDataSize), -1);
     xmlSecAssert2(hKey != 0, -1);
     xmlSecAssert2(type & (xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate), -1);
-    
+
     ctx = xmlSecMSCryptoKeyDataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
 
@@ -538,9 +538,9 @@ xmlSecMSCryptoKeyDataAdoptKey(xmlSecKeyDataPtr data,
  * @data:               the key data to retrieve certificate from.
  * @type:              type of key requested (public/private)
  *
- * Native MSCrypto key retrieval from xmlsec keydata. The 
+ * Native MSCrypto key retrieval from xmlsec keydata. The
  * returned HKEY must not be destroyed by the caller.
- * 
+ *
  * Returns: HKEY on success or NULL otherwise.
  */
 HCRYPTKEY
@@ -552,14 +552,14 @@ xmlSecMSCryptoKeyDataGetKey(xmlSecKeyDataPtr data, xmlSecKeyDataType type) {
 
     ctx = xmlSecMSCryptoKeyDataGetCtx(data);
     xmlSecAssert2(ctx != NULL, 0);
- 
+
     return(xmlSecMSCryptoKeyDataCtxGetKey(ctx));
 }
 
 /**
  * xmlSecMSCryptoKeyDataGetDecryptKey:
  * @data:       the key data pointer
- * 
+ *
  * Native MSCrypto decrypt key retrieval from xmlsec keydata. The
  * returned HKEY must not be destroyed by the caller.
  *
@@ -590,10 +590,10 @@ xmlSecMSCryptoKeyDataGetDecryptKey(xmlSecKeyDataPtr data) {
 /**
  * xmlSecMSCryptoKeyDataGetCert:
  * @data:               the key data to retrieve certificate from.
- * 
- * Native MSCrypto certificate retrieval from xmlsec keydata. The 
+ *
+ * Native MSCrypto certificate retrieval from xmlsec keydata. The
  * returned PCCERT_CONTEXT must not be released by the caller.
- * 
+ *
  * Returns: PCCERT_CONTEXT on success or NULL otherwise.
  */
 PCCERT_CONTEXT
@@ -605,7 +605,7 @@ xmlSecMSCryptoKeyDataGetCert(xmlSecKeyDataPtr data) {
 
     ctx = xmlSecMSCryptoKeyDataGetCtx(data);
     xmlSecAssert2(ctx != NULL, 0);
- 
+
     return(xmlSecMSCryptoKeyDataCtxGetCert(ctx));
 }
 
@@ -635,7 +635,7 @@ xmlSecMSCryptoKeyDataGetMSCryptoKeySpec(xmlSecKeyDataPtr data) {
     return(ctx->dwKeySpec);
 }
 
-static int 
+static int
 xmlSecMSCryptoKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     xmlSecMSCryptoKeyDataCtxPtr ctxDst;
     xmlSecMSCryptoKeyDataCtxPtr ctxSrc;
@@ -677,7 +677,7 @@ xmlSecMSCryptoKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
     }
-    
+
     ctxDst->dwKeySpec       = ctxSrc->dwKeySpec;
     ctxDst->providerName    = ctxSrc->providerName;
     ctxDst->providerType    = ctxSrc->providerType;
@@ -686,9 +686,9 @@ xmlSecMSCryptoKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     return(0);
 }
 
-static void 
+static void
 xmlSecMSCryptoKeyDataInitialize(xmlSecKeyDataPtr data) {
-    xmlSecMSCryptoKeyDataCtxPtr ctx;    
+    xmlSecMSCryptoKeyDataCtxPtr ctx;
 
     xmlSecAssert(xmlSecKeyDataIsValid(data));
     xmlSecAssert(xmlSecKeyDataCheckSize(data, xmlSecMSCryptoKeyDataSize));
@@ -703,16 +703,16 @@ xmlSecMSCryptoKeyDataInitialize(xmlSecKeyDataPtr data) {
     xmlSecMSCryptoKeyDataCtxCreateCert(ctx);
 }
 
-static void 
+static void
 xmlSecMSCryptoKeyDataFinalize(xmlSecKeyDataPtr data) {
     xmlSecMSCryptoKeyDataCtxPtr ctx;
-    
+
     xmlSecAssert(xmlSecKeyDataIsValid(data));
     xmlSecAssert(xmlSecKeyDataCheckSize(data, xmlSecMSCryptoKeyDataSize));
 
     ctx = xmlSecMSCryptoKeyDataGetCtx(data);
     xmlSecAssert(ctx != NULL);
-    
+
     xmlSecMSCryptoKeyDataCtxDestroyKey(ctx);
     xmlSecMSCryptoKeyDataCtxDestroyCert(ctx);
     xmlSecMSCryptoKeyDataCtxDestroyProvider(ctx);
@@ -720,7 +720,7 @@ xmlSecMSCryptoKeyDataFinalize(xmlSecKeyDataPtr data) {
     memset(ctx, 0, sizeof(xmlSecMSCryptoKeyDataCtx));
 }
 
-static int 
+static int
 xmlSecMSCryptoKeyDataGetSize(xmlSecKeyDataPtr data) {
     xmlSecMSCryptoKeyDataCtxPtr ctx;
 
@@ -732,12 +732,12 @@ xmlSecMSCryptoKeyDataGetSize(xmlSecKeyDataPtr data) {
 
     if(xmlSecMSCryptoKeyDataCtxGetCert(ctx) != NULL) {
         xmlSecAssert2(xmlSecMSCryptoKeyDataCtxGetCert(ctx)->pCertInfo != NULL, 0);
-        return (CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 
+        return (CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
                     &(xmlSecMSCryptoKeyDataCtxGetCert(ctx)->pCertInfo->SubjectPublicKeyInfo)));
     } else if (xmlSecMSCryptoKeyDataCtxGetKey(ctx) != 0) {
         DWORD length = 0;
             DWORD lenlen = sizeof(DWORD);
-        
+
         if (!CryptGetKeyParam(xmlSecMSCryptoKeyDataCtxGetKey(ctx), KP_KEYLEN, (BYTE *)&length, &lenlen, 0)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -748,14 +748,14 @@ xmlSecMSCryptoKeyDataGetSize(xmlSecKeyDataPtr data) {
         }
         return(length);
     }
-    
+
     return (0);
 }
 
-static xmlSecKeyDataType 
+static xmlSecKeyDataType
 xmlSecMSCryptoKeyDataGetType(xmlSecKeyDataPtr data) {
     xmlSecMSCryptoKeyDataCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecKeyDataIsValid(data), xmlSecKeyDataTypeUnknown);
     xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecMSCryptoKeyDataSize), xmlSecKeyDataTypeUnknown);
 
@@ -763,7 +763,7 @@ xmlSecMSCryptoKeyDataGetType(xmlSecKeyDataPtr data) {
     xmlSecAssert2(ctx != NULL, xmlSecKeyDataTypeUnknown);
 
     /* We could make a call to CryptFindCertificateKeyProvInfo here, to find out if
-     * we *really* have a private key or not. However if the certificate is not 
+     * we *really* have a private key or not. However if the certificate is not
      * linked to a private key, the call takes an ridiculous amount of time.
      * the way it is now is better I think. WK.
      */
@@ -773,10 +773,10 @@ xmlSecMSCryptoKeyDataGetType(xmlSecKeyDataPtr data) {
 /**
  * xmlSecMSCryptoCertDup:
  * @pCert:              the pointer to cert.
- * 
+ *
  * Duplicates the @pCert.
  *
- * Returns: pointer to newly created PCCERT_CONTEXT object or 
+ * Returns: pointer to newly created PCCERT_CONTEXT object or
  * NULL if an error occurs.
  */
 PCCERT_CONTEXT xmlSecMSCryptoCertDup(PCCERT_CONTEXT pCert) {
@@ -791,9 +791,9 @@ PCCERT_CONTEXT xmlSecMSCryptoCertDup(PCCERT_CONTEXT pCert) {
                     "CertDuplicateCertificateContext",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     return(ret);
 }
 
@@ -807,11 +807,11 @@ PCCERT_CONTEXT xmlSecMSCryptoCertDup(PCCERT_CONTEXT pCert) {
  *
  * Returns: pointer to newly created xmlsec key or NULL if an error occurs.
  */
-xmlSecKeyDataPtr 
+xmlSecKeyDataPtr
 xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
     xmlSecKeyDataPtr data = NULL;
     int ret;
-    
+
     xmlSecAssert2(pCert != NULL, NULL);
     xmlSecAssert2(pCert->pCertInfo != NULL, NULL);
     xmlSecAssert2(pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId != NULL, NULL);
@@ -825,10 +825,10 @@ xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
                         "xmlSecKeyDataCreate",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "xmlSecMSCryptoDataRsaId");
-            return(NULL);           
+            return(NULL);
         }
     }
-#endif /* XMLSEC_NO_RSA */      
+#endif /* XMLSEC_NO_RSA */
 
 #ifndef XMLSEC_NO_DSA
     if (!strcmp(pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, szOID_X957_DSA /*szOID_DSALG_SIGN*/)) {
@@ -839,10 +839,10 @@ xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
                             "xmlSecKeyDataCreate",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             "xmlSecMSCryptoKeyDataDsaId");
-                return(NULL);       
+                return(NULL);
         }
     }
-#endif /* XMLSEC_NO_DSA */      
+#endif /* XMLSEC_NO_DSA */
 
 #ifndef XMLSEC_NO_GOST
     if (!strcmp(pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId,  szOID_MAGPRO_PUBKEY_SIGN_R3410_2001_CP) ||
@@ -855,10 +855,10 @@ xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
                             "xmlSecKeyDataCreate",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             "xmlSecMSCryptoKeyDataGost2001Id");
-                return(NULL);       
+                return(NULL);
         }
     }
-#endif /* XMLSEC_NO_GOST*/      
+#endif /* XMLSEC_NO_GOST*/
 
     if (NULL == data) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -869,7 +869,7 @@ xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
         return(NULL);
     }
 
-    xmlSecAssert2(data != NULL, NULL);    
+    xmlSecAssert2(data != NULL, NULL);
 
     ret = xmlSecMSCryptoKeyDataAdoptCert(data, pCert, type);
     if(ret < 0) {
@@ -879,7 +879,7 @@ xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDataDestroy(data);
-        return(NULL);       
+        return(NULL);
     }
     return(data);
 }
@@ -903,27 +903,27 @@ xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
  *   <Exponent>AQAB</Exponent>
  * </RSAKeyValue>
  *
- * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are 
+ * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are
  * represented in XML as octet strings as defined by the ds:CryptoBinary type.
  *
  * Schema Definition:
- * 
+ *
  * <element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
  * <complexType name="RSAKeyValueType">
  *   <sequence>
- *     <element name="Modulus" type="ds:CryptoBinary"/> 
+ *     <element name="Modulus" type="ds:CryptoBinary"/>
  *     <element name="Exponent" type="ds:CryptoBinary"/>
  *   </sequence>
  * </complexType>
  *
  * DTD Definition:
- * 
- * <!ELEMENT RSAKeyValue (Modulus, Exponent) > 
+ *
+ * <!ELEMENT RSAKeyValue (Modulus, Exponent) >
  * <!ELEMENT Modulus (#PCDATA) >
  * <!ELEMENT Exponent (#PCDATA) >
  *
  * ============================================================================
- * 
+ *
  *
  *************************************************************************/
 
@@ -953,22 +953,22 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataRsaKlass = {
 
     /* data */
     xmlSecNameRSAKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefRSAKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeRSAKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecMSCryptoKeyDataRsaInitialize,         /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecMSCryptoKeyDataRsaDuplicate,          /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecMSCryptoKeyDataRsaFinalize,           /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecMSCryptoKeyDataRsaGenerate,           /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecMSCryptoKeyDataRsaGetType,            /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecMSCryptoKeyDataRsaGetSize,            /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecMSCryptoKeyDataRsaXmlRead,            /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -985,22 +985,22 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataRsaKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecMSCryptoKeyDataRsaGetKlass:
  *
  * The MSCrypto RSA CertKey data klass.
  *
  * Returns: pointer to MSCrypto RSA key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecMSCryptoKeyDataRsaGetKlass(void) {
     return(&xmlSecMSCryptoKeyDataRsaKlass);
 }
 
-static int 
+static int
 xmlSecMSCryptoKeyDataRsaInitialize(xmlSecKeyDataPtr data) {
     xmlSecMSCryptoKeyDataCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataRsaId), xmlSecKeyDataTypeUnknown);
 
     xmlSecMSCryptoKeyDataInitialize(data);
@@ -1010,11 +1010,11 @@ xmlSecMSCryptoKeyDataRsaInitialize(xmlSecKeyDataPtr data) {
 
     ctx->providerName = MS_ENHANCED_PROV;
     ctx->providerType = PROV_RSA_FULL;
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoKeyDataRsaDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     xmlSecAssert2(xmlSecKeyDataCheckId(dst, xmlSecMSCryptoKeyDataRsaId), -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(src, xmlSecMSCryptoKeyDataRsaId), -1);
@@ -1022,16 +1022,16 @@ xmlSecMSCryptoKeyDataRsaDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     return(xmlSecMSCryptoKeyDataDuplicate(dst, src));
 }
 
-static void 
+static void
 xmlSecMSCryptoKeyDataRsaFinalize(xmlSecKeyDataPtr data) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataRsaId));
 
     xmlSecMSCryptoKeyDataFinalize(data);
 }
 
-static int 
+static int
 xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
-                                xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {                                  
+                                xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecBn modulus, exponent;
     xmlSecBuffer blob;
     unsigned int blobBufferLen;
@@ -1049,11 +1049,11 @@ xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
-    
+
     if(xmlSecKeyGetValue(key) != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
-                    NULL,                   
+                    NULL,
                     XMLSEC_ERRORS_R_INVALID_KEY_DATA,
                     "key already has a value");
         return(-1);
@@ -1102,7 +1102,7 @@ xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
         goto done;
     }
@@ -1113,19 +1113,19 @@ xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     NULL,
                     "xmlSecBnGetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
         goto done;
     }
     cur = xmlSecGetNextElementNode(cur->next);
-    
+
     /* next is Exponent node. It is REQUIRED because we do not support Seed and PgenCounter*/
     if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeRSAExponent, xmlSecDSigNs))) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
         goto done;
     }
@@ -1135,15 +1135,15 @@ xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     NULL,
                     "xmlSecBnGetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
         goto done;
     }
     cur = xmlSecGetNextElementNode(cur->next);
-    
+
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeRSAPrivateExponent, xmlSecNs))) {
         /* next is X node. It is REQUIRED for private key but
-         * MSCrypto does not support it. We just ignore it */ 
+         * MSCrypto does not support it. We just ignore it */
         cur = xmlSecGetNextElementNode(cur->next);
     }
 
@@ -1185,7 +1185,7 @@ xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                    "exponent size=%d", 
+                    "exponent size=%d",
                     xmlSecBnGetSize(&exponent));
         goto done;
     }
@@ -1280,7 +1280,7 @@ done:
     return(res);
 }
 
-static int 
+static int
 xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecMSCryptoKeyDataCtxPtr ctx;
@@ -1292,7 +1292,7 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     xmlSecSize modulusLen, exponentLen;
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecMSCryptoKeyDataRsaId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecMSCryptoKeyDataRsaId), -1);
@@ -1311,7 +1311,7 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecBufferInitialize(&buf, dwBlobLen);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1345,7 +1345,7 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     /* check PUBLICKEYSTRUC */
     pubKeyStruc = (PUBLICKEYSTRUC*)blob;
     if(pubKeyStruc->bVersion != 0x02) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1354,7 +1354,7 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
         return(-1);
     }
     if(pubKeyStruc->bType != PUBLICKEYBLOB) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1366,7 +1366,7 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     /* check RSAPUBKEY */
     pubKey          = (RSAPUBKEY *)(blob + sizeof(PUBLICKEYSTRUC));
     if(pubKey->magic != 0x31415352) { /* RSA public key magic */
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1394,10 +1394,10 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
         xmlSecBufferFinalize(&buf);
-        return(-1);     
+        return(-1);
     }
 
     ret = xmlSecBnBlobSetNodeValue(blob, modulusLen, cur, xmlSecBnBase64, 1, 1);
@@ -1406,11 +1406,11 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecBnBlobSetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
         xmlSecBufferFinalize(&buf);
         return(-1);
-    }    
+    }
 
     /* next is Exponent node. */
     cur = xmlSecAddChild(node, xmlSecNodeRSAExponent, xmlSecDSigNs);
@@ -1419,10 +1419,10 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
         xmlSecBufferFinalize(&buf);
-        return(-1);     
+        return(-1);
     }
 
     /* Remove leading zero's (from least significant end) */
@@ -1438,10 +1438,10 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecBnBlobSetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
         xmlSecBufferFinalize(&buf);
-        return(-1);     
+        return(-1);
     }
 
     /* next is PrivateExponent node: not supported in MSCrypto */
@@ -1450,8 +1450,8 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     return(0);
 }
 
-static int 
-xmlSecMSCryptoKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, 
+static int
+xmlSecMSCryptoKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
                                 xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
     xmlSecMSCryptoKeyDataCtxPtr ctx;
     HCRYPTPROV hProv = 0;
@@ -1477,7 +1477,7 @@ xmlSecMSCryptoKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
                             "CryptAcquireContext",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
-        
+
                 return(-1);
             }
         } else {
@@ -1486,7 +1486,7 @@ xmlSecMSCryptoKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
                             "CryptAcquireContext",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
-                
+
             return(-1);
         }
     }
@@ -1502,7 +1502,7 @@ xmlSecMSCryptoKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
         goto done;
     }
 
-    ret = xmlSecMSCryptoKeyDataAdoptKey(data, hProv, TRUE, hKey, dwKeySpec, 
+    ret = xmlSecMSCryptoKeyDataAdoptKey(data, hProv, TRUE, hKey, dwKeySpec,
                                         xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1530,38 +1530,38 @@ done:
     return(res);
 }
 
-static xmlSecKeyDataType 
+static xmlSecKeyDataType
 xmlSecMSCryptoKeyDataRsaGetType(xmlSecKeyDataPtr data) {
     return(xmlSecMSCryptoKeyDataGetType(data));
 }
 
-static xmlSecSize 
+static xmlSecSize
 xmlSecMSCryptoKeyDataRsaGetSize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataRsaId), 0);
 
     return (xmlSecMSCryptoKeyDataGetSize(data));
 }
 
-static void 
+static void
 xmlSecMSCryptoKeyDataRsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataRsaId));
     xmlSecAssert(output != NULL);
-    
-    fprintf(output, "=== rsa key: size = %d\n", 
+
+    fprintf(output, "=== rsa key: size = %d\n",
             xmlSecMSCryptoKeyDataRsaGetSize(data));
 }
 
 static void xmlSecMSCryptoKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataRsaId));
     xmlSecAssert(output != NULL);
-        
-    fprintf(output, "<RSAKeyValue size=\"%d\" />\n", 
+
+    fprintf(output, "<RSAKeyValue size=\"%d\" />\n",
             xmlSecMSCryptoKeyDataRsaGetSize(data));
 }
-    
+
 #endif /* XMLSEC_NO_RSA */
 
-#ifndef XMLSEC_NO_DSA    
+#ifndef XMLSEC_NO_DSA
 /**************************************************************************
  *
  * <dsig:DSAKeyValue> processing
@@ -1569,57 +1569,57 @@ static void xmlSecMSCryptoKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* ou
  *
  * The DSAKeyValue Element (http://www.w3.org/TR/xmldsig-core/#sec-DSAKeyValue)
  *
- * DSA keys and the DSA signature algorithm are specified in [DSS]. 
+ * DSA keys and the DSA signature algorithm are specified in [DSS].
  * DSA public key values can have the following fields:
- *      
- *   * P - a prime modulus meeting the [DSS] requirements 
- *   * Q - an integer in the range 2**159 < Q < 2**160 which is a prime 
- *         divisor of P-1 
- *   * G - an integer with certain properties with respect to P and Q 
- *   * Y - G**X mod P (where X is part of the private key and not made 
- *         public) 
- *   * J - (P - 1) / Q 
- *   * seed - a DSA prime generation seed 
+ *
+ *   * P - a prime modulus meeting the [DSS] requirements
+ *   * Q - an integer in the range 2**159 < Q < 2**160 which is a prime
+ *         divisor of P-1
+ *   * G - an integer with certain properties with respect to P and Q
+ *   * Y - G**X mod P (where X is part of the private key and not made
+ *         public)
+ *   * J - (P - 1) / Q
+ *   * seed - a DSA prime generation seed
  *   * pgenCounter - a DSA prime generation counter
  *
- * Parameter J is available for inclusion solely for efficiency as it is 
- * calculatable from P and Q. Parameters seed and pgenCounter are used in the 
- * DSA prime number generation algorithm specified in [DSS]. As such, they are 
- * optional but must either both be present or both be absent. This prime 
- * generation algorithm is designed to provide assurance that a weak prime is 
- * not being used and it yields a P and Q value. Parameters P, Q, and G can be 
- * public and common to a group of users. They might be known from application 
- * context. As such, they are optional but P and Q must either both appear or 
- * both be absent. If all of P, Q, seed, and pgenCounter are present, 
- * implementations are not required to check if they are consistent and are 
- * free to use either P and Q or seed and pgenCounter. All parameters are 
+ * Parameter J is available for inclusion solely for efficiency as it is
+ * calculatable from P and Q. Parameters seed and pgenCounter are used in the
+ * DSA prime number generation algorithm specified in [DSS]. As such, they are
+ * optional but must either both be present or both be absent. This prime
+ * generation algorithm is designed to provide assurance that a weak prime is
+ * not being used and it yields a P and Q value. Parameters P, Q, and G can be
+ * public and common to a group of users. They might be known from application
+ * context. As such, they are optional but P and Q must either both appear or
+ * both be absent. If all of P, Q, seed, and pgenCounter are present,
+ * implementations are not required to check if they are consistent and are
+ * free to use either P and Q or seed and pgenCounter. All parameters are
  * encoded as base64 [MIME] values.
- *     
- * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are 
+ *
+ * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are
  * represented in XML as octet strings as defined by the ds:CryptoBinary type.
- *     
+ *
  * Schema Definition:
- *     
- * <element name="DSAKeyValue" type="ds:DSAKeyValueType"/> 
- * <complexType name="DSAKeyValueType"> 
+ *
+ * <element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
+ * <complexType name="DSAKeyValueType">
  *   <sequence>
  *     <sequence minOccurs="0">
- *        <element name="P" type="ds:CryptoBinary"/> 
+ *        <element name="P" type="ds:CryptoBinary"/>
  *        <element name="Q" type="ds:CryptoBinary"/>
  *     </sequence>
- *     <element name="G" type="ds:CryptoBinary" minOccurs="0"/> 
- *     <element name="Y" type="ds:CryptoBinary"/> 
+ *     <element name="G" type="ds:CryptoBinary" minOccurs="0"/>
+ *     <element name="Y" type="ds:CryptoBinary"/>
  *     <element name="J" type="ds:CryptoBinary" minOccurs="0"/>
  *     <sequence minOccurs="0">
- *       <element name="Seed" type="ds:CryptoBinary"/> 
- *       <element name="PgenCounter" type="ds:CryptoBinary"/> 
+ *       <element name="Seed" type="ds:CryptoBinary"/>
+ *       <element name="PgenCounter" type="ds:CryptoBinary"/>
  *     </sequence>
  *   </sequence>
  * </complexType>
- *     
+ *
  * DTD Definition:
- *     
- *  <!ELEMENT DSAKeyValue ((P, Q)?, G?, Y, J?, (Seed, PgenCounter)?) > 
+ *
+ *  <!ELEMENT DSAKeyValue ((P, Q)?, G?, Y, J?, (Seed, PgenCounter)?) >
  *  <!ELEMENT P (#PCDATA) >
  *  <!ELEMENT Q (#PCDATA) >
  *  <!ELEMENT G (#PCDATA) >
@@ -1629,7 +1629,7 @@ static void xmlSecMSCryptoKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* ou
  *  <!ELEMENT PgenCounter (#PCDATA) >
  *
  * ============================================================================
- * 
+ *
  * To support reading/writing private keys an X element added (before Y).
  * todo: The current implementation does not support Seed and PgenCounter!
  * by this the P, Q and G are *required*!
@@ -1664,22 +1664,22 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataDsaKlass = {
 
     /* data */
     xmlSecNameDSAKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                         /* xmlSecKeyDataUsage usage; */
     xmlSecHrefDSAKeyValue,              /* const xmlChar* href; */
     xmlSecNodeDSAKeyValue,              /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                       /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecMSCryptoKeyDataDsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecMSCryptoKeyDataDsaDuplicate,  /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecMSCryptoKeyDataDsaFinalize,   /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecMSCryptoKeyDataDsaGenerate,   /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecMSCryptoKeyDataDsaGetType,    /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecMSCryptoKeyDataDsaGetSize,    /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                               /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                               /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecMSCryptoKeyDataDsaXmlRead,    /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -1698,12 +1698,12 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataDsaKlass = {
 
 /**
  * xmlSecMSCryptoKeyDataDsaGetKlass:
- * 
+ *
  * The DSA key data klass.
  *
  * Returns: pointer to DSA key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecMSCryptoKeyDataDsaGetKlass(void) {
     return(&xmlSecMSCryptoKeyDataDsaKlass);
 }
@@ -1722,7 +1722,7 @@ xmlSecMSCryptoKeyDataDsaInitialize(xmlSecKeyDataPtr data) {
 
     ctx->providerName = MS_DEF_DSS_PROV;
     ctx->providerType = PROV_DSS;
-    
+
     return(0);
 }
 
@@ -1737,7 +1737,7 @@ xmlSecMSCryptoKeyDataDsaDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
 static void
 xmlSecMSCryptoKeyDataDsaFinalize(xmlSecKeyDataPtr data) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataDsaId));
-    
+
     xmlSecMSCryptoKeyDataFinalize(data);
 }
 
@@ -1843,7 +1843,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
         goto done;
     }
@@ -1852,9 +1852,9 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     if((ret < 0) || (xmlSecBnGetSize(&p) == 0)){
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
-                    "xmlSecBnGetNodeValue",                 
+                    "xmlSecBnGetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
         goto done;
     }
@@ -1866,7 +1866,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
         goto done;
     }
@@ -1876,7 +1876,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecBnGetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
         goto done;
     }
@@ -1888,7 +1888,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
         goto done;
     }
@@ -1898,7 +1898,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecBnGetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
         goto done;
     }
@@ -1908,7 +1908,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
         /* next is X node. It is REQUIRED for private key but
          * MSCrypto does not support it, we just ignore it */
 
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
 
     /* next is Y node. */
@@ -1917,7 +1917,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAY));
         goto done;
     }
@@ -1934,17 +1934,17 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
 
     /* todo: add support for J */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAJ, xmlSecDSigNs))) {
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     /* todo: add support for seed */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSASeed, xmlSecDSigNs))) {
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
 
     /* todo: add support for pgencounter */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAPgenCounter, xmlSecDSigNs))) {
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
 
     if(cur != NULL) {
@@ -1982,7 +1982,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
 
     /* copy the key data */
     buf                     = (BYTE*) (xmlSecBufferGetData(&blob) + sizeof(PUBLICKEYSTRUC) + sizeof(DSSPUBKEY));
-    
+
     /* set p */
     xmlSecAssert2(xmlSecBnGetData(&p) != NULL, -1);
     memcpy(buf, xmlSecBnGetData(&p), xmlSecBnGetSize(&p));
@@ -2003,7 +2003,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
 
     /* Pad with zeros */
     for(i = xmlSecBnGetSize(&q); i < 0x14; ++i) {
-        *(buf++) = 0;    
+        *(buf++) = 0;
     }
 
     /* set generator */
@@ -2012,8 +2012,8 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     NULL,
                     "g",
                     XMLSEC_ERRORS_R_INVALID_SIZE,
-                    "size=%d > %d", 
-                    xmlSecBnGetSize(&g), 
+                    "size=%d > %d",
+                    xmlSecBnGetSize(&g),
                     xmlSecBnGetSize(&p));
         goto done;
     }
@@ -2022,7 +2022,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     buf += xmlSecBnGetSize(&g);
     /* Pad with zeros */
     for(i = xmlSecBnGetSize(&g); i < xmlSecBnGetSize(&p); ++i) {
-        *(buf++) = 0;    
+        *(buf++) = 0;
     }
 
     /* Public key */
@@ -2031,8 +2031,8 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     NULL,
                     "y",
                     XMLSEC_ERRORS_R_INVALID_SIZE,
-                    "size=%d > %d", 
-                    xmlSecBnGetSize(&y), 
+                    "size=%d > %d",
+                    xmlSecBnGetSize(&y),
                     xmlSecBnGetSize(&p));
         goto done;
     }
@@ -2041,7 +2041,7 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     buf += xmlSecBnGetSize(&y);
     /* Pad with zeros */
     for(i = xmlSecBnGetSize(&y); i < xmlSecBnGetSize(&p); ++i) {
-        *(buf++) = 0;    
+        *(buf++) = 0;
     }
 
     /* Set seed to 0xFFFFFFFFF */
@@ -2135,7 +2135,7 @@ done:
     return(res);
 }
 
-static int 
+static int
 xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecMSCryptoKeyDataCtxPtr ctx;
@@ -2148,7 +2148,7 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     xmlNodePtr cur;
     int ret;
 
-    
+
     xmlSecAssert2(id == xmlSecMSCryptoKeyDataDsaId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecMSCryptoKeyDataDsaId), -1);
@@ -2158,7 +2158,7 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     ctx = xmlSecMSCryptoKeyDataGetCtx(xmlSecKeyGetValue(key));
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(xmlSecMSCryptoKeyDataCtxGetKey(ctx) != 0, -1);
-    
+
     if (!CryptExportKey(xmlSecMSCryptoKeyDataCtxGetKey(ctx), 0, PUBLICKEYBLOB, 0, NULL, &dwBlobLen)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
@@ -2201,7 +2201,7 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     /* check PUBLICKEYSTRUC */
     pubKeyStruc     = (PUBLICKEYSTRUC*)blob;
     if(pubKeyStruc->bVersion != 0x02) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -2210,7 +2210,7 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
         return(-1);
     }
     if(pubKeyStruc->bType != PUBLICKEYBLOB) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -2222,7 +2222,7 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     /* check DSSPUBKEY */
     pubKey          = (DSSPUBKEY*)(blob + sizeof(PUBLICKEYSTRUC));
     if(pubKey->magic != 0x31535344) { /* DSS key magic */
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -2251,10 +2251,10 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
         xmlSecBufferFinalize(&buf);
-        return(-1);     
+        return(-1);
     }
 
     ret = xmlSecBnBlobSetNodeValue(blob, keyLen, cur, xmlSecBnBase64, 1, 1);
@@ -2263,11 +2263,11 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecBnBlobSetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
         xmlSecBufferFinalize(&buf);
         return(-1);
-    }    
+    }
     blob += keyLen;
 
     /* next is Q node. */
@@ -2277,10 +2277,10 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
         xmlSecBufferFinalize(&buf);
-        return(-1);     
+        return(-1);
     }
 
     /* we think that the size of q is 0x14, skip trailing zeros */
@@ -2292,7 +2292,7 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecBnBlobSetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
         xmlSecBufferFinalize(&buf);
         return(-1);
@@ -2306,10 +2306,10 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
         xmlSecBufferFinalize(&buf);
-        return(-1);     
+        return(-1);
     }
 
     /* skip trailing zeros */
@@ -2321,7 +2321,7 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecBnBlobSetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
         xmlSecBufferFinalize(&buf);
         return(-1);
@@ -2337,10 +2337,10 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAY));
         xmlSecBufferFinalize(&buf);
-        return(-1);     
+        return(-1);
     }
 
     /* skip trailing zeros */
@@ -2352,7 +2352,7 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecBnBlobSetNodeValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAY));
         xmlSecBufferFinalize(&buf);
         return(-1);
@@ -2366,7 +2366,7 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
 static int
 xmlSecMSCryptoKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
     xmlSecMSCryptoKeyDataCtxPtr ctx;
-    HCRYPTPROV hProv = 0; 
+    HCRYPTPROV hProv = 0;
     HCRYPTKEY hKey = 0;
     DWORD dwKeySpec;
     DWORD dwSize;
@@ -2411,7 +2411,7 @@ xmlSecMSCryptoKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xml
             goto done;
     }
 
-    ret = xmlSecMSCryptoKeyDataAdoptKey(data, hProv, TRUE, hKey, dwKeySpec, 
+    ret = xmlSecMSCryptoKeyDataAdoptKey(data, hProv, TRUE, hKey, dwKeySpec,
         xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate);
     if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2444,19 +2444,19 @@ xmlSecMSCryptoKeyDataDsaGetType(xmlSecKeyDataPtr data) {
     return(xmlSecMSCryptoKeyDataGetType(data));
 }
 
-static xmlSecSize 
+static xmlSecSize
 xmlSecMSCryptoKeyDataDsaGetSize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataDsaId), 0);
 
     return xmlSecMSCryptoKeyDataGetSize(data);
 }
 
-static void 
+static void
 xmlSecMSCryptoKeyDataDsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataDsaId));
     xmlSecAssert(output != NULL);
-    
-    fprintf(output, "=== dsa key: size = %d\n", 
+
+    fprintf(output, "=== dsa key: size = %d\n",
             xmlSecMSCryptoKeyDataDsaGetSize(data));
 }
 
@@ -2464,8 +2464,8 @@ static void
 xmlSecMSCryptoKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataDsaId));
     xmlSecAssert(output != NULL);
-        
-    fprintf(output, "<DSAKeyValue size=\"%d\" />\n", 
+
+    fprintf(output, "<DSAKeyValue size=\"%d\" />\n",
             xmlSecMSCryptoKeyDataDsaGetSize(data));
 }
 
@@ -2507,22 +2507,22 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataGost2001Klass = {
 
     /* data */
     xmlSecNameGOST2001KeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                         /* xmlSecKeyDataUsage usage; */
     xmlSecHrefGOST2001KeyValue,         /* const xmlChar* href; */
     xmlSecNodeGOST2001KeyValue,         /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                       /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecMSCryptoKeyDataGost2001Initialize,    /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecMSCryptoKeyDataGost2001Duplicate,     /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecMSCryptoKeyDataGost2001Finalize,      /* xmlSecKeyDataFinalizeMethod finalize; */
     NULL, /* xmlSecMSCryptoKeyDataGost2001Generate,*/   /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecMSCryptoKeyDataGost2001GetType,       /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecMSCryptoKeyDataGost2001GetSize,       /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                               /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                               /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     NULL,       /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -2541,12 +2541,12 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataGost2001Klass = {
 
 /**
  * xmlSecMSCryptoKeyDataGost2001GetKlass:
- * 
+ *
  * The GOST2001 key data klass.
  *
  * Returns: pointer to GOST2001 key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecMSCryptoKeyDataGost2001GetKlass(void) {
     return(&xmlSecMSCryptoKeyDataGost2001Klass);
 }
@@ -2596,7 +2596,7 @@ xmlSecMSCryptoKeyDataGost2001Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr sr
 static void
 xmlSecMSCryptoKeyDataGost2001Finalize(xmlSecKeyDataPtr data) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataGost2001Id));
-    
+
     xmlSecMSCryptoKeyDataFinalize(data);
 }
 
@@ -2605,19 +2605,19 @@ xmlSecMSCryptoKeyDataGost2001GetType(xmlSecKeyDataPtr data) {
     return(xmlSecMSCryptoKeyDataGetType(data));
 }
 
-static xmlSecSize 
+static xmlSecSize
 xmlSecMSCryptoKeyDataGost2001GetSize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataGost2001Id), 0);
 
     return xmlSecMSCryptoKeyDataGetSize(data);
 }
 
-static void 
+static void
 xmlSecMSCryptoKeyDataGost2001DebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataGost2001Id));
     xmlSecAssert(output != NULL);
-    
-    fprintf(output, "=== dsa key: size = %d\n", 
+
+    fprintf(output, "=== dsa key: size = %d\n",
             xmlSecMSCryptoKeyDataGost2001GetSize(data));
 }
 
@@ -2625,8 +2625,8 @@ static void
 xmlSecMSCryptoKeyDataGost2001DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataGost2001Id));
     xmlSecAssert(output != NULL);
-        
-    fprintf(output, "<GOST2001KeyValue size=\"%d\" />\n", 
+
+    fprintf(output, "<GOST2001KeyValue size=\"%d\" />\n",
             xmlSecMSCryptoKeyDataGost2001GetSize(data));
 }
 
diff --git a/src/mscrypto/ciphers.c b/src/mscrypto/ciphers.c
index 8185f85..54b8321 100644
--- a/src/mscrypto/ciphers.c
+++ b/src/mscrypto/ciphers.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  * Copyright (C) 2003 Aleksey Sanin <aleksey aleksey com>
  */
@@ -29,13 +29,13 @@
 #define MS_ENH_RSA_AES_PROV_PROTO "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
 #endif /* MS_ENH_RSA_AES_PROV_PROTO */
 
-static BOOL xmlSecMSCryptoCreatePrivateExponentOneKey   (HCRYPTPROV hProv, 
+static BOOL xmlSecMSCryptoCreatePrivateExponentOneKey   (HCRYPTPROV hProv,
                                                          HCRYPTKEY *hPrivateKey);
-static BOOL xmlSecMSCryptoImportPlainSessionBlob        (HCRYPTPROV hProv, 
+static BOOL xmlSecMSCryptoImportPlainSessionBlob        (HCRYPTPROV hProv,
                                                          HCRYPTKEY hPrivateKey,
-                                                         ALG_ID dwAlgId, 
+                                                         ALG_ID dwAlgId,
                                                          LPBYTE pbKeyMaterial,
-                                                         DWORD dwKeyMaterial, 
+                                                         DWORD dwKeyMaterial,
                                                          HCRYPTKEY *hSessionKey);
 
 /**************************************************************************
@@ -67,7 +67,7 @@ static int      xmlSecMSCryptoBlockCipherCtxUpdate      (xmlSecMSCryptoBlockCiph
                                                          xmlSecTransformCtxPtr transformCtx);
 
 
-static int 
+static int
 xmlSecMSCryptoBlockCipherCtxInit(xmlSecMSCryptoBlockCipherCtxPtr ctx,
                                  xmlSecBufferPtr in,
                                  xmlSecBufferPtr out,
@@ -88,25 +88,25 @@ xmlSecMSCryptoBlockCipherCtxInit(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     /* iv len == block len */
     dwBlockLenLen = sizeof(DWORD);
     if (!CryptGetKeyParam(ctx->cryptKey, KP_BLOCKLEN, (BYTE *)&dwBlockLen, &dwBlockLenLen, 0)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "CryptGetKeyParam",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     blockLen = dwBlockLen / 8;
     xmlSecAssert2(blockLen > 0, -1);
     if(encrypt) {
         unsigned char* iv;
         size_t outSize;
 
-        /* allocate space for IV */     
+        /* allocate space for IV */
         outSize = xmlSecBufferGetSize(out);
         ret = xmlSecBufferSetSize(out, outSize + blockLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferSetSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -117,16 +117,16 @@ xmlSecMSCryptoBlockCipherCtxInit(xmlSecMSCryptoBlockCipherCtxPtr ctx,
 
         /* generate and use random iv */
         if(!CryptGenRandom(ctx->cryptProvider, blockLen, iv)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "CryptGenRandom",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "len=%d", blockLen);
             return(-1);
         }
-            
+
         if(!CryptSetKeyParam(ctx->cryptKey, KP_IV, iv, 0)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "CryptSetKeyParam",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -134,7 +134,7 @@ xmlSecMSCryptoBlockCipherCtxInit(xmlSecMSCryptoBlockCipherCtxPtr ctx,
             return(-1);
         }
     } else {
-        /* if we don't have enough data, exit and hope that 
+        /* if we don't have enough data, exit and hope that
         * we'll have iv next time */
         if(xmlSecBufferGetSize(in) < (size_t)blockLen) {
             return(0);
@@ -143,7 +143,7 @@ xmlSecMSCryptoBlockCipherCtxInit(xmlSecMSCryptoBlockCipherCtxPtr ctx,
 
         /* set iv */
         if (!CryptSetKeyParam(ctx->cryptKey, KP_IV, xmlSecBufferGetData(in), 0)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "CryptSetKeyParam",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -154,7 +154,7 @@ xmlSecMSCryptoBlockCipherCtxInit(xmlSecMSCryptoBlockCipherCtxPtr ctx,
         /* and remove from input */
         ret = xmlSecBufferRemoveHead(in, blockLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -165,10 +165,10 @@ xmlSecMSCryptoBlockCipherCtxInit(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     }
 
     ctx->ctxInitialized = 1;
-    return(0);                                                           
+    return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
                                    xmlSecBufferPtr in, xmlSecBufferPtr out,
                                    int encrypt,
@@ -186,10 +186,10 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     xmlSecAssert2(in != NULL, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-        
+
     dwBlockLenLen = sizeof(DWORD);
     if (!CryptGetKeyParam(ctx->cryptKey, KP_BLOCKLEN, (BYTE *)&dwBlockLen, &dwBlockLenLen, 0)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "CryptSetKeyParam",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -201,7 +201,7 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
 
     inSize = xmlSecBufferGetSize(in);
     outSize = xmlSecBufferGetSize(out);
-    
+
     if(inSize < (size_t)blockLen) {
         return(0);
     }
@@ -209,7 +209,7 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     if(encrypt) {
         inBlocks = inSize / ((size_t)blockLen);
     } else {
-        /* we want to have the last block in the input buffer 
+        /* we want to have the last block in the input buffer
          * for padding check */
         inBlocks = (inSize - 1) / ((size_t)blockLen);
     }
@@ -218,7 +218,7 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     /* we write out the input size plus may be one block */
     ret = xmlSecBufferSetMaxSize(out, outSize + inSize + blockLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -233,7 +233,7 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     dwCLen = inSize;
     if(encrypt) {
         if(!CryptEncrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen, inSize + blockLen)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "CryptEncrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -242,7 +242,7 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
         }
     } else {
         if (!CryptDecrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "CryptSetKeyDecrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -252,7 +252,7 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     }
     /* Check if we really have de/encrypted the numbers of bytes that we requested */
     if (dwCLen != inSize) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "CryptEn/Decrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -263,7 +263,7 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     /* set correct output buffer size */
     ret = xmlSecBufferSetSize(out, outSize + inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -274,7 +274,7 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     /* remove the processed block from input */
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -284,7 +284,7 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
                                   xmlSecBufferPtr in,
                                   xmlSecBufferPtr out,
@@ -297,7 +297,7 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     unsigned char* outBuf;
     int ret;
     DWORD dwBlockLen, dwBlockLenLen, dwCLen;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->ctxInitialized != 0, -1);
     xmlSecAssert2(in != NULL, -1);
@@ -306,7 +306,7 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
 
     dwBlockLenLen = sizeof(DWORD);
     if (!CryptGetKeyParam(ctx->cryptKey, KP_BLOCKLEN, (BYTE *)&dwBlockLen, &dwBlockLenLen, 0)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "CryptGetKeyParam",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -320,12 +320,12 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     outSize = xmlSecBufferGetSize(out);
 
     if(encrypt != 0) {
-        xmlSecAssert2(inSize < (size_t)blockLen, -1);        
+        xmlSecAssert2(inSize < (size_t)blockLen, -1);
 
         /* create padding */
         ret = xmlSecBufferSetMaxSize(in, blockLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferSetMaxSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -337,7 +337,7 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
         /* create random padding */
         if((size_t)blockLen > (inSize + 1)) {
             if (!CryptGenRandom(ctx->cryptProvider, blockLen - inSize - 1, inBuf + inSize)) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(cipherName),
                             "CryptGenRandom",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -349,7 +349,7 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
         inSize = blockLen;
     } else {
         if(inSize != (size_t)blockLen) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
@@ -358,11 +358,11 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
         }
         inBuf = xmlSecBufferGetData(in);
     }
-    
+
     /* process last block */
     ret = xmlSecBufferSetMaxSize(out, outSize + 2 * blockLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -374,10 +374,10 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
 
     dwCLen = inSize;
     if(encrypt) {
-        /* Set process last block to false, since we handle padding ourselves, and MSCrypto padding 
+        /* Set process last block to false, since we handle padding ourselves, and MSCrypto padding
          * can be skipped. I hope this will work .... */
         if(!CryptEncrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen, inSize + blockLen)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "CryptEncrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -386,7 +386,7 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
         }
     } else {
         if (!CryptDecrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "CryptDecrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -397,7 +397,7 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
 
     /* Check if we really have de/encrypted the numbers of bytes that we requested */
     if (dwCLen != inSize) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "CryptEn/Decrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -414,7 +414,7 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
                         XMLSEC_ERRORS_R_INVALID_DATA,
                         "padding=%d;buffer=%d",
                         outBuf[blockLen - 1], inSize);
-            return(-1); 
+            return(-1);
         }
         outLen = inSize - outBuf[blockLen - 1];
     } else {
@@ -424,7 +424,7 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     /* set correct output buffer size */
     ret = xmlSecBufferSetSize(out, outSize + outLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -435,14 +435,14 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
     /* remove the processed block from input */
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", inSize);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -451,7 +451,7 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
  *  Block Cipher transforms
  *
  * xmlSecMSCryptoBlockCipherCtx block is located after xmlSecTransform structure
- * 
+ *
  *****************************************************************************/
 #define xmlSecMSCryptoBlockCipherSize   \
     (sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoBlockCipherCtx))
@@ -460,7 +460,7 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
 
 static int      xmlSecMSCryptoBlockCipherInitialize     (xmlSecTransformPtr transform);
 static void     xmlSecMSCryptoBlockCipherFinalize       (xmlSecTransformPtr transform);
-static int      xmlSecMSCryptoBlockCipherSetKeyReq      (xmlSecTransformPtr transform, 
+static int      xmlSecMSCryptoBlockCipherSetKeyReq      (xmlSecTransformPtr transform,
                                                          xmlSecKeyReqPtr keyReq);
 static int      xmlSecMSCryptoBlockCipherSetKey         (xmlSecTransformPtr transform,
                                                          xmlSecKeyPtr key);
@@ -468,7 +468,7 @@ static int      xmlSecMSCryptoBlockCipherExecute        (xmlSecTransformPtr tran
                                                          int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 static int      xmlSecMSCryptoBlockCipherCheckId        (xmlSecTransformPtr transform);
-                                                         
+
 static int
 xmlSecMSCryptoBlockCipherCheckId(xmlSecTransformPtr transform) {
 #ifndef XMLSEC_NO_DES
@@ -489,7 +489,7 @@ xmlSecMSCryptoBlockCipherCheckId(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoBlockCipherInitialize(xmlSecTransformPtr transform) {
     xmlSecMSCryptoBlockCipherCtxPtr ctx;
 
@@ -498,7 +498,7 @@ xmlSecMSCryptoBlockCipherInitialize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecMSCryptoBlockCipherGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecMSCryptoBlockCipherCtx));
 
 #ifndef XMLSEC_NO_DES
@@ -508,7 +508,7 @@ xmlSecMSCryptoBlockCipherInitialize(xmlSecTransformPtr transform) {
         ctx->providerName           = MS_ENHANCED_PROV;
         ctx->providerType           = PROV_RSA_FULL;
         ctx->keySize                = 24;
-    } else 
+    } else
 #endif /* XMLSEC_NO_DES */
 
 #ifndef XMLSEC_NO_AES
@@ -530,25 +530,25 @@ xmlSecMSCryptoBlockCipherInitialize(xmlSecTransformPtr transform) {
         ctx->providerName           = MS_ENH_RSA_AES_PROV_PROTO;
         ctx->providerType           = PROV_RSA_AES;
         ctx->keySize                = 32;
-    } else 
+    } else
 #endif /* XMLSEC_NO_AES */
 
     if(1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
             NULL,
             XMLSEC_ERRORS_R_INVALID_TRANSFORM,
             XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }        
-        
-    if(!CryptAcquireContext(&ctx->cryptProvider, NULL /*"xmlSecMSCryptoTempContainer"*/, 
+    }
+
+    if(!CryptAcquireContext(&ctx->cryptProvider, NULL /*"xmlSecMSCryptoTempContainer"*/,
                              ctx->providerName, ctx->providerType, 0)) {
         DWORD dwError = GetLastError();
         if (dwError == NTE_EXISTS) {
-            if (!CryptAcquireContext(&ctx->cryptProvider, "xmlSecMSCryptoTempContainer", 
+            if (!CryptAcquireContext(&ctx->cryptProvider, "xmlSecMSCryptoTempContainer",
                                      ctx->providerName, ctx->providerType, 0)) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "CryptAcquireContext",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -557,15 +557,15 @@ xmlSecMSCryptoBlockCipherInitialize(xmlSecTransformPtr transform) {
                 return(-1);
             }
         } else if (dwError == NTE_BAD_KEYSET) {
-          /* This error can indicate that a newly installed provider 
+          /* This error can indicate that a newly installed provider
            * does not have a usable key container yet. It needs to be
            * created, and then we have to try again CryptAcquireContext.
-           * This is also referenced in 
+           * This is also referenced in
            * http://www.microsoft.com/mind/0697/crypto.asp (inituser)
            */
             if(!CryptAcquireContext(&ctx->cryptProvider, NULL, ctx->providerName,
                                     ctx->providerType, CRYPT_NEWKEYSET)) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "CryptAcquireContext",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -573,7 +573,7 @@ xmlSecMSCryptoBlockCipherInitialize(xmlSecTransformPtr transform) {
                 return(-1);
             }
         } else {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "CryptAcquireContext",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -584,7 +584,7 @@ xmlSecMSCryptoBlockCipherInitialize(xmlSecTransformPtr transform) {
 
     /* Create dummy key to be able to import plain session keys */
     if (!xmlSecMSCryptoCreatePrivateExponentOneKey(ctx->cryptProvider, &(ctx->pubPrivKey))) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecMSCryptoCreatePrivateExponentOneKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -597,7 +597,7 @@ xmlSecMSCryptoBlockCipherInitialize(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static void 
+static void
 xmlSecMSCryptoBlockCipherFinalize(xmlSecTransformPtr transform) {
     xmlSecMSCryptoBlockCipherCtxPtr ctx;
 
@@ -615,14 +615,14 @@ xmlSecMSCryptoBlockCipherFinalize(xmlSecTransformPtr transform) {
     }
     if (ctx->cryptProvider) {
         CryptReleaseContext(ctx->cryptProvider, 0);
-        CryptAcquireContext(&ctx->cryptProvider, "xmlSecMSCryptoTempContainer", 
+        CryptAcquireContext(&ctx->cryptProvider, "xmlSecMSCryptoTempContainer",
                             MS_ENHANCED_PROV, ctx->providerType, CRYPT_DELETEKEYSET);
     }
 
     memset(ctx, 0, sizeof(xmlSecMSCryptoBlockCipherCtx));
 }
 
-static int  
+static int
 xmlSecMSCryptoBlockCipherSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecMSCryptoBlockCipherCtxPtr ctx;
 
@@ -685,12 +685,12 @@ xmlSecMSCryptoBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key)
     /* Import this key and get an HCRYPTKEY handle */
     if (!xmlSecMSCryptoImportPlainSessionBlob(ctx->cryptProvider,
         ctx->pubPrivKey,
-        ctx->algorithmIdentifier, 
-        bufData, 
-        ctx->keySize, 
+        ctx->algorithmIdentifier,
+        bufData,
+        ctx->keySize,
         &(ctx->cryptKey)))  {
 
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecMSCryptoImportPlainSessionBlob",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -702,17 +702,17 @@ xmlSecMSCryptoBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key)
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecMSCryptoBlockCipherCtxPtr ctx;
     xmlSecBufferPtr in, out;
     int ret;
-    
+
     xmlSecAssert2(xmlSecMSCryptoBlockCipherCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecMSCryptoBlockCipherSize), -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-        
+
     in = &(transform->inBuf);
     out = &(transform->outBuf);
 
@@ -725,15 +725,15 @@ xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecT
 
     if(transform->status == xmlSecTransformStatusWorking) {
         if(ctx->ctxInitialized == 0) {
-            ret = xmlSecMSCryptoBlockCipherCtxInit(ctx, 
-                                                   in, 
+            ret = xmlSecMSCryptoBlockCipherCtxInit(ctx,
+                                                   in,
                                                    out,
                                                    (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
                                                    xmlSecTransformGetName(transform),
                                                    transformCtx);
-                                
+
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecMSCryptoBlockCipherCtxInit",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -742,7 +742,7 @@ xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecT
             }
         }
         if((ctx->ctxInitialized == 0) && (last != 0)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
@@ -750,11 +750,11 @@ xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecT
             return(-1);
         }
         if(ctx->ctxInitialized != 0) {
-            ret = xmlSecMSCryptoBlockCipherCtxUpdate(ctx, in, out, 
+            ret = xmlSecMSCryptoBlockCipherCtxUpdate(ctx, in, out,
                 (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
                 xmlSecTransformGetName(transform), transformCtx);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecMSCryptoBlockCipherCtxUpdate",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -762,14 +762,14 @@ xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecT
                 return(-1);
             }
         }
-        
+
         if(last) {
-            ret = xmlSecMSCryptoBlockCipherCtxFinal(ctx, in, out, 
+            ret = xmlSecMSCryptoBlockCipherCtxFinal(ctx, in, out,
                 (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
                 xmlSecTransformGetName(transform), transformCtx);
 
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecMSCryptoBlockCipherCtxFinal",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -777,7 +777,7 @@ xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecT
                 return(-1);
             }
             transform->status = xmlSecTransformStatusFinished;
-        } 
+        }
     } else if(transform->status == xmlSecTransformStatusFinished) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
@@ -785,14 +785,14 @@ xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecT
         /* the only way we can get here is if there is no enough data in the input */
         xmlSecAssert2(last == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -831,12 +831,12 @@ static xmlSecTransformKlass xmlSecMSCryptoAes128CbcKlass = {
 
 /**
  * xmlSecMSCryptoTransformAes128CbcGetKlass:
- * 
+ *
  * AES 128 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 128 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecMSCryptoTransformAes128CbcGetKlass(void) {
     return(&xmlSecMSCryptoAes128CbcKlass);
 }
@@ -863,19 +863,19 @@ static xmlSecTransformKlass xmlSecMSCryptoAes192CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecMSCryptoBlockCipherExecute,           /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecMSCryptoTransformAes192CbcGetKlass:
- * 
+ *
  * AES 192 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 192 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecMSCryptoTransformAes192CbcGetKlass(void) {
     return(&xmlSecMSCryptoAes192CbcKlass);
 }
@@ -902,19 +902,19 @@ static xmlSecTransformKlass xmlSecMSCryptoAes256CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecMSCryptoBlockCipherExecute,           /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecMSCryptoTransformAes256CbcGetKlass:
- * 
+ *
  * AES 256 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 256 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecMSCryptoTransformAes256CbcGetKlass(void) {
     return(&xmlSecMSCryptoAes256CbcKlass);
 }
@@ -945,33 +945,33 @@ static xmlSecTransformKlass xmlSecMSCryptoDes3CbcKlass = {
     NULL,                                /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecMSCryptoBlockCipherExecute,    /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                /* void* reserved0; */
     NULL,                                /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecMSCryptoTransformDes3CbcGetKlass:
  *
  * Triple DES CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to Triple DES encryption transform.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecMSCryptoTransformDes3CbcGetKlass(void) {
     return(&xmlSecMSCryptoDes3CbcKlass);
 }
 #endif /* XMLSEC_NO_DES */
 
 /*
- * Low level helper routines for importing plain text keys in MS HKEY handle, 
+ * Low level helper routines for importing plain text keys in MS HKEY handle,
  * since MSCrypto API does not support import of plain text (session) keys
  * just like that.
  * These functions are based upon MS kb article: 228786
- * 
+ *
  * aleksey: also check "Base Provider Key BLOBs" article for priv key blob format
  **/
-static BOOL 
+static BOOL
 xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateKey)
 {
     HCRYPTKEY hKey = 0;
@@ -992,7 +992,7 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
 
     /* Generate the private key */
     if(!CryptGenKey(hProv, AT_KEYEXCHANGE, CRYPT_EXPORTABLE, &hKey)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptGenKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1002,7 +1002,7 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
 
     /* Export the private key, we'll convert it to a private exponent of one key */
     if(!CryptExportKey(hKey, 0, PRIVATEKEYBLOB, 0, NULL, &keyBlobLen)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1012,16 +1012,16 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
 
     keyBlob = (LPBYTE)xmlMalloc(sizeof(BYTE) * keyBlobLen);
     if(keyBlob == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
     }
- 
+
     if(!CryptExportKey(hKey, 0, PRIVATEKEYBLOB, 0, keyBlob, &keyBlobLen)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1033,7 +1033,7 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
 
     /* Get the bit length of the key */
     if(keyBlobLen < sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1042,7 +1042,7 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
     }
     pubKeyStruc = (PUBLICKEYSTRUC*)keyBlob;
     if(pubKeyStruc->bVersion != 0x02) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1050,7 +1050,7 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
         goto done;
     }
     if(pubKeyStruc->bType != PRIVATEKEYBLOB) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1059,11 +1059,11 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
     }
 
     /* aleksey: don't ask me why it is RSAPUBKEY, just don't ask */
-    rsaPubKey = (RSAPUBKEY*)(keyBlob + sizeof(PUBLICKEYSTRUC)); 
+    rsaPubKey = (RSAPUBKEY*)(keyBlob + sizeof(PUBLICKEYSTRUC));
 
     /* check that we have RSA private key */
-    if(rsaPubKey->magic != 0x32415352) { 
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+    if(rsaPubKey->magic != 0x32415352) {
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1075,28 +1075,28 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
     /*  Modify the Exponent in Key BLOB format Key BLOB format is documented in SDK */
     rsaPubKey->pubexp = 1;
 
-    /* Private-key BLOBs, type PRIVATEKEYBLOB, are used to store private keys outside a CSP. 
+    /* Private-key BLOBs, type PRIVATEKEYBLOB, are used to store private keys outside a CSP.
      * Base provider private-key BLOBs have the following format:
-     * 
+     *
      * PUBLICKEYSTRUC  publickeystruc ;
      * RSAPUBKEY rsapubkey;
      * BYTE modulus[rsapubkey.bitlen/8];                1/8
-     * BYTE prime1[rsapubkey.bitlen/16];                1/16 
-     * BYTE prime2[rsapubkey.bitlen/16];                1/16 
-     * BYTE exponent1[rsapubkey.bitlen/16];             1/16 
-     * BYTE exponent2[rsapubkey.bitlen/16];             1/16 
+     * BYTE prime1[rsapubkey.bitlen/16];                1/16
+     * BYTE prime2[rsapubkey.bitlen/16];                1/16
+     * BYTE exponent1[rsapubkey.bitlen/16];             1/16
+     * BYTE exponent2[rsapubkey.bitlen/16];             1/16
      * BYTE coefficient[rsapubkey.bitlen/16];           1/16
      * BYTE privateExponent[rsapubkey.bitlen/8];        1/8
      */
     if(keyBlobLen < sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY) + bitLen / 2 + bitLen / 16) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptExportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "len=%ld", keyBlobLen);
         goto done;
     }
-    ptr = (BYTE*)(keyBlob + sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY)); 
+    ptr = (BYTE*)(keyBlob + sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY));
 
     /* Skip modulus, prime1, prime2 */
     ptr += bitLen / 8;
@@ -1127,8 +1127,8 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
     }
 
     /* Import the exponent-of-one private key. */
-    if (!CryptImportKey(hProv, keyBlob, keyBlobLen, 0, 0, &hKey)) {                 
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+    if (!CryptImportKey(hProv, keyBlob, keyBlobLen, 0, 0, &hKey)) {
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptImportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1138,9 +1138,9 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
     (*hPrivateKey) = hKey;
     hKey = 0;
     res = TRUE;
-   
+
 done:
-    if(keyBlob != NULL) { 
+    if(keyBlob != NULL) {
         xmlFree(keyBlob);
     }
     if (hKey != 0) {
@@ -1150,7 +1150,7 @@ done:
     return res;
 }
 
-static BOOL 
+static BOOL
 xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
                                      ALG_ID dwAlgId, LPBYTE pbKeyMaterial,
                                      DWORD dwKeyMaterial, HCRYPTKEY *hSessionKey) {
@@ -1161,13 +1161,13 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
     ALG_ID* algId;
     DWORD dwPublicKeySize;
     DWORD dwProvSessionKeySize;
-    LPBYTE pbPtr; 
+    LPBYTE pbPtr;
     DWORD dwFlags;
     PROV_ENUMALGS_EX ProvEnum;
     HCRYPTKEY hTempKey = 0;
     BOOL fFound;
     BOOL res = FALSE;
-    
+
     xmlSecAssert2(hProv != 0, FALSE);
     xmlSecAssert2(hPrivateKey != 0, FALSE);
     xmlSecAssert2(pbKeyMaterial != NULL, FALSE);
@@ -1187,7 +1187,7 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
         dwFlags = 0;
     }
     if(!fFound) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptGetProvParam",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1195,11 +1195,11 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
         goto done;
     }
 
-    /* We have to get the key size(including padding) from an HCRYPTKEY handle.  
+    /* We have to get the key size(including padding) from an HCRYPTKEY handle.
      * PP_ENUMALGS_EX contains the key size without the padding so we can't use it.
      */
     if(!CryptGenKey(hProv, dwAlgId, 0, &hTempKey)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptGenKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1209,7 +1209,7 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
 
     dwSize = sizeof(DWORD);
     if(!CryptGetKeyParam(hTempKey, KP_KEYLEN, (LPBYTE)&dwProvSessionKeySize, &dwSize, 0)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptGetKeyParam(KP_KEYLEN)",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1221,11 +1221,11 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
 
     /* Our key is too big, leave */
     if ((dwKeyMaterial * 8) > dwProvSessionKeySize) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_SIZE,
-                    "dwKeyMaterial=%ld;dwProvSessionKeySize=%ld", 
+                    "dwKeyMaterial=%ld;dwProvSessionKeySize=%ld",
                     dwKeyMaterial, dwProvSessionKeySize);
         goto done;
     }
@@ -1233,7 +1233,7 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
     /* Get private key's algorithm */
     dwSize = sizeof(ALG_ID);
     if(!CryptGetKeyParam(hPrivateKey, KP_ALGID, (LPBYTE)&dwPrivKeyAlg, &dwSize, 0)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptGetKeyParam(KP_ALGID)",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1244,30 +1244,30 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
     /* Get private key's length in bits */
     dwSize = sizeof(DWORD);
     if(!CryptGetKeyParam(hPrivateKey, KP_KEYLEN, (LPBYTE)&dwPublicKeySize, &dwSize, 0)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptGetKeyParam(KP_KEYLEN)",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "algId=%d", dwAlgId);
         goto done;
     }
-    
+
     /* 3 is for the first reserved byte after the key material and the 2 reserved bytes at the end. */
     if(dwPublicKeySize / 8 < dwKeyMaterial + 3) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_SIZE,
-                    "dwKeyMaterial=%ld;dwPublicKeySize=%ld", 
+                    "dwKeyMaterial=%ld;dwPublicKeySize=%ld",
                     dwKeyMaterial, dwPublicKeySize);
         goto done;
     }
     rndBlobSize = dwPublicKeySize / 8 - (dwKeyMaterial + 3);
 
-    /* Simple key BLOBs, type SIMPLEBLOB, are used to store and transport session keys outside a CSP. 
-     * Base provider simple-key BLOBs are always encrypted with a key exchange public key. The pbData 
+    /* Simple key BLOBs, type SIMPLEBLOB, are used to store and transport session keys outside a CSP.
+     * Base provider simple-key BLOBs are always encrypted with a key exchange public key. The pbData
      * member of the SIMPLEBLOB is a sequence of bytes in the following format:
-     * 
+     *
      * PUBLICKEYSTRUC  publickeystruc ;
      * ALG_ID algid;
      * BYTE encryptedkey[rsapubkey.bitlen/8];
@@ -1279,7 +1279,7 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
     /* allocate simple blob buffer */
     keyBlob = (LPBYTE)xmlMalloc(sizeof(BYTE) * keyBlobLen);
     if(keyBlob == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
@@ -1293,7 +1293,7 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
     pubKeyStruc->bType      = SIMPLEBLOB;
     pubKeyStruc->bVersion   = 0x02;
     pubKeyStruc->reserved   = 0;
-    pubKeyStruc->aiKeyAlg   = dwAlgId;  
+    pubKeyStruc->aiKeyAlg   = dwAlgId;
 
     /* Copy private key algorithm to buffer */
     algId                   = (ALG_ID*)(keyBlob + sizeof(PUBLICKEYSTRUC));
@@ -1311,7 +1311,7 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
 
     /* Generate random data for the rest of the buffer */
     if((rndBlobSize > 0) && !CryptGenRandom(hProv, rndBlobSize, pbPtr)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptGenRandom",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1327,7 +1327,7 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
     keyBlob[keyBlobLen - 2] = 2;
 
     if(!CryptImportKey(hProv, keyBlob , keyBlobLen, hPrivateKey, CRYPT_EXPORTABLE, hSessionKey)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "CryptImportKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -1336,7 +1336,7 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
     }
 
     /* success */
-    res = TRUE;           
+    res = TRUE;
 
 done:
     if(hTempKey != 0) {
diff --git a/src/mscrypto/crypto.c b/src/mscrypto/crypto.c
index d25a8b6..2be8009 100644
--- a/src/mscrypto/crypto.c
+++ b/src/mscrypto/crypto.c
@@ -1,12 +1,12 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  * Copyright (C) 2003 Aleksey Sanin <aleksey aleksey com>
- * Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).  
+ * Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).
  */
 #include "globals.h"
 
@@ -40,7 +40,7 @@ static xmlSecCryptoDLFunctionsPtr gXmlSecMSCryptoFunctions = NULL;
 xmlSecCryptoDLFunctionsPtr
 xmlSecCryptoGetFunctions_mscrypto(void) {
     static xmlSecCryptoDLFunctions functions;
-    
+
     if(gXmlSecMSCryptoFunctions != NULL) {
         return(gXmlSecMSCryptoFunctions);
     }
@@ -48,7 +48,7 @@ xmlSecCryptoGetFunctions_mscrypto(void) {
     memset(&functions, 0, sizeof(functions));
     gXmlSecMSCryptoFunctions = &functions;
 
-    /**  
+    /**
      * Crypto Init/shutdown
      */
     gXmlSecMSCryptoFunctions->cryptoInit                        = xmlSecMSCryptoInit;
@@ -58,11 +58,11 @@ xmlSecCryptoGetFunctions_mscrypto(void) {
     /**
      * Key data ids
      */
-#ifndef XMLSEC_NO_DES    
+#ifndef XMLSEC_NO_DES
     gXmlSecMSCryptoFunctions->keyDataDesGetKlass                = xmlSecMSCryptoKeyDataDesGetKlass;
 #endif /* XMLSEC_NO_DES */
 
-#ifndef XMLSEC_NO_AES    
+#ifndef XMLSEC_NO_AES
     gXmlSecMSCryptoFunctions->keyDataAesGetKlass                = xmlSecMSCryptoKeyDataAesGetKlass;
 #endif /* XMLSEC_NO_AES */
 
@@ -93,13 +93,13 @@ xmlSecCryptoGetFunctions_mscrypto(void) {
     /**
      * Crypto transforms ids
      */
-#ifndef XMLSEC_NO_AES    
+#ifndef XMLSEC_NO_AES
     gXmlSecMSCryptoFunctions->transformAes128CbcGetKlass        = xmlSecMSCryptoTransformAes128CbcGetKlass;
     gXmlSecMSCryptoFunctions->transformAes192CbcGetKlass        = xmlSecMSCryptoTransformAes192CbcGetKlass;
     gXmlSecMSCryptoFunctions->transformAes256CbcGetKlass        = xmlSecMSCryptoTransformAes256CbcGetKlass;
 #endif /* XMLSEC_NO_AES */
 
-#ifndef XMLSEC_NO_DES    
+#ifndef XMLSEC_NO_DES
     gXmlSecMSCryptoFunctions->transformDes3CbcGetKlass          = xmlSecMSCryptoTransformDes3CbcGetKlass;
 #endif /* XMLSEC_NO_DES */
 
@@ -116,17 +116,17 @@ xmlSecCryptoGetFunctions_mscrypto(void) {
     gXmlSecMSCryptoFunctions->transformGost2001GostR3411_94GetKlass             = xmlSecMSCryptoTransformGost2001GostR3411_94GetKlass;
 #endif /* XMLSEC_NO_GOST */
 
-#ifndef XMLSEC_NO_SHA1    
+#ifndef XMLSEC_NO_SHA1
     gXmlSecMSCryptoFunctions->transformSha1GetKlass             = xmlSecMSCryptoTransformSha1GetKlass;
 #endif /* XMLSEC_NO_SHA1 */
 
-#ifndef XMLSEC_NO_GOST    
+#ifndef XMLSEC_NO_GOST
     gXmlSecMSCryptoFunctions->transformGostR3411_94GetKlass             = xmlSecMSCryptoTransformGostR3411_94GetKlass;
 #endif /* XMLSEC_NO_GOST */
 
     /**
      * High level routines form xmlsec command line utility
-     */ 
+     */
     gXmlSecMSCryptoFunctions->cryptoAppInit                     = xmlSecMSCryptoAppInit;
     gXmlSecMSCryptoFunctions->cryptoAppShutdown                 = xmlSecMSCryptoAppShutdown;
     gXmlSecMSCryptoFunctions->cryptoAppDefaultKeysMngrInit      = xmlSecMSCryptoAppDefaultKeysMngrInit;
@@ -136,13 +136,13 @@ xmlSecCryptoGetFunctions_mscrypto(void) {
 #ifndef XMLSEC_NO_X509
     gXmlSecMSCryptoFunctions->cryptoAppKeysMngrCertLoad         = xmlSecMSCryptoAppKeysMngrCertLoad;
     gXmlSecMSCryptoFunctions->cryptoAppKeysMngrCertLoadMemory   = xmlSecMSCryptoAppKeysMngrCertLoadMemory;
-    gXmlSecMSCryptoFunctions->cryptoAppPkcs12Load               = xmlSecMSCryptoAppPkcs12Load; 
-    gXmlSecMSCryptoFunctions->cryptoAppPkcs12LoadMemory         = xmlSecMSCryptoAppPkcs12LoadMemory; 
+    gXmlSecMSCryptoFunctions->cryptoAppPkcs12Load               = xmlSecMSCryptoAppPkcs12Load;
+    gXmlSecMSCryptoFunctions->cryptoAppPkcs12LoadMemory         = xmlSecMSCryptoAppPkcs12LoadMemory;
     gXmlSecMSCryptoFunctions->cryptoAppKeyCertLoad              = xmlSecMSCryptoAppKeyCertLoad;
     gXmlSecMSCryptoFunctions->cryptoAppKeyCertLoadMemory        = xmlSecMSCryptoAppKeyCertLoadMemory;
 #endif /* XMLSEC_NO_X509 */
-    gXmlSecMSCryptoFunctions->cryptoAppKeyLoad                  = xmlSecMSCryptoAppKeyLoad; 
-    gXmlSecMSCryptoFunctions->cryptoAppKeyLoadMemory            = xmlSecMSCryptoAppKeyLoadMemory; 
+    gXmlSecMSCryptoFunctions->cryptoAppKeyLoad                  = xmlSecMSCryptoAppKeyLoad;
+    gXmlSecMSCryptoFunctions->cryptoAppKeyLoadMemory            = xmlSecMSCryptoAppKeyLoadMemory;
     gXmlSecMSCryptoFunctions->cryptoAppDefaultPwdCallback       = (void*)xmlSecMSCryptoAppGetDefaultPwdCallback();
 
     return(gXmlSecMSCryptoFunctions);
@@ -150,12 +150,12 @@ xmlSecCryptoGetFunctions_mscrypto(void) {
 
 /**
  * xmlSecMSCryptoInit:
- * 
- * XMLSec library specific crypto engine initialization. 
+ *
+ * XMLSec library specific crypto engine initialization.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecMSCryptoInit (void)  {
     /* Check loaded xmlsec library version */
     if(xmlSecCheckVersionExact() != 1) {
@@ -184,12 +184,12 @@ xmlSecMSCryptoInit (void)  {
 
 /**
  * xmlSecMSCryptoShutdown:
- * 
- * XMLSec library specific crypto engine shutdown. 
+ *
+ * XMLSec library specific crypto engine shutdown.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecMSCryptoShutdown(void) {
     /* TODO: if necessary, do additional shutdown here */
     return(0);
@@ -203,10 +203,10 @@ xmlSecMSCryptoShutdown(void) {
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecMSCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) {
     int ret;
-   
+
     xmlSecAssert2(mngr != NULL, -1);
 
 #ifndef XMLSEC_NO_X509
@@ -252,16 +252,16 @@ xmlSecMSCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) {
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecMSCryptoGenerateRandom(xmlSecBufferPtr buffer, size_t size) {     
+xmlSecMSCryptoGenerateRandom(xmlSecBufferPtr buffer, size_t size) {
     HCRYPTPROV hProv = 0;
     int ret;
-    
+
     xmlSecAssert2(buffer != NULL, -1);
     xmlSecAssert2(size > 0, -1);
 
     ret = xmlSecBufferSetSize(buffer, size);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -296,14 +296,14 @@ xmlSecMSCryptoGenerateRandom(xmlSecBufferPtr buffer, size_t size) {
  * @file:               the error location file name (__FILE__ macro).
  * @line:               the error location line number (__LINE__ macro).
  * @func:               the error location function name (__FUNCTION__ macro).
- * @errorObject:        the error specific error object 
+ * @errorObject:        the error specific error object
  * @errorSubject:       the error specific error subject.
  * @reason:             the error code.
  * @msg:                the additional error message.
  *
  * The default errors reporting callback function.
  */
-void 
+void
 xmlSecMSCryptoErrorsDefaultCallback(const char* file, int line, const char* func,
                                 const char* errorObject, const char* errorSubject,
                                 int reason, const char* msg) {
@@ -312,8 +312,8 @@ xmlSecMSCryptoErrorsDefaultCallback(const char* file, int line, const char* func
     xmlChar buf[500];
 
     dwError = GetLastError();
-    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
-                  FORMAT_MESSAGE_FROM_SYSTEM | 
+    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                  FORMAT_MESSAGE_FROM_SYSTEM |
                   FORMAT_MESSAGE_IGNORE_INSERTS,
                   NULL,
                   dwError,
@@ -326,8 +326,8 @@ xmlSecMSCryptoErrorsDefaultCallback(const char* file, int line, const char* func
     } else {
         xmlSecStrPrintf(buf, sizeof(buf), BAD_CAST "last error=%d (0x%08x);last error msg=%s", dwError, dwError, (LPTSTR)lpMsgBuf);
     }
-    xmlSecErrorsDefaultCallback(file, line, func, 
-                errorObject, errorSubject, 
+    xmlSecErrorsDefaultCallback(file, line, func,
+                errorObject, errorSubject,
                 reason, (char*)buf);
 
     LocalFree(lpMsgBuf);
@@ -344,21 +344,21 @@ xmlSecMSCryptoErrorsDefaultCallback(const char* file, int line, const char* func
  *
  * Returns: a pointer to newly allocated string or NULL if an error occurs.
  */
-BYTE* 
+BYTE*
 xmlSecMSCryptoCertStrToName(DWORD dwCertEncodingType, LPCTSTR pszX500, DWORD dwStrType, DWORD* len) {
-    BYTE* str = NULL; 
+    BYTE* str = NULL;
     LPCTSTR ppszError = NULL;
 
     xmlSecAssert2(pszX500 != NULL, NULL);
     xmlSecAssert2(len != NULL, NULL);
 
-    if (!CertStrToName(dwCertEncodingType, pszX500, dwStrType, 
+    if (!CertStrToName(dwCertEncodingType, pszX500, dwStrType,
                         NULL, NULL, len, &ppszError)) {
         /* this might not be an error, string might just not exist */
                 DWORD dw = GetLastError();
         return(NULL);
     }
-        
+
     str = (BYTE *)xmlMalloc((*len) + 1);
     if(str == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -369,8 +369,8 @@ xmlSecMSCryptoCertStrToName(DWORD dwCertEncodingType, LPCTSTR pszX500, DWORD dwS
         return(NULL);
     }
     memset(str, 0, (*len) + 1);
-        
-    if (!CertStrToName(dwCertEncodingType, pszX500, dwStrType, 
+
+    if (!CertStrToName(dwCertEncodingType, pszX500, dwStrType,
                         NULL, str, len, NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -395,21 +395,21 @@ xmlSecMSCryptoCertStrToName(DWORD dwCertEncodingType, LPCTSTR pszX500, DWORD dwS
  *
  * Returns: a pointer to newly allocated string or NULL if an error occurs.
  */
-BYTE* 
+BYTE*
 xmlSecMSCryptoCertStrToNameW(DWORD dwCertEncodingType, LPWSTR pszX500, DWORD dwStrType, DWORD* len) {
-    BYTE* str = NULL; 
+    BYTE* str = NULL;
     LPCWSTR ppszError = NULL;
 
     xmlSecAssert2(pszX500 != NULL, NULL);
     xmlSecAssert2(len != NULL, NULL);
 
-    if (!CertStrToNameW(dwCertEncodingType, pszX500, dwStrType, 
+    if (!CertStrToNameW(dwCertEncodingType, pszX500, dwStrType,
                         NULL, NULL, len, &ppszError)) {
         /* this might not be an error, string might just not exist */
                 DWORD dw = GetLastError();
         return(NULL);
     }
-        
+
     str = (BYTE *)xmlMalloc((*len) + 1);
     if(str == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -420,8 +420,8 @@ xmlSecMSCryptoCertStrToNameW(DWORD dwCertEncodingType, LPWSTR pszX500, DWORD dwS
         return(NULL);
     }
     memset(str, 0, (*len) + 1);
-        
-    if (!CertStrToNameW(dwCertEncodingType, pszX500, dwStrType, 
+
+    if (!CertStrToNameW(dwCertEncodingType, pszX500, dwStrType,
                         NULL, str, len, NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -443,7 +443,7 @@ xmlSecMSCryptoCertStrToNameW(DWORD dwCertEncodingType, LPWSTR pszX500, DWORD dwS
  *
  * Returns: a pointer to newly allocated string (must be freed with xmlFree) or NULL if an error occurs.
  */
-LPWSTR 
+LPWSTR
 xmlSecMSCryptoConvertUtf8ToUnicode(const xmlChar* str) {
     LPWSTR res = NULL;
     int len;
@@ -488,7 +488,7 @@ xmlSecMSCryptoConvertUtf8ToUnicode(const xmlChar* str) {
  *
  * Returns: a pointer to newly allocated string (must be freed with xmlFree) or NULL if an error occurs.
  */
-LPWSTR 
+LPWSTR
 xmlSecMSCryptoConvertLocaleToUnicode(const char* str) {
         LPWSTR res = NULL;
         int len;
diff --git a/src/mscrypto/csp_calg.h b/src/mscrypto/csp_calg.h
index 706a898..c780ecb 100644
--- a/src/mscrypto/csp_calg.h
+++ b/src/mscrypto/csp_calg.h
@@ -1,10 +1,10 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
- * Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).  
+ *
+ * Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).
  * All rights reserved.
  */
 #ifndef CRYPTOCOM_CSP_CALG_H
@@ -29,10 +29,10 @@
 #define ALG_SID_DH_EL_SF                                36
 #define ALG_SID_DH_EL_EPHEM                             37
 
-/*! \defgroup CALG_MAGPRO CALG_MAGPRO 
+/*! \defgroup CALG_MAGPRO CALG_MAGPRO
  *  \brief The description of CALG_MAGPRO
  *
- * @{ 
+ * @{
  */
 
 
@@ -67,10 +67,10 @@
 #define CALG_DH_EL_EPHEM                                (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EL_EPHEM)
 
 /*! @} */
-/*! \defgroup PROV_TYPE PROV_TYPE 
+/*! \defgroup PROV_TYPE PROV_TYPE
  *  \brief The description of PROV_MAGPRO_GOST
  *
- * @{ 
+ * @{
  */
 
 #define PROV_MAGPRO_GOST 501
@@ -78,9 +78,9 @@
 #define PROV_CRYPTOPRO_GOST 75
 
 /*! @} */
-/*! \defgroup PP_MAGPRO PP_MAGPRO 
+/*! \defgroup PP_MAGPRO PP_MAGPRO
  *
- * @{ 
+ * @{
  */
 
 #define PP_RNGTYPE                      201
diff --git a/src/mscrypto/csp_oid.h b/src/mscrypto/csp_oid.h
index b4de688..e563674 100644
--- a/src/mscrypto/csp_oid.h
+++ b/src/mscrypto/csp_oid.h
@@ -1,20 +1,20 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
- * Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).  
+ *
+ * Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).
  * All rights reserved.
  */
 #ifndef CRYPTOCOM_OIDS_csp_H
 #define CRYPTOCOM_OIDS_csp_H
 /* Autogenerated from master.oid by oid2h.tcl */
 
-/*! \defgroup szOID_MAGPRO szOID_MAGPRO 
+/*! \defgroup szOID_MAGPRO szOID_MAGPRO
  *  \brief The OIDs supported by MagPro CSP
  *
- * @{ 
+ * @{
  */
 
 /*! GOST 34.10-94 Diffie-Hellman algorithm Cryptocom LTD */
@@ -79,34 +79,34 @@
 #define szOID_MAGPRO_PARAM_PK_CC_94 "1.2.643.2.2.32.2"
 
 
-#define szOID_CP_PARAM_R3411_94_DEF "1.2.643.2.2.30.1"  
+#define szOID_CP_PARAM_R3411_94_DEF "1.2.643.2.2.30.1"
 #define szOID_CP_PARAM_R3411_94_1       "1.2.643.2.2.30.2"
 #define szOID_CP_PARAM_R3411_94_2       "1.2.643.2.2.30.3"
 #define szOID_CP_PARAM_R3411_94_3       "1.2.643.2.2.30.4"
 
-#define szOID_CP_PARAM_28147_89_DEF "1.2.643.2.2.31.1"  
-#define szOID_CP_PARAM_28147_89_1       "1.2.643.2.2.31.2"      
-#define szOID_CP_PARAM_28147_89_2       "1.2.643.2.2.31.3"      
-#define szOID_CP_PARAM_28147_89_3       "1.2.643.2.2.31.4"      
+#define szOID_CP_PARAM_28147_89_DEF "1.2.643.2.2.31.1"
+#define szOID_CP_PARAM_28147_89_1       "1.2.643.2.2.31.2"
+#define szOID_CP_PARAM_28147_89_2       "1.2.643.2.2.31.3"
+#define szOID_CP_PARAM_28147_89_3       "1.2.643.2.2.31.4"
 #define szOID_CP_PARAM_28147_89_4       "1.2.643.2.2.31.5"
 #define szOID_CP_PARAM_28147_89_5       "1.2.643.2.2.31.6"
 #define szOID_CP_PARAM_28147_89_6       "1.2.643.2.2.31.7"
 
 /* OID for Signature 1024*/
 #define szOID_CP_PARAM_PK_R3410_94_DEF  "1.2.643.2.2.32.2"      /*VerbaO*/
-#define szOID_CP_PARAM_PK_R3410_94_S1   "1.2.643.2.2.32.3" 
-#define szOID_CP_PARAM_PK_R3410_94_S2   "1.2.643.2.2.32.4" 
-#define szOID_CP_PARAM_PK_R3410_94_S3   "1.2.643.2.2.32.5" 
+#define szOID_CP_PARAM_PK_R3410_94_S1   "1.2.643.2.2.32.3"
+#define szOID_CP_PARAM_PK_R3410_94_S2   "1.2.643.2.2.32.4"
+#define szOID_CP_PARAM_PK_R3410_94_S3   "1.2.643.2.2.32.5"
 /* OID for DH 1024*/
-#define szOID_CP_PARAM_PK_R3410_94_E1   "1.2.643.2.2.33.1" 
-#define szOID_CP_PARAM_PK_R3410_94_E2   "1.2.643.2.2.33.2" 
-#define szOID_CP_PARAM_PK_R3410_94_E3   "1.2.643.2.2.33.3" 
-
-#define szOID_CP_PARAM_PK_R3410_2001_DEF "1.2.643.2.2.35.1"     
-#define szOID_CP_PARAM_PK_R3410_2001_S0  "1.2.643.2.2.35.2"     
-#define szOID_CP_PARAM_PK_R3410_2001_S1  "1.2.643.2.2.35.3"     
-#define szOID_CP_PARAM_PK_R3410_2001_E0  "1.2.643.2.2.36.0"     
-#define szOID_CP_PARAM_PK_R3410_2001_E1  "1.2.643.2.2.36.1"     
+#define szOID_CP_PARAM_PK_R3410_94_E1   "1.2.643.2.2.33.1"
+#define szOID_CP_PARAM_PK_R3410_94_E2   "1.2.643.2.2.33.2"
+#define szOID_CP_PARAM_PK_R3410_94_E3   "1.2.643.2.2.33.3"
+
+#define szOID_CP_PARAM_PK_R3410_2001_DEF "1.2.643.2.2.35.1"
+#define szOID_CP_PARAM_PK_R3410_2001_S0  "1.2.643.2.2.35.2"
+#define szOID_CP_PARAM_PK_R3410_2001_S1  "1.2.643.2.2.35.3"
+#define szOID_CP_PARAM_PK_R3410_2001_E0  "1.2.643.2.2.36.0"
+#define szOID_CP_PARAM_PK_R3410_2001_E1  "1.2.643.2.2.36.1"
 
 
 /*! @} */
diff --git a/src/mscrypto/digests.c b/src/mscrypto/digests.c
index e4d58a9..5c4a074 100644
--- a/src/mscrypto/digests.c
+++ b/src/mscrypto/digests.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
- * Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).  
+ * Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).
  */
 #include "globals.h"
 
@@ -32,7 +32,7 @@ struct _xmlSecMSCryptoDigestCtx {
     HCRYPTHASH      mscHash;
     unsigned char   dgst[MSCRYPTO_MAX_HASH_SIZE];
     size_t          dgstSize;   /* dgst size in bytes */
-};          
+};
 
 /******************************************************************************
  *
@@ -42,41 +42,41 @@ struct _xmlSecMSCryptoDigestCtx {
  *
  *****************************************************************************/
 #define xmlSecMSCryptoDigestSize        \
-    (sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoDigestCtx)) 
+    (sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoDigestCtx))
 #define xmlSecMSCryptoDigestGetCtx(transform) \
     ((xmlSecMSCryptoDigestCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
 
 
 static int      xmlSecMSCryptoDigestInitialize  (xmlSecTransformPtr transform);
 static void     xmlSecMSCryptoDigestFinalize    (xmlSecTransformPtr transform);
-static int      xmlSecMSCryptoDigestVerify      (xmlSecTransformPtr transform, 
+static int      xmlSecMSCryptoDigestVerify      (xmlSecTransformPtr transform,
                                                  const xmlSecByte* data,
                                                  xmlSecSize dataSize,
                                                  xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecMSCryptoDigestExecute     (xmlSecTransformPtr transform, 
+static int      xmlSecMSCryptoDigestExecute     (xmlSecTransformPtr transform,
                                                  int last,
                                                  xmlSecTransformCtxPtr transformCtx);
 static int      xmlSecMSCryptoDigestCheckId     (xmlSecTransformPtr transform);
 
 
-static int 
+static int
 xmlSecMSCryptoDigestCheckId(xmlSecTransformPtr transform) {
 #ifndef XMLSEC_NO_SHA1
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformSha1Id)) {
         return(1);
     }
-#endif /* XMLSEC_NO_SHA1 */    
-    
+#endif /* XMLSEC_NO_SHA1 */
+
 #ifndef XMLSEC_NO_GOST
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformGostR3411_94Id)) {
         return(1);
     }
-#endif /* XMLSEC_NO_GOST*/    
-    
+#endif /* XMLSEC_NO_GOST*/
+
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoDigestInitialize(xmlSecTransformPtr transform) {
     xmlSecMSCryptoDigestCtxPtr ctx;
 
@@ -92,8 +92,8 @@ xmlSecMSCryptoDigestInitialize(xmlSecTransformPtr transform) {
 #ifndef XMLSEC_NO_SHA1
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformSha1Id)) {
         ctx->alg_id = CALG_SHA;
-    } else 
-#endif /* XMLSEC_NO_SHA1 */    
+    } else
+#endif /* XMLSEC_NO_SHA1 */
 
 #ifndef XMLSEC_NO_GOST
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformGostR3411_94Id)) {
@@ -102,7 +102,7 @@ xmlSecMSCryptoDigestInitialize(xmlSecTransformPtr transform) {
     /* TODO: Check what provider is best suited here.... */
     if (!CryptAcquireContext(&ctx->provider, NULL, 0, PROV_MAGPRO_GOST, CRYPT_VERIFYCONTEXT)) {
       if (!CryptAcquireContext(&ctx->provider, NULL, 0, PROV_CRYPTOPRO_GOST, CRYPT_VERIFYCONTEXT)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -111,11 +111,11 @@ xmlSecMSCryptoDigestInitialize(xmlSecTransformPtr transform) {
     }
     }
     return(0);
-    } else 
-#endif /* XMLSEC_NO_GOST*/    
+    } else
+#endif /* XMLSEC_NO_GOST*/
 
     {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
@@ -126,7 +126,7 @@ xmlSecMSCryptoDigestInitialize(xmlSecTransformPtr transform) {
     /* TODO: Check what provider is best suited here.... */
     if (!CryptAcquireContext(&ctx->provider, NULL, MS_STRONG_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
         if (!CryptAcquireContext(&ctx->provider, NULL, MS_ENHANCED_PROV,PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -155,13 +155,13 @@ static void xmlSecMSCryptoDigestFinalize(xmlSecTransformPtr transform) {
     memset(ctx, 0, sizeof(xmlSecMSCryptoDigestCtx));
 }
 
-static int 
-xmlSecMSCryptoDigestVerify(xmlSecTransformPtr transform, 
-                           const xmlSecByte* data, 
+static int
+xmlSecMSCryptoDigestVerify(xmlSecTransformPtr transform,
+                           const xmlSecByte* data,
                            xmlSecSize dataSize,
                            xmlSecTransformCtxPtr transformCtx) {
     xmlSecMSCryptoDigestCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecMSCryptoDigestCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecMSCryptoDigestSize), -1);
     xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1);
@@ -174,18 +174,18 @@ xmlSecMSCryptoDigestVerify(xmlSecTransformPtr transform,
     xmlSecAssert2(ctx->dgstSize > 0, -1);
 
     if(dataSize != ctx->dgstSize) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_SIZE,
-                    "data_size=%d;dgst_size=%d", 
+                    "data_size=%d;dgst_size=%d",
                     dataSize, ctx->dgstSize);
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
 
     if(memcmp(ctx->dgst, data, ctx->dgstSize) != 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_DATA,
@@ -193,19 +193,19 @@ xmlSecMSCryptoDigestVerify(xmlSecTransformPtr transform,
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-    
+
     transform->status = xmlSecTransformStatusOk;
     return(0);
 }
 
-static int 
-xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform, 
-                            int last, 
+static int
+xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
+                            int last,
                             xmlSecTransformCtxPtr transformCtx) {
     xmlSecMSCryptoDigestCtxPtr ctx;
     xmlSecBufferPtr in, out;
     int ret;
-    
+
     xmlSecAssert2(xmlSecMSCryptoDigestCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecMSCryptoDigestSize), -1);
@@ -219,7 +219,7 @@ xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
 
     ctx = xmlSecMSCryptoDigestGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     if(transform->status == xmlSecTransformStatusNone) {
         ret = CryptCreateHash(ctx->provider,
             ctx->alg_id,
@@ -228,17 +228,17 @@ xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
             &(ctx->mscHash));
 
         if((ret == 0) || (ctx->mscHash == 0)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "CryptHashData",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1);                 
+            return(-1);
         }
 
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if (transform->status == xmlSecTransformStatusWorking) {
         xmlSecSize inSize;
 
@@ -250,7 +250,7 @@ xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
                 0);
 
             if(ret == 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "CryptHashData",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -260,7 +260,7 @@ xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
 
             ret = xmlSecBufferRemoveHead(in, inSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferRemoveHead",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -281,7 +281,7 @@ xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
                 0);
 
             if (ret == 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "CryptGetHashParam",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -297,7 +297,7 @@ xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
             if(transform->operation == xmlSecTransformOperationSign) {
                 ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferAppend",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -311,14 +311,14 @@ xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -349,19 +349,19 @@ static xmlSecTransformKlass xmlSecMSCryptoSha1Klass = {
     xmlSecTransformDefaultPopBin,               /* xmlSecTransformPopBinMethod popBin; */
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
-    xmlSecMSCryptoDigestExecute,                /* xmlSecTransformExecuteMethod execute; */    
+    xmlSecMSCryptoDigestExecute,                /* xmlSecTransformExecuteMethod execute; */
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecMSCryptoTransformSha1GetKlass:
  *
  * SHA-1 digest transform klass.
  *
  * Returns: pointer to SHA-1 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecMSCryptoTransformSha1GetKlass(void) {
     return(&xmlSecMSCryptoSha1Klass);
 }
@@ -393,19 +393,19 @@ static xmlSecTransformKlass xmlSecMSCryptoGostR3411_94Klass = {
     xmlSecTransformDefaultPopBin,               /* xmlSecTransformPopBinMethod popBin; */
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
-    xmlSecMSCryptoDigestExecute,                /* xmlSecTransformExecuteMethod execute; */    
+    xmlSecMSCryptoDigestExecute,                /* xmlSecTransformExecuteMethod execute; */
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecMSCryptoTransformGostR3411_94GetKlass:
  *
  * GOSTR3411_94 digest transform klass.
  *
  * Returns: pointer to GOSTR3411_94 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecMSCryptoTransformGostR3411_94GetKlass(void) {
     return(&xmlSecMSCryptoGostR3411_94Klass);
 }
diff --git a/src/mscrypto/globals.h b/src/mscrypto/globals.h
index a616e44..0d34fdd 100644
--- a/src/mscrypto/globals.h
+++ b/src/mscrypto/globals.h
@@ -5,14 +5,14 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  */
 #ifndef __XMLSEC_GLOBALS_H__
 #define __XMLSEC_GLOBALS_H__
 
 /**
- * Use autoconf defines if present. 
+ * Use autoconf defines if present.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/src/mscrypto/keysstore.c b/src/mscrypto/keysstore.c
index 05efda3..108706a 100644
--- a/src/mscrypto/keysstore.c
+++ b/src/mscrypto/keysstore.c
@@ -1,17 +1,17 @@
-/** 
+/**
  * XMLSec library
- * 
+ *
  * MSCrypto keys store that uses Simple Keys Store under the hood. Uses the
- * MS Certificate store as a backing store for the finding keys, but the 
+ * MS Certificate store as a backing store for the finding keys, but the
  * MS Certificate store not written to by the keys store.
  * So, if store->findkey is done and the key is not found in the simple
  * keys store, the MS Certificate store is looked up.
- * Thus, the MS Certificate store can be used to pre-load keys and becomes 
+ * Thus, the MS Certificate store can be used to pre-load keys and becomes
  * an alternate source of keys for xmlsec
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for precise wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  * Copyright (C) 2003 Aleksey Sanin <aleksey aleksey com>
  */
@@ -23,7 +23,7 @@
 #include <windows.h>
 #include <wincrypt.h>
 
-#include <libxml/tree.h> 
+#include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -48,7 +48,7 @@
 /****************************************************************************
  *
  * MSCrypto Keys Store. Uses Simple Keys Store under the hood
- * 
+ *
  * Simple Keys Store ptr is located after xmlSecKeyStore
  *
  ***************************************************************************/
@@ -62,8 +62,8 @@
 
 static int                      xmlSecMSCryptoKeysStoreInitialize   (xmlSecKeyStorePtr store);
 static void                     xmlSecMSCryptoKeysStoreFinalize     (xmlSecKeyStorePtr store);
-static xmlSecKeyPtr             xmlSecMSCryptoKeysStoreFindKey      (xmlSecKeyStorePtr store, 
-                                                                     const xmlChar* name, 
+static xmlSecKeyPtr             xmlSecMSCryptoKeysStoreFindKey      (xmlSecKeyStorePtr store,
+                                                                     const xmlChar* name,
                                                                      xmlSecKeyInfoCtxPtr keyInfoCtx);
 
 static xmlSecKeyStoreKlass xmlSecMSCryptoKeysStoreKlass = {
@@ -71,8 +71,8 @@ static xmlSecKeyStoreKlass xmlSecMSCryptoKeysStoreKlass = {
     xmlSecMSCryptoKeysStoreSize,
 
     /* data */
-    BAD_CAST "MSCrypto-keys-store",             /* const xmlChar* name; */ 
-        
+    BAD_CAST "MSCrypto-keys-store",             /* const xmlChar* name; */
+
     /* constructors/destructor */
     xmlSecMSCryptoKeysStoreInitialize,          /* xmlSecKeyStoreInitializeMethod initialize; */
     xmlSecMSCryptoKeysStoreFinalize,            /* xmlSecKeyStoreFinalizeMethod finalize; */
@@ -85,12 +85,12 @@ static xmlSecKeyStoreKlass xmlSecMSCryptoKeysStoreKlass = {
 
 /**
  * xmlSecMSCryptoKeysStoreGetKlass:
- * 
+ *
  * The MSCrypto list based keys store klass.
  *
  * Returns: MSCrypto list based keys store klass.
  */
-xmlSecKeyStoreId 
+xmlSecKeyStoreId
 xmlSecMSCryptoKeysStoreGetKlass(void) {
     return(&xmlSecMSCryptoKeysStoreKlass);
 }
@@ -99,12 +99,12 @@ xmlSecMSCryptoKeysStoreGetKlass(void) {
  * xmlSecMSCryptoKeysStoreAdoptKey:
  * @store:              the pointer to MSCrypto keys store.
  * @key:                the pointer to key.
- * 
- * Adds @key to the @store. 
+ *
+ * Adds @key to the @store.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecMSCryptoKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
     xmlSecKeyStorePtr *ss;
 
@@ -112,24 +112,24 @@ xmlSecMSCryptoKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
     xmlSecAssert2((key != NULL), -1);
 
     ss = xmlSecMSCryptoKeysStoreGetSS(store);
-    xmlSecAssert2(((ss != NULL) && (*ss != NULL) && 
+    xmlSecAssert2(((ss != NULL) && (*ss != NULL) &&
         (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
 
     return (xmlSecSimpleKeysStoreAdoptKey(*ss, key));
 }
 
-/** 
+/**
  * xmlSecMSCryptoKeysStoreLoad:
  * @store:              the pointer to MSCrypto keys store.
  * @uri:                the filename.
- * @keysMngr:           the pointer to associated keys manager. 
- * 
+ * @keysMngr:           the pointer to associated keys manager.
+ *
  * Reads keys from an XML file.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
 int
-xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri, 
+xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
                             xmlSecKeysMngrPtr keysMngr) {
     xmlDocPtr doc;
     xmlNodePtr root;
@@ -139,7 +139,7 @@ xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
     int ret;
 
     xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecMSCryptoKeysStoreId), -1);
-    xmlSecAssert2((uri != NULL), -1);    
+    xmlSecAssert2((uri != NULL), -1);
 
     doc = xmlParseFile(uri);
     if(doc == NULL) {
@@ -147,11 +147,11 @@ xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
                     xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
                     "xmlParseFile",
                     XMLSEC_ERRORS_R_XML_FAILED,
-                    "uri=%s", 
+                    "uri=%s",
                     xmlSecErrorsSafeString(uri));
         return(-1);
     }
-    
+
     root = xmlDocGetRootElement(doc);
     if(!xmlSecCheckNodeName(root, BAD_CAST "Keys", xmlSecNs)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -162,9 +162,9 @@ xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
         xmlFreeDoc(doc);
         return(-1);
     }
-        
+
     cur = xmlSecGetNextElementNode(root->children);
-    while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {  
+    while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {
         key = xmlSecKeyCreate();
         if(key == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -188,7 +188,7 @@ xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
             xmlFreeDoc(doc);
             return(-1);
         }
-        
+
         keyInfoCtx.mode           = xmlSecKeyInfoModeRead;
         keyInfoCtx.keysMngr       = keysMngr;
         keyInfoCtx.flags          = XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND |
@@ -210,7 +210,7 @@ xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
             return(-1);
         }
         xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
-        
+
         if(xmlSecKeyIsValid(key)) {
             ret = xmlSecMSCryptoKeysStoreAdoptKey(store, key);
             if(ret < 0) {
@@ -229,7 +229,7 @@ xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
         }
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
@@ -237,19 +237,19 @@ xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
                     XMLSEC_ERRORS_R_UNEXPECTED_NODE,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFreeDoc(doc);
-        return(-1);         
+        return(-1);
     }
-    
+
     xmlFreeDoc(doc);
     return(0);
 }
 
-/** 
+/**
  * xmlSecMSCryptoKeysStoreSave:
  * @store:              the pointer to MSCrypto keys store.
  * @filename:           the filename.
  * @type:               the saved keys type (public, private, ...).
- * 
+ *
  * Writes keys from @store to an XML file.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -259,10 +259,10 @@ xmlSecMSCryptoKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSe
     xmlSecKeyStorePtr *ss;
 
     xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecMSCryptoKeysStoreId), -1);
-    xmlSecAssert2((filename != NULL), -1);    
-    
+    xmlSecAssert2((filename != NULL), -1);
+
     ss = xmlSecMSCryptoKeysStoreGetSS(store);
-    xmlSecAssert2(((ss != NULL) && (*ss != NULL) && 
+    xmlSecAssert2(((ss != NULL) && (*ss != NULL) &&
                    (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
 
     return (xmlSecSimpleKeysStoreSave(*ss, filename, type));
@@ -287,23 +287,23 @@ xmlSecMSCryptoKeysStoreInitialize(xmlSecKeyStorePtr store) {
         return(-1);
     }
 
-    return(0);    
+    return(0);
 }
 
 static void
 xmlSecMSCryptoKeysStoreFinalize(xmlSecKeyStorePtr store) {
     xmlSecKeyStorePtr *ss;
-    
+
     xmlSecAssert(xmlSecKeyStoreCheckId(store, xmlSecMSCryptoKeysStoreId));
-    
+
     ss = xmlSecMSCryptoKeysStoreGetSS(store);
     xmlSecAssert((ss != NULL) && (*ss != NULL));
-    
+
     xmlSecKeyStoreDestroy(*ss);
 }
 
 static PCCERT_CONTEXT
-xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name, 
+xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
                                 xmlSecKeyInfoCtxPtr keyInfoCtx) {
     const char* storeName;
     HCERTSTORE hStoreHandle = NULL;
@@ -330,6 +330,7 @@ xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
         return(NULL);
     }
 
+    /* convert name to unicode */
     wcName = xmlSecMSCryptoConvertUtf8ToUnicode(name);
     if(wcName == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -341,69 +342,12 @@ xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
         return(NULL);
     }
 
-    /* first attempt: search by cert id == name */
-    if(pCertContext == NULL) {
-        pCertContext = CertFindCertificateInStore(
+    /* first attempt: try to find the cert with a full blown subject dn */
+    if(NULL == pCertContext) {
+        pCertContext = xmlSecMSCryptoX509FindCertBySubject(
             hStoreHandle,
-            X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
-            0,
-            CERT_FIND_SUBJECT_STR,
             wcName,
-            NULL);
-    }
-
-    /* We don't give up easily, now try to fetch the cert with a full blown 
-     * subject dn
-     */
-    if (NULL == pCertContext) {
-        BYTE* bdata;
-        DWORD len;
-        
-        bdata = xmlSecMSCryptoCertStrToNameW(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
-                                            wcName, 
-                                            CERT_OID_NAME_STR,
-                                            &len);
-        if(bdata != NULL) {
-            CERT_NAME_BLOB cnb;
-    
-            cnb.cbData = len;
-            cnb.pbData = bdata;
-            
-            pCertContext = CertFindCertificateInStore(hStoreHandle,
-                                X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
-                                0,
-                                CERT_FIND_SUBJECT_NAME,
-                                &cnb,
-                                NULL);
-            xmlFree(bdata);
-        }
-    }
-            
-    /* We don't give up easily, now try to fetch the cert with a full blown 
-     * subject dn, and try with a reversed dn
-     */
-    if (NULL == pCertContext) {
-        BYTE* bdata;
-        DWORD len;
-        
-        bdata = xmlSecMSCryptoCertStrToNameW(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
-                                            wcName, 
-                                            CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG,
-                                            &len);
-        if(bdata != NULL) {
-            CERT_NAME_BLOB cnb;
-    
-            cnb.cbData = len;
-            cnb.pbData = bdata;
-            
-            pCertContext = CertFindCertificateInStore(hStoreHandle,
-                                X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
-                                0,
-                                CERT_FIND_SUBJECT_NAME,
-                                &cnb,
-                                NULL);
-            xmlFree(bdata);
-        }
+            X509_ASN_ENCODING | PKCS_7_ASN_ENCODING);
     }
 
     /*
@@ -413,8 +357,8 @@ xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
         DWORD dwPropSize;
         PBYTE pbFriendlyName;
         PCCERT_CONTEXT pCertCtxIter = NULL;
-        
-            
+
+
         while (pCertCtxIter = CertEnumCertificatesInStore(hStoreHandle, pCertCtxIter)) {
             if (TRUE != CertGetCertificateContextProperty(pCertCtxIter,
                                                       CERT_FRIENDLY_NAME_PROP_ID,
@@ -434,7 +378,7 @@ xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
                 CertCloseStore(hStoreHandle, 0);
                 return(NULL);
             }
-        
+
             if (TRUE != CertGetCertificateContextProperty(pCertCtxIter,
                                                       CERT_FRIENDLY_NAME_PROP_ID,
                                                       pbFriendlyName,
@@ -453,17 +397,30 @@ xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
         }
     }
 
-    /* We could do the following here: 
+    /* We don't give up easily, now try to find cert with part of the name
+     */
+    if (NULL == pCertContext) {
+        pCertContext = CertFindCertificateInStore(
+            hStoreHandle,
+            X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+            0,
+            CERT_FIND_SUBJECT_STR,
+            wcName,
+            NULL);
+    }
+
+
+    /* We could do the following here:
      * It would be nice if we could locate the cert with issuer name and
      * serial number, the given keyname can be something like this:
      * 'serial=1234567;issuer=CN=ikke, C=NL'
      * to be implemented by the first person who reads this, and thinks it's
      * a good idea :) WK
-     */     
+     */
 
     /* OK, I give up, I'm gone :( */
-    
-    /* aleksey todo: is it a right idea to close store if we have a handle to 
+
+    /* aleksey todo: is it a right idea to close store if we have a handle to
      * a cert in this store? */
     xmlFree(wcName);
     CertCloseStore(hStoreHandle, 0);
@@ -471,8 +428,8 @@ xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
 }
 
 
-static xmlSecKeyPtr 
-xmlSecMSCryptoKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name, 
+static xmlSecKeyPtr
+xmlSecMSCryptoKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
                                xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyStorePtr* ss;
     xmlSecKeyPtr key = NULL;
@@ -503,9 +460,9 @@ xmlSecMSCryptoKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
         goto done;
     }
 
-    /* what type of key are we looking for? 
+    /* what type of key are we looking for?
     * WK: For now, we'll look only for public/private keys using the
-    * name as a cert nickname. Then the name is regarded as the subject 
+    * name as a cert nickname. Then the name is regarded as the subject
     * dn of the certificate to be searched for.
     */
     keyReq = &(keyInfoCtx->keyReq);
@@ -602,7 +559,7 @@ xmlSecMSCryptoKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
                         NULL,
                         "xmlSecKeySetValue",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "data=%s", 
+                        "data=%s",
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
             goto done;
         }
diff --git a/src/mscrypto/kt_rsa.c b/src/mscrypto/kt_rsa.c
index 8dee2d5..400ce80 100644
--- a/src/mscrypto/kt_rsa.c
+++ b/src/mscrypto/kt_rsa.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * RSA Algorithms support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  */
 #include "globals.h"
@@ -35,12 +35,12 @@
  * Internal MSCRYPTO RSA PKCS1 CTX
  *
  *************************************************************************/
-typedef struct _xmlSecMSCryptoRsaPkcs1Ctx       xmlSecMSCryptoRsaPkcs1Ctx, 
+typedef struct _xmlSecMSCryptoRsaPkcs1Ctx       xmlSecMSCryptoRsaPkcs1Ctx,
                                                 *xmlSecMSCryptoRsaPkcs1CtxPtr;
 struct _xmlSecMSCryptoRsaPkcs1Ctx {
     xmlSecKeyDataPtr data;
     DWORD typeFlags;
-};          
+};
 
 /*********************************************************************
  *
@@ -50,20 +50,20 @@ struct _xmlSecMSCryptoRsaPkcs1Ctx {
  *
  ********************************************************************/
 #define xmlSecMSCryptoRsaPkcs1Size      \
-    (sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoRsaPkcs1Ctx))       
+    (sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoRsaPkcs1Ctx))
 #define xmlSecMSCryptoRsaPkcs1GetCtx(transform) \
     ((xmlSecMSCryptoRsaPkcs1CtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
 
 static int      xmlSecMSCryptoRsaPkcs1Initialize                (xmlSecTransformPtr transform);
 static void     xmlSecMSCryptoRsaPkcs1Finalize                  (xmlSecTransformPtr transform);
-static int      xmlSecMSCryptoRsaPkcs1SetKeyReq                 (xmlSecTransformPtr transform, 
+static int      xmlSecMSCryptoRsaPkcs1SetKeyReq                 (xmlSecTransformPtr transform,
                                                                  xmlSecKeyReqPtr keyReq);
-static int      xmlSecMSCryptoRsaPkcs1SetKey                    (xmlSecTransformPtr transform, 
+static int      xmlSecMSCryptoRsaPkcs1SetKey                    (xmlSecTransformPtr transform,
                                                                  xmlSecKeyPtr key);
-static int      xmlSecMSCryptoRsaPkcs1Execute                   (xmlSecTransformPtr transform, 
+static int      xmlSecMSCryptoRsaPkcs1Execute                   (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecMSCryptoRsaPkcs1Process                   (xmlSecTransformPtr transform, 
+static int      xmlSecMSCryptoRsaPkcs1Process                   (xmlSecTransformPtr transform,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
 static xmlSecTransformKlass xmlSecMSCryptoRsaPkcs1Klass = {
@@ -88,39 +88,39 @@ static xmlSecTransformKlass xmlSecMSCryptoRsaPkcs1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecMSCryptoRsaPkcs1Execute,              /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 
-/** 
+/**
  * xmlSecMSCryptoTransformRsaPkcs1GetKlass:
  *
  * The RSA-PKCS1 key transport transform klass.
  *
  * Returns: RSA-PKCS1 key transport transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecMSCryptoTransformRsaPkcs1GetKlass(void) {
     return(&xmlSecMSCryptoRsaPkcs1Klass);
 }
 
-static int 
+static int
 xmlSecMSCryptoRsaPkcs1Initialize(xmlSecTransformPtr transform) {
     xmlSecMSCryptoRsaPkcs1CtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformRsaPkcs1Id), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecMSCryptoRsaPkcs1Size), -1);
 
     ctx = xmlSecMSCryptoRsaPkcs1GetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecMSCryptoRsaPkcs1Ctx));
     return(0);
 }
 
-static void 
+static void
 xmlSecMSCryptoRsaPkcs1Finalize(xmlSecTransformPtr transform) {
     xmlSecMSCryptoRsaPkcs1CtxPtr ctx;
 
@@ -129,7 +129,7 @@ xmlSecMSCryptoRsaPkcs1Finalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecMSCryptoRsaPkcs1GetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     if (ctx->data != NULL)  {
         xmlSecKeyDataDestroy(ctx->data);
         ctx->data = NULL;
@@ -138,7 +138,7 @@ xmlSecMSCryptoRsaPkcs1Finalize(xmlSecTransformPtr transform) {
     memset(ctx, 0, sizeof(xmlSecMSCryptoRsaPkcs1Ctx));
 }
 
-static int  
+static int
 xmlSecMSCryptoRsaPkcs1SetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecMSCryptoRsaPkcs1CtxPtr ctx;
 
@@ -157,14 +157,14 @@ xmlSecMSCryptoRsaPkcs1SetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr k
     } else {
         keyReq->keyType  = xmlSecKeyDataTypePrivate;
         keyReq->keyUsage = xmlSecKeyUsageDecrypt;
-    }    
+    }
     return(0);
 }
 
-static int      
+static int
 xmlSecMSCryptoRsaPkcs1SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecMSCryptoRsaPkcs1CtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformRsaPkcs1Id), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecMSCryptoRsaPkcs1Size), -1);
@@ -188,7 +188,7 @@ xmlSecMSCryptoRsaPkcs1SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoRsaPkcs1Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecMSCryptoRsaPkcs1CtxPtr ctx;
     int ret;
@@ -203,14 +203,14 @@ xmlSecMSCryptoRsaPkcs1Execute(xmlSecTransformPtr transform, int last, xmlSecTran
 
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
-    } 
-    
+    }
+
     if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
                 /* just do nothing */
     } else  if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
         ret = xmlSecMSCryptoRsaPkcs1Process(transform, transformCtx);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecMSCryptoRsaPkcs1Process",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -222,7 +222,7 @@ xmlSecMSCryptoRsaPkcs1Execute(xmlSecTransformPtr transform, int last, xmlSecTran
                 /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -232,7 +232,7 @@ xmlSecMSCryptoRsaPkcs1Execute(xmlSecTransformPtr transform, int last, xmlSecTran
     return(0);
 }
 
-static int  
+static int
 xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr transformCtx) {
     xmlSecMSCryptoRsaPkcs1CtxPtr ctx;
     xmlSecBufferPtr in, out;
@@ -255,17 +255,17 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
     ctx = xmlSecMSCryptoRsaPkcs1GetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->data != NULL, -1);
-    
+
     keySize = xmlSecKeyDataGetSize(ctx->data) / 8;
     xmlSecAssert2(keySize > 0, -1);
-    
+
     in = &(transform->inBuf);
     out = &(transform->outBuf);
-        
+
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
+    outSize = xmlSecBufferGetSize(out);
     xmlSecAssert2(outSize == 0, -1);
-        
+
     /* the encoded size is equal to the keys size so we could not
      * process more than that */
     if((transform->operation == xmlSecTransformOperationEncrypt) && (inSize >= keySize)) {
@@ -283,11 +283,11 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
                     "%d when expected %d", inSize, keySize);
         return(-1);
     }
-        
-    outSize = keySize; 
+
+    outSize = keySize;
     ret = xmlSecBufferSetMaxSize(out, outSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -299,18 +299,18 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
         BYTE ch;
 
         if(inSize > outSize) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_SIZE,
-                        "inSize=%d;outSize=%d", 
+                        "inSize=%d;outSize=%d",
                         inSize, outSize);
             return(-1);
         }
 
         ret = xmlSecBufferSetData(out, xmlSecBufferGetData(in), inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferSetData",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -328,7 +328,7 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
                         XMLSEC_ERRORS_NO_MESSAGE);
             return (-1);
         }
-        
+
         outBuf = xmlSecBufferGetData(out);
         xmlSecAssert2(outBuf != NULL, -1);
         if (!CryptEncrypt(hKey, 0, TRUE, 0, outBuf, &dwInLen, dwBufLen)) {
@@ -351,7 +351,7 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
     } else {
         dwOutLen = inSize;
 
-        /* The input of CryptDecrypt is expected to be little-endian, 
+        /* The input of CryptDecrypt is expected to be little-endian,
          * so we have to convert from big-endian to little endian.
          */
         inBuf   = xmlSecBufferGetData(in);
@@ -372,7 +372,7 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
             return (-1);
         }
         if (!CryptDecrypt(hKey, 0, TRUE, 0, outBuf, &dwOutLen)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "CryptDecrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -385,9 +385,9 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
 
     ret = xmlSecBufferSetSize(out, outSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
-                    "xmlSecBufferSetSize",                  
+                    "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", outSize);
         return(-1);
@@ -395,7 +395,7 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
 
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
diff --git a/src/mscrypto/signatures.c b/src/mscrypto/signatures.c
index 2dbc8fd..ee52800 100644
--- a/src/mscrypto/signatures.c
+++ b/src/mscrypto/signatures.c
@@ -1,12 +1,12 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  * Copyright (C) 2003 Aleksey Sanin <aleksey aleksey com>
- * Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).  
+ * Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).
  */
 #include "globals.h"
 
@@ -41,7 +41,7 @@ extern DWORD xmlSecMSCryptoKeyDataGetMSCryptoKeySpec(xmlSecKeyDataPtr data);
  * Internal MSCrypto signatures ctx
  *
  *****************************************************************************/
-typedef struct _xmlSecMSCryptoSignatureCtx      xmlSecMSCryptoSignatureCtx, 
+typedef struct _xmlSecMSCryptoSignatureCtx      xmlSecMSCryptoSignatureCtx,
                                                 *xmlSecMSCryptoSignatureCtxPtr;
 struct _xmlSecMSCryptoSignatureCtx {
     xmlSecKeyDataPtr    data;
@@ -49,7 +49,7 @@ struct _xmlSecMSCryptoSignatureCtx {
     HCRYPTHASH          mscHash;
     ALG_ID              digestAlgId;
     xmlSecKeyDataId     keyId;
-};          
+};
 
 /******************************************************************************
  *
@@ -66,15 +66,15 @@ struct _xmlSecMSCryptoSignatureCtx {
 static int      xmlSecMSCryptoSignatureCheckId          (xmlSecTransformPtr transform);
 static int      xmlSecMSCryptoSignatureInitialize       (xmlSecTransformPtr transform);
 static void     xmlSecMSCryptoSignatureFinalize         (xmlSecTransformPtr transform);
-static int      xmlSecMSCryptoSignatureSetKeyReq        (xmlSecTransformPtr transform, 
+static int      xmlSecMSCryptoSignatureSetKeyReq        (xmlSecTransformPtr transform,
                                                          xmlSecKeyReqPtr keyReq);
 static int      xmlSecMSCryptoSignatureSetKey           (xmlSecTransformPtr transform,
                                                          xmlSecKeyPtr key);
-static int      xmlSecMSCryptoSignatureVerify           (xmlSecTransformPtr transform, 
+static int      xmlSecMSCryptoSignatureVerify           (xmlSecTransformPtr transform,
                                                          const xmlSecByte* data,
                                                          xmlSecSize dataSize,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecMSCryptoSignatureExecute          (xmlSecTransformPtr transform, 
+static int      xmlSecMSCryptoSignatureExecute          (xmlSecTransformPtr transform,
                                                          int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 
@@ -111,31 +111,31 @@ static int xmlSecMSCryptoSignatureInitialize(xmlSecTransformPtr transform) {
     ctx = xmlSecMSCryptoSignatureGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
 
-    memset(ctx, 0, sizeof(xmlSecMSCryptoSignatureCtx));    
+    memset(ctx, 0, sizeof(xmlSecMSCryptoSignatureCtx));
 
 #ifndef XMLSEC_NO_RSA
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformRsaSha1Id)) {
         ctx->digestAlgId    = CALG_SHA1;
         ctx->keyId          = xmlSecMSCryptoKeyDataRsaId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_RSA */
 
 #ifndef XMLSEC_NO_GOST
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformGost2001GostR3411_94Id)) {
         ctx->digestAlgId    = CALG_MAGPRO_HASH_R3411_94;
         ctx->keyId          = xmlSecMSCryptoKeyDataGost2001Id;
-    } else 
+    } else
 #endif /* XMLSEC_NO_GOST*/
 
 #ifndef XMLSEC_NO_DSA
     if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformDsaSha1Id)) {
         ctx->digestAlgId    = CALG_SHA1;
         ctx->keyId          = xmlSecMSCryptoKeyDataDsaId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_DSA */
 
     if(1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
@@ -164,7 +164,7 @@ static void xmlSecMSCryptoSignatureFinalize(xmlSecTransformPtr transform) {
         ctx->data = NULL;
     }
 
-    memset(ctx, 0, sizeof(xmlSecMSCryptoSignatureCtx));    
+    memset(ctx, 0, sizeof(xmlSecMSCryptoSignatureCtx));
 }
 
 static int xmlSecMSCryptoSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
@@ -222,8 +222,8 @@ static int xmlSecMSCryptoSignatureSetKeyReq(xmlSecTransformPtr transform,  xmlSe
 }
 
 
-static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform, 
-                                         const xmlSecByte* data, 
+static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform,
+                                         const xmlSecByte* data,
                                          xmlSecSize dataSize,
                                          xmlSecTransformCtxPtr transformCtx) {
     xmlSecMSCryptoSignatureCtxPtr ctx;
@@ -232,7 +232,7 @@ static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform,
     DWORD dwError;
     BYTE *tmpBuf, *j, *k, *l, *m;
     int ret;
-    
+
     xmlSecAssert2(xmlSecMSCryptoSignatureCheckId(transform), -1);
     xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecMSCryptoSignatureSize), -1);
@@ -253,10 +253,10 @@ static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform,
                     "dataSize=%d", dataSize);
         return(-1);
     }
-    
+
     tmpBuf = xmlSecBufferGetData(&tmp);
     xmlSecAssert2(tmpBuf != NULL, -1);
-    
+
     /* Reverse the sig - Windows stores integers as octet streams in little endian
      * order.  The I2OSP algorithm used by XMLDSig to store integers is big endian */
     if (xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformDsaSha1Id)) {
@@ -283,7 +283,7 @@ static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform,
             *l-- = *j++;
         }
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -294,7 +294,7 @@ static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform,
 
     hKey = xmlSecMSCryptoKeyDataGetKey(ctx->data, xmlSecKeyDataTypePublic);
     if (hKey == 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecMSCryptoKeyDataGetKey",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -310,7 +310,7 @@ static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform,
                               0)) {
         dwError = GetLastError();
         if (NTE_BAD_SIGNATURE == dwError) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "CryptVerifySignature",
                         XMLSEC_ERRORS_R_DATA_NOT_MATCH,
@@ -333,7 +333,7 @@ static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform,
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecMSCryptoSignatureCtxPtr ctx;
     HCRYPTPROV hProv;
@@ -355,7 +355,7 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
     in = &(transform->inBuf);
     out = &(transform->outBuf);
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
+    outSize = xmlSecBufferGetSize(out);
 
     ctx = xmlSecMSCryptoSignatureGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
@@ -365,7 +365,7 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
         xmlSecAssert2(outSize == 0, -1);
 
         if (0 == (hProv = xmlSecMSCryptoKeyDataGetMSCryptoProvider(ctx->data))) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecMSCryptoKeyDataGetMSCryptoProvider",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -383,7 +383,7 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
 
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if((transform->status == xmlSecTransformStatusWorking) && (inSize > 0)) {
         xmlSecAssert2(outSize == 0, -1);
 
@@ -398,7 +398,7 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
 
         ret = xmlSecBufferRemoveHead(in, inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -421,12 +421,12 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
-            }   
+            }
             outSize = (xmlSecSize)dwSigLen;
 
             ret = xmlSecBufferInitialize(&tmp, outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferSetMaxSize",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -449,7 +449,7 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
 
             ret = xmlSecBufferSetSize(out, outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferSetSize",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -461,7 +461,7 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
             xmlSecAssert2(outBuf != NULL, -1);
 
             /* Now encode into a signature block,
-             * convert signature value to big endian */     
+             * convert signature value to big endian */
             if (xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformDsaSha1Id)) {
                 i = tmpBuf;
                 j = tmpBuf + 20;
@@ -489,7 +489,7 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
                 }
             } else {
                 /* We shouldn't get at this place */
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             NULL,
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -501,12 +501,12 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
         }
         transform->status = xmlSecTransformStatusFinished;
     }
-    
+
     if((transform->status == xmlSecTransformStatusWorking) || (transform->status == xmlSecTransformStatusFinished)) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -532,7 +532,7 @@ static xmlSecTransformKlass xmlSecMSCryptoRsaSha1Klass = {
     xmlSecNameRsaSha1,                          /* const xmlChar* name; */
     xmlSecHrefRsaSha1,                          /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecMSCryptoSignatureInitialize,          /* xmlSecTransformInitializeMethod initialize; */
     xmlSecMSCryptoSignatureFinalize,            /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -546,19 +546,19 @@ static xmlSecTransformKlass xmlSecMSCryptoRsaSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecMSCryptoSignatureExecute,             /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecMSCryptoTransformRsaSha1GetKlass:
- * 
+ *
  * The RSA-SHA1 signature transform klass.
  *
  * Returns: RSA-SHA1 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecMSCryptoTransformRsaSha1GetKlass(void) {
     return(&xmlSecMSCryptoRsaSha1Klass);
 }
@@ -580,7 +580,7 @@ static xmlSecTransformKlass xmlSecMSCryptoDsaSha1Klass = {
     xmlSecNameDsaSha1,                          /* const xmlChar* name; */
     xmlSecHrefDsaSha1,                          /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecMSCryptoSignatureInitialize,          /* xmlSecTransformInitializeMethod initialize; */
     xmlSecMSCryptoSignatureFinalize,            /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -594,19 +594,19 @@ static xmlSecTransformKlass xmlSecMSCryptoDsaSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecMSCryptoSignatureExecute,             /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecMSCryptoTransformDsaSha1GetKlass:
- * 
+ *
  * The DSA-SHA1 signature transform klass.
  *
  * Returns: DSA-SHA1 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecMSCryptoTransformDsaSha1GetKlass(void) {
     return(&xmlSecMSCryptoDsaSha1Klass);
 }
@@ -628,7 +628,7 @@ static xmlSecTransformKlass xmlSecMSCryptoGost2001GostR3411_94Klass = {
     xmlSecNameGost2001GostR3411_94,                             /* const xmlChar* name; */
     xmlSecHrefGost2001GostR3411_94,                             /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecMSCryptoSignatureInitialize,          /* xmlSecTransformInitializeMethod initialize; */
     xmlSecMSCryptoSignatureFinalize,            /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -642,19 +642,19 @@ static xmlSecTransformKlass xmlSecMSCryptoGost2001GostR3411_94Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecMSCryptoSignatureExecute,             /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecMSCryptoTransformGost2001GostR3411_94GetKlass:
- * 
+ *
  * The GOST2001-GOSTR3411_94 signature transform klass.
  *
  * Returns: GOST2001-GOSTR3411_94 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecMSCryptoTransformGost2001GostR3411_94GetKlass(void) {
     return(&xmlSecMSCryptoGost2001GostR3411_94Klass);
 }
diff --git a/src/mscrypto/symkeys.c b/src/mscrypto/symkeys.c
index 3f8eead..259db44 100644
--- a/src/mscrypto/symkeys.c
+++ b/src/mscrypto/symkeys.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * DES Algorithm support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  */
 #include "globals.h"
@@ -28,7 +28,7 @@
 #include <xmlsec/mscrypto/crypto.h>
 
 /*****************************************************************************
- * 
+ *
  * Symmetic (binary) keys - just a wrapper for xmlSecKeyDataBinary
  *
  ****************************************************************************/
@@ -78,18 +78,18 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataAesKlass = {
 
     /* data */
     xmlSecNameAESKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefAESKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeAESKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecMSCryptoSymKeyDataInitialize,         /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecMSCryptoSymKeyDataDuplicate,          /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecMSCryptoSymKeyDataFinalize,           /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecMSCryptoSymKeyDataGenerate,           /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecMSCryptoSymKeyDataGetType,            /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecMSCryptoSymKeyDataGetSize,            /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -110,14 +110,14 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataAesKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecMSCryptoKeyDataAesGetKlass:
- * 
+ *
  * The AES key data klass.
  *
  * Returns: AES key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecMSCryptoKeyDataAesGetKlass(void) {
     return(&xmlSecMSCryptoKeyDataAesKlass);
 }
@@ -135,14 +135,14 @@ xmlSecMSCryptoKeyDataAesGetKlass(void) {
 int
 xmlSecMSCryptoKeyDataAesSet(xmlSecKeyDataPtr data, const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataAesId), -1);
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(bufSize > 0, -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecBufferSetData(buffer, buf, bufSize));
 }
 #endif /* XMLSEC_NO_AES */
@@ -159,18 +159,18 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataDesKlass = {
 
     /* data */
     xmlSecNameDESKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                                         /* xmlSecKeyDataUsage usage; */
     xmlSecHrefDESKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeDESKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecMSCryptoSymKeyDataInitialize,         /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecMSCryptoSymKeyDataDuplicate,          /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecMSCryptoSymKeyDataFinalize,           /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecMSCryptoSymKeyDataGenerate,           /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecMSCryptoSymKeyDataGetType,            /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecMSCryptoSymKeyDataGetSize,            /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -191,21 +191,21 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataDesKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecMSCryptoKeyDataDesGetKlass:
- * 
+ *
  * The DES key data klass.
  *
  * Returns: DES key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecMSCryptoKeyDataDesGetKlass(void) {
     return(&xmlSecMSCryptoKeyDataDesKlass);
 }
 #endif /* XMLSEC_NO_DES */
 
 /*
- * GENERIC HELPER FUNCTIONS 
+ * GENERIC HELPER FUNCTIONS
  */
 
 #define xmlSecMSCryptoSymKeyDataCheckId(data) \
@@ -215,7 +215,7 @@ xmlSecMSCryptoKeyDataDesGetKlass(void) {
 static int
 xmlSecMSCryptoSymKeyDataInitialize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecMSCryptoSymKeyDataCheckId(data), -1);
-    
+
     return(xmlSecKeyDataBinaryValueInitialize(data));
 }
 
@@ -224,14 +224,14 @@ xmlSecMSCryptoSymKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     xmlSecAssert2(xmlSecMSCryptoSymKeyDataCheckId(dst), -1);
     xmlSecAssert2(xmlSecMSCryptoSymKeyDataCheckId(src), -1);
     xmlSecAssert2(dst->id == src->id, -1);
-        
+
     return(xmlSecKeyDataBinaryValueDuplicate(dst, src));
 }
 
 static void
 xmlSecMSCryptoSymKeyDataFinalize(xmlSecKeyDataPtr data) {
     xmlSecAssert(xmlSecMSCryptoSymKeyDataCheckId(data));
-    
+
     xmlSecKeyDataBinaryValueFinalize(data);
 }
 
@@ -239,15 +239,15 @@ static int
 xmlSecMSCryptoSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecMSCryptoSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueXmlRead(id, key, node, keyInfoCtx));
 }
 
-static int 
+static int
 xmlSecMSCryptoSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                     xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecMSCryptoSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueXmlWrite(id, key, node, keyInfoCtx));
 }
 
@@ -256,7 +256,7 @@ xmlSecMSCryptoSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 const unsigned char* buf, size_t bufSize,
                                 xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecMSCryptoSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueBinRead(id, key, buf, bufSize, keyInfoCtx));
 }
 
@@ -265,7 +265,7 @@ xmlSecMSCryptoSymKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                  unsigned char** buf, size_t* bufSize,
                                  xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecMSCryptoSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueBinWrite(id, key, buf, bufSize, keyInfoCtx));
 }
 
@@ -278,7 +278,7 @@ xmlSecMSCryptoSymKeyDataGenerate(xmlSecKeyDataPtr data, size_t sizeBits, xmlSecK
 
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecMSCryptoGenerateRandom(buffer, (sizeBits + 7) / 8));
 }
 
@@ -294,29 +294,29 @@ xmlSecMSCryptoSymKeyDataGetType(xmlSecKeyDataPtr data) {
     return((xmlSecBufferGetSize(buffer) > 0) ? xmlSecKeyDataTypeSymmetric : xmlSecKeyDataTypeUnknown);
 }
 
-static size_t 
+static size_t
 xmlSecMSCryptoSymKeyDataGetSize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecMSCryptoSymKeyDataCheckId(data), 0);
-    
+
     return(xmlSecKeyDataBinaryValueGetSize(data));
 }
 
-static void 
+static void
 xmlSecMSCryptoSymKeyDataDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecMSCryptoSymKeyDataCheckId(data));
-    
-    xmlSecKeyDataBinaryValueDebugDump(data, output);    
+
+    xmlSecKeyDataBinaryValueDebugDump(data, output);
 }
 
 static void
 xmlSecMSCryptoSymKeyDataDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecMSCryptoSymKeyDataCheckId(data));
-    
-    xmlSecKeyDataBinaryValueDebugXmlDump(data, output);    
+
+    xmlSecKeyDataBinaryValueDebugXmlDump(data, output);
 }
 
-static int 
-xmlSecMSCryptoSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {    
+static int
+xmlSecMSCryptoSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {
 #ifndef XMLSEC_NO_DES
     if(klass == xmlSecMSCryptoKeyDataDesId) {
         return(1);
diff --git a/src/mscrypto/x509.c b/src/mscrypto/x509.c
index 6eedf88..3f6d8a5 100644
--- a/src/mscrypto/x509.c
+++ b/src/mscrypto/x509.c
@@ -1,4 +1,4 @@
-/** 
+/**
  * XMLSec library
  *
  * X509 support
@@ -6,7 +6,7 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  * Copyright (C) 2003 Aleksey Sanin <aleksey aleksey com>
  */
@@ -84,29 +84,29 @@ static int              xmlSecMSCryptoX509CRLNodeRead           (xmlSecKeyDataPt
 static int              xmlSecMSCryptoX509CRLNodeWrite          (PCCRL_CONTEXT crl,
                                                                  xmlNodePtr node,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int              xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, 
+static int              xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data,
                                                                 xmlSecKeyPtr key,
                                                                 xmlSecKeyInfoCtxPtr keyInfoCtx);
 
-static PCCERT_CONTEXT   xmlSecMSCryptoX509CertDerRead           (const xmlSecByte* buf, 
+static PCCERT_CONTEXT   xmlSecMSCryptoX509CertDerRead           (const xmlSecByte* buf,
                                                                  xmlSecSize size);
 static PCCERT_CONTEXT   xmlSecMSCryptoX509CertBase64DerRead     (xmlChar* buf);
-static xmlChar*         xmlSecMSCryptoX509CertBase64DerWrite    (PCCERT_CONTEXT cert, 
+static xmlChar*         xmlSecMSCryptoX509CertBase64DerWrite    (PCCERT_CONTEXT cert,
                                                                  int base64LineWrap);
-static PCCRL_CONTEXT    xmlSecMSCryptoX509CrlDerRead            (xmlSecByte* buf, 
+static PCCRL_CONTEXT    xmlSecMSCryptoX509CrlDerRead            (xmlSecByte* buf,
                                                                  xmlSecSize size,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
 static PCCRL_CONTEXT xmlSecMSCryptoX509CrlBase64DerRead         (xmlChar* buf,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
-static xmlChar*         xmlSecMSCryptoX509CrlBase64DerWrite     (PCCRL_CONTEXT crl, 
+static xmlChar*         xmlSecMSCryptoX509CrlBase64DerWrite     (PCCRL_CONTEXT crl,
                                                                  int base64LineWrap);
 static xmlChar*         xmlSecMSCryptoX509NameWrite(PCERT_NAME_BLOB nm);
 static int              xmlSecMSCryptoASN1IntegerWrite          (xmlNodePtr node,
                                                                  PCRYPT_INTEGER_BLOB num);
 static xmlChar*         xmlSecMSCryptoX509SKIWrite              (PCCERT_CONTEXT cert);
-static void             xmlSecMSCryptoX509CertDebugDump         (PCCERT_CONTEXT cert, 
+static void             xmlSecMSCryptoX509CertDebugDump         (PCCERT_CONTEXT cert,
                                                                  FILE* output);
-static void             xmlSecMSCryptoX509CertDebugXmlDump      (PCCERT_CONTEXT cert, 
+static void             xmlSecMSCryptoX509CertDebugXmlDump      (PCCERT_CONTEXT cert,
                                                                  FILE* output);
 static int              xmlSecMSCryptoX509CertGetTime           (FILETIME t,
                                                                  time_t* res);
@@ -134,52 +134,52 @@ struct _xmlSecMSCryptoX509DataCtx {
  *
  * The X509Data  Element (http://www.w3.org/TR/xmldsig-core/#sec-X509Data)
  *
- * An X509Data element within KeyInfo contains one or more identifiers of keys 
- * or X509 certificates (or certificates' identifiers or a revocation list). 
+ * An X509Data element within KeyInfo contains one or more identifiers of keys
+ * or X509 certificates (or certificates' identifiers or a revocation list).
  * The content of X509Data is:
  *
  *  1. At least one element, from the following set of element types; any of these may appear together or more than once iff (if and only if) each instance describes or is related to the same certificate:
  *  2.
- *    * The X509IssuerSerial element, which contains an X.509 issuer 
- *      distinguished name/serial number pair that SHOULD be compliant 
+ *    * The X509IssuerSerial element, which contains an X.509 issuer
+ *      distinguished name/serial number pair that SHOULD be compliant
  *      with RFC2253 [LDAP-DN],
- *    * The X509SubjectName element, which contains an X.509 subject 
+ *    * The X509SubjectName element, which contains an X.509 subject
  *      distinguished name that SHOULD be compliant with RFC2253 [LDAP-DN],
- *    * The X509SKI element, which contains the base64 encoded plain (i.e. 
+ *    * The X509SKI element, which contains the base64 encoded plain (i.e.
  *      non-DER-encoded) value of a X509 V.3 SubjectKeyIdentifier extension.
- *    * The X509Certificate element, which contains a base64-encoded [X509v3] 
+ *    * The X509Certificate element, which contains a base64-encoded [X509v3]
  *      certificate, and
- *    * Elements from an external namespace which accompanies/complements any 
+ *    * Elements from an external namespace which accompanies/complements any
  *      of the elements above.
- *    * The X509CRL element, which contains a base64-encoded certificate 
+ *    * The X509CRL element, which contains a base64-encoded certificate
  *      revocation list (CRL) [X509v3].
  *
- * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that appear 
+ * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that appear
  * MUST refer to the certificate or certificates containing the validation key.
- * All such elements that refer to a particular individual certificate MUST be 
- * grouped inside a single X509Data element and if the certificate to which 
+ * All such elements that refer to a particular individual certificate MUST be
+ * grouped inside a single X509Data element and if the certificate to which
  * they refer appears, it MUST also be in that X509Data element.
  *
- * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that relate to 
- * the same key but different certificates MUST be grouped within a single 
+ * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that relate to
+ * the same key but different certificates MUST be grouped within a single
  * KeyInfo but MAY occur in multiple X509Data elements.
  *
- * All certificates appearing in an X509Data element MUST relate to the 
- * validation key by either containing it or being part of a certification 
+ * All certificates appearing in an X509Data element MUST relate to the
+ * validation key by either containing it or being part of a certification
  * chain that terminates in a certificate containing the validation key.
  *
  * No ordering is implied by the above constraints.
  *
- * Note, there is no direct provision for a PKCS#7 encoded "bag" of 
- * certificates or CRLs. However, a set of certificates and CRLs can occur 
- * within an X509Data element and multiple X509Data elements can occur in a 
- * KeyInfo. Whenever multiple certificates occur in an X509Data element, at 
- * least one such certificate must contain the public key which verifies the 
+ * Note, there is no direct provision for a PKCS#7 encoded "bag" of
+ * certificates or CRLs. However, a set of certificates and CRLs can occur
+ * within an X509Data element and multiple X509Data elements can occur in a
+ * KeyInfo. Whenever multiple certificates occur in an X509Data element, at
+ * least one such certificate must contain the public key which verifies the
  * signature.
  *
  * Schema Definition
  *
- *  <element name="X509Data" type="ds:X509DataType"/> 
+ *  <element name="X509Data" type="ds:X509DataType"/>
  *  <complexType name="X509DataType">
  *    <sequence maxOccurs="unbounded">
  *      <choice>
@@ -192,10 +192,10 @@ struct _xmlSecMSCryptoX509DataCtx {
  *      </choice>
  *    </sequence>
  *  </complexType>
- *  <complexType name="X509IssuerSerialType"> 
- *    <sequence> 
- *       <element name="X509IssuerName" type="string"/> 
- *       <element name="X509SerialNumber" type="integer"/> 
+ *  <complexType name="X509IssuerSerialType">
+ *    <sequence>
+ *       <element name="X509IssuerName" type="string"/>
+ *       <element name="X509SerialNumber" type="integer"/>
  *     </sequence>
  *  </complexType>
  *
@@ -217,7 +217,7 @@ struct _xmlSecMSCryptoX509DataCtx {
  *
  *************************************************************************/
 #define xmlSecMSCryptoX509DataSize      \
-    (sizeof(xmlSecKeyData) + sizeof(xmlSecMSCryptoX509DataCtx)) 
+    (sizeof(xmlSecKeyData) + sizeof(xmlSecMSCryptoX509DataCtx))
 #define xmlSecMSCryptoX509DataGetCtx(data) \
     ((xmlSecMSCryptoX509DataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
 
@@ -249,12 +249,12 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataX509Klass = {
 
     /* data */
     xmlSecNameX509Data,
-    xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefX509Data,                         /* const xmlChar* href; */
     xmlSecNodeX509Data,                         /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecMSCryptoKeyDataX509Initialize,        /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecMSCryptoKeyDataX509Duplicate,         /* xmlSecKeyDataDuplicateMethod duplicate; */
@@ -264,7 +264,7 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataX509Klass = {
     /* get info */
     xmlSecMSCryptoKeyDataX509GetType,           /* xmlSecKeyDataGetTypeMethod getType; */
     NULL,                                       /* xmlSecKeyDataGetSizeMethod getSize; */
-    xmlSecMSCryptoKeyDataX509GetIdentifier,     /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    xmlSecMSCryptoKeyDataX509GetIdentifier,     /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecMSCryptoKeyDataX509XmlRead,           /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -281,14 +281,14 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataX509Klass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecMSCryptoKeyDataX509GetKlass:
- * 
+ *
  * The MSCrypto X509 key data klass (http://www.w3.org/TR/xmldsig-core/#sec-X509Data).
  *
  * Returns: the X509 data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecMSCryptoKeyDataX509GetKlass(void) {
     return(&xmlSecMSCryptoKeyDataX509Klass);
 }
@@ -297,7 +297,7 @@ xmlSecMSCryptoKeyDataX509GetKlass(void) {
  * xmlSecMSCryptoKeyDataX509GetKeyCert:
  * @data:               the pointer to X509 key data.
  *
- * Gets the certificate from which the key was extracted. 
+ * Gets the certificate from which the key was extracted.
  *
  * Returns: the key's certificate or NULL if key data was not used for key
  * extraction or an error occurs.
@@ -305,7 +305,7 @@ xmlSecMSCryptoKeyDataX509GetKlass(void) {
 PCCERT_CONTEXT
 xmlSecMSCryptoKeyDataX509GetKeyCert(xmlSecKeyDataPtr data) {
     xmlSecMSCryptoX509DataCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataX509Id), NULL);
 
     ctx = xmlSecMSCryptoX509DataGetCtx(data);
@@ -351,7 +351,7 @@ xmlSecMSCryptoKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT cert
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecMSCryptoKeyDataX509AdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT cert) {
     xmlSecMSCryptoX509DataCtxPtr ctx;
 
@@ -368,11 +368,11 @@ xmlSecMSCryptoKeyDataX509AdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT cert) {
                     "CertAddCertificateContextToStore",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
     CertFreeCertificateContext(cert);
     ctx->numCerts++;
-      
+
     return(0);
 }
 
@@ -380,13 +380,13 @@ xmlSecMSCryptoKeyDataX509AdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT cert) {
  * xmlSecMSCryptoKeyDataX509GetCert:
  * @data:               the pointer to X509 key data.
  * @pos:                the desired certificate position.
- * 
+ *
  * Gets a certificate from X509 key data.
  *
- * Returns: the pointer to certificate or NULL if @pos is larger than the 
+ * Returns: the pointer to certificate or NULL if @pos is larger than the
  * number of certificates in @data or an error occurs.
  */
-PCCERT_CONTEXT 
+PCCERT_CONTEXT
 xmlSecMSCryptoKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
     xmlSecMSCryptoX509DataCtxPtr ctx;
     PCCERT_CONTEXT pCert = NULL;
@@ -413,7 +413,7 @@ xmlSecMSCryptoKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
  *
  * Returns: te number of certificates in @data.
  */
-xmlSecSize      
+xmlSecSize
 xmlSecMSCryptoKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
     xmlSecMSCryptoX509DataCtxPtr ctx;
 
@@ -434,7 +434,7 @@ xmlSecMSCryptoKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecMSCryptoKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, PCCRL_CONTEXT crl) {
     xmlSecMSCryptoX509DataCtxPtr ctx;
 
@@ -451,7 +451,7 @@ xmlSecMSCryptoKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, PCCRL_CONTEXT crl) {
                     "CertAddCRLContextToStore",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
     ctx->numCrls++;
 
@@ -506,7 +506,7 @@ xmlSecMSCryptoKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data) {
     return(ctx->numCrls);
 }
 
-static int      
+static int
 xmlSecMSCryptoKeyDataX509Initialize(xmlSecKeyDataPtr data) {
     xmlSecMSCryptoX509DataCtxPtr ctx;
 
@@ -518,9 +518,9 @@ xmlSecMSCryptoKeyDataX509Initialize(xmlSecKeyDataPtr data) {
     memset(ctx, 0, sizeof(xmlSecMSCryptoX509DataCtx));
 
     ctx->hMemStore = CertOpenStore(CERT_STORE_PROV_MEMORY,
-                                   0, 
-                                   0, 
-                                   CERT_STORE_CREATE_NEW_FLAG, 
+                                   0,
+                                   0,
+                                   CERT_STORE_CREATE_NEW_FLAG,
                                    NULL);
     if (ctx->hMemStore == 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -544,7 +544,7 @@ xmlSecMSCryptoKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     xmlSecAssert2(xmlSecKeyDataCheckId(dst, xmlSecMSCryptoKeyDataX509Id), -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(src, xmlSecMSCryptoKeyDataX509Id), -1);
 
-    /* copy certsList */ 
+    /* copy certsList */
     size = xmlSecMSCryptoKeyDataX509GetCertsSize(src);
     for(pos = 0; pos < size; ++pos) {
         /* TBD: function below does linear scan, eliminate loop within
@@ -716,7 +716,7 @@ xmlSecMSCryptoKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataPtr data;
@@ -725,7 +725,7 @@ xmlSecMSCryptoKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     xmlSecSize size, pos;
     int content = 0;
     int ret;
-                                
+
     xmlSecAssert2(id == xmlSecMSCryptoKeyDataX509Id, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -748,7 +748,7 @@ xmlSecMSCryptoKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     data = xmlSecKeyGetData(key, id);
     if(data == NULL) {
         /* no x509 data in the key */
-        return(0);      
+        return(0);
     }
 
     /* write certs */
@@ -811,7 +811,7 @@ xmlSecMSCryptoKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                 return(-1);
             }
         }
-    }    
+    }
 
     /* write crls if needed */
     if((content & XMLSEC_X509DATA_CRL_NODE) != 0) {
@@ -846,19 +846,19 @@ static xmlSecKeyDataType
 xmlSecMSCryptoKeyDataX509GetType(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataX509Id), xmlSecKeyDataTypeUnknown);
 
-    /* TODO: return verified/not verified status */     
+    /* TODO: return verified/not verified status */
     return(xmlSecKeyDataTypeUnknown);
 }
 
 static const xmlChar*
 xmlSecMSCryptoKeyDataX509GetIdentifier(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataX509Id), NULL);
-    
-    /* TODO */    
+
+    /* TODO */
     return(NULL);
 }
 
-static void 
+static void
 xmlSecMSCryptoKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) {
     PCCERT_CONTEXT cert;
     xmlSecSize size, pos;
@@ -929,13 +929,13 @@ xmlSecMSCryptoKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
 
 static int
 xmlSecMSCryptoX509DataNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
-    xmlNodePtr cur; 
+    xmlNodePtr cur;
     int ret;
-        
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataX509Id), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
-    
+
     for(cur = xmlSecGetNextElementNode(node->children);
         cur != NULL;
         cur = xmlSecGetNextElementNode(cur->next)) {
@@ -966,14 +966,14 @@ xmlSecMSCryptoX509DataNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKey
                 xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                 "read node failed");
-            return(-1);  
-        }       
+            return(-1);
+        }
     }
     return(0);
 }
 
 static int
-xmlSecMSCryptoX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { 
+xmlSecMSCryptoX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlChar *content;
     PCCERT_CONTEXT cert;
     int ret;
@@ -1007,7 +1007,7 @@ xmlSecMSCryptoX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFree(content);
         return(-1);
-    }    
+    }
 
     ret = xmlSecMSCryptoKeyDataX509AdoptCert(data, cert);
     if(ret < 0) {
@@ -1020,23 +1020,23 @@ xmlSecMSCryptoX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
         xmlFree(content);
         return(-1);
     }
-     
+
     xmlFree(content);
     return(0);
 }
 
-static int 
-xmlSecMSCryptoX509CertificateNodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node, 
+static int
+xmlSecMSCryptoX509CertificateNodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node,
                                        xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlChar* buf;
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(cert != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
-    
+
     /* set base64 lines size from context */
-    buf = xmlSecMSCryptoX509CertBase64DerWrite(cert, keyInfoCtx->base64LineSize); 
+    buf = xmlSecMSCryptoX509CertBase64DerWrite(cert, keyInfoCtx->base64LineSize);
     if(buf == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1055,7 +1055,7 @@ xmlSecMSCryptoX509CertificateNodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
         xmlFree(buf);
-        return(-1);     
+        return(-1);
     }
 
     /* todo: add \n around base64 data - from context */
@@ -1066,13 +1066,13 @@ xmlSecMSCryptoX509CertificateNodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node,
     return(0);
 }
 
-static int              
-xmlSecMSCryptoX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) { 
+static int
+xmlSecMSCryptoX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataStorePtr x509Store;
     xmlChar* subject;
     PCCERT_CONTEXT cert;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataX509Id), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
@@ -1111,7 +1111,7 @@ xmlSecMSCryptoX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                         NULL,
                         XMLSEC_ERRORS_R_CERT_NOT_FOUND,
-                        "subject=%s", 
+                        "subject=%s",
                         xmlSecErrorsSafeString(subject));
             xmlFree(subject);
             return(-1);
@@ -1170,12 +1170,12 @@ xmlSecMSCryptoX509SubjectNameNodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node, xml
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataStorePtr x509Store;
     xmlNodePtr cur;
     xmlChar *issuerName;
-    xmlChar *issuerSerial;    
+    xmlChar *issuerSerial;
     PCCERT_CONTEXT cert;
     int ret;
 
@@ -1217,7 +1217,7 @@ xmlSecMSCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, x
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
         return(-1);
-    }    
+    }
     issuerName = xmlNodeGetContent(cur);
     if(issuerName == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1228,7 +1228,7 @@ xmlSecMSCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, x
                     xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
         return(-1);
     }
-    cur = xmlSecGetNextElementNode(cur->next); 
+    cur = xmlSecGetNextElementNode(cur->next);
 
     /* next is required node X509SerialNumber */
     if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs)) {
@@ -1240,7 +1240,7 @@ xmlSecMSCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, x
                     xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
         xmlFree(issuerName);
         return(-1);
-    }    
+    }
     issuerSerial = xmlNodeGetContent(cur);
     if(issuerSerial == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1252,7 +1252,7 @@ xmlSecMSCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, x
         xmlFree(issuerName);
         return(-1);
     }
-    cur = xmlSecGetNextElementNode(cur->next); 
+    cur = xmlSecGetNextElementNode(cur->next);
 
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1273,7 +1273,7 @@ xmlSecMSCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, x
                         NULL,
                         XMLSEC_ERRORS_R_CERT_NOT_FOUND,
                         "issuerName=%s;issuerSerial=%s",
-                        xmlSecErrorsSafeString(issuerName), 
+                        xmlSecErrorsSafeString(issuerName),
                         xmlSecErrorsSafeString(issuerSerial));
             xmlFree(issuerSerial);
             xmlFree(issuerName);
@@ -1282,7 +1282,7 @@ xmlSecMSCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, x
 
         xmlFree(issuerSerial);
         xmlFree(issuerName);
-        return(0);    
+        return(0);
     }
 
     ret = xmlSecMSCryptoKeyDataX509AdoptCert(data, cert);
@@ -1297,15 +1297,15 @@ xmlSecMSCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, x
         xmlFree(issuerName);
         return(-1);
     }
-    
+
     xmlFree(issuerSerial);
     xmlFree(issuerName);
     return(0);
 }
 
 static int
-xmlSecMSCryptoX509IssuerSerialNodeWrite(PCCERT_CONTEXT cert, 
-                                        xmlNodePtr node, 
+xmlSecMSCryptoX509IssuerSerialNodeWrite(PCCERT_CONTEXT cert,
+                                        xmlNodePtr node,
                                         xmlSecKeyInfoCtxPtr keyInfoCtx ATTRIBUTE_UNUSED) {
     xmlNodePtr cur;
     xmlNodePtr issuerNameNode;
@@ -1375,13 +1375,13 @@ xmlSecMSCryptoX509IssuerSerialNodeWrite(PCCERT_CONTEXT cert,
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataStorePtr x509Store;
     xmlChar* ski;
     PCCERT_CONTEXT cert;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataX509Id), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
@@ -1423,7 +1423,7 @@ xmlSecMSCryptoX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyI
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                         NULL,
                         XMLSEC_ERRORS_R_CERT_NOT_FOUND,
-                        "ski=%s", 
+                        "ski=%s",
                         xmlSecErrorsSafeString(ski));
             return(-1);
         }
@@ -1481,7 +1481,7 @@ xmlSecMSCryptoX509SKINodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node, xmlSecKeyIn
     return(0);
 }
 
-static int 
+static int
 xmlSecMSCryptoX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlChar *content;
     PCCRL_CONTEXT crl;
@@ -1515,7 +1515,7 @@ xmlSecMSCryptoX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyI
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFree(content);
         return(-1);
-    }    
+    }
 
     if (0 != xmlSecMSCryptoKeyDataX509AdoptCrl(data, crl)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1524,10 +1524,10 @@ xmlSecMSCryptoX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyI
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFree(content);
-        CertFreeCRLContext(crl); 
+        CertFreeCRLContext(crl);
         return(-1);
     }
-    
+
     xmlFree(content);
     return(0);
 }
@@ -1542,7 +1542,7 @@ xmlSecMSCryptoX509CRLNodeWrite(PCCRL_CONTEXT crl, xmlNodePtr node, xmlSecKeyInfo
     xmlSecAssert2(keyInfoCtx != NULL, -1);
 
     /* set base64 lines size from context */
-    buf = xmlSecMSCryptoX509CrlBase64DerWrite(crl, keyInfoCtx->base64LineSize); 
+    buf = xmlSecMSCryptoX509CrlBase64DerWrite(crl, keyInfoCtx->base64LineSize);
     if(buf == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1579,7 +1579,7 @@ xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
     xmlSecMSCryptoX509DataCtxPtr ctx;
     xmlSecKeyDataStorePtr x509Store;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecMSCryptoKeyDataX509Id), -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
@@ -1664,7 +1664,7 @@ xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
                                 XMLSEC_ERRORS_NO_MESSAGE);
                     xmlSecKeyDataDestroy(keyValue);
                     return(-1);
-            }   
+            }
 
             ret = xmlSecKeySetValue(key, keyValue);
             if(ret < 0) {
@@ -1675,7 +1675,7 @@ xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
                                 XMLSEC_ERRORS_NO_MESSAGE);
                     xmlSecKeyDataDestroy(keyValue);
                     return(-1);
-            }       
+            }
 
             ret = xmlSecMSCryptoX509CertGetTime(ctx->keyCert->pCertInfo->NotBefore, &(key->notValidBefore));
             if(ret < 0) {
@@ -1711,9 +1711,9 @@ xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
 static int
 xmlSecMSCryptoX509CertGetTime(FILETIME t, time_t* res) {
     LONGLONG result;
-    
+
     xmlSecAssert2(res != NULL, -1);
-    
+
     result = t.dwHighDateTime;
     result = (result) << 32;
     result |= t.dwLowDateTime;
@@ -1734,9 +1734,9 @@ xmlSecMSCryptoX509CertBase64DerRead(xmlChar* buf) {
     int ret;
 
     xmlSecAssert2(buf != NULL, NULL);
-    
+
     /* usual trick with base64 decoding "in-place" */
-    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf)); 
+    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1745,7 +1745,7 @@ xmlSecMSCryptoX509CertBase64DerRead(xmlChar* buf) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(xmlSecMSCryptoX509CertDerRead((xmlSecByte*)buf, ret));
 }
 
@@ -1797,20 +1797,20 @@ xmlSecMSCryptoX509CertBase64DerWrite(PCCERT_CONTEXT cert, int base64LineWrap) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
-    }    
+    }
 
     return(res);
 }
 
 static PCCRL_CONTEXT
-xmlSecMSCryptoX509CrlBase64DerRead(xmlChar* buf, 
+xmlSecMSCryptoX509CrlBase64DerRead(xmlChar* buf,
                                    xmlSecKeyInfoCtxPtr keyInfoCtx) {
     int ret;
 
     xmlSecAssert2(buf != NULL, NULL);
 
     /* usual trick with base64 decoding "in-place" */
-    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf)); 
+    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1824,7 +1824,7 @@ xmlSecMSCryptoX509CrlBase64DerRead(xmlChar* buf,
 }
 
 
-static PCCRL_CONTEXT                      
+static PCCRL_CONTEXT
 xmlSecMSCryptoX509CrlDerRead(xmlSecByte* buf, xmlSecSize size,
                              xmlSecKeyInfoCtxPtr keyInfoCtx) {
     PCCRL_CONTEXT crl = NULL;
@@ -1874,7 +1874,7 @@ xmlSecMSCryptoX509CrlBase64DerWrite(PCCRL_CONTEXT crl, int base64LineWrap) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
-    }   
+    }
 
     return(res);
 }
@@ -1913,7 +1913,7 @@ xmlSecMSCryptoX509NameWrite(PCERT_NAME_BLOB nm) {
 
     /* aleksey: this is a hack, but mscrypto can not read E= flag and wants Email= instead.
      * don't ask me how is it possible not to read something you wrote yourself but also
-     * see comment in the xmlSecMSCryptoX509FindCert function. 
+     * see comment in the xmlSecMSCryptoX509FindCert function.
      */
     if(strncmp(str, "E=", 2) == 0) {
         res = xmlMalloc(strlen(str) + 13 + 1);
@@ -1929,7 +1929,7 @@ xmlSecMSCryptoX509NameWrite(PCERT_NAME_BLOB nm) {
         }
 
         memcpy(res, "emailAddress=", 13);
-        strcpy(res + 13, BAD_CAST (str + 2)); 
+        strcpy(res + 13, BAD_CAST (str + 2));
     } else {
         res = xmlStrdup(BAD_CAST str);
         if(res == NULL) {
@@ -1977,8 +1977,8 @@ xmlSecMSCryptoASN1IntegerWrite(xmlNodePtr node, PCRYPT_INTEGER_BLOB num) {
         return(-1);
     }
 
-    /* I have no clue why at a sudden a swap is needed to 
-     * convert from lsb... This code is purely based upon 
+    /* I have no clue why at a sudden a swap is needed to
+     * convert from lsb... This code is purely based upon
      * trial and error :( WK
      */
     ret = xmlSecBnSetNodeValue(&bn, node, xmlSecBnDec, 1, 0);
@@ -1991,7 +1991,7 @@ xmlSecMSCryptoASN1IntegerWrite(xmlNodePtr node, PCRYPT_INTEGER_BLOB num) {
         xmlSecBnFinalize(&bn);
         return(-1);
     }
-    
+
     xmlSecBnFinalize(&bn);
     return(0);
 }
@@ -2059,12 +2059,12 @@ xmlSecMSCryptoX509SKIWrite(PCCERT_CONTEXT cert) {
         return(NULL);
     }
     xmlFree(bSKI);
-    
+
     return(res);
 }
 
 
-static void 
+static void
 xmlSecMSCryptoX509CertDebugDump(PCCERT_CONTEXT cert, FILE* output) {
     PCRYPT_INTEGER_BLOB sn;
     unsigned int i;
@@ -2100,7 +2100,7 @@ xmlSecMSCryptoX509CertDebugDump(PCCERT_CONTEXT cert, FILE* output) {
 }
 
 
-static void 
+static void
 xmlSecMSCryptoX509CertDebugXmlDump(PCCERT_CONTEXT cert, FILE* output) {
     PCRYPT_INTEGER_BLOB sn;
     unsigned int i;
@@ -2111,7 +2111,7 @@ xmlSecMSCryptoX509CertDebugXmlDump(PCCERT_CONTEXT cert, FILE* output) {
     xmlSecAssert(output != NULL);
 
     /* todo: add error checks */
-    
+
     /* subject */
     dwSize = CertGetNameString(cert, CERT_NAME_RDN_TYPE, 0, NULL, NULL, 0);
     subject = (LPSTR)xmlMalloc(dwSize);
@@ -2121,8 +2121,8 @@ xmlSecMSCryptoX509CertDebugXmlDump(PCCERT_CONTEXT cert, FILE* output) {
     xmlSecPrintXmlString(output, BAD_CAST subject);
     fprintf(output, "</SubjectName>\n");
     xmlFree(subject);
-    
-    
+
+
     /* issuer */
     dwSize = CertGetNameString(cert, CERT_NAME_RDN_TYPE, CERT_NAME_ISSUER_FLAG, NULL, NULL, 0);
     issuer = (LPSTR)xmlMalloc(dwSize);
@@ -2132,7 +2132,7 @@ xmlSecMSCryptoX509CertDebugXmlDump(PCCERT_CONTEXT cert, FILE* output) {
     xmlSecPrintXmlString(output, BAD_CAST issuer);
     fprintf(output, "</IssuerName>\n");
     xmlFree(issuer);
-    
+
     /* serial */
     fprintf(output, "<SerialNumber>");
     sn = &(cert->pCertInfo->SerialNumber);
@@ -2165,12 +2165,12 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataRawX509CertKlass = {
 
     /* data */
     xmlSecNameRawX509Cert,
-    xmlSecKeyDataUsageRetrievalMethodNodeBin, 
+    xmlSecKeyDataUsageRetrievalMethodNodeBin,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefRawX509Cert,                      /* const xmlChar* href; */
     NULL,                                       /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     NULL,                                       /* xmlSecKeyDataInitializeMethod initialize; */
     NULL,                                       /* xmlSecKeyDataDuplicateMethod duplicate; */
@@ -2180,7 +2180,7 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataRawX509CertKlass = {
     /* get info */
     NULL,                                       /* xmlSecKeyDataGetTypeMethod getType; */
     NULL,                                       /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     NULL,                                       /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -2199,12 +2199,12 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataRawX509CertKlass = {
 
 /**
  * xmlSecMSCryptoKeyDataRawX509CertGetKlass:
- * 
+ *
  * The raw X509 certificates key data klass.
  *
  * Returns: raw X509 certificates key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecMSCryptoKeyDataRawX509CertGetKlass(void) {
     return(&xmlSecMSCryptoKeyDataRawX509CertKlass);
 }
@@ -2216,7 +2216,7 @@ xmlSecMSCryptoKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     xmlSecKeyDataPtr data;
     PCCERT_CONTEXT cert;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecMSCryptoKeyDataRawX509CertId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(buf != NULL, -1);
diff --git a/src/mscrypto/x509vfy.c b/src/mscrypto/x509vfy.c
index d3f2b7c..eda4943 100644
--- a/src/mscrypto/x509vfy.c
+++ b/src/mscrypto/x509vfy.c
@@ -1,4 +1,4 @@
-/** 
+/**
  * XMLSec library
  *
  * X509 support
@@ -6,7 +6,7 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2003 Cordys R&D BV, All rights reserved.
  * Copyright (C) 2003 Aleksey Sanin <aleksey aleksey com>
  */
@@ -43,13 +43,13 @@
  * Internal MSCRYPTO X509 store CTX
  *
  *************************************************************************/
-typedef struct _xmlSecMSCryptoX509StoreCtx    xmlSecMSCryptoX509StoreCtx, 
+typedef struct _xmlSecMSCryptoX509StoreCtx    xmlSecMSCryptoX509StoreCtx,
                         *xmlSecMSCryptoX509StoreCtxPtr;
 struct _xmlSecMSCryptoX509StoreCtx {
     HCERTSTORE trusted;
     HCERTSTORE untrusted;
     int        dont_use_system_trusted_certs;
-};        
+};
 
 /****************************************************************************
  *
@@ -63,7 +63,7 @@ struct _xmlSecMSCryptoX509StoreCtx {
                     sizeof(xmlSecKeyDataStoreKlass)))
 #define xmlSecMSCryptoX509StoreSize    \
     (sizeof(xmlSecKeyDataStoreKlass) + sizeof(xmlSecMSCryptoX509StoreCtx))
- 
+
 static int         xmlSecMSCryptoX509StoreInitialize    (xmlSecKeyDataStorePtr store);
 static void        xmlSecMSCryptoX509StoreFinalize      (xmlSecKeyDataStorePtr store);
 
@@ -72,8 +72,8 @@ static xmlSecKeyDataStoreKlass xmlSecMSCryptoX509StoreKlass = {
     xmlSecMSCryptoX509StoreSize,
 
     /* data */
-    xmlSecNameX509Store,                    /* const xmlChar* name; */ 
-        
+    xmlSecNameX509Store,                    /* const xmlChar* name; */
+
     /* constructors/destructor */
     xmlSecMSCryptoX509StoreInitialize,      /* xmlSecKeyDataStoreInitializeMethod initialize; */
     xmlSecMSCryptoX509StoreFinalize,        /* xmlSecKeyDataStoreFinalizeMethod finalize; */
@@ -90,14 +90,14 @@ static PCCERT_CONTEXT xmlSecMSCryptoX509FindCert(HCERTSTORE store,
                          const xmlChar *ski);
 
 
-/** 
+/**
  * xmlSecMSCryptoX509StoreGetKlass:
- * 
+ *
  * The MSCrypto X509 certificates key data store klass.
  *
  * Returns: pointer to MSCrypto X509 certificates key data store klass.
  */
-xmlSecKeyDataStoreId 
+xmlSecKeyDataStoreId
 xmlSecMSCryptoX509StoreGetKlass(void) {
     return(&xmlSecMSCryptoX509StoreKlass);
 }
@@ -122,7 +122,7 @@ xmlSecMSCryptoX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectNam
                 xmlChar *ski, xmlSecKeyInfoCtx* keyInfoCtx) {
     xmlSecMSCryptoX509StoreCtxPtr ctx;
     PCCERT_CONTEXT pCert = NULL;
-    
+
     xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecMSCryptoX509StoreId), NULL);
     xmlSecAssert2(keyInfoCtx != NULL, NULL);
 
@@ -143,7 +143,7 @@ xmlSecMSCryptoX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectNam
 }
 
 
-static void 
+static void
 xmlSecMSCryptoUnixTimeToFileTime(time_t t, LPFILETIME pft) {
     /* Note that LONGLONG is a 64-bit value */
     LONGLONG ll;
@@ -171,7 +171,7 @@ xmlSecMSCrypoVerifyCertTime(PCCERT_CONTEXT pCert, LPFILETIME pft) {
     if(-1 == CompareFileTime(&(pCert->pCertInfo->NotAfter), pft)) {
         return (FALSE);
     }
- 
+
     return (TRUE);
 }
 
@@ -182,7 +182,7 @@ xmlSecMSCryptoCheckRevocation(HCERTSTORE hStore, PCCERT_CONTEXT pCert) {
 
     xmlSecAssert2(pCert != NULL, FALSE);
     xmlSecAssert2(hStore != NULL, FALSE);
-    
+
     while((pCrl = CertEnumCRLsInStore(hStore, pCrl)) != NULL) {
         if (CertFindCertificateInCRL(pCert, pCrl, 0, NULL, &pCrlEntry) && (pCrlEntry != NULL)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -265,12 +265,12 @@ xmlSecMSCryptoX509StoreCertError(xmlSecKeyDataStorePtr store, PCCERT_CONTEXT cer
  * @pfTime: pointer to FILETIME that we are interested in
  * @store_untrusted: untrusted certificates added via API
  * @store_doc: untrusted certificates/CRLs extracted from a document
- * 
+ *
  * Builds certificates chain using Windows API.
- * 
+ *
  * Returns: TRUE on success or FALSE otherwise.
  */
-static BOOL 
+static BOOL
 xmlSecBuildChainUsingWinapi (PCCERT_CONTEXT cert, LPFILETIME pfTime,
                 HCERTSTORE store_untrusted, HCERTSTORE store_doc)
 {
@@ -368,9 +368,9 @@ end:
  * @store_untrusted: untrusted certificates added via API
  * @certs: untrusted certificates/CRLs extracted from a document
  * @store: pointer to store klass passed to error functions
- * 
+ *
  * Builds certificates chain manually.
- * 
+ *
  * Returns: TRUE on success or FALSE otherwise.
  */
 static BOOL
@@ -393,7 +393,7 @@ xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
      * Try to find the cert in the trusted cert store. We will trust
      * the certificate in the trusted store.
      */
-    issuerCert = CertFindCertificateInStore(store_trusted, 
+    issuerCert = CertFindCertificateInStore(store_trusted,
                 X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
                 0,
                 CERT_FIND_SUBJECT_NAME,
@@ -412,7 +412,7 @@ xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
     }
 
     /* try to find issuer cert in the trusted cert in the store */
-    issuerCert = CertFindCertificateInStore(store_trusted, 
+    issuerCert = CertFindCertificateInStore(store_trusted,
                 X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
                 0,
                 CERT_FIND_SUBJECT_NAME,
@@ -432,7 +432,7 @@ xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
     }
 
     /* try the untrusted certs in the chain */
-    issuerCert = CertFindCertificateInStore(certs, 
+    issuerCert = CertFindCertificateInStore(certs,
                 X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
                 0,
                 CERT_FIND_SUBJECT_NAME,
@@ -455,7 +455,7 @@ xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
     }
 
     /* try the untrusted certs in the store */
-    issuerCert = CertFindCertificateInStore(store_untrusted, 
+    issuerCert = CertFindCertificateInStore(store_untrusted,
                 X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
                 0,
                 CERT_FIND_SUBJECT_NAME,
@@ -480,13 +480,13 @@ xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
 }
 
 static BOOL
-xmlSecMSCryptoX509StoreConstructCertsChain(xmlSecKeyDataStorePtr store, PCCERT_CONTEXT cert, HCERTSTORE certs, 
+xmlSecMSCryptoX509StoreConstructCertsChain(xmlSecKeyDataStorePtr store, PCCERT_CONTEXT cert, HCERTSTORE certs,
                               xmlSecKeyInfoCtx* keyInfoCtx) {
     xmlSecMSCryptoX509StoreCtxPtr ctx;
     PCCERT_CONTEXT tempCert = NULL;
     FILETIME fTime;
     BOOL res = FALSE;
-    
+
     xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecMSCryptoX509StoreId), FALSE);
     xmlSecAssert2(cert != NULL, FALSE);
     xmlSecAssert2(cert->pCertInfo != NULL, FALSE);
@@ -533,7 +533,7 @@ xmlSecMSCryptoX509StoreConstructCertsChain(xmlSecKeyDataStorePtr store, PCCERT_C
  * Verifies @certs list.
  *
  * Returns: pointer to the first verified certificate from @certs.
- */ 
+ */
 PCCERT_CONTEXT
 xmlSecMSCryptoX509StoreVerify(xmlSecKeyDataStorePtr store, HCERTSTORE certs,
                   xmlSecKeyInfoCtx* keyInfoCtx) {
@@ -546,10 +546,10 @@ xmlSecMSCryptoX509StoreVerify(xmlSecKeyDataStorePtr store, HCERTSTORE certs,
     while((cert = CertEnumCertificatesInStore(certs, cert)) != NULL){
         PCCERT_CONTEXT nextCert = NULL;
         unsigned char selected = 1;
-        
+
         xmlSecAssert2(cert->pCertInfo != NULL, NULL);
 
-        /* if cert is the issuer of any other cert in the list, then it is 
+        /* if cert is the issuer of any other cert in the list, then it is
           * to be skipped except a case of a celf-signed cert*/
         do {
             nextCert = CertFindCertificateInStore(certs,
@@ -558,13 +558,13 @@ xmlSecMSCryptoX509StoreVerify(xmlSecKeyDataStorePtr store, HCERTSTORE certs,
                     CERT_FIND_ISSUER_NAME,
                     &(cert->pCertInfo->Subject),
                     nextCert);
-            if((nextCert != NULL) && !CertCompareCertificateName(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 
+            if((nextCert != NULL) && !CertCompareCertificateName(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
                                         &(nextCert->pCertInfo->Subject), &(nextCert->pCertInfo->Issuer))) {
                 selected = 0;
-            }    
+            }
         } while((selected == 1) && (nextCert != NULL));
         if(nextCert != NULL) {
-            CertFreeCertificateContext(nextCert);                
+            CertFreeCertificateContext(nextCert);
         }
 
         if((selected == 1) && xmlSecMSCryptoX509StoreConstructCertsChain(store, cert, certs, keyInfoCtx)) {
@@ -611,8 +611,8 @@ xmlSecMSCryptoX509StoreAdoptCert(xmlSecKeyDataStorePtr store, PCCERT_CONTEXT pCe
         return(-1);
     }
 
-    /* TODO: The context to be added here is not duplicated first, 
-    * hopefully this will not lead to errors when closing teh store 
+    /* TODO: The context to be added here is not duplicated first,
+    * hopefully this will not lead to errors when closing teh store
     * and freeing the mem for all the context in the store.
     */
     xmlSecAssert2(certStore != NULL, -1);
@@ -629,8 +629,8 @@ xmlSecMSCryptoX509StoreAdoptCert(xmlSecKeyDataStorePtr store, PCCERT_CONTEXT pCe
 }
 
 
-/** 
- * xmlSecMSCryptoX509StoreAdoptKeyStore: 
+/**
+ * xmlSecMSCryptoX509StoreAdoptKeyStore:
  * @store:              the pointer to X509 key data store klass.
  * @keyStore:           the pointer to keys store.
  *
@@ -638,7 +638,7 @@ xmlSecMSCryptoX509StoreAdoptCert(xmlSecKeyDataStorePtr store, PCCERT_CONTEXT pCe
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int    
+int
 xmlSecMSCryptoX509StoreAdoptKeyStore (xmlSecKeyDataStorePtr store, HCERTSTORE keyStore) {
     xmlSecMSCryptoX509StoreCtxPtr ctx;
 
@@ -661,8 +661,8 @@ xmlSecMSCryptoX509StoreAdoptKeyStore (xmlSecKeyDataStorePtr store, HCERTSTORE ke
     return(0);
 }
 
-/** 
- * xmlSecMSCryptoX509StoreAdoptTrustedStore: 
+/**
+ * xmlSecMSCryptoX509StoreAdoptTrustedStore:
  * @store:              the pointer to X509 key data store klass.
  * @trustedStore:       the pointer to certs store.
  *
@@ -693,8 +693,8 @@ xmlSecMSCryptoX509StoreAdoptTrustedStore (xmlSecKeyDataStorePtr store, HCERTSTOR
     return(0);
 }
 
-/** 
- * xmlSecMSCryptoX509StoreAdoptUntrustedStore: 
+/**
+ * xmlSecMSCryptoX509StoreAdoptUntrustedStore:
  * @store:              the pointer to X509 key data store klass.
  * @untrustedStore:     the pointer to certs store.
  *
@@ -725,8 +725,8 @@ xmlSecMSCryptoX509StoreAdoptUntrustedStore (xmlSecKeyDataStorePtr store, HCERTST
     return(0);
 }
 
-/** 
- * xmlSecMSCryptoX509StoreEnableSystemTrustedCerts: 
+/**
+ * xmlSecMSCryptoX509StoreEnableSystemTrustedCerts:
  * @store:              the pointer to X509 key data store klass.
  * @val:                the enable/disable flag
  *
@@ -735,13 +735,13 @@ xmlSecMSCryptoX509StoreAdoptUntrustedStore (xmlSecKeyDataStorePtr store, HCERTST
 void
 xmlSecMSCryptoX509StoreEnableSystemTrustedCerts (xmlSecKeyDataStorePtr store, int val) {
     xmlSecMSCryptoX509StoreCtxPtr ctx;
-    
+
     xmlSecAssert(xmlSecKeyDataStoreCheckId(store, xmlSecMSCryptoX509StoreId));
-    
+
     ctx = xmlSecMSCryptoX509StoreGetCtx(store);
     xmlSecAssert(ctx != NULL);
     xmlSecAssert(ctx->untrusted != NULL);
-    
+
     /* it is other way around to make default value 0 mimic old behaiviour */
     ctx->dont_use_system_trusted_certs = !val;
 }
@@ -857,7 +857,7 @@ xmlSecMSCryptoX509StoreInitialize(xmlSecKeyDataStorePtr store) {
     }
     CertCloseStore(hUntrustedMemStore, CERT_CLOSE_STORE_CHECK_FLAG);
 
-    return(0);    
+    return(0);
 }
 
 static void
@@ -884,11 +884,231 @@ xmlSecMSCryptoX509StoreFinalize(xmlSecKeyDataStorePtr store) {
  * Low-level x509 functions
  *
  *****************************************************************************/
+
+/**
+ * xmlSecMSCryptoX509FindCertBySubject:
+ * @store:              the pointer to certs store
+ * @wcSubject:          the cert subject (Unicode)
+ * @dwCertEncodingType: the cert encoding type
+ *
+ * Searches for a cert with given @subject in the @store
+ *
+ * Returns: cert handle on success or NULL otherwise
+ */
+PCCERT_CONTEXT
+xmlSecMSCryptoX509FindCertBySubject(HCERTSTORE store, const LPWSTR wcSubject, DWORD dwCertEncodingType) {
+    PCCERT_CONTEXT res = NULL;
+    CERT_NAME_BLOB cnb;
+    BYTE* bdata;
+    DWORD len;
+
+    xmlSecAssert2(store != NULL, NULL);
+    xmlSecAssert2(wcSubject != NULL, NULL);
+
+    /* CASE 1: UTF8, DN */
+    if (NULL == res) {
+        bdata = xmlSecMSCryptoCertStrToNameW(dwCertEncodingType,
+                    wcSubject,
+                    CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG | CERT_OID_NAME_STR,
+                    &len);
+        if(bdata != NULL) {
+            cnb.cbData = len;
+            cnb.pbData = bdata;
+
+            res = CertFindCertificateInStore(store,
+                        dwCertEncodingType,
+                        0,
+                        CERT_FIND_SUBJECT_NAME,
+                        &cnb,
+                        NULL);
+            xmlFree(bdata);
+        }
+    }
+
+    /* CASE 2: UTF8, REVERSE DN */
+    if (NULL == res) {
+        bdata = xmlSecMSCryptoCertStrToNameW(dwCertEncodingType,
+                    wcSubject,
+                    CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG | CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG,
+                    &len);
+        if(bdata != NULL) {
+            cnb.cbData = len;
+            cnb.pbData = bdata;
+
+            res = CertFindCertificateInStore(store,
+                        dwCertEncodingType,
+                        0,
+                        CERT_FIND_SUBJECT_NAME,
+                        &cnb,
+                        NULL);
+            xmlFree(bdata);
+        }
+    }
+
+    /* CASE 3: UNICODE, DN */
+    if (NULL == res) {
+        bdata = xmlSecMSCryptoCertStrToNameW(dwCertEncodingType,
+                    wcSubject,
+                    CERT_OID_NAME_STR,
+                    &len);
+        if(bdata != NULL) {
+            cnb.cbData = len;
+            cnb.pbData = bdata;
+
+            res = CertFindCertificateInStore(store,
+                        dwCertEncodingType,
+                        0,
+                        CERT_FIND_SUBJECT_NAME,
+                        &cnb,
+                        NULL);
+            xmlFree(bdata);
+        }
+    }
+
+    /* CASE 4: UNICODE, REVERSE DN */
+    if (NULL == res) {
+        bdata = xmlSecMSCryptoCertStrToNameW(dwCertEncodingType,
+                    wcSubject,
+                    CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG,
+                    &len);
+        if(bdata != NULL) {
+            cnb.cbData = len;
+            cnb.pbData = bdata;
+
+            res = CertFindCertificateInStore(store,
+                        dwCertEncodingType,
+                        0,
+                        CERT_FIND_SUBJECT_NAME,
+                        &cnb,
+                        NULL);
+            xmlFree(bdata);
+        }
+    }
+
+
+    /* done */
+    return (res);
+}
+
+/**
+ * xmlSecMSCryptoX509FindCertByIssuer:
+ * @store:              the pointer to certs store
+ * @wcIssuer:           the cert issuer (Unicode)
+ * @issuerSerialBn:     the cert issuer serial
+ * @dwCertEncodingType: the cert encoding type
+ *
+ * Searches for a cert with given @subject in the @store
+ *
+ * Returns: cert handle on success or NULL otherwise
+ */
 static PCCERT_CONTEXT
-xmlSecMSCryptoX509FindCert(HCERTSTORE store, 
-                const xmlChar *subjectName, 
-                const xmlChar *issuerName, 
-                const xmlChar *issuerSerial, 
+xmlSecMSCryptoX509FindCertByIssuer(HCERTSTORE store, const LPWSTR wcIssuer,
+                                   xmlSecBnPtr issuerSerialBn, DWORD dwCertEncodingType) {
+
+    PCCERT_CONTEXT res = NULL;
+    CERT_INFO certInfo;
+    BYTE* bdata;
+    DWORD len;
+
+
+    xmlSecAssert2(store != NULL, NULL);
+    xmlSecAssert2(wcIssuer != NULL, NULL);
+    xmlSecAssert2(issuerSerialBn != NULL, NULL);
+
+    certInfo.SerialNumber.cbData = xmlSecBnGetSize(issuerSerialBn);
+    certInfo.SerialNumber.pbData = xmlSecBnGetData(issuerSerialBn);
+
+
+    /* CASE 1: UTF8, DN */
+    if (NULL == res) {
+        bdata = xmlSecMSCryptoCertStrToNameW(dwCertEncodingType,
+                    wcIssuer,
+                    CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG | CERT_OID_NAME_STR,
+                    &len);
+        if(bdata != NULL) {
+            certInfo.Issuer.cbData = len;
+            certInfo.Issuer.pbData = bdata;
+
+            res = CertFindCertificateInStore(store,
+                        dwCertEncodingType,
+                        0,
+                        CERT_FIND_SUBJECT_CERT,
+                        &certInfo,
+                        NULL);
+            xmlFree(bdata);
+        }
+    }
+
+    /* CASE 2: UTF8, REVERSE DN */
+    if (NULL == res) {
+        bdata = xmlSecMSCryptoCertStrToNameW(dwCertEncodingType,
+                    wcIssuer,
+                    CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG | CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG,
+                    &len);
+        if(bdata != NULL) {
+            certInfo.Issuer.cbData = len;
+            certInfo.Issuer.pbData = bdata;
+
+            res = CertFindCertificateInStore(store,
+                        dwCertEncodingType,
+                        0,
+                        CERT_FIND_SUBJECT_CERT,
+                        &certInfo,
+                        NULL);
+            xmlFree(bdata);
+        }
+    }
+
+    /* CASE 3: UNICODE, DN */
+    if (NULL == res) {
+        bdata = xmlSecMSCryptoCertStrToNameW(dwCertEncodingType,
+                    wcIssuer,
+                    CERT_OID_NAME_STR,
+                    &len);
+        if(bdata != NULL) {
+            certInfo.Issuer.cbData = len;
+            certInfo.Issuer.pbData = bdata;
+
+            res = CertFindCertificateInStore(store,
+                        dwCertEncodingType,
+                        0,
+                        CERT_FIND_SUBJECT_CERT,
+                        &certInfo,
+                        NULL);
+            xmlFree(bdata);
+        }
+    }
+
+    /* CASE 4: UNICODE, REVERSE DN */
+    if (NULL == res) {
+        bdata = xmlSecMSCryptoCertStrToNameW(dwCertEncodingType,
+                    wcIssuer,
+                    CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG,
+                    &len);
+        if(bdata != NULL) {
+            certInfo.Issuer.cbData = len;
+            certInfo.Issuer.pbData = bdata;
+
+            res = CertFindCertificateInStore(store,
+                        dwCertEncodingType,
+                        0,
+                        CERT_FIND_SUBJECT_CERT,
+                        &certInfo,
+                        NULL);
+            xmlFree(bdata);
+        }
+    }
+
+
+    /* done */
+    return (res);
+}
+
+static PCCERT_CONTEXT
+xmlSecMSCryptoX509FindCert(HCERTSTORE store,
+                const xmlChar *subjectName,
+                const xmlChar *issuerName,
+                const xmlChar *issuerSerial,
                 const xmlChar *ski) {
     PCCERT_CONTEXT pCert = NULL;
     int ret;
@@ -896,12 +1116,9 @@ xmlSecMSCryptoX509FindCert(HCERTSTORE store,
     xmlSecAssert2(store != 0, NULL);
 
     if((pCert == NULL) && (NULL != subjectName)) {
-        CERT_NAME_BLOB cnb;
         LPWSTR wcSubjectName = NULL;
-        BYTE *cName = NULL; 
-        DWORD cNameLen;
 
-        /* get subject name */
+        /* get unicode subject name */
         wcSubjectName = xmlSecMSCryptoConvertUtf8ToUnicode(subjectName);
         if(wcSubjectName == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -912,81 +1129,19 @@ xmlSecMSCryptoX509FindCert(HCERTSTORE store,
             return(NULL);
         }
 
+        /* search */
+        pCert = xmlSecMSCryptoX509FindCertBySubject(store,
+            wcSubjectName,
+            PKCS_7_ASN_ENCODING | X509_ASN_ENCODING);
 
-        cName = xmlSecMSCryptoCertStrToNameW(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
-                        wcSubjectName,
-                        CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG,
-                        &cNameLen);
-        if(cName == NULL) {
-            xmlSecError(XMLSEC_ERRORS_HERE,
-                        NULL,
-                        "xmlSecMSCryptoCertStrToName",
-                        XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        XMLSEC_ERRORS_NO_MESSAGE);
-            xmlFree(wcSubjectName);
-            return (NULL);
-        }
-        cnb.pbData = cName;
-        cnb.cbData = cNameLen;
 
-        /* search */
-        pCert = CertFindCertificateInStore(store, 
-                        PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
-                        0,
-                        CERT_FIND_SUBJECT_NAME,
-                        &cnb,
-                        NULL);
-        
         /* cleanup */
-        xmlFree(cName);
         xmlFree(wcSubjectName);
     }
 
     if((pCert == NULL) && (NULL != issuerName) && (NULL != issuerSerial)) {
-        xmlSecBn issuerSerialBn;    
-        xmlChar * p;
-        CERT_INFO certInfo;
-        CERT_NAME_BLOB cnb;
+        xmlSecBn issuerSerialBn;
         LPWSTR wcIssuerName = NULL;
-        BYTE *cName = NULL; 
-        DWORD cNameLen = 0;    
-
-        /* aleksey: for some unknown to me reasons, mscrypto wants Email
-        * instead of emailAddress. This code is not bullet proof and may 
-        * produce incorrect results if someone has "emailAddress=" string
-        * in one of the fields, but it is best I can suggest to fix this problem.
-        * Also see xmlSecMSCryptoX509NameWrite function.
-        */
-        while( (p = (xmlChar*)xmlStrstr(issuerName, BAD_CAST "emailAddress=")) != NULL) {
-            memcpy(p, "       Email=", 13);
-        }
-
-        /* get issuer name */
-        wcIssuerName = xmlSecMSCryptoConvertUtf8ToUnicode(issuerName);
-        if(wcIssuerName == NULL) {
-            xmlSecError(XMLSEC_ERRORS_HERE,
-                        NULL,
-                        "xmlSecMSCryptoConvertUtf8ToUnicode",
-                        XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "wcIssuerName");
-            return(NULL);
-        }
-
-        cName = xmlSecMSCryptoCertStrToNameW(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
-                        wcIssuerName,
-                        CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG | CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG,
-                        &cNameLen);
-        if(cName == NULL) {
-            xmlSecError(XMLSEC_ERRORS_HERE,
-                NULL,
-                "xmlSecMSCryptoCertStrToName",
-                XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                XMLSEC_ERRORS_NO_MESSAGE);
-            xmlFree(wcIssuerName);
-            return (NULL);
-        }
-        cnb.pbData = cName;
-        cnb.cbData = cNameLen;
 
         /* get serial number */
         ret = xmlSecBnInitialize(&issuerSerialBn, 0);
@@ -996,8 +1151,6 @@ xmlSecMSCryptoX509FindCert(HCERTSTORE store,
                 "xmlSecBnInitialize",
                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                 XMLSEC_ERRORS_NO_MESSAGE);
-            xmlFree(cName);
-            xmlFree(wcIssuerName);
             return(NULL);
         }
 
@@ -1009,13 +1162,11 @@ xmlSecMSCryptoX509FindCert(HCERTSTORE store,
                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                 XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecBnFinalize(&issuerSerialBn);
-            xmlFree(cName);
-            xmlFree(wcIssuerName);
             return(NULL);
         }
 
-        /* I have no clue why at a sudden a swap is needed to 
-        * convert from lsb... This code is purely based upon 
+        /* I have no clue why at a sudden a swap is needed to
+        * convert from lsb... This code is purely based upon
         * trial and error :( WK
         */
         ret = xmlSecBnReverse(&issuerSerialBn);
@@ -1026,28 +1177,81 @@ xmlSecMSCryptoX509FindCert(HCERTSTORE store,
                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                 XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecBnFinalize(&issuerSerialBn);
-            xmlFree(cName);
-            xmlFree(wcIssuerName);
             return(NULL);
         }
 
-        certInfo.Issuer.cbData = cnb.cbData ;
-        certInfo.Issuer.pbData = cnb.pbData ;
-        certInfo.SerialNumber.cbData = xmlSecBnGetSize( &issuerSerialBn ) ;
-        certInfo.SerialNumber.pbData = xmlSecBnGetData( &issuerSerialBn ) ;
+        /* get issuer name */
+        wcIssuerName = xmlSecMSCryptoConvertUtf8ToUnicode(issuerName);
+        if(wcIssuerName == NULL) {
+            xmlSecError(XMLSEC_ERRORS_HERE,
+                        NULL,
+                        "xmlSecMSCryptoConvertUtf8ToUnicode",
+                        XMLSEC_ERRORS_R_XMLSEC_FAILED,
+                        "wcIssuerName");
+            xmlSecBnFinalize(&issuerSerialBn);
+            return(NULL);
+        }
+
+        /* search */
+        pCert = xmlSecMSCryptoX509FindCertByIssuer(store,
+                        wcIssuerName,
+                        &issuerSerialBn,
+                        X509_ASN_ENCODING | PKCS_7_ASN_ENCODING);
 
-        pCert = CertFindCertificateInStore(
-                        store,
-                        X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
-                        0,
-                        CERT_FIND_SUBJECT_CERT,
-                        &certInfo,
-                        NULL
-                ) ;
+        xmlFree(wcIssuerName);
 
+        /* aleksey: for some unknown to me reasons, mscrypto wants Email
+        * instead of emailAddress. This code is not bullet proof and may
+        * produce incorrect results if someone has "emailAddress=" string
+        * in one of the fields, but it is best I can suggest to fix this problem.
+        * Also see xmlSecMSCryptoX509NameWrite function.
+        */
+        if(pCert == NULL) {
+            xmlChar * issuerName2 = NULL;
+            LPWSTR wcIssuerName2 = NULL;
+            xmlChar * p;
+
+            /* replace "emailAddress=" with "Email" */
+            issuerName2 = xmlStrdup(issuerName);
+            if(issuerName2 == NULL) {
+                xmlSecError(XMLSEC_ERRORS_HERE,
+                            NULL,
+                            NULL,
+                            XMLSEC_ERRORS_R_MALLOC_FAILED,
+                            "xmlStrlen(issuerName)=%d",
+                            xmlStrlen(issuerName));
+                xmlSecBnFinalize(&issuerSerialBn);
+                return(NULL);
+            }
+            while( (p = (xmlChar*)xmlStrstr(issuerName2, BAD_CAST "emailAddress=")) != NULL) {
+                memcpy(p, "       Email=", 13);
+            }
+
+            /* get issuer name */
+            wcIssuerName2 = xmlSecMSCryptoConvertUtf8ToUnicode(issuerName2);
+            if(wcIssuerName2 == NULL) {
+                xmlSecError(XMLSEC_ERRORS_HERE,
+                            NULL,
+                            "xmlSecMSCryptoConvertUtf8ToUnicode",
+                            XMLSEC_ERRORS_R_XMLSEC_FAILED,
+                            "wcIssuerName2");
+                xmlFree(issuerName2);
+                xmlSecBnFinalize(&issuerSerialBn);
+                return(NULL);
+            }
+
+            /* search */
+            pCert = xmlSecMSCryptoX509FindCertByIssuer(store,
+                            wcIssuerName2,
+                            &issuerSerialBn,
+                            X509_ASN_ENCODING | PKCS_7_ASN_ENCODING);
+
+            xmlFree(issuerName2);
+            xmlFree(wcIssuerName2);
+        }
+
+        /* cleanup */
         xmlSecBnFinalize(&issuerSerialBn);
-        xmlFree(cName);
-        xmlFree(wcIssuerName);
     }
 
     if((pCert == NULL) && (ski != NULL)) {
@@ -1080,7 +1284,7 @@ xmlSecMSCryptoX509FindCert(HCERTSTORE store,
 
         blob.pbData = binSki;
         blob.cbData = binSkiLen;
-        pCert = CertFindCertificateInStore(store, 
+        pCert = CertFindCertificateInStore(store,
                         PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
                         0,
                         CERT_FIND_KEY_IDENTIFIER,
@@ -1089,7 +1293,7 @@ xmlSecMSCryptoX509FindCert(HCERTSTORE store,
         xmlFree(binSki);
     }
 
-  return(pCert);
+    return(pCert);
 }
 
 
diff --git a/src/mscrypto/xmlsec-mingw.h b/src/mscrypto/xmlsec-mingw.h
index 3be3c27..99f544b 100644
--- a/src/mscrypto/xmlsec-mingw.h
+++ b/src/mscrypto/xmlsec-mingw.h
@@ -3,7 +3,7 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2007 Roumen Petrov.
  */
 
diff --git a/src/nodeset.c b/src/nodeset.c
index ebcff60..3ebc3d1 100644
--- a/src/nodeset.c
+++ b/src/nodeset.c
@@ -1,18 +1,18 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Enchanced nodes set
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
 
 #include <stdlib.h>
 #include <string.h>
- 
+
 #include <libxml/tree.h>
 #include <libxml/xpath.h>
 #include <libxml/xpathInternals.h>
@@ -25,14 +25,14 @@
     (((node)->type != XML_NAMESPACE_DECL) ? \
         (node)->parent : \
         (xmlNodePtr)((xmlNsPtr)(node))->next)
-        
-static int      xmlSecNodeSetOneContains                (xmlSecNodeSetPtr nset, 
-                                                         xmlNodePtr node, 
+
+static int      xmlSecNodeSetOneContains                (xmlSecNodeSetPtr nset,
+                                                         xmlNodePtr node,
                                                          xmlNodePtr parent);
-static int      xmlSecNodeSetWalkRecursive              (xmlSecNodeSetPtr nset, 
-                                                         xmlSecNodeSetWalkCallback walkFunc, 
-                                                         void* data, 
-                                                         xmlNodePtr cur, 
+static int      xmlSecNodeSetWalkRecursive              (xmlSecNodeSetPtr nset,
+                                                         xmlSecNodeSetWalkCallback walkFunc,
+                                                         void* data,
+                                                         xmlNodePtr cur,
                                                          xmlNodePtr parent);
 
 /**
@@ -51,7 +51,7 @@ xmlSecNodeSetCreate(xmlDocPtr doc, xmlNodeSetPtr nodes, xmlSecNodeSetType type)
     xmlSecNodeSetPtr nset;
 
     nset = (xmlSecNodeSetPtr)xmlMalloc(sizeof(xmlSecNodeSet));
-    if(nset == NULL) { 
+    if(nset == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
@@ -61,7 +61,7 @@ xmlSecNodeSetCreate(xmlDocPtr doc, xmlNodeSetPtr nodes, xmlSecNodeSetType type)
         return(NULL);
     }
     memset(nset, 0,  sizeof(xmlSecNodeSet));
-    
+
     nset->doc   = doc;
     nset->nodes = nodes;
     nset->type  = type;
@@ -90,7 +90,7 @@ xmlSecNodeSetDestroy(xmlSecNodeSetPtr nset) {
         } else {
             nset = NULL;
         }
-        
+
         if(tmp->nodes != NULL) {
             xmlXPathFreeNodeSet(tmp->nodes);
         }
@@ -118,20 +118,20 @@ xmlSecNodeSetDestroy(xmlSecNodeSetPtr nset) {
  *
  * Instructs node set to destroy nodes parent doc when node set is destroyed.
  */
-void 
+void
 xmlSecNodeSetDocDestroy(xmlSecNodeSetPtr nset) {
     xmlSecAssert(nset != NULL);
-    
+
     nset->destroyDoc = 1;
 }
 
 static int
 xmlSecNodeSetOneContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr parent) {
     int in_nodes_set = 1;
-    
+
     xmlSecAssert2(nset != NULL, 0);
     xmlSecAssert2(node != NULL, 0);
-        
+
     /* special cases: */
     switch(nset->type) {
         case xmlSecNodeSetTreeWithoutComments:
@@ -145,30 +145,30 @@ xmlSecNodeSetOneContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr pare
         default:
             break;
     }
-        
+
     if(nset->nodes != NULL) {
         if(node->type != XML_NAMESPACE_DECL) {
             in_nodes_set = xmlXPathNodeSetContains(nset->nodes, node);
         } else {
             xmlNs ns;
-            
-            memcpy(&ns, node, sizeof(ns)); 
-            
+
+            memcpy(&ns, node, sizeof(ns));
+
             /* this is a libxml hack! check xpath.c for details */
             if((parent != NULL) && (parent->type == XML_ATTRIBUTE_NODE)) {
                 ns.next = (xmlNsPtr)parent->parent;
             } else {
-                ns.next = (xmlNsPtr)parent; 
+                ns.next = (xmlNsPtr)parent;
             }
 
-            /* 
-             * If the input is an XPath node-set, then the node-set must explicitly 
+            /*
+             * If the input is an XPath node-set, then the node-set must explicitly
              * contain every node to be rendered to the canonical form.
              */
             in_nodes_set = (xmlXPathNodeSetContains(nset->nodes, (xmlNodePtr)&ns));
         }
     }
-    
+
     switch(nset->type) {
     case xmlSecNodeSetNormal:
         return(in_nodes_set);
@@ -199,7 +199,7 @@ xmlSecNodeSetOneContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr pare
                     XMLSEC_ERRORS_R_INVALID_TYPE,
                     "type=%d", nset->type);
     }
-    
+
     return(0);
 }
 
@@ -218,14 +218,14 @@ int
 xmlSecNodeSetContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr parent) {
     int status = 1;
     xmlSecNodeSetPtr cur;
-    
+
     xmlSecAssert2(node != NULL, 0);
-    
+
     /* special cases: */
     if(nset == NULL) {
         return(1);
     }
-    
+
     status = 1;
     cur = nset;
     do {
@@ -243,7 +243,7 @@ xmlSecNodeSetContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr parent)
         case xmlSecNodeSetUnion:
             if(!status && xmlSecNodeSetOneContains(cur, node, parent)) {
                 status = 1;
-            }   
+            }
             break;
         default:
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -255,7 +255,7 @@ xmlSecNodeSetContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr parent)
         }
         cur = cur->next;
     } while(cur != nset);
-    
+
     return(status);
 }
 
@@ -265,13 +265,13 @@ xmlSecNodeSetContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr parent)
  * @newNSet:            the pointer to new nodes set.
  * @op:                 the operation type.
  *
- * Adds @newNSet to the @nset using operation @op. 
+ * Adds @newNSet to the @nset using operation @op.
  *
- * Returns: the pointer to combined nodes set or NULL if an error 
+ * Returns: the pointer to combined nodes set or NULL if an error
  * occurs.
  */
-xmlSecNodeSetPtr        
-xmlSecNodeSetAdd(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, 
+xmlSecNodeSetPtr
+xmlSecNodeSetAdd(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet,
                  xmlSecNodeSetOp op) {
     xmlSecAssert2(newNSet != NULL, NULL);
     xmlSecAssert2(newNSet->next == newNSet, NULL);
@@ -297,17 +297,17 @@ xmlSecNodeSetAdd(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet,
  * @newNSet:            the pointer to new nodes set.
  * @op:                 the operation type.
  *
- * Adds @newNSet to the @nset as child using operation @op. 
+ * Adds @newNSet to the @nset as child using operation @op.
  *
- * Returns: the pointer to combined nodes set or NULL if an error 
+ * Returns: the pointer to combined nodes set or NULL if an error
  * occurs.
  */
-xmlSecNodeSetPtr        
+xmlSecNodeSetPtr
 xmlSecNodeSetAddList(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, xmlSecNodeSetOp op) {
     xmlSecNodeSetPtr tmp1, tmp2;
 
     xmlSecAssert2(newNSet != NULL, NULL);
-    
+
     tmp1 = xmlSecNodeSetCreate(newNSet->doc, NULL, xmlSecNodeSetList);
     if(tmp1 == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -318,7 +318,7 @@ xmlSecNodeSetAddList(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, xmlSecNode
         return(NULL);
     }
     tmp1->children = newNSet;
-    
+
     tmp2 = xmlSecNodeSetAdd(nset, tmp1, op);
     if(tmp2 == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -332,7 +332,7 @@ xmlSecNodeSetAddList(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, xmlSecNode
     return(tmp2);
 }
 
- 
+
 /**
  * xmlSecNodeSetWalk:
  * @nset:               the pointer to node set.
@@ -340,7 +340,7 @@ xmlSecNodeSetAddList(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, xmlSecNode
  * @data:               the application specific data passed to the @walkFunc.
  *
  * Calls the function @walkFunc once per each node in the nodes set @nset.
- * If the @walkFunc returns a negative value, then the walk procedure 
+ * If the @walkFunc returns a negative value, then the walk procedure
  * is interrupted.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -349,7 +349,7 @@ int
 xmlSecNodeSetWalk(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc, void* data) {
     xmlNodePtr cur;
     int ret = 0;
-    
+
     xmlSecAssert2(nset != NULL, -1);
     xmlSecAssert2(nset->doc != NULL, -1);
     xmlSecAssert2(walkFunc != NULL, -1);
@@ -363,8 +363,8 @@ xmlSecNodeSetWalk(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc, voi
         case xmlSecNodeSetTree:
         case xmlSecNodeSetTreeWithoutComments:
             for(i = 0; (ret >= 0) && (i < nset->nodes->nodeNr); ++i) {
-                ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data, 
-                    nset->nodes->nodeTab[i], 
+                ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data,
+                    nset->nodes->nodeTab[i],
                     xmlSecGetParent(nset->nodes->nodeTab[i]));
             }
             return(ret);
@@ -372,7 +372,7 @@ xmlSecNodeSetWalk(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc, voi
             break;
         }
     }
-    
+
     for(cur = nset->doc->children; (cur != NULL) && (ret >= 0); cur = cur->next) {
         ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data, cur, xmlSecGetParent(cur));
     }
@@ -380,29 +380,29 @@ xmlSecNodeSetWalk(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc, voi
 }
 
 static int
-xmlSecNodeSetWalkRecursive(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc, 
+xmlSecNodeSetWalkRecursive(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc,
                             void* data, xmlNodePtr cur, xmlNodePtr parent) {
     int ret;
 
     xmlSecAssert2(nset != NULL, -1);
     xmlSecAssert2(cur != NULL, -1);
     xmlSecAssert2(walkFunc != NULL, -1);
-    
+
     /* the node itself */
     if(xmlSecNodeSetContains(nset, cur, parent)) {
         ret = walkFunc(nset, cur, parent, data);
-        
+
         if(ret < 0) {
             return(ret);
         }
     }
-        
-    /* element node has attributes, namespaces  */      
+
+    /* element node has attributes, namespaces  */
     if(cur->type == XML_ELEMENT_NODE) {
         xmlAttrPtr attr;
         xmlNodePtr node;
         xmlNsPtr ns, tmp;
-        
+
         attr = (xmlAttrPtr)cur->properties;
         while(attr != NULL) {
             if(xmlSecNodeSetContains(nset, (xmlNodePtr)attr, cur)) {
@@ -434,7 +434,7 @@ xmlSecNodeSetWalkRecursive(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walk
     /* element and document nodes have children */
     if((cur->type == XML_ELEMENT_NODE) || (cur->type == XML_DOCUMENT_NODE)) {
         xmlNodePtr node;
-        
+
         node = cur->children;
         while(node != NULL) {
             ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data, node, cur);
@@ -462,19 +462,19 @@ xmlSecNodeSetWalkRecursive(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walk
  *  - if @withComments is not 0 and @invert not is 0:
  *    all nodes in the @doc except nodes in the @parent subtree;
  *  - if @withComments is 0 and @invert is 0:
- *    all nodes in the @doc except nodes in the @parent subtree 
+ *    all nodes in the @doc except nodes in the @parent subtree
  *    and comment nodes.
  *
  * Returns: pointer to the newly created #xmlSecNodeSet structure
  * or NULL if an error occurs.
  */
-xmlSecNodeSetPtr        
+xmlSecNodeSetPtr
 xmlSecNodeSetGetChildren(xmlDocPtr doc, const xmlNodePtr parent, int withComments, int invert) {
     xmlNodeSetPtr nodes;
     xmlSecNodeSetType type;
 
     xmlSecAssert2(doc != NULL, NULL);
-        
+
     nodes = xmlXPathNodeSetCreate(parent);
     if(nodes == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -483,8 +483,8 @@ xmlSecNodeSetGetChildren(xmlDocPtr doc, const xmlNodePtr parent, int withComment
                     XMLSEC_ERRORS_R_XML_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
-    }   
-    
+    }
+
     /* if parent is NULL then we add all the doc children */
     if(parent == NULL) {
         xmlNodePtr cur;
@@ -509,16 +509,16 @@ xmlSecNodeSetGetChildren(xmlDocPtr doc, const xmlNodePtr parent, int withComment
 }
 
 static int
-xmlSecNodeSetDumpTextNodesWalkCallback(xmlSecNodeSetPtr nset, xmlNodePtr cur, 
-                                   xmlNodePtr parent ATTRIBUTE_UNUSED, 
+xmlSecNodeSetDumpTextNodesWalkCallback(xmlSecNodeSetPtr nset, xmlNodePtr cur,
+                                   xmlNodePtr parent ATTRIBUTE_UNUSED,
                                    void* data) {
     xmlSecAssert2(nset != NULL, -1);
     xmlSecAssert2(cur != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
 
     if(cur->type == XML_TEXT_NODE) {
-        xmlOutputBufferWriteString((xmlOutputBufferPtr)data, 
-                                    (char*)(cur->content)); 
+        xmlOutputBufferWriteString((xmlOutputBufferPtr)data,
+                                    (char*)(cur->content));
     }
     return(0);
 }
@@ -532,7 +532,7 @@ xmlSecNodeSetDumpTextNodesWalkCallback(xmlSecNodeSetPtr nset, xmlNodePtr cur,
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecNodeSetDumpTextNodes(xmlSecNodeSetPtr nset, xmlOutputBufferPtr out) {
     xmlSecAssert2(nset != NULL, -1);
     xmlSecAssert2(out != NULL, -1);
@@ -541,10 +541,10 @@ xmlSecNodeSetDumpTextNodes(xmlSecNodeSetPtr nset, xmlOutputBufferPtr out) {
 }
 
 /**
- * xmlSecNodeSetDebugDump: 
+ * xmlSecNodeSetDebugDump:
  * @nset:               the pointer to node set.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints information about @nset to the @output.
  */
 void
@@ -589,21 +589,21 @@ xmlSecNodeSetDebugDump(xmlSecNodeSetPtr nset, FILE *output) {
                     XMLSEC_ERRORS_R_INVALID_TYPE,
                     "type=%d", nset->type);
     }
-        
+
     l = xmlXPathNodeSetGetLength(nset->nodes);
     for(i = 0; i < l; ++i) {
         cur = xmlXPathNodeSetItem(nset->nodes, i);
         if(cur->type != XML_NAMESPACE_DECL) {
-            fprintf(output, "%d: %s\n", cur->type, 
+            fprintf(output, "%d: %s\n", cur->type,
                 (cur->name) ? cur->name : BAD_CAST "null");
         } else {
             xmlNsPtr ns = (xmlNsPtr)cur;
-            fprintf(output, "%d: %s=%s (%s:%s)\n", cur->type, 
+            fprintf(output, "%d: %s=%s (%s:%s)\n", cur->type,
                 (ns->prefix) ? ns->prefix : BAD_CAST "null",
                 (ns->href) ? ns->href : BAD_CAST "null",
-                (((xmlNodePtr)ns->next)->ns && 
-                 ((xmlNodePtr)ns->next)->ns->prefix) ? 
-                  ((xmlNodePtr)ns->next)->ns->prefix : BAD_CAST "null",         
+                (((xmlNodePtr)ns->next)->ns &&
+                 ((xmlNodePtr)ns->next)->ns->prefix) ?
+                  ((xmlNodePtr)ns->next)->ns->prefix : BAD_CAST "null",
                 ((xmlNodePtr)ns->next)->name);
         }
     }
diff --git a/src/nss/README b/src/nss/README
index 884ade9..cce889b 100644
--- a/src/nss/README
+++ b/src/nss/README
@@ -6,24 +6,24 @@ KEYS MANAGER
 ------------------------------------------------------------------------
 
 xmlsec-nss key manager uses a custom Keys Store, and a custom X509 Store.
-The custom Keys Store and the X509 Store use the NSS database as the underlying 
+The custom Keys Store and the X509 Store use the NSS database as the underlying
 store for public/private keys, Certs and CRLs.
 
 The NSS Keys store uses the Simple Keys Store on top of the NSS repository.
 The reason for this is that XMLSEC's generic adoptkey/getKey functions use a
 XMLSEC key object that contains more attributes than the raw NSS key object,
 and the getkey function may use a combination of one or more of these attributes
-(name, type, usage, Id) to find a key. There is no straightforward 1-1 mapping 
-between XMLSEC's adoptkey/getkey and NSS's APIs. 
-
-For example, the store may be asked to adopt a symmetric key, and later asked 
-to find it just by name. Or the store may be asked to adopt a private key 
-just by its type, and later asked to find it just by type. The key returned 
-by getKey is expected to contain all the attributes that were present at the 
-time of adoptkey - NSS store does not provide a way to store app-specific 
+(name, type, usage, Id) to find a key. There is no straightforward 1-1 mapping
+between XMLSEC's adoptkey/getkey and NSS's APIs.
+
+For example, the store may be asked to adopt a symmetric key, and later asked
+to find it just by name. Or the store may be asked to adopt a private key
+just by its type, and later asked to find it just by type. The key returned
+by getKey is expected to contain all the attributes that were present at the
+time of adoptkey - NSS store does not provide a way to store app-specific
 attributes.
 
-When a key is adopted by the NSS Keys Store, it is simply saved in the 
+When a key is adopted by the NSS Keys Store, it is simply saved in the
 Simple Keys Store. It is not saved into the NSS database. The only
 way to load keys into the NSS database is with a load operation through
 the XMLSEC API or via an administrator operation.
@@ -43,28 +43,28 @@ are:
 
 KNOWN ISSUES.
 ------------------------------------------------------------------------
-1)  NSS needs to provide a way to convert a DER integer string to an ASCII 
-decimal string. Once NSS is fixed, the function xmlSecNssASN1IntegerWrite 
-in src/nss/x509.c needs to be implemented. 
+1)  NSS needs to provide a way to convert a DER integer string to an ASCII
+decimal string. Once NSS is fixed, the function xmlSecNssASN1IntegerWrite
+in src/nss/x509.c needs to be implemented.
     NSS bug: http://bugzilla.mozilla.org/show_bug.cgi?id=212864
     xmlsec bug: http://bugzilla.gnome.org/show_bug.cgi?id=118633
 
-2) RSA Encryption/Decryption using PKCS#1 v1.5 padding not currently exposed 
+2) RSA Encryption/Decryption using PKCS#1 v1.5 padding not currently exposed
 in NSS. This causes some tests to fail.
-          
+
     NSS bug: http://bugzilla.mozilla.org/show_bug.cgi?id=214236
     xmlsec bug: http://bugzilla.gnome.org/show_bug.cgi?id=118628
 
-3) RSA-OAEP is not yet implemented in NSS. This is the only REQUIRED algorithm 
+3) RSA-OAEP is not yet implemented in NSS. This is the only REQUIRED algorithm
 that is missing from xmlsec-nss.
-           
+
     NSS bug: http://bugzilla.mozilla.org/show_bug.cgi?id=158747
-    xmlsec bug: http://bugzilla.gnome.org/show_bug.cgi?id=118629    
+    xmlsec bug: http://bugzilla.gnome.org/show_bug.cgi?id=118629
 
-4) There are 2 fixes in NSS that will be rolled into the next release (3.9). 
+4) There are 2 fixes in NSS that will be rolled into the next release (3.9).
 They are:
-    - http://bugzilla.mozilla.org/show_bug.cgi?id=208194 
-    Once available, need to change src/nss/x509.c. Replace 
+    - http://bugzilla.mozilla.org/show_bug.cgi?id=208194
+    Once available, need to change src/nss/x509.c. Replace
         PR_AtomicIncrement(&(crlSrc->referenceCount));
     with
         SEC_DupCrl(crlSrc);
@@ -82,13 +82,13 @@ xmlsec bug: http://bugzilla.gnome.org/show_bug.cgi?id=118630
    xmlsec bug: http://bugzilla.gnome.org/show_bug.cgi?id=118631
 
 6) CERT_FindCertBySubjectKeyID does not work in all cases
-	   
+	
    NSS bug: http://bugzilla.mozilla.org/show_bug.cgi?id=211051
    xmlsec bug: http://bugzilla.gnome.org/show_bug.cgi?id=118632
 
 7) Finding a cert by Issuer & Serial Number needs the ability to
 convert an ASCII decimal string to a DER integer string. Filed
-an RFE against NSS. Once fixed, xmlSecNumToItem in x509vfy.c 
+an RFE against NSS. Once fixed, xmlSecNumToItem in x509vfy.c
 needs to be changed to use the new function(s) provided
 
     NSS bug: http://bugzilla.mozilla.org/show_bug.cgi?id=212864
@@ -97,8 +97,8 @@ needs to be changed to use the new function(s) provided
 8) RIPEMD160 Digest and RIPEMD160 HMAC is not supported by NSS
 
    xmlsec bug: http://bugzilla.gnome.org/show_bug.cgi?id=118634
-	    
-9) AES Key wrap algorithm is implemented in NSS but not exposed due to 
+	
+9) AES Key wrap algorithm is implemented in NSS but not exposed due to
 some bug src/nss/kw_aes.c uses a workaround which should be removed
 when the bug is fixed
 
@@ -107,29 +107,29 @@ when the bug is fixed
 
 10) Not all file formats are supported
 
-- xmlSecNssAppKeyLoad(): This function loads a PKI key from a file. 
+- xmlSecNssAppKeyLoad(): This function loads a PKI key from a file.
     The following formats are supported:
-	. xmlSecKeyDataFormatDer: This expects the private key to be in 
-		PrivateKeyInfo format. Note that the DER files containing 
+	. xmlSecKeyDataFormatDer: This expects the private key to be in
+		PrivateKeyInfo format. Note that the DER files containing
                 private keys in the xmlsec test suite aren't in that format
-	. xmlsecKeyDataFormatPkcs12 
+	. xmlsecKeyDataFormatPkcs12
 
     The following formats are not supported:
 	. xmlSecKeyDataFormatPkcs8Pem
 	. xmlSecKeyDataFormatPkcs8Der
 
 
-- xmlSecNssAppCertLoad(): This function loads a cert from a file. 
+- xmlSecNssAppCertLoad(): This function loads a cert from a file.
     The following formats are supported:
 	xmlSecKeyDataFormatDer
 
     The following formats are not supported:
 	xmlSecKeyDataFormatPem
 
-11) "Trusted" vs "Untrusted" certificates: 
-The distinction between "trusted" and "untrusted" certificates in 
+11) "Trusted" vs "Untrusted" certificates:
+The distinction between "trusted" and "untrusted" certificates in
 xmlsec-openssl is maintained because the OPENSSL application (and
-not the OPENSSL library) has to maintain a cert store and verify 
+not the OPENSSL library) has to maintain a cert store and verify
 certificates. With NSS, no such distinction is necessary in the
 application.
 
diff --git a/src/nss/app.c b/src/nss/app.c
index 6e7449e..dabe36d 100644
--- a/src/nss/app.c
+++ b/src/nss/app.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * 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) 2003 America Online, Inc.  All rights reserved.
  */
@@ -39,10 +39,10 @@ extern CERTCertificate * __CERT_NewTempCertificate              (CERTCertDBHandl
                                                                  char *nickname,
                                                                  PRBool isperm,
                                                                  PRBool copyDER);
-static int xmlSecNssAppCreateSECItem                            (SECItem *contents, 
+static int xmlSecNssAppCreateSECItem                            (SECItem *contents,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize);
-static int xmlSecNssAppReadSECItem                              (SECItem *contents, 
+static int xmlSecNssAppReadSECItem                              (SECItem *contents,
                                                                  const char *fn);
 static PRBool xmlSecNssAppAscii2UCS2Conv                        (PRBool toUnicode,
                                                                  unsigned char *inBuf,
@@ -59,9 +59,9 @@ static xmlSecKeyPtr     xmlSecNssAppDerKeyLoadSECItem           (SECItem* secIte
 /**
  * xmlSecNssAppInit:
  * @config:             the path to NSS database files.
- * 
+ *
  * General crypto engine initialization. This function is used
- * by XMLSec command line utility and called before 
+ * by XMLSec command line utility and called before
  * @xmlSecInit function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -77,7 +77,7 @@ xmlSecNssAppInit(const char* config) {
                         NULL,
                         "NSS_InitReadWrite",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                        "config=%s", 
+                        "config=%s",
                         xmlSecErrorsSafeString(config));
             return(-1);
         }
@@ -97,8 +97,8 @@ xmlSecNssAppInit(const char* config) {
     PK11_ConfigurePKCS11("manufacturesID", "libraryDescription",
                          "tokenDescription", "privateTokenDescription",
                          "slotDescription", "privateSlotDescription",
-                         "fipsSlotDescription", "fipsPrivateSlotDescription", 
-                         0, 0); 
+                         "fipsSlotDescription", "fipsPrivateSlotDescription",
+                         0, 0);
 
     /* setup for PKCS12 */
     PORT_SetUCS2_ASCIIConversionFunction(xmlSecNssAppAscii2UCS2Conv);
@@ -115,9 +115,9 @@ xmlSecNssAppInit(const char* config) {
 
 /**
  * xmlSecNssAppShutdown:
- * 
+ *
  * General crypto engine shutdown. This function is used
- * by XMLSec command line utility and called after 
+ * by XMLSec command line utility and called after
  * @xmlSecShutdown function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -127,8 +127,8 @@ xmlSecNssAppShutdown(void) {
     SECStatus rv;
 /*
     SSL_ClearSessionCache();
-*/    
-    PK11_LogoutAll();    
+*/
+    PK11_LogoutAll();
     rv = NSS_Shutdown();
     if(rv != SECSuccess) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -156,7 +156,7 @@ xmlSecNssAppCreateSECItem(SECItem *contents, const xmlSecByte* data, xmlSecSize
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     if(dataSize > 0) {
         xmlSecAssert2(contents->data != NULL, -1);
         memcpy(contents->data,  data, dataSize);
@@ -207,7 +207,7 @@ xmlSecNssAppReadSECItem(SECItem *contents, const char *fn) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
     }
-    
+
     numBytes = PR_Read(file, contents->data, info.size);
     if (numBytes != info.size) {
         SECITEM_FreeItem(contents, PR_FALSE);
@@ -223,7 +223,7 @@ done:
     return (ret);
 }
 
-static PRBool 
+static PRBool
 xmlSecNssAppAscii2UCS2Conv(PRBool toUnicode,
                            unsigned char *inBuf,
                            unsigned int   inBufLen,
@@ -233,7 +233,7 @@ xmlSecNssAppAscii2UCS2Conv(PRBool toUnicode,
                            PRBool         swapBytes ATTRIBUTE_UNUSED)
 {
     SECItem it;
-                                          
+
     if (toUnicode == PR_FALSE) {
         return (PR_FALSE);
     }
@@ -278,7 +278,7 @@ xmlSecNssAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
     SECItem secItem;
     xmlSecKeyPtr res;
     int ret;
-    
+
     xmlSecAssert2(filename != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
 
@@ -293,7 +293,7 @@ xmlSecNssAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     res = xmlSecNssAppKeyLoadSECItem(&secItem, format, pwd, pwdCallback, pwdCallbackCtx);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -328,7 +328,7 @@ xmlSecNssAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKey
     SECItem secItem;
     xmlSecKeyPtr res;
     int ret;
-    
+
     xmlSecAssert2(data != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
 
@@ -342,7 +342,7 @@ xmlSecNssAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKey
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     res = xmlSecNssAppKeyLoadSECItem(&secItem, format, pwd, pwdCallback, pwdCallbackCtx);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -390,10 +390,10 @@ xmlSecNssAppKeyLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format,
                         "xmlSecNssAppPkcs12LoadSECItem",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);       
+            return(NULL);
         }
         break;
-    case xmlSecKeyDataFormatCertDer: 
+    case xmlSecKeyDataFormatCertDer:
         key = xmlSecNssAppKeyFromCertLoadSECItem(secItem, format);
         if(key == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -401,7 +401,7 @@ xmlSecNssAppKeyLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format,
                         "xmlSecNssAppKeyFromCertLoadSECItem",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);       
+            return(NULL);
         }
         break;
 #endif /* XMLSEC_NO_X509 */
@@ -413,7 +413,7 @@ xmlSecNssAppKeyLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format,
                         "xmlSecNssAppDerKeyLoadSECItem",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);       
+            return(NULL);
         }
         break;
     default:
@@ -422,7 +422,7 @@ xmlSecNssAppKeyLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format,
                     "xmlSecNssAppKeyLoad",
                     XMLSEC_ERRORS_R_INVALID_FORMAT,
                     "format=%d", format);
-            return(NULL);       
+            return(NULL);
     }
 
     return(key);
@@ -443,8 +443,8 @@ xmlSecNssAppDerKeyLoadSECItem(SECItem* secItem) {
 
     xmlSecAssert2(secItem != NULL, NULL);
 
-    /* we're importing a key about which we know nothing yet, just use the 
-     * internal slot 
+    /* we're importing a key about which we know nothing yet, just use the
+     * internal slot
      */
     slot = xmlSecNssGetInternalKeySlot();
     if (slot == NULL) {
@@ -460,13 +460,13 @@ xmlSecNssAppDerKeyLoadSECItem(SECItem* secItem) {
     nickname.data = NULL;
 
 
-    /* TRY PRIVATE KEY FIRST 
+    /* TRY PRIVATE KEY FIRST
      * Note: This expects the key to be in PrivateKeyInfo format. The
-     * DER files created from PEM via openssl utilities aren't in that 
+     * DER files created from PEM via openssl utilities aren't in that
      * format
      */
-    status = PK11_ImportDERPrivateKeyInfoAndReturnKey(slot, secItem, 
-                            &nickname, NULL, PR_FALSE, 
+    status = PK11_ImportDERPrivateKeyInfoAndReturnKey(slot, secItem,
+                            &nickname, NULL, PR_FALSE,
                             PR_TRUE, KU_ALL, &privkey, NULL);
     if (status != SECSuccess) {
         /* TRY PUBLIC KEY */
@@ -478,7 +478,7 @@ xmlSecNssAppDerKeyLoadSECItem(SECItem* secItem) {
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
         }
-        
+
         pubkey = SECKEY_ExtractPublicKey(spki);
         if (pubkey == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -498,7 +498,7 @@ xmlSecNssAppDerKeyLoadSECItem(SECItem* secItem) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
-    }    
+    }
     privkey = NULL;
     pubkey = NULL;
 
@@ -511,7 +511,7 @@ xmlSecNssAppDerKeyLoadSECItem(SECItem* secItem) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
     }
-    
+
     ret = xmlSecKeySetValue(key, data);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -525,7 +525,7 @@ xmlSecNssAppDerKeyLoadSECItem(SECItem* secItem) {
     retval = key;
     key = NULL;
     data = NULL;
-    
+
 
 done:
     if(slot != NULL) {
@@ -556,15 +556,15 @@ done:
  * @filename:           the certificate filename.
  * @format:             the certificate file format.
  *
- * Reads the certificate from $ filename and adds it to key 
- * 
+ * Reads the certificate from $ filename and adds it to key
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
+int
 xmlSecNssAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFormat format) {
     SECItem secItem;
     int ret;
-    
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
@@ -580,7 +580,7 @@ xmlSecNssAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFor
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecNssAppKeyCertLoadSECItem(key, &secItem, format);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -603,15 +603,15 @@ xmlSecNssAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFor
  * @dataSize:           the key binary data size.
  * @format:             the certificate format.
  *
- * Reads the certificate from @data and adds it to key 
- * 
+ * Reads the certificate from @data and adds it to key
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
+int
 xmlSecNssAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize, xmlSecKeyDataFormat format) {
     SECItem secItem;
     int ret;
-    
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
@@ -627,7 +627,7 @@ xmlSecNssAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSi
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecNssAppKeyCertLoadSECItem(key, &secItem, format);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -649,11 +649,11 @@ xmlSecNssAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSi
  * @secItem:            the pointer to SECItem.
  * @format:             the certificate format.
  *
- * Reads the certificate from @secItem and adds it to key 
- * 
+ * Reads the certificate from @secItem and adds it to key
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
+int
 xmlSecNssAppKeyCertLoadSECItem(xmlSecKeyPtr key, SECItem* secItem, xmlSecKeyDataFormat format) {
     CERTCertificate *cert=NULL;
     xmlSecKeyDataPtr data;
@@ -662,12 +662,12 @@ xmlSecNssAppKeyCertLoadSECItem(xmlSecKeyPtr key, SECItem* secItem, xmlSecKeyData
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(secItem != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
-    
+
     data = xmlSecKeyEnsureData(key, xmlSecNssKeyDataX509Id);
     if(data == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecKeyEnsureData",                  
+                    "xmlSecKeyEnsureData",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecNssKeyDataX509Id)));
@@ -677,15 +677,15 @@ xmlSecNssAppKeyCertLoadSECItem(xmlSecKeyPtr key, SECItem* secItem, xmlSecKeyData
     switch(format) {
     case xmlSecKeyDataFormatPkcs8Der:
     case xmlSecKeyDataFormatDer:
-        cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(), 
+        cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(),
                                          secItem, NULL, PR_FALSE, PR_TRUE);
         if(cert == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "__CERT_NewTempCertificate", 
+                        "__CERT_NewTempCertificate",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "format=%d", format);
-            return(-1);    
+            return(-1);
         }
         break;
     default:
@@ -693,10 +693,10 @@ xmlSecNssAppKeyCertLoadSECItem(xmlSecKeyPtr key, SECItem* secItem, xmlSecKeyData
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_FORMAT,
-                    "format=%d", format); 
+                    "format=%d", format);
         return(-1);
     }
-    
+
     xmlSecAssert2(cert != NULL, -1);
     ret = xmlSecNssKeyDataX509AdoptCert(data, cert);
     if(ret < 0) {
@@ -707,10 +707,10 @@ xmlSecNssAppKeyCertLoadSECItem(xmlSecKeyPtr key, SECItem* secItem, xmlSecKeyData
                     "data=%s",
                     xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
         CERT_DestroyCertificate(cert);
-        return(-1);    
+        return(-1);
     }
-    
-    return(0);        
+
+    return(0);
 }
 
 /**
@@ -726,14 +726,14 @@ xmlSecNssAppKeyCertLoadSECItem(xmlSecKeyPtr key, SECItem* secItem, xmlSecKeyData
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
+xmlSecKeyPtr
 xmlSecNssAppPkcs12Load(const char *filename, const char *pwd,
-                       void *pwdCallback ATTRIBUTE_UNUSED, 
+                       void *pwdCallback ATTRIBUTE_UNUSED,
                        void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
     SECItem secItem;
     xmlSecKeyPtr res;
     int ret;
-    
+
     xmlSecAssert2(filename != NULL, NULL);
 
     /* read the file contents */
@@ -747,7 +747,7 @@ xmlSecNssAppPkcs12Load(const char *filename, const char *pwd,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     res = xmlSecNssAppPkcs12LoadSECItem(&secItem, pwd, pwdCallback, pwdCallbackCtx);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -777,14 +777,14 @@ xmlSecNssAppPkcs12Load(const char *filename, const char *pwd,
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
+xmlSecKeyPtr
 xmlSecNssAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, const char *pwd,
-                       void *pwdCallback ATTRIBUTE_UNUSED, 
+                       void *pwdCallback ATTRIBUTE_UNUSED,
                        void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
     SECItem secItem;
     xmlSecKeyPtr res;
     int ret;
-    
+
     xmlSecAssert2(data != NULL, NULL);
 
     memset(&secItem, 0, sizeof(secItem));
@@ -797,7 +797,7 @@ xmlSecNssAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, const
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     res = xmlSecNssAppPkcs12LoadSECItem(&secItem, pwd, pwdCallback, pwdCallbackCtx);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -827,9 +827,9 @@ xmlSecNssAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, const
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
+xmlSecKeyPtr
 xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
-                       void *pwdCallback ATTRIBUTE_UNUSED, 
+                       void *pwdCallback ATTRIBUTE_UNUSED,
                        void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
     xmlSecKeyPtr key = NULL;
     xmlSecKeyDataPtr data = NULL;
@@ -854,9 +854,9 @@ xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
         pwd = "";
     }
     memset(&uc2_pwditem, 0, sizeof(uc2_pwditem));
-        
-    /* we're importing a key about which we know nothing yet, just use the 
-     * internal slot. We have no criteria to choose a slot. 
+
+    /* we're importing a key about which we know nothing yet, just use the
+     * internal slot. We have no criteria to choose a slot.
      */
     slot = xmlSecNssGetInternalKeySlot();
     if (slot == NULL) {
@@ -960,7 +960,7 @@ xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecNssKeyDataX509Id)));
         goto done;
-    }    
+    }
 
     for (head = CERT_LIST_HEAD(certlist);
          !CERT_LIST_END(head, certlist);
@@ -971,7 +971,7 @@ xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
         if (privkey != NULL) {
             if (data != NULL) {
                 /* we already found a private key.
-                 * assume the first private key we find is THE ONE 
+                 * assume the first private key we find is THE ONE
                  */
                 SECKEY_DestroyPrivateKey(privkey);
                 privkey = NULL;
@@ -1006,7 +1006,7 @@ xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
                                 XMLSEC_ERRORS_R_CRYPTO_FAILED,
                                 "data=%s",
                                 xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
-                    goto done;  
+                    goto done;
                 }
 
                 ret = xmlSecNssKeyDataX509AdoptKeyCert(x509Data, tmpcert);
@@ -1032,7 +1032,7 @@ xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "data=%s",
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
-            goto done;  
+            goto done;
         }
         ret = xmlSecNssKeyDataX509AdoptCert(x509Data, tmpcert);
         if(ret < 0) {
@@ -1065,8 +1065,8 @@ xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
-    }    
-    
+    }
+
     ret = xmlSecKeySetValue(key, data);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1094,7 +1094,7 @@ xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
         goto done;
     }
     x509Data = NULL;
-    
+
 done:
     if (p12ctx) {
         SEC_PKCS12DecoderFinish(p12ctx);
@@ -1119,7 +1119,7 @@ done:
         SECKEY_DestroyPublicKey(pubkey);
     }
 
-    return(key);    
+    return(key);
 }
 
 /**
@@ -1131,7 +1131,7 @@ done:
  *
  * Returns: pointer to key or NULL if an error occurs.
  */
-xmlSecKeyPtr 
+xmlSecKeyPtr
 xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format) {
     xmlSecKeyPtr key;
     xmlSecKeyDataPtr keyData;
@@ -1141,19 +1141,19 @@ xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format)
 
     xmlSecAssert2(secItem != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
-    
+
     /* load cert */
     switch(format) {
     case xmlSecKeyDataFormatCertDer:
-        cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(), 
+        cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(),
                                          secItem, NULL, PR_FALSE, PR_TRUE);
         if(cert == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "__CERT_NewTempCertificate", 
+                        "__CERT_NewTempCertificate",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "format=%d", format);
-            return(NULL);    
+            return(NULL);
         }
         break;
     default:
@@ -1161,7 +1161,7 @@ xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format)
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_FORMAT,
-                    "format=%d", format); 
+                    "format=%d", format);
         return(NULL);
     }
 
@@ -1174,9 +1174,9 @@ xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format)
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         CERT_DestroyCertificate(cert);
-        return(NULL);    
+        return(NULL);
     }
-    
+
     /* create key */
     key = xmlSecKeyCreate();
     if(key == NULL) {
@@ -1187,9 +1187,9 @@ xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format)
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDataDestroy(keyData);
         CERT_DestroyCertificate(cert);
-        return(NULL);    
-    }    
-    
+        return(NULL);
+    }
+
     /* set key value */
     ret = xmlSecKeySetValue(key, keyData);
     if(ret < 0) {
@@ -1201,20 +1201,20 @@ xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format)
         xmlSecKeyDestroy(key);
         xmlSecKeyDataDestroy(keyData);
         CERT_DestroyCertificate(cert);
-        return(NULL);    
+        return(NULL);
     }
 
-    /* create cert data */ 
+    /* create cert data */
     certData = xmlSecKeyEnsureData(key, xmlSecNssKeyDataX509Id);
     if(certData == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecKeyEnsureData",                  
+                    "xmlSecKeyEnsureData",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDestroy(key);
         CERT_DestroyCertificate(cert);
-        return(NULL);    
+        return(NULL);
     }
 
     /* put cert in the cert data */
@@ -1227,9 +1227,9 @@ xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format)
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDestroy(key);
         CERT_DestroyCertificate(cert);
-        return(NULL);    
+        return(NULL);
     }
-    
+
     return(key);
 }
 
@@ -1247,12 +1247,12 @@ xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format)
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecNssAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename, 
-                             xmlSecKeyDataFormat format, 
+xmlSecNssAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
+                             xmlSecKeyDataFormat format,
                              xmlSecKeyDataType type) {
     SECItem secItem;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
@@ -1268,7 +1268,7 @@ xmlSecNssAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecNssAppKeysMngrCertLoadSECItem(mngr, &secItem, format, type);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1298,12 +1298,12 @@ xmlSecNssAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data, 
-                             xmlSecSize dataSize, xmlSecKeyDataFormat format, 
+xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
+                             xmlSecSize dataSize, xmlSecKeyDataFormat format,
                              xmlSecKeyDataType type) {
     SECItem secItem;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
@@ -1318,7 +1318,7 @@ xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* dat
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecNssAppKeysMngrCertLoadSECItem(mngr, &secItem, format, type);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1347,8 +1347,8 @@ xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* dat
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, SECItem* secItem, 
-                             xmlSecKeyDataFormat format, 
+xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, SECItem* secItem,
+                             xmlSecKeyDataFormat format,
                              xmlSecKeyDataType type) {
     xmlSecKeyDataStorePtr x509Store;
     CERTCertificate* cert;
@@ -1357,7 +1357,7 @@ xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, SECItem* secItem,
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(secItem != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
-    
+
     x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecNssX509StoreId);
     if(x509Store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1370,15 +1370,15 @@ xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, SECItem* secItem,
 
     switch(format) {
     case xmlSecKeyDataFormatDer:
-        cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(), 
+        cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(),
                                          secItem, NULL, PR_FALSE, PR_TRUE);
         if(cert == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "__CERT_NewTempCertificate", 
+                        "__CERT_NewTempCertificate",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "format=%d", format);
-            return(-1);    
+            return(-1);
         }
         break;
     default:
@@ -1386,10 +1386,10 @@ xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, SECItem* secItem,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_FORMAT,
-                    "format=%d", format); 
+                    "format=%d", format);
         return(-1);
     }
-    
+
     ret = xmlSecNssX509StoreAdoptCert(x509Store, cert, type);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1414,14 +1414,14 @@ xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, SECItem* secItem,
  * and a default NSS crypto key data stores.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 int
 xmlSecNssAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
 
-    /* create NSS keys store if needed */        
+    /* create NSS keys store if needed */
     if(xmlSecKeysMngrGetKeysStore(mngr) == NULL) {
         xmlSecKeyStorePtr keysStore;
 
@@ -1434,7 +1434,7 @@ xmlSecNssAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         "xmlSecNssKeysStoreId");
             return(-1);
         }
-        
+
         ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1443,20 +1443,20 @@ xmlSecNssAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecKeyStoreDestroy(keysStore);
-            return(-1);        
+            return(-1);
         }
     }
 
-    ret = xmlSecNssKeysMngrInit(mngr);    
+    ret = xmlSecNssKeysMngrInit(mngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecNssKeysMngrInit",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1); 
+        return(-1);
     }
-    
+
     mngr->getKey = xmlSecKeysMngrGetKey;
     return(0);
 }
@@ -1468,17 +1468,17 @@ xmlSecNssAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
  *
  * Adds @key to the keys manager @mngr created with #xmlSecNssAppDefaultKeysMngrInit
  * function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecNssAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1488,7 +1488,7 @@ xmlSecNssAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecNssKeysStoreAdoptKey(store, key);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1498,7 +1498,7 @@ xmlSecNssAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1507,19 +1507,19 @@ xmlSecNssAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
  * @mngr:               the pointer to keys manager.
  * @uri:                the uri.
  *
- * Loads XML keys file from @uri to the keys manager @mngr created 
+ * Loads XML keys file from @uri to the keys manager @mngr created
  * with #xmlSecNssAppDefaultKeysMngrInit function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecNssAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(uri != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1529,7 +1529,7 @@ xmlSecNssAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecNssKeysStoreLoad(store, uri, mngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1539,7 +1539,7 @@ xmlSecNssAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     "uri=%s", xmlSecErrorsSafeString(uri));
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1550,17 +1550,17 @@ xmlSecNssAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
  * @type:               the type of keys to save (public/private/symmetric).
  *
  * Saves keys from @mngr to  XML keys file.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecNssAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename, xmlSecKeyDataType type) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1570,7 +1570,7 @@ xmlSecNssAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename, xm
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecNssKeysStoreSave(store, filename, type);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1580,7 +1580,7 @@ xmlSecNssAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename, xm
                     "filename%s", xmlSecErrorsSafeString(filename));
         return(-1);
     }
-    
+
     return(0);
 }
 
diff --git a/src/nss/bignum.c b/src/nss/bignum.c
index 0b33229..261155e 100644
--- a/src/nss/bignum.c
+++ b/src/nss/bignum.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XMLSec library
- * 
+ *
  * Reading/writing bignum values
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for precise wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 #include "globals.h"
@@ -13,10 +13,10 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <nss.h> 
-#include <secitem.h> 
+#include <nss.h>
+#include <secitem.h>
 
-#include <libxml/tree.h> 
+#include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -32,8 +32,8 @@
  * @cur: the poitner to an XML node.
  * @a: a SECItem object to hold the BigNum value
  *
- * Converts the node content from CryptoBinary format 
- * (http://www.w3.org/TR/xmldsig-core/#sec-CryptoBinary) 
+ * Converts the node content from CryptoBinary format
+ * (http://www.w3.org/TR/xmldsig-core/#sec-CryptoBinary)
  * to a SECItem. If no SECItem object provided then a new
  * one is created (caller is responsible for freeing it).
  *
@@ -41,7 +41,7 @@
  * or NULL if an error occurs.
  */
 SECItem *
-xmlSecNssNodeGetBigNumValue(PRArenaPool *arena, const xmlNodePtr cur, 
+xmlSecNssNodeGetBigNumValue(PRArenaPool *arena, const xmlNodePtr cur,
                             SECItem *a) {
     xmlSecBuffer buf;
     int ret;
@@ -59,8 +59,8 @@ xmlSecNssNodeGetBigNumValue(PRArenaPool *arena, const xmlNodePtr cur,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
-    }    
-    
+    }
+
     ret = xmlSecBufferBase64NodeContentRead(&buf, cur);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -70,8 +70,8 @@ xmlSecNssNodeGetBigNumValue(PRArenaPool *arena, const xmlNodePtr cur,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecBufferFinalize(&buf);
         return(NULL);
-    }    
-    
+    }
+
     len = xmlSecBufferGetSize(&buf);
 
     if (a == NULL) {
@@ -82,7 +82,7 @@ xmlSecNssNodeGetBigNumValue(PRArenaPool *arena, const xmlNodePtr cur,
         rv->len = len;
         rv->data = PORT_ArenaZAlloc(arena, len);
     }
-        
+
     PORT_Memcpy(rv->data, xmlSecBufferGetData(&buf), len);
 
     xmlSecBufferFinalize(&buf);
@@ -93,23 +93,23 @@ xmlSecNssNodeGetBigNumValue(PRArenaPool *arena, const xmlNodePtr cur,
  * xmlSecNssNodeSetBigNumValue:
  * @cur: the pointer to an XML node.
  * @a: a SECItem containing the BigNum value.
- * @addLineBreaks: if the flag is equal to 1 then 
+ * @addLineBreaks: if the flag is equal to 1 then
  *              linebreaks will be added before and after
  *              new buffer content.
  *
  * Converts SECItem to CryptoBinary string
- * (http://www.w3.org/TR/xmldsig-core/#sec-CryptoBinary) 
- * and sets it as the content of the given node. If the 
- * addLineBreaks is set then line breaks are added 
+ * (http://www.w3.org/TR/xmldsig-core/#sec-CryptoBinary)
+ * and sets it as the content of the given node. If the
+ * addLineBreaks is set then line breaks are added
  * before and after the CryptoBinary string.
- * 
+ *
  * Returns: 0 on success or -1 otherwise.
  */
 int
 xmlSecNssNodeSetBigNumValue(xmlNodePtr cur, const SECItem *a, int addLineBreaks) {
     xmlSecBuffer buf;
     int ret;
-    
+
     xmlSecAssert2(a != NULL, -1);
     xmlSecAssert2(cur != NULL, -1);
 
@@ -121,10 +121,10 @@ xmlSecNssNodeSetBigNumValue(xmlNodePtr cur, const SECItem *a, int addLineBreaks)
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", a->len + 1);
         return(-1);
-    }    
+    }
 
     PORT_Memcpy(xmlSecBufferGetData(&buf), a->data, a->len);
-    
+
     ret = xmlSecBufferSetSize(&buf, a->len);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -141,7 +141,7 @@ xmlSecNssNodeSetBigNumValue(xmlNodePtr cur, const SECItem *a, int addLineBreaks)
     } else {
         xmlNodeSetContent(cur, xmlSecStringEmpty);
     }
-    
+
     ret = xmlSecBufferBase64NodeContentWrite(&buf, cur, xmlSecBase64GetDefaultLineSize());
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
diff --git a/src/nss/ciphers.c b/src/nss/ciphers.c
index a0b0278..54bd2af 100644
--- a/src/nss/ciphers.c
+++ b/src/nss/ciphers.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * 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) 2003 America Online, Inc.  All rights reserved.
  */
@@ -63,7 +63,7 @@ static int      xmlSecNssBlockCipherCtxFinal            (xmlSecNssBlockCipherCtx
                                                          int encrypt,
                                                          const xmlChar* cipherName,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int 
+static int
 xmlSecNssBlockCipherCtxInit(xmlSecNssBlockCipherCtxPtr ctx,
                                 xmlSecBufferPtr in, xmlSecBufferPtr out,
                                 int encrypt,
@@ -89,7 +89,7 @@ xmlSecNssBlockCipherCtxInit(xmlSecNssBlockCipherCtxPtr ctx,
     ivLen = PK11_GetIVLength(ctx->cipher);
     xmlSecAssert2(ivLen > 0, -1);
     xmlSecAssert2((xmlSecSize)ivLen <= sizeof(ctx->iv), -1);
-    
+
     if(encrypt) {
         /* generate random iv */
         rv = PK11_GenerateRandom(ctx->iv, ivLen);
@@ -99,35 +99,35 @@ xmlSecNssBlockCipherCtxInit(xmlSecNssBlockCipherCtxPtr ctx,
                         "PK11_GenerateRandom",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "size=%d", ivLen);
-            return(-1);    
+            return(-1);
         }
-        
+
         /* write iv to the output */
         ret = xmlSecBufferAppend(out, ctx->iv, ivLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferAppend",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", ivLen);
             return(-1);
         }
-        
+
     } else {
-        /* if we don't have enough data, exit and hope that 
+        /* if we don't have enough data, exit and hope that
          * we'll have iv next time */
         if(xmlSecBufferGetSize(in) < (xmlSecSize)ivLen) {
             return(0);
         }
-        
+
         /* copy iv to our buffer*/
         xmlSecAssert2(xmlSecBufferGetData(in) != NULL, -1);
         memcpy(ctx->iv, xmlSecBufferGetData(in), ivLen);
-        
+
         /* and remove from input */
         ret = xmlSecBufferRemoveHead(in, ivLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -138,25 +138,25 @@ xmlSecNssBlockCipherCtxInit(xmlSecNssBlockCipherCtxPtr ctx,
 
     memset(&keyItem, 0, sizeof(keyItem));
     keyItem.data = ctx->key;
-    keyItem.len  = ctx->keySize; 
+    keyItem.len  = ctx->keySize;
     memset(&ivItem, 0, sizeof(ivItem));
     ivItem.data = ctx->iv;
-    ivItem.len  = ctx->ivSize; 
+    ivItem.len  = ctx->ivSize;
 
     slot = PK11_GetBestSlot(ctx->cipher, NULL);
     if(slot == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "PK11_GetBestSlot",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
-    symKey = PK11_ImportSymKey(slot, ctx->cipher, PK11_OriginDerive, 
+
+    symKey = PK11_ImportSymKey(slot, ctx->cipher, PK11_OriginDerive,
                                CKA_SIGN, &keyItem, NULL);
     if(symKey == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "PK11_ImportSymKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -165,11 +165,11 @@ xmlSecNssBlockCipherCtxInit(xmlSecNssBlockCipherCtxPtr ctx,
         return(-1);
     }
 
-    ctx->cipherCtx = PK11_CreateContextBySymKey(ctx->cipher, 
-                        (encrypt) ? CKA_ENCRYPT : CKA_DECRYPT, 
+    ctx->cipherCtx = PK11_CreateContextBySymKey(ctx->cipher,
+                        (encrypt) ? CKA_ENCRYPT : CKA_DECRYPT,
                         symKey, &ivItem);
     if(ctx->cipherCtx == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "PK11_CreateContextBySymKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -185,7 +185,7 @@ xmlSecNssBlockCipherCtxInit(xmlSecNssBlockCipherCtxPtr ctx,
     return(0);
 }
 
-static int 
+static int
 xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
                                   xmlSecBufferPtr in, xmlSecBufferPtr out,
                                   int encrypt,
@@ -197,7 +197,7 @@ xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
     xmlSecByte* outBuf;
     SECStatus rv;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->cipher != 0, -1);
     xmlSecAssert2(ctx->cipherCtx != NULL, -1);
@@ -211,7 +211,7 @@ xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
 
     inSize = xmlSecBufferGetSize(in);
     outSize = xmlSecBufferGetSize(out);
-    
+
     if(inSize < (xmlSecSize)blockLen) {
         return(0);
     }
@@ -219,7 +219,7 @@ xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
     if(encrypt) {
         inBlocks = inSize / ((xmlSecSize)blockLen);
     } else {
-        /* we want to have the last block in the input buffer 
+        /* we want to have the last block in the input buffer
          * for padding check */
         inBlocks = (inSize - 1) / ((xmlSecSize)blockLen);
     }
@@ -228,7 +228,7 @@ xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
     /* we write out the input size plus may be one block */
     ret = xmlSecBufferSetMaxSize(out, outSize + inSize + blockLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -236,11 +236,11 @@ xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
         return(-1);
     }
     outBuf = xmlSecBufferGetData(out) + outSize;
-    
+
     rv = PK11_CipherOp(ctx->cipherCtx, outBuf, &outLen, inSize + blockLen,
                         xmlSecBufferGetData(in), inSize);
     if(rv != SECSuccess) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "PK11_CipherOp",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -248,22 +248,22 @@ xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
         return(-1);
     }
     xmlSecAssert2((xmlSecSize)outLen == inSize, -1);
-    
+
     /* set correct output buffer size */
     ret = xmlSecBufferSetSize(out, outSize + outLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", outSize + outLen);
         return(-1);
     }
-        
+
     /* remove the processed block from input */
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -273,7 +273,7 @@ xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
     return(0);
 }
 
-static int 
+static int
 xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
                                  xmlSecBufferPtr in,
                                  xmlSecBufferPtr out,
@@ -286,7 +286,7 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
     xmlSecByte* outBuf;
     SECStatus rv;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->cipher != 0, -1);
     xmlSecAssert2(ctx->cipherCtx != NULL, -1);
@@ -302,12 +302,12 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
     outSize = xmlSecBufferGetSize(out);
 
     if(encrypt != 0) {
-        xmlSecAssert2(inSize < (xmlSecSize)blockLen, -1);        
-    
+        xmlSecAssert2(inSize < (xmlSecSize)blockLen, -1);
+
         /* create padding */
         ret = xmlSecBufferSetMaxSize(in, blockLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferSetMaxSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -324,15 +324,15 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
                             xmlSecErrorsSafeString(cipherName),
                             "PK11_GenerateRandom",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                            "size=%d", blockLen - inSize - 1); 
-                return(-1);    
+                            "size=%d", blockLen - inSize - 1);
+                return(-1);
             }
         }
         inBuf[blockLen - 1] = blockLen - inSize;
         inSize = blockLen;
     } else {
         if(inSize != (xmlSecSize)blockLen) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
@@ -340,11 +340,11 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
             return(-1);
         }
     }
-    
+
     /* process last block */
     ret = xmlSecBufferSetMaxSize(out, outSize + 2 * blockLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -356,7 +356,7 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
     rv = PK11_CipherOp(ctx->cipherCtx, outBuf, &outLen, 2 * blockLen,
                         xmlSecBufferGetData(in), inSize);
     if(rv != SECSuccess) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "PK11_CipherOp",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -364,7 +364,7 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
         return(-1);
     }
     xmlSecAssert2((xmlSecSize)outLen == inSize, -1);
-    
+
     if(encrypt == 0) {
         /* check padding */
         if(outLen < outBuf[blockLen - 1]) {
@@ -374,15 +374,15 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
                         XMLSEC_ERRORS_R_INVALID_DATA,
                         "padding=%d;buffer=%d",
                         outBuf[blockLen - 1], outLen);
-            return(-1); 
+            return(-1);
         }
         outLen -= outBuf[blockLen - 1];
-    } 
+    }
 
     /* set correct output buffer size */
     ret = xmlSecBufferSetSize(out, outSize + outLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -393,7 +393,7 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
     /* remove the processed block from input */
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -410,7 +410,7 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
  * EVP Block Cipher transforms
  *
  * xmlSecNssBlockCipherCtx block is located after xmlSecTransform structure
- * 
+ *
  *****************************************************************************/
 #define xmlSecNssBlockCipherSize        \
     (sizeof(xmlSecTransform) + sizeof(xmlSecNssBlockCipherCtx))
@@ -419,7 +419,7 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
 
 static int      xmlSecNssBlockCipherInitialize  (xmlSecTransformPtr transform);
 static void     xmlSecNssBlockCipherFinalize            (xmlSecTransformPtr transform);
-static int      xmlSecNssBlockCipherSetKeyReq   (xmlSecTransformPtr transform, 
+static int      xmlSecNssBlockCipherSetKeyReq   (xmlSecTransformPtr transform,
                                                          xmlSecKeyReqPtr keyReq);
 static int      xmlSecNssBlockCipherSetKey              (xmlSecTransformPtr transform,
                                                          xmlSecKeyPtr key);
@@ -427,7 +427,7 @@ static int      xmlSecNssBlockCipherExecute             (xmlSecTransformPtr tran
                                                          int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 static int      xmlSecNssBlockCipherCheckId             (xmlSecTransformPtr transform);
-                                                         
+
 
 
 static int
@@ -442,24 +442,24 @@ xmlSecNssBlockCipherCheckId(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecNssTransformAes128CbcId) ||
        xmlSecTransformCheckId(transform, xmlSecNssTransformAes192CbcId) ||
        xmlSecTransformCheckId(transform, xmlSecNssTransformAes256CbcId)) {
-       
+
        return(1);
     }
 #endif /* XMLSEC_NO_AES */
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecNssBlockCipherInitialize(xmlSecTransformPtr transform) {
     xmlSecNssBlockCipherCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecNssBlockCipherCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssBlockCipherSize), -1);
 
     ctx = xmlSecNssBlockCipherGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecNssBlockCipherCtx));
 
 #ifndef XMLSEC_NO_DES
@@ -467,38 +467,38 @@ xmlSecNssBlockCipherInitialize(xmlSecTransformPtr transform) {
         ctx->cipher     = CKM_DES3_CBC;
         ctx->keyId      = xmlSecNssKeyDataDesId;
         ctx->keySize    = 24;
-    } else 
+    } else
 #endif /* XMLSEC_NO_DES */
 
 #ifndef XMLSEC_NO_AES
     if(transform->id == xmlSecNssTransformAes128CbcId) {
-        ctx->cipher     = CKM_AES_CBC;  
+        ctx->cipher     = CKM_AES_CBC;
         ctx->keyId      = xmlSecNssKeyDataAesId;
         ctx->keySize    = 16;
     } else if(transform->id == xmlSecNssTransformAes192CbcId) {
-        ctx->cipher     = CKM_AES_CBC;  
+        ctx->cipher     = CKM_AES_CBC;
         ctx->keyId      = xmlSecNssKeyDataAesId;
         ctx->keySize    = 24;
     } else if(transform->id == xmlSecNssTransformAes256CbcId) {
-        ctx->cipher     = CKM_AES_CBC;  
+        ctx->cipher     = CKM_AES_CBC;
         ctx->keyId      = xmlSecNssKeyDataAesId;
         ctx->keySize    = 32;
-    } else 
+    } else
 #endif /* XMLSEC_NO_AES */
 
     if(1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }        
-    
+    }
+
     return(0);
 }
 
-static void 
+static void
 xmlSecNssBlockCipherFinalize(xmlSecTransformPtr transform) {
     xmlSecNssBlockCipherCtxPtr ctx;
 
@@ -511,11 +511,11 @@ xmlSecNssBlockCipherFinalize(xmlSecTransformPtr transform) {
     if(ctx->cipherCtx != NULL) {
         PK11_DestroyContext(ctx->cipherCtx, PR_TRUE);
     }
-    
+
     memset(ctx, 0, sizeof(xmlSecNssBlockCipherCtx));
 }
 
-static int  
+static int
 xmlSecNssBlockCipherSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecNssBlockCipherCtxPtr ctx;
 
@@ -543,7 +543,7 @@ static int
 xmlSecNssBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecNssBlockCipherCtxPtr ctx;
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecNssBlockCipherCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssBlockCipherSize), -1);
@@ -571,20 +571,20 @@ xmlSecNssBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                     xmlSecBufferGetSize(buffer), ctx->keySize);
         return(-1);
     }
-    
+
     xmlSecAssert2(xmlSecBufferGetData(buffer) != NULL, -1);
     memcpy(ctx->key, xmlSecBufferGetData(buffer), ctx->keySize);
-    
+
     ctx->keyInitialized = 1;
     return(0);
 }
 
-static int 
+static int
 xmlSecNssBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecNssBlockCipherCtxPtr ctx;
     xmlSecBufferPtr in, out;
     int ret;
-    
+
     xmlSecAssert2(xmlSecNssBlockCipherCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssBlockCipherSize), -1);
@@ -602,11 +602,11 @@ xmlSecNssBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
 
     if(transform->status == xmlSecTransformStatusWorking) {
         if(ctx->ctxInitialized == 0) {
-            ret = xmlSecNssBlockCipherCtxInit(ctx, in, out, 
+            ret = xmlSecNssBlockCipherCtxInit(ctx, in, out,
                         (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
                         xmlSecTransformGetName(transform), transformCtx);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecNssBlockCipherCtxInit",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -615,7 +615,7 @@ xmlSecNssBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
             }
         }
         if((ctx->ctxInitialized == 0) && (last != 0)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
@@ -624,11 +624,11 @@ xmlSecNssBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
         }
 
         if(ctx->ctxInitialized != 0) {
-            ret = xmlSecNssBlockCipherCtxUpdate(ctx, in, out, 
+            ret = xmlSecNssBlockCipherCtxUpdate(ctx, in, out,
                         (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
                         xmlSecTransformGetName(transform), transformCtx);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecNssBlockCipherCtxUpdate",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -636,13 +636,13 @@ xmlSecNssBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
                 return(-1);
             }
         }
-        
+
         if(last) {
-            ret = xmlSecNssBlockCipherCtxFinal(ctx, in, out, 
+            ret = xmlSecNssBlockCipherCtxFinal(ctx, in, out,
                         (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
                         xmlSecTransformGetName(transform), transformCtx);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecNssBlockCipherCtxFinal",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -650,7 +650,7 @@ xmlSecNssBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
                 return(-1);
             }
             transform->status = xmlSecTransformStatusFinished;
-        } 
+        }
     } else if(transform->status == xmlSecTransformStatusFinished) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
@@ -658,14 +658,14 @@ xmlSecNssBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
         /* the only way we can get here is if there is no enough data in the input */
         xmlSecAssert2(last == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -705,12 +705,12 @@ static xmlSecTransformKlass xmlSecNssAes128CbcKlass = {
 
 /**
  * xmlSecNssTransformAes128CbcGetKlass:
- * 
+ *
  * AES 128 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 128 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecNssTransformAes128CbcGetKlass(void) {
     return(&xmlSecNssAes128CbcKlass);
 }
@@ -737,19 +737,19 @@ static xmlSecTransformKlass xmlSecNssAes192CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssBlockCipherExecute,                /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecNssTransformAes192CbcGetKlass:
- * 
+ *
  * AES 192 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 192 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecNssTransformAes192CbcGetKlass(void) {
     return(&xmlSecNssAes192CbcKlass);
 }
@@ -776,19 +776,19 @@ static xmlSecTransformKlass xmlSecNssAes256CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssBlockCipherExecute,                /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecNssTransformAes256CbcGetKlass:
- * 
+ *
  * AES 256 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 256 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecNssTransformAes256CbcGetKlass(void) {
     return(&xmlSecNssAes256CbcKlass);
 }
@@ -818,19 +818,19 @@ static xmlSecTransformKlass xmlSecNssDes3CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssBlockCipherExecute,                /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssTransformDes3CbcGetKlass:
  *
  * Triple DES CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to Triple DES encryption transform.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformDes3CbcGetKlass(void) {
     return(&xmlSecNssDes3CbcKlass);
 }
diff --git a/src/nss/crypto.c b/src/nss/crypto.c
index 889087f..f075b55 100644
--- a/src/nss/crypto.c
+++ b/src/nss/crypto.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * 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) 2003 America Online, Inc.  All rights reserved.
  */
@@ -41,7 +41,7 @@ static xmlSecCryptoDLFunctionsPtr gXmlSecNssFunctions = NULL;
 xmlSecCryptoDLFunctionsPtr
 xmlSecCryptoGetFunctions_nss(void) {
     static xmlSecCryptoDLFunctions functions;
-    
+
     if(gXmlSecNssFunctions != NULL) {
         return(gXmlSecNssFunctions);
     }
@@ -49,7 +49,7 @@ xmlSecCryptoGetFunctions_nss(void) {
     memset(&functions, 0, sizeof(functions));
     gXmlSecNssFunctions = &functions;
 
-    /**  
+    /**
      * Crypto Init/shutdown
      */
     gXmlSecNssFunctions->cryptoInit                     = xmlSecNssInit;
@@ -59,21 +59,21 @@ xmlSecCryptoGetFunctions_nss(void) {
     /**
      * Key data ids
      */
-#ifndef XMLSEC_NO_AES    
+#ifndef XMLSEC_NO_AES
     gXmlSecNssFunctions->keyDataAesGetKlass             = xmlSecNssKeyDataAesGetKlass;
 #endif /* XMLSEC_NO_AES */
 
-#ifndef XMLSEC_NO_DES    
+#ifndef XMLSEC_NO_DES
     gXmlSecNssFunctions->keyDataDesGetKlass             = xmlSecNssKeyDataDesGetKlass;
 #endif /* XMLSEC_NO_DES */
 
 #ifndef XMLSEC_NO_DSA
     gXmlSecNssFunctions->keyDataDsaGetKlass             = xmlSecNssKeyDataDsaGetKlass;
-#endif /* XMLSEC_NO_DSA */    
+#endif /* XMLSEC_NO_DSA */
 
-#ifndef XMLSEC_NO_HMAC  
+#ifndef XMLSEC_NO_HMAC
     gXmlSecNssFunctions->keyDataHmacGetKlass            = xmlSecNssKeyDataHmacGetKlass;
-#endif /* XMLSEC_NO_HMAC */    
+#endif /* XMLSEC_NO_HMAC */
 
 #ifndef XMLSEC_NO_RSA
     gXmlSecNssFunctions->keyDataRsaGetKlass             = xmlSecNssKeyDataRsaGetKlass;
@@ -94,7 +94,7 @@ xmlSecCryptoGetFunctions_nss(void) {
     /**
      * Crypto transforms ids
      */
-#ifndef XMLSEC_NO_AES    
+#ifndef XMLSEC_NO_AES
     gXmlSecNssFunctions->transformAes128CbcGetKlass     = xmlSecNssTransformAes128CbcGetKlass;
     gXmlSecNssFunctions->transformAes192CbcGetKlass     = xmlSecNssTransformAes192CbcGetKlass;
     gXmlSecNssFunctions->transformAes256CbcGetKlass     = xmlSecNssTransformAes256CbcGetKlass;
@@ -103,7 +103,7 @@ xmlSecCryptoGetFunctions_nss(void) {
     gXmlSecNssFunctions->transformKWAes256GetKlass      = xmlSecNssTransformKWAes256GetKlass;
 #endif /* XMLSEC_NO_AES */
 
-#ifndef XMLSEC_NO_DES    
+#ifndef XMLSEC_NO_DES
     gXmlSecNssFunctions->transformDes3CbcGetKlass       = xmlSecNssTransformDes3CbcGetKlass;
     gXmlSecNssFunctions->transformKWDes3GetKlass        = xmlSecNssTransformKWDes3GetKlass;
 #endif /* XMLSEC_NO_DES */
@@ -123,19 +123,19 @@ xmlSecCryptoGetFunctions_nss(void) {
     gXmlSecNssFunctions->transformRsaPkcs1GetKlass      = xmlSecNssTransformRsaPkcs1GetKlass;
 
 /* RSA OAEP is not supported by NSS yet */
-#ifdef TODO
+#ifdef TODO
     gXmlSecNssFunctions->transformRsaOaepGetKlass       = xmlSecNssTransformRsaOaepGetKlass;
 #endif /* TODO: RSA OAEP is not supported by NSS yet */
 
 #endif /* XMLSEC_NO_RSA */
 
-#ifndef XMLSEC_NO_SHA1    
+#ifndef XMLSEC_NO_SHA1
     gXmlSecNssFunctions->transformSha1GetKlass          = xmlSecNssTransformSha1GetKlass;
 #endif /* XMLSEC_NO_SHA1 */
 
     /**
      * High level routines form xmlsec command line utility
-     */ 
+     */
     gXmlSecNssFunctions->cryptoAppInit                  = xmlSecNssAppInit;
     gXmlSecNssFunctions->cryptoAppShutdown              = xmlSecNssAppShutdown;
     gXmlSecNssFunctions->cryptoAppDefaultKeysMngrInit   = xmlSecNssAppDefaultKeysMngrInit;
@@ -145,13 +145,13 @@ xmlSecCryptoGetFunctions_nss(void) {
 #ifndef XMLSEC_NO_X509
     gXmlSecNssFunctions->cryptoAppKeysMngrCertLoad      = xmlSecNssAppKeysMngrCertLoad;
     gXmlSecNssFunctions->cryptoAppKeysMngrCertLoadMemory= xmlSecNssAppKeysMngrCertLoadMemory;
-    gXmlSecNssFunctions->cryptoAppPkcs12Load            = xmlSecNssAppPkcs12Load; 
-    gXmlSecNssFunctions->cryptoAppPkcs12LoadMemory      = xmlSecNssAppPkcs12LoadMemory; 
+    gXmlSecNssFunctions->cryptoAppPkcs12Load            = xmlSecNssAppPkcs12Load;
+    gXmlSecNssFunctions->cryptoAppPkcs12LoadMemory      = xmlSecNssAppPkcs12LoadMemory;
     gXmlSecNssFunctions->cryptoAppKeyCertLoad           = xmlSecNssAppKeyCertLoad;
     gXmlSecNssFunctions->cryptoAppKeyCertLoadMemory     = xmlSecNssAppKeyCertLoadMemory;
 #endif /* XMLSEC_NO_X509 */
-    gXmlSecNssFunctions->cryptoAppKeyLoad               = xmlSecNssAppKeyLoad; 
-    gXmlSecNssFunctions->cryptoAppKeyLoadMemory         = xmlSecNssAppKeyLoadMemory; 
+    gXmlSecNssFunctions->cryptoAppKeyLoad               = xmlSecNssAppKeyLoad;
+    gXmlSecNssFunctions->cryptoAppKeyLoadMemory         = xmlSecNssAppKeyLoadMemory;
     gXmlSecNssFunctions->cryptoAppDefaultPwdCallback    = (void*)xmlSecNssAppGetDefaultPwdCallback();
 
     return(gXmlSecNssFunctions);
@@ -159,12 +159,12 @@ xmlSecCryptoGetFunctions_nss(void) {
 
 /**
  * xmlSecNssInit:
- * 
- * XMLSec library specific crypto engine initialization. 
+ *
+ * XMLSec library specific crypto engine initialization.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecNssInit (void)  {
     /* Check loaded xmlsec library version */
     if(xmlSecCheckVersionExact() != 1) {
@@ -188,18 +188,18 @@ xmlSecNssInit (void)  {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
 /**
  * xmlSecNssShutdown:
- * 
- * XMLSec library specific crypto engine shutdown. 
+ *
+ * XMLSec library specific crypto engine shutdown.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecNssShutdown(void) {
     return(0);
 }
@@ -215,7 +215,7 @@ xmlSecNssShutdown(void) {
 int
 xmlSecNssKeysMngrInit(xmlSecKeysMngrPtr mngr) {
     int ret;
-   
+
     xmlSecAssert2(mngr != NULL, -1);
 
 #ifndef XMLSEC_NO_X509
@@ -251,17 +251,17 @@ xmlSecNssKeysMngrInit(xmlSecKeysMngrPtr mngr) {
 
 /**
  * xmlSecNssGetInternalKeySlot:
- * 
+ *
  * Gets internal NSS key slot.
- * 
+ *
  * Returns: internal key slot and initializes it if needed.
  */
-PK11SlotInfo * 
+PK11SlotInfo *
 xmlSecNssGetInternalKeySlot()
 {
     PK11SlotInfo *slot = NULL;
     SECStatus rv;
-        
+
     slot = PK11_GetInternalKeySlot();
     if (slot == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -272,7 +272,7 @@ xmlSecNssGetInternalKeySlot()
         return NULL;
     }
 
-    if (PK11_NeedUserInit(slot)) {
+    if (PK11_NeedUserInit(slot)) {
         rv = PK11_InitPin(slot, NULL, NULL);
         if (rv != SECSuccess) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -309,33 +309,33 @@ xmlSecNssGetInternalKeySlot()
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecNssGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {      
+xmlSecNssGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
     SECStatus rv;
     int ret;
-    
+
     xmlSecAssert2(buffer != NULL, -1);
     xmlSecAssert2(size > 0, -1);
 
     ret = xmlSecBufferSetSize(buffer, size);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", size);
         return(-1);
     }
-        
+
     /* get random data */
     rv = PK11_GenerateRandom((xmlSecByte*)xmlSecBufferGetData(buffer), size);
     if(rv != SECSuccess) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "PK11_GenerateRandom",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "size=%d", size);
-        return(-1);    
-    }    
+        return(-1);
+    }
     return(0);
 }
 
@@ -344,14 +344,14 @@ xmlSecNssGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
  * @file:               the error location file name (__FILE__ macro).
  * @line:               the error location line number (__LINE__ macro).
  * @func:               the error location function name (__FUNCTION__ macro).
- * @errorObject:        the error specific error object 
+ * @errorObject:        the error specific error object
  * @errorSubject:       the error specific error subject.
  * @reason:             the error code.
  * @msg:                the additional error message.
  *
  * The default errors reporting callback function.
  */
-void 
+void
 xmlSecNssErrorsDefaultCallback(const char* file, int line, const char* func,
                                 const char* errorObject, const char* errorSubject,
                                 int reason, const char* msg) {
@@ -360,7 +360,7 @@ xmlSecNssErrorsDefaultCallback(const char* file, int line, const char* func,
 
     err = PORT_GetError();
     xmlSecStrPrintf(buf, sizeof(buf), BAD_CAST "%s;last nss error=%d (0x%08X)", msg, err, err);
-    xmlSecErrorsDefaultCallback(file, line, func, 
-                errorObject, errorSubject, 
+    xmlSecErrorsDefaultCallback(file, line, func,
+                errorObject, errorSubject,
                 reason, (char*)buf);
 }
diff --git a/src/nss/digests.c b/src/nss/digests.c
index 4e38576..a10005d 100644
--- a/src/nss/digests.c
+++ b/src/nss/digests.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * 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) 2003 America Online, Inc.  All rights reserved.
  */
@@ -37,7 +37,7 @@ struct _xmlSecNssDigestCtx {
     PK11Context*        digestCtx;
     xmlSecByte          dgst[XMLSEC_NSS_MAX_DIGEST_SIZE];
     xmlSecSize          dgstSize;       /* dgst size in bytes */
-};          
+};
 
 /******************************************************************************
  *
@@ -47,18 +47,18 @@ struct _xmlSecNssDigestCtx {
  *
  *****************************************************************************/
 #define xmlSecNssDigestSize     \
-    (sizeof(xmlSecTransform) + sizeof(xmlSecNssDigestCtx))      
+    (sizeof(xmlSecTransform) + sizeof(xmlSecNssDigestCtx))
 #define xmlSecNssDigestGetCtx(transform) \
     ((xmlSecNssDigestCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
 
 static int      xmlSecNssDigestInitialize               (xmlSecTransformPtr transform);
 static void     xmlSecNssDigestFinalize                 (xmlSecTransformPtr transform);
-static int      xmlSecNssDigestVerify                   (xmlSecTransformPtr transform, 
-                                                         const xmlSecByte* data, 
+static int      xmlSecNssDigestVerify                   (xmlSecTransformPtr transform,
+                                                         const xmlSecByte* data,
                                                          xmlSecSize dataSize,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecNssDigestExecute                  (xmlSecTransformPtr transform, 
-                                                         int last, 
+static int      xmlSecNssDigestExecute                  (xmlSecTransformPtr transform,
+                                                         int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 static int      xmlSecNssDigestCheckId                  (xmlSecTransformPtr transform);
 
@@ -69,12 +69,12 @@ xmlSecNssDigestCheckId(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecNssTransformSha1Id)) {
         return(1);
     }
-#endif /* XMLSEC_NO_SHA1 */    
+#endif /* XMLSEC_NO_SHA1 */
 
     return(0);
 }
 
-static int 
+static int
 xmlSecNssDigestInitialize(xmlSecTransformPtr transform) {
     xmlSecNssDigestCtxPtr ctx;
 
@@ -91,40 +91,40 @@ xmlSecNssDigestInitialize(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecNssTransformSha1Id)) {
         ctx->digest = SECOID_FindOIDByTag(SEC_OID_SHA1);
     } else
-#endif /* XMLSEC_NO_SHA1 */     
+#endif /* XMLSEC_NO_SHA1 */
 
     if(1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     if(ctx->digest == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "SECOID_FindOIDByTag",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "error code=%d", PORT_GetError());
         return(-1);
     }
-    
+
     ctx->digestCtx = PK11_CreateDigestContext(ctx->digest->offset);
     if(ctx->digestCtx == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "PK11_CreateDigestContext",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "error code=%d", PORT_GetError());
         return(-1);
     }
-        
+
     return(0);
 }
 
-static void 
+static void
 xmlSecNssDigestFinalize(xmlSecTransformPtr transform) {
     xmlSecNssDigestCtxPtr ctx;
 
@@ -133,7 +133,7 @@ xmlSecNssDigestFinalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecNssDigestGetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     if(ctx->digestCtx != NULL) {
         PK11_DestroyContext(ctx->digestCtx, PR_TRUE);
     }
@@ -141,11 +141,11 @@ xmlSecNssDigestFinalize(xmlSecTransformPtr transform) {
 }
 
 static int
-xmlSecNssDigestVerify(xmlSecTransformPtr transform, 
+xmlSecNssDigestVerify(xmlSecTransformPtr transform,
                         const xmlSecByte* data, xmlSecSize dataSize,
                         xmlSecTransformCtxPtr transformCtx) {
     xmlSecNssDigestCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecNssDigestCheckId(transform), -1);
     xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssDigestSize), -1);
@@ -156,20 +156,20 @@ xmlSecNssDigestVerify(xmlSecTransformPtr transform,
     ctx = xmlSecNssDigestGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->dgstSize > 0, -1);
-    
+
     if(dataSize != ctx->dgstSize) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_DATA,
-                    "data and digest sizes are different (data=%d, dgst=%d)", 
+                    "data and digest sizes are different (data=%d, dgst=%d)",
                     dataSize, ctx->dgstSize);
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-    
+
     if(memcmp(ctx->dgst, data, dataSize) != 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_DATA,
@@ -177,18 +177,18 @@ xmlSecNssDigestVerify(xmlSecTransformPtr transform,
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-    
+
     transform->status = xmlSecTransformStatusOk;
     return(0);
 }
 
-static int 
+static int
 xmlSecNssDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecNssDigestCtxPtr ctx;
     xmlSecBufferPtr in, out;
     SECStatus rv;
     int ret;
-    
+
     xmlSecAssert2(xmlSecNssDigestCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(transformCtx != NULL, -1);
@@ -204,7 +204,7 @@ xmlSecNssDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
     if(transform->status == xmlSecTransformStatusNone) {
         rv = PK11_DigestBegin(ctx->digestCtx);
         if(rv != SECSuccess) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "PK11_DigestBegin",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -213,7 +213,7 @@ xmlSecNssDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
         }
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if(transform->status == xmlSecTransformStatusWorking) {
         xmlSecSize inSize;
 
@@ -221,17 +221,17 @@ xmlSecNssDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
         if(inSize > 0) {
             rv = PK11_DigestOp(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
             if (rv != SECSuccess) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "PK11_DigestOp",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
                             "error code=%d", PORT_GetError());
                 return(-1);
             }
-            
+
             ret = xmlSecBufferRemoveHead(in, inSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferRemoveHead",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -242,7 +242,7 @@ xmlSecNssDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
         if(last) {
             rv = PK11_DigestFinal(ctx->digestCtx, ctx->dgst, &ctx->dgstSize, sizeof(ctx->dgst));
             if(rv != SECSuccess) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "PK11_DigestFinal",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -254,7 +254,7 @@ xmlSecNssDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
             if(transform->operation == xmlSecTransformOperationSign) {
                 ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferAppend",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -268,14 +268,14 @@ xmlSecNssDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -294,7 +294,7 @@ static xmlSecTransformKlass xmlSecNssSha1Klass = {
     xmlSecNameSha1,                             /* const xmlChar* name; */
     xmlSecHrefSha1,                             /* const xmlChar* href; */
     xmlSecTransformUsageDigestMethod,           /* xmlSecTransformUsage usage; */
-    
+
     /* methods */
     xmlSecNssDigestInitialize,                  /* xmlSecTransformInitializeMethod initialize; */
     xmlSecNssDigestFinalize,                    /* xmlSecTransformFinalizeMethod finalize; */
@@ -309,19 +309,19 @@ static xmlSecTransformKlass xmlSecNssSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssDigestExecute,                     /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssTransformSha1GetKlass:
  *
  * SHA-1 digest transform klass.
  *
  * Returns: pointer to SHA-1 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformSha1GetKlass(void) {
     return(&xmlSecNssSha1Klass);
 }
diff --git a/src/nss/globals.h b/src/nss/globals.h
index 272a27b..770b6db 100644
--- a/src/nss/globals.h
+++ b/src/nss/globals.h
@@ -5,14 +5,14 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_GLOBALS_H__
 #define __XMLSEC_GLOBALS_H__
 
 /**
- * Use autoconf defines if present. 
+ * Use autoconf defines if present.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/src/nss/hmac.c b/src/nss/hmac.c
index fe62647..9237765 100644
--- a/src/nss/hmac.c
+++ b/src/nss/hmac.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * 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) 2003 America Online, Inc.  All rights reserved.
  */
@@ -38,10 +38,10 @@
 static int g_xmlsec_nss_hmac_min_length = XMLSEC_NSS_MIN_HMAC_SIZE;
 
 /**
- * xmlSecNssHmacGetMinOutputLength: 
- * 
+ * xmlSecNssHmacGetMinOutputLength:
+ *
  * Gets the value of min HMAC length.
- * 
+ *
  * Returns: the min HMAC output length
  */
 int xmlSecNssHmacGetMinOutputLength(void)
@@ -50,9 +50,9 @@ int xmlSecNssHmacGetMinOutputLength(void)
 }
 
 /**
- * xmlSecNssHmacSetMinOutputLength: 
- * @min_length: the new min length 
- * 
+ * xmlSecNssHmacSetMinOutputLength:
+ * @min_length: the new min length
+ *
  * Sets the min HMAC output length
  */
 void xmlSecNssHmacSetMinOutputLength(int min_length)
@@ -71,7 +71,7 @@ struct _xmlSecNssHmacCtx {
     PK11Context*        digestCtx;
     xmlSecByte          dgst[XMLSEC_NSS_MAX_HMAC_SIZE / 8];
     xmlSecSize          dgstSize;       /* dgst size in bits */
-};          
+};
 
 /******************************************************************************
  *
@@ -94,19 +94,19 @@ static void     xmlSecNssHmacFinalize                   (xmlSecTransformPtr tran
 static int      xmlSecNssHmacNodeRead                   (xmlSecTransformPtr transform,
                                                          xmlNodePtr node,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecNssHmacSetKeyReq                  (xmlSecTransformPtr transform, 
+static int      xmlSecNssHmacSetKeyReq                  (xmlSecTransformPtr transform,
                                                          xmlSecKeyReqPtr keyReq);
-static int      xmlSecNssHmacSetKey                     (xmlSecTransformPtr transform, 
+static int      xmlSecNssHmacSetKey                     (xmlSecTransformPtr transform,
                                                          xmlSecKeyPtr key);
-static int      xmlSecNssHmacVerify                     (xmlSecTransformPtr transform, 
-                                                         const xmlSecByte* data, 
+static int      xmlSecNssHmacVerify                     (xmlSecTransformPtr transform,
+                                                         const xmlSecByte* data,
                                                          xmlSecSize dataSize,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecNssHmacExecute                    (xmlSecTransformPtr transform, 
-                                                         int last, 
+static int      xmlSecNssHmacExecute                    (xmlSecTransformPtr transform,
+                                                         int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 
-static int 
+static int
 xmlSecNssHmacInitialize(xmlSecTransformPtr transform) {
     xmlSecNssHmacCtxPtr ctx;
 
@@ -115,7 +115,7 @@ xmlSecNssHmacInitialize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecNssHmacGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecNssHmacCtx));
     if(xmlSecTransformCheckId(transform, xmlSecNssTransformHmacSha1Id)) {
         ctx->digestType = CKM_SHA_1_HMAC;
@@ -124,7 +124,7 @@ xmlSecNssHmacInitialize(xmlSecTransformPtr transform) {
     } else if(xmlSecTransformCheckId(transform, xmlSecNssTransformHmacRipemd160Id)) {
         ctx->digestType = CKM_RIPEMD160_HMAC;
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
@@ -134,11 +134,11 @@ xmlSecNssHmacInitialize(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static void 
+static void
 xmlSecNssHmacFinalize(xmlSecTransformPtr transform) {
     xmlSecNssHmacCtxPtr ctx;
 
-    xmlSecAssert(xmlSecNssHmacCheckId(transform));    
+    xmlSecAssert(xmlSecNssHmacCheckId(transform));
     xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecNssHmacSize));
 
     ctx = xmlSecNssHmacGetCtx(transform);
@@ -155,21 +155,21 @@ xmlSecNssHmacFinalize(xmlSecTransformPtr transform) {
  *
  * HMAC (http://www.w3.org/TR/xmldsig-core/#sec-HMAC):
  *
- * The HMAC algorithm (RFC2104 [HMAC]) takes the truncation length in bits 
- * as a parameter; if the parameter is not specified then all the bits of the 
- * hash are output. An example of an HMAC SignatureMethod element:  
+ * The HMAC algorithm (RFC2104 [HMAC]) takes the truncation length in bits
+ * as a parameter; if the parameter is not specified then all the bits of the
+ * hash are output. An example of an HMAC SignatureMethod element:
  * <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1";>
  *   <HMACOutputLength>128</HMACOutputLength>
  * </SignatureMethod>
- * 
+ *
  * Schema Definition:
- * 
+ *
  * <simpleType name="HMACOutputLengthType">
  *   <restriction base="integer"/>
  * </simpleType>
- *     
+ *
  * DTD:
- *     
+ *
  * <!ELEMENT HMACOutputLength (#PCDATA)>
  */
 static int
@@ -185,18 +185,18 @@ xmlSecNssHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTrans
     ctx = xmlSecNssHmacGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
 
-    cur = xmlSecGetNextElementNode(node->children); 
-    if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) {  
+    cur = xmlSecGetNextElementNode(node->children);
+    if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) {
         xmlChar *content;
-        
+
         content = xmlNodeGetContent(cur);
         if(content != NULL) {
-            ctx->dgstSize = atoi((char*)content);           
+            ctx->dgstSize = atoi((char*)content);
             xmlFree(content);
         }
 
         /* Ensure that HMAC length is greater than min specified.
-           Otherwise, an attacker can set this lenght to 0 or very 
+           Otherwise, an attacker can set this lenght to 0 or very
            small value
         */
         if((int)ctx->dgstSize < xmlSecNssHmacGetMinOutputLength()) {
@@ -210,7 +210,7 @@ xmlSecNssHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTrans
 
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -219,11 +219,11 @@ xmlSecNssHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTrans
                     "no nodes expected");
         return(-1);
     }
-    return(0); 
+    return(0);
 }
 
 
-static int  
+static int
 xmlSecNssHmacSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecNssHmacCtxPtr ctx;
 
@@ -242,7 +242,7 @@ xmlSecNssHmacSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     } else {
         keyReq->keyUsage = xmlSecKeyUsageVerify;
     }
-    
+
     return(0);
 }
 
@@ -255,7 +255,7 @@ xmlSecNssHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     SECItem ignore;
     PK11SlotInfo* slot;
     PK11SymKey* symKey;
-    
+
     xmlSecAssert2(xmlSecNssHmacCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssHmacSize), -1);
@@ -265,7 +265,7 @@ xmlSecNssHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->digestType != 0, -1);
     xmlSecAssert2(ctx->digestCtx == NULL, -1);
-    
+
     value = xmlSecKeyGetValue(key);
     xmlSecAssert2(xmlSecKeyDataCheckId(value, xmlSecNssKeyDataHmacId), -1);
 
@@ -273,33 +273,33 @@ xmlSecNssHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecAssert2(buffer != NULL, -1);
 
     if(xmlSecBufferGetSize(buffer) == 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
                     "key is empty");
-        return(-1);    
+        return(-1);
     }
 
     memset(&ignore, 0, sizeof(ignore));
     memset(&keyItem, 0, sizeof(keyItem));
     keyItem.data = xmlSecBufferGetData(buffer);
-    keyItem.len  = xmlSecBufferGetSize(buffer); 
+    keyItem.len  = xmlSecBufferGetSize(buffer);
 
     slot = PK11_GetBestSlot(ctx->digestType, NULL);
     if(slot == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "PK11_GetBestSlot",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
-    symKey = PK11_ImportSymKey(slot, ctx->digestType, PK11_OriginDerive, 
+
+    symKey = PK11_ImportSymKey(slot, ctx->digestType, PK11_OriginDerive,
                                CKA_SIGN, &keyItem, NULL);
     if(symKey == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "PK11_ImportSymKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -310,7 +310,7 @@ xmlSecNssHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
 
     ctx->digestCtx = PK11_CreateContextBySymKey(ctx->digestType, CKA_SIGN, symKey, &ignore);
     if(ctx->digestCtx == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "PK11_CreateContextBySymKey",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -326,15 +326,15 @@ xmlSecNssHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
 }
 
 static int
-xmlSecNssHmacVerify(xmlSecTransformPtr transform, 
+xmlSecNssHmacVerify(xmlSecTransformPtr transform,
                         const xmlSecByte* data, xmlSecSize dataSize,
                         xmlSecTransformCtxPtr transformCtx) {
-    static xmlSecByte last_byte_masks[] =       
+    static xmlSecByte last_byte_masks[] =
                 { 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
 
     xmlSecNssHmacCtxPtr ctx;
     xmlSecByte mask;
-        
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssHmacSize), -1);
@@ -346,10 +346,10 @@ xmlSecNssHmacVerify(xmlSecTransformPtr transform,
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->digestCtx != NULL, -1);
     xmlSecAssert2(ctx->dgstSize > 0, -1);
-    
+
     /* compare the digest size in bytes */
     if(dataSize != ((ctx->dgstSize + 7) / 8)){
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_SIZE,
@@ -363,7 +363,7 @@ xmlSecNssHmacVerify(xmlSecTransformPtr transform,
     xmlSecAssert2(dataSize > 0, -1);
     mask = last_byte_masks[ctx->dgstSize % 8];
     if((ctx->dgst[dataSize - 1] & mask) != (data[dataSize - 1]  & mask)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_DATA_NOT_MATCH,
@@ -374,7 +374,7 @@ xmlSecNssHmacVerify(xmlSecTransformPtr transform,
 
     /* now check the rest of the digest */
     if((dataSize > 1) && (memcmp(ctx->dgst, data, dataSize - 1) != 0)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_DATA_NOT_MATCH,
@@ -382,18 +382,18 @@ xmlSecNssHmacVerify(xmlSecTransformPtr transform,
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-    
+
     transform->status = xmlSecTransformStatusOk;
     return(0);
 }
 
-static int 
+static int
 xmlSecNssHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecNssHmacCtxPtr ctx;
     xmlSecBufferPtr in, out;
     SECStatus rv;
     int ret;
-    
+
     xmlSecAssert2(xmlSecNssHmacCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssHmacSize), -1);
@@ -409,7 +409,7 @@ xmlSecNssHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxP
     if(transform->status == xmlSecTransformStatusNone) {
         rv = PK11_DigestBegin(ctx->digestCtx);
         if(rv != SECSuccess) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "PK11_DigestBegin",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -418,7 +418,7 @@ xmlSecNssHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxP
         }
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if(transform->status == xmlSecTransformStatusWorking) {
         xmlSecSize inSize;
 
@@ -426,17 +426,17 @@ xmlSecNssHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxP
         if(inSize > 0) {
             rv = PK11_DigestOp(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
             if (rv != SECSuccess) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "PK11_DigestOp",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
                             "error code=%d", PORT_GetError());
                 return(-1);
             }
-            
+
             ret = xmlSecBufferRemoveHead(in, inSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferRemoveHead",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -449,7 +449,7 @@ xmlSecNssHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxP
 
             rv = PK11_DigestFinal(ctx->digestCtx, ctx->dgst, &dgstSize, sizeof(ctx->dgst));
             if(rv != SECSuccess) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "PK11_DigestFinal",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -464,7 +464,7 @@ xmlSecNssHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxP
             } else if(ctx->dgstSize <= 8 * dgstSize) {
                 dgstSize = ((ctx->dgstSize + 7) / 8); /* we need to truncate result digest */
             } else {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             NULL,
                             XMLSEC_ERRORS_R_INVALID_SIZE,
@@ -476,7 +476,7 @@ xmlSecNssHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxP
             if(transform->operation == xmlSecTransformOperationSign) {
                 ret = xmlSecBufferAppend(out, ctx->dgst, dgstSize);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferAppend",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -490,18 +490,18 @@ xmlSecNssHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxP
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "size=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
-/** 
+/**
  * HMAC SHA1
  */
 static xmlSecTransformKlass xmlSecNssHmacSha1Klass = {
@@ -512,11 +512,11 @@ static xmlSecTransformKlass xmlSecNssHmacSha1Klass = {
     xmlSecNameHmacSha1,                         /* const xmlChar* name; */
     xmlSecHrefHmacSha1,                         /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecNssHmacInitialize,                    /* xmlSecTransformInitializeMethod initialize; */
     xmlSecNssHmacFinalize,                      /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecNssHmacNodeRead,                      /* xmlSecTransformNodeReadMethod readNode; */
-    NULL,                                       /* xmlSecTransformNodeWriteMethod writeNode; */    
+    NULL,                                       /* xmlSecTransformNodeWriteMethod writeNode; */
     xmlSecNssHmacSetKeyReq,                     /* xmlSecTransformSetKeyReqMethod setKeyReq; */
     xmlSecNssHmacSetKey,                        /* xmlSecTransformSetKeyMethod setKey; */
     xmlSecNssHmacVerify,                        /* xmlSecTransformValidateMethod validate; */
@@ -526,24 +526,24 @@ static xmlSecTransformKlass xmlSecNssHmacSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssHmacExecute,                       /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssTransformHmacSha1GetKlass:
  *
  * The HMAC-SHA1 transform klass.
  *
  * Returns: the HMAC-SHA1 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformHmacSha1GetKlass(void) {
     return(&xmlSecNssHmacSha1Klass);
 }
 
-/** 
+/**
  * HMAC Ripemd160
  */
 static xmlSecTransformKlass xmlSecNssHmacRipemd160Klass = {
@@ -554,11 +554,11 @@ static xmlSecTransformKlass xmlSecNssHmacRipemd160Klass = {
     xmlSecNameHmacRipemd160,                    /* const xmlChar* name; */
     xmlSecHrefHmacRipemd160,                    /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecNssHmacInitialize,                    /* xmlSecTransformInitializeMethod initialize; */
     xmlSecNssHmacFinalize,                      /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecNssHmacNodeRead,                      /* xmlSecTransformNodeReadMethod readNode; */
-    NULL,                                       /* xmlSecTransformNodeWriteMethod writeNode; */    
+    NULL,                                       /* xmlSecTransformNodeWriteMethod writeNode; */
     xmlSecNssHmacSetKeyReq,                     /* xmlSecTransformSetKeyReqMethod setKeyReq; */
     xmlSecNssHmacSetKey,                        /* xmlSecTransformSetKeyMethod setKey; */
     xmlSecNssHmacVerify,                        /* xmlSecTransformValidateMethod validate; */
@@ -568,24 +568,24 @@ static xmlSecTransformKlass xmlSecNssHmacRipemd160Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssHmacExecute,                       /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssTransformHmacRipemd160GetKlass:
  *
  * The HMAC-RIPEMD160 transform klass.
  *
  * Returns: the HMAC-RIPEMD160 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformHmacRipemd160GetKlass(void) {
     return(&xmlSecNssHmacRipemd160Klass);
 }
 
-/** 
+/**
  * HMAC Md5
  */
 static xmlSecTransformKlass xmlSecNssHmacMd5Klass = {
@@ -596,11 +596,11 @@ static xmlSecTransformKlass xmlSecNssHmacMd5Klass = {
     xmlSecNameHmacMd5,                          /* const xmlChar* name; */
     xmlSecHrefHmacMd5,                          /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecNssHmacInitialize,                    /* xmlSecTransformInitializeMethod initialize; */
     xmlSecNssHmacFinalize,                      /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecNssHmacNodeRead,                      /* xmlSecTransformNodeReadMethod readNode; */
-    NULL,                                       /* xmlSecTransformNodeWriteMethod writeNode; */    
+    NULL,                                       /* xmlSecTransformNodeWriteMethod writeNode; */
     xmlSecNssHmacSetKeyReq,                     /* xmlSecTransformSetKeyReqMethod setKeyReq; */
     xmlSecNssHmacSetKey,                        /* xmlSecTransformSetKeyMethod setKey; */
     xmlSecNssHmacVerify,                        /* xmlSecTransformValidateMethod validate; */
@@ -610,19 +610,19 @@ static xmlSecTransformKlass xmlSecNssHmacMd5Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssHmacExecute,                       /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssTransformHmacMd5GetKlass:
  *
  * The HMAC-MD5 transform klass.
  *
  * Returns: the HMAC-MD5 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformHmacMd5GetKlass(void) {
     return(&xmlSecNssHmacMd5Klass);
 }
diff --git a/src/nss/keysstore.c b/src/nss/keysstore.c
index 453bff9..f07e44b 100644
--- a/src/nss/keysstore.c
+++ b/src/nss/keysstore.c
@@ -1,6 +1,6 @@
-/** 
+/**
  * XMLSec library
- * 
+ *
  * Nss keys store that uses Simple Keys Store under the hood. Uses the
  * Nss DB as a backing store for the finding keys, but the NSS DB is
  * not written to by the keys store.
@@ -8,12 +8,12 @@
  * keys store, the NSS DB is looked up.
  * If store is called to adopt a key, that key is not written to the NSS
  * DB.
- * Thus, the NSS DB can be used to pre-load keys and becomes an alternate 
+ * Thus, the NSS DB can be used to pre-load keys and becomes an alternate
  * source of keys for xmlsec
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for precise wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 #include "globals.h"
@@ -21,12 +21,12 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <nss.h> 
-#include <cert.h> 
-#include <pk11func.h> 
-#include <keyhi.h> 
+#include <nss.h>
+#include <cert.h>
+#include <pk11func.h>
+#include <keyhi.h>
 
-#include <libxml/tree.h> 
+#include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -44,7 +44,7 @@
 /****************************************************************************
  *
  * Nss Keys Store. Uses Simple Keys Store under the hood
- * 
+ *
  * Simple Keys Store ptr is located after xmlSecKeyStore
  *
  ***************************************************************************/
@@ -58,8 +58,8 @@
 
 static int                      xmlSecNssKeysStoreInitialize    (xmlSecKeyStorePtr store);
 static void                     xmlSecNssKeysStoreFinalize      (xmlSecKeyStorePtr store);
-static xmlSecKeyPtr             xmlSecNssKeysStoreFindKey       (xmlSecKeyStorePtr store, 
-                                                                 const xmlChar* name, 
+static xmlSecKeyPtr             xmlSecNssKeysStoreFindKey       (xmlSecKeyStorePtr store,
+                                                                 const xmlChar* name,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
 
 static xmlSecKeyStoreKlass xmlSecNssKeysStoreKlass = {
@@ -67,8 +67,8 @@ static xmlSecKeyStoreKlass xmlSecNssKeysStoreKlass = {
     xmlSecNssKeysStoreSize,
 
     /* data */
-    BAD_CAST "NSS-keys-store",          /* const xmlChar* name; */ 
-        
+    BAD_CAST "NSS-keys-store",          /* const xmlChar* name; */
+
     /* constructors/destructor */
     xmlSecNssKeysStoreInitialize,       /* xmlSecKeyStoreInitializeMethod initialize; */
     xmlSecNssKeysStoreFinalize,         /* xmlSecKeyStoreFinalizeMethod finalize; */
@@ -81,12 +81,12 @@ static xmlSecKeyStoreKlass xmlSecNssKeysStoreKlass = {
 
 /**
  * xmlSecNssKeysStoreGetKlass:
- * 
+ *
  * The Nss list based keys store klass.
  *
  * Returns: Nss list based keys store klass.
  */
-xmlSecKeyStoreId 
+xmlSecKeyStoreId
 xmlSecNssKeysStoreGetKlass(void) {
     return(&xmlSecNssKeysStoreKlass);
 }
@@ -95,37 +95,37 @@ xmlSecNssKeysStoreGetKlass(void) {
  * xmlSecNssKeysStoreAdoptKey:
  * @store:              the pointer to Nss keys store.
  * @key:                the pointer to key.
- * 
- * Adds @key to the @store. 
+ *
+ * Adds @key to the @store.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecNssKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
     xmlSecKeyStorePtr *ss;
-    
+
     xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecNssKeysStoreId), -1);
     xmlSecAssert2((key != NULL), -1);
 
     ss = xmlSecNssKeysStoreGetSS(store);
-    xmlSecAssert2(((ss != NULL) && (*ss != NULL) && 
+    xmlSecAssert2(((ss != NULL) && (*ss != NULL) &&
                    (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
 
     return (xmlSecSimpleKeysStoreAdoptKey(*ss, key));
 }
 
-/** 
+/**
  * xmlSecNssKeysStoreLoad:
  * @store:              the pointer to Nss keys store.
  * @uri:                the filename.
- * @keysMngr:           the pointer to associated keys manager. 
- * 
+ * @keysMngr:           the pointer to associated keys manager.
+ *
  * Reads keys from an XML file.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
 int
-xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri, 
+xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
                             xmlSecKeysMngrPtr keysMngr) {
     xmlDocPtr doc;
     xmlNodePtr root;
@@ -135,7 +135,7 @@ xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
     int ret;
 
     xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecNssKeysStoreId), -1);
-    xmlSecAssert2((uri != NULL), -1);    
+    xmlSecAssert2((uri != NULL), -1);
 
     doc = xmlParseFile(uri);
     if(doc == NULL) {
@@ -143,11 +143,11 @@ xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
                     xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
                     "xmlParseFile",
                     XMLSEC_ERRORS_R_XML_FAILED,
-                    "uri=%s", 
+                    "uri=%s",
                     xmlSecErrorsSafeString(uri));
         return(-1);
     }
-    
+
     root = xmlDocGetRootElement(doc);
     if(!xmlSecCheckNodeName(root, BAD_CAST "Keys", xmlSecNs)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -158,9 +158,9 @@ xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
         xmlFreeDoc(doc);
         return(-1);
     }
-        
+
     cur = xmlSecGetNextElementNode(root->children);
-    while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {  
+    while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {
         key = xmlSecKeyCreate();
         if(key == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -184,7 +184,7 @@ xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
             xmlFreeDoc(doc);
             return(-1);
         }
-        
+
         keyInfoCtx.mode           = xmlSecKeyInfoModeRead;
         keyInfoCtx.keysMngr       = keysMngr;
         keyInfoCtx.flags          = XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND |
@@ -206,7 +206,7 @@ xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
             return(-1);
         }
         xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
-        
+
         if(xmlSecKeyIsValid(key)) {
             ret = xmlSecNssKeysStoreAdoptKey(store, key);
             if(ret < 0) {
@@ -225,7 +225,7 @@ xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
         }
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
@@ -233,19 +233,19 @@ xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
                     XMLSEC_ERRORS_R_UNEXPECTED_NODE,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFreeDoc(doc);
-        return(-1);         
+        return(-1);
     }
-    
+
     xmlFreeDoc(doc);
     return(0);
 }
 
-/** 
+/**
  * xmlSecNssKeysStoreSave:
  * @store:              the pointer to Nss keys store.
  * @filename:           the filename.
  * @type:               the saved keys type (public, private, ...).
- * 
+ *
  * Writes keys from @store to an XML file.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -255,10 +255,10 @@ xmlSecNssKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecKeyD
     xmlSecKeyStorePtr *ss;
 
     xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecNssKeysStoreId), -1);
-    xmlSecAssert2((filename != NULL), -1);    
-    
+    xmlSecAssert2((filename != NULL), -1);
+
     ss = xmlSecNssKeysStoreGetSS(store);
-    xmlSecAssert2(((ss != NULL) && (*ss != NULL) && 
+    xmlSecAssert2(((ss != NULL) && (*ss != NULL) &&
                    (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
 
     return (xmlSecSimpleKeysStoreSave(*ss, filename, type));
@@ -283,23 +283,23 @@ xmlSecNssKeysStoreInitialize(xmlSecKeyStorePtr store) {
         return(-1);
     }
 
-    return(0);    
+    return(0);
 }
 
 static void
 xmlSecNssKeysStoreFinalize(xmlSecKeyStorePtr store) {
     xmlSecKeyStorePtr *ss;
-    
+
     xmlSecAssert(xmlSecKeyStoreCheckId(store, xmlSecNssKeysStoreId));
-    
+
     ss = xmlSecNssKeysStoreGetSS(store);
     xmlSecAssert((ss != NULL) && (*ss != NULL));
-    
+
     xmlSecKeyStoreDestroy(*ss);
 }
 
-static xmlSecKeyPtr 
-xmlSecNssKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name, 
+static xmlSecKeyPtr
+xmlSecNssKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
                           xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyStorePtr* ss;
     xmlSecKeyPtr key = NULL;
@@ -330,13 +330,13 @@ xmlSecNssKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
         goto done;
     }
 
-    /* what type of key are we looking for? 
+    /* what type of key are we looking for?
      * TBD: For now, we'll look only for public/private keys using the
      * name as a cert nickname. Later on, we can attempt to find
-     * symmetric keys using PK11_FindFixedKey 
+     * symmetric keys using PK11_FindFixedKey
      */
     keyReq = &(keyInfoCtx->keyReq);
-    if (keyReq->keyType & 
+    if (keyReq->keyType &
         (xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate)) {
         cert = CERT_FindCertByNickname (CERT_GetDefaultCertDB(), (char *)name);
         if (cert == NULL) {
@@ -353,9 +353,9 @@ xmlSecNssKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 goto done;
             }
-        } 
+        }
 
-        if (keyReq->keyType & xmlSecKeyDataTypePrivate) { 
+        if (keyReq->keyType & xmlSecKeyDataTypePrivate) {
             privkey = PK11_FindKeyByAnyCert(cert, NULL);
             if (privkey == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -375,7 +375,7 @@ xmlSecNssKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             goto done;
-        }    
+        }
         privkey = NULL;
         pubkey = NULL;
 
@@ -439,7 +439,7 @@ xmlSecNssKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
                         NULL,
                         "xmlSecKeySetValue",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "data=%s", 
+                        "data=%s",
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
             goto done;
         }
diff --git a/src/nss/keytrans.c b/src/nss/keytrans.c
index cca9b88..14caf5b 100644
--- a/src/nss/keytrans.c
+++ b/src/nss/keytrans.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * AES Algorithm support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright .................................
  */
 #include "globals.h"
@@ -53,38 +53,38 @@ struct _xmlSecNssKeyTransportCtx {
 
 static int              xmlSecNssKeyTransportInitialize(xmlSecTransformPtr transform);
 static void     xmlSecNssKeyTransportFinalize(xmlSecTransformPtr transform);
-static int      xmlSecNssKeyTransportSetKeyReq(xmlSecTransformPtr transform, 
+static int      xmlSecNssKeyTransportSetKeyReq(xmlSecTransformPtr transform,
                                                          xmlSecKeyReqPtr keyReq);
-static int      xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform, 
+static int      xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform,
                                                          xmlSecKeyPtr key);
-static int      xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, 
+static int      xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform,
                                                          int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 
 static int
 xmlSecNssKeyTransportCheckId(xmlSecTransformPtr transform) {
 #ifndef XMLSEC_NO_RSA
-        if( xmlSecTransformCheckId( transform, xmlSecNssTransformRsaPkcs1Id ) 
+        if( xmlSecTransformCheckId( transform, xmlSecNssTransformRsaPkcs1Id )
 /* RSA OAEP is not supported by NSS yet */
 #ifdef TODO
-        || xmlSecTransformCheckId( transform, xmlSecNssTransformRsaOaepId ) 
+        || xmlSecTransformCheckId( transform, xmlSecNssTransformRsaOaepId )
 #endif /* TODO: RSA OAEP is not supported by NSS yet */
-        
+
         ) {
 
                 return(1);
     }
 #endif /* XMLSEC_NO_RSA */
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecNssKeyTransportInitialize(xmlSecTransformPtr transform) {
         xmlSecNssKeyTransportCtxPtr context ;
     xmlSecAssert2(xmlSecNssKeyTransportCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKeyTransportSize), -1);
-    
+
         context = xmlSecNssKeyTransportGetCtx( transform ) ;
         xmlSecAssert2( context != NULL , -1 ) ;
 
@@ -107,7 +107,7 @@ xmlSecNssKeyTransportInitialize(xmlSecTransformPtr transform) {
                     NULL ,
                     XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                     XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         context->pubkey = NULL ;
@@ -117,13 +117,13 @@ xmlSecNssKeyTransportInitialize(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static void 
+static void
 xmlSecNssKeyTransportFinalize(xmlSecTransformPtr transform) {
         xmlSecNssKeyTransportCtxPtr context ;
-    
+
     xmlSecAssert(xmlSecNssKeyTransportCheckId(transform));
     xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecNssKeyTransportSize));
-    
+
         context = xmlSecNssKeyTransportGetCtx( transform ) ;
         xmlSecAssert( context != NULL ) ;
 
@@ -143,15 +143,15 @@ xmlSecNssKeyTransportFinalize(xmlSecTransformPtr transform) {
         }
 }
 
-static int  
+static int
 xmlSecNssKeyTransportSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
         xmlSecNssKeyTransportCtxPtr context ;
-    
+
     xmlSecAssert2(xmlSecNssKeyTransportCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKeyTransportSize), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(keyReq != NULL, -1);
-    
+
         context = xmlSecNssKeyTransportGetCtx( transform ) ;
         xmlSecAssert2( context != NULL , -1 ) ;
 
@@ -167,7 +167,7 @@ xmlSecNssKeyTransportSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr ke
     return(0);
 }
 
-static int      
+static int
 xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
         xmlSecNssKeyTransportCtxPtr context = NULL ;
         xmlSecKeyDataPtr        keyData = NULL ;
@@ -186,7 +186,7 @@ xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                     "xmlSecNssKeyTransportGetCtx" ,
                     XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                     XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
         xmlSecAssert2( xmlSecKeyCheckId( key, context->keyId ), -1 ) ;
 
@@ -197,7 +197,7 @@ xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                     "xmlSecKeyGetValue" ,
                     XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                     XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
     if(transform->operation == xmlSecTransformOperationEncrypt) {
@@ -207,7 +207,7 @@ xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                             "xmlSecNssPKIKeyDataGetPubKey" ,
                             XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                             XMLSEC_ERRORS_NO_MESSAGE ) ;
-                        return(-1);    
+                        return(-1);
                 }
 
                 context->pubkey = pubkey ;
@@ -218,7 +218,7 @@ xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                             "xmlSecNssPKIKeyDataGetPrivKey" ,
                             XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                             XMLSEC_ERRORS_NO_MESSAGE ) ;
-                        return(-1);    
+                        return(-1);
                 }
 
                 context->prikey = prikey ;
@@ -230,7 +230,7 @@ xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
 /**
  * key wrap transform
  */
-static int 
+static int
 xmlSecNssKeyTransportCtxInit(
         xmlSecNssKeyTransportCtxPtr             ctx ,
         xmlSecBufferPtr                         in ,
@@ -267,7 +267,7 @@ xmlSecNssKeyTransportCtxInit(
                         NULL ,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         ctx->material = xmlSecBufferCreate( blockSize ) ;
@@ -277,7 +277,7 @@ xmlSecNssKeyTransportCtxInit(
                         "xmlSecBufferCreate" ,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         /* read raw key material into context */
@@ -287,7 +287,7 @@ xmlSecNssKeyTransportCtxInit(
                         "xmlSecBufferSetData" ,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         if( xmlSecBufferRemoveHead( in , xmlSecBufferGetSize(in) ) < 0 ) {
@@ -296,7 +296,7 @@ xmlSecNssKeyTransportCtxInit(
                         "xmlSecBufferRemoveHead" ,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         return(0);
@@ -305,7 +305,7 @@ xmlSecNssKeyTransportCtxInit(
 /**
  * key wrap transform update
  */
-static int 
+static int
 xmlSecNssKeyTransportCtxUpdate(
         xmlSecNssKeyTransportCtxPtr             ctx ,
         xmlSecBufferPtr                         in ,
@@ -329,7 +329,7 @@ xmlSecNssKeyTransportCtxUpdate(
                         "xmlSecBufferAppend" ,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         if( xmlSecBufferRemoveHead( in , xmlSecBufferGetSize(in) ) < 0 ) {
@@ -338,7 +338,7 @@ xmlSecNssKeyTransportCtxUpdate(
                         "xmlSecBufferRemoveHead" ,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         return(0);
@@ -347,8 +347,8 @@ xmlSecNssKeyTransportCtxUpdate(
 /**
  * Block cipher transform final
  */
-static int 
-xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr in,  xmlSecBufferPtr out, 
+static int
+xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr in,  xmlSecBufferPtr out,
                               int encrypt, xmlSecTransformCtxPtr transformCtx) {
         PK11SymKey*                     symKey ;
         PK11SlotInfo*           slot ;
@@ -372,7 +372,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                         "xmlSecBufferAppend" ,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         if( xmlSecBufferRemoveHead( in , xmlSecBufferGetSize(in) ) < 0 ) {
@@ -381,7 +381,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                         "xmlSecBufferRemoveHead" ,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         /* Now we get all of the key materail */
@@ -400,7 +400,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                         "PK11_GetBlockSize" ,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         result = xmlSecBufferCreate( blockSize * 2 ) ;
@@ -410,7 +410,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                         "xmlSecBufferCreate" ,
                         XMLSEC_ERRORS_R_XMLSEC_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE) ;
-                return(-1);    
+                return(-1);
         }
 
         oriskv.type = siBuffer ;
@@ -432,7 +432,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                                         XMLSEC_ERRORS_NO_MESSAGE ) ;
                                 xmlSecBufferDestroy(result);
-                                return(-1);    
+                                return(-1);
                         }
 
                         id = PK11_ImportPublicKey( slot, ctx->pubkey, PR_FALSE ) ;
@@ -444,7 +444,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                                         XMLSEC_ERRORS_NO_MESSAGE ) ;
                                 xmlSecBufferDestroy(result);
                                 PK11_FreeSlot( slot ) ;
-                                return(-1);    
+                                return(-1);
                         }
                 }
 
@@ -458,7 +458,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                                 XMLSEC_ERRORS_NO_MESSAGE ) ;
                         xmlSecBufferDestroy(result);
                         PK11_FreeSlot( slot ) ;
-                        return(-1);    
+                        return(-1);
                 }
 
                 wrpskv.type = siBuffer ;
@@ -474,7 +474,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                         PK11_FreeSymKey( symKey ) ;
                         xmlSecBufferDestroy(result);
                         PK11_FreeSlot( slot ) ;
-                        return(-1);    
+                        return(-1);
                 }
 
                 if( xmlSecBufferSetSize( result , wrpskv.len ) < 0 ) {
@@ -486,7 +486,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                         PK11_FreeSymKey( symKey ) ;
                         xmlSecBufferDestroy(result);
                         PK11_FreeSlot( slot ) ;
-                        return(-1);    
+                        return(-1);
                 }
                 PK11_FreeSymKey( symKey ) ;
                 PK11_FreeSlot( slot ) ;
@@ -502,7 +502,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                                 XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                                 XMLSEC_ERRORS_NO_MESSAGE ) ;
                         xmlSecBufferDestroy(result);
-                        return(-1);    
+                        return(-1);
                 }
 
                 /* Extract raw data from symmetric key */
@@ -514,7 +514,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                                 XMLSEC_ERRORS_NO_MESSAGE ) ;
                         PK11_FreeSymKey( symKey ) ;
                         xmlSecBufferDestroy(result);
-                        return(-1);    
+                        return(-1);
                 }
 
         keyItem = PK11_GetKeyData( symKey );
@@ -526,7 +526,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                                 XMLSEC_ERRORS_NO_MESSAGE ) ;
                         PK11_FreeSymKey( symKey ) ;
                         xmlSecBufferDestroy(result);
-                        return(-1);    
+                        return(-1);
                 }
 
                 if( xmlSecBufferSetData( result, keyItem->data, keyItem->len ) < 0 ) {
@@ -537,7 +537,7 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                                 XMLSEC_ERRORS_NO_MESSAGE ) ;
                         PK11_FreeSymKey( symKey ) ;
                         xmlSecBufferDestroy(result);
-                        return(-1);    
+                        return(-1);
                 }
                 PK11_FreeSymKey( symKey ) ;
         }
@@ -550,17 +550,17 @@ xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx,  xmlSecBufferPtr
                         XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                         XMLSEC_ERRORS_NO_MESSAGE ) ;
                 xmlSecBufferDestroy(result);
-                return(-1);    
+                return(-1);
         }
         xmlSecBufferDestroy(result);
 
         return(0);
 }
 
-static int 
+static int
 xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
         xmlSecNssKeyTransportCtxPtr     context = NULL ;
-        xmlSecBufferPtr                 inBuf, outBuf ; 
+        xmlSecBufferPtr                 inBuf, outBuf ;
         int                                             operation ;
         int                                             rtv ;
 
@@ -576,7 +576,7 @@ xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
                     "xmlSecNssKeyTransportGetCtx" ,
                     XMLSEC_ERRORS_R_CRYPTO_FAILED ,
                     XMLSEC_ERRORS_NO_MESSAGE ) ;
-                return(-1);    
+                return(-1);
         }
 
         inBuf = &( transform->inBuf ) ;
@@ -591,7 +591,7 @@ xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
                 if( context->material == NULL ) {
                         rtv = xmlSecNssKeyTransportCtxInit( context, inBuf , outBuf , operation , transformCtx ) ;
                         if( rtv < 0 ) {
-                                xmlSecError( XMLSEC_ERRORS_HERE , 
+                                xmlSecError( XMLSEC_ERRORS_HERE ,
                                         xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
                                         "xmlSecNssKeyTransportCtxInit" ,
                                         XMLSEC_ERRORS_R_INVALID_STATUS ,
@@ -601,7 +601,7 @@ xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
                 }
 
                 if( (context->material == NULL) && (last != 0) ) {
-                        xmlSecError( XMLSEC_ERRORS_HERE , 
+                        xmlSecError( XMLSEC_ERRORS_HERE ,
                                 xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
                                 NULL ,
                                 XMLSEC_ERRORS_R_INVALID_STATUS ,
@@ -612,7 +612,7 @@ xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
                 if( context->material != NULL ) {
                         rtv = xmlSecNssKeyTransportCtxUpdate( context, inBuf , outBuf , operation , transformCtx ) ;
                         if( rtv < 0 ) {
-                                xmlSecError( XMLSEC_ERRORS_HERE , 
+                                xmlSecError( XMLSEC_ERRORS_HERE ,
                                         xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
                                         "xmlSecNssKeyTransportCtxUpdate" ,
                                         XMLSEC_ERRORS_R_INVALID_STATUS ,
@@ -620,11 +620,11 @@ xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
                                 return(-1);
                         }
                 }
-                
+
                 if( last ) {
                         rtv = xmlSecNssKeyTransportCtxFinal( context, inBuf , outBuf , operation , transformCtx ) ;
                         if( rtv < 0 ) {
-                                xmlSecError( XMLSEC_ERRORS_HERE , 
+                                xmlSecError( XMLSEC_ERRORS_HERE ,
                                         xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
                                         "xmlSecNssKeyTransportCtxFinal" ,
                                         XMLSEC_ERRORS_R_INVALID_STATUS ,
@@ -635,7 +635,7 @@ xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
                 }
         } else if( transform->status == xmlSecTransformStatusFinished ) {
                 if( xmlSecBufferGetSize( inBuf ) != 0 ) {
-                        xmlSecError( XMLSEC_ERRORS_HERE , 
+                        xmlSecError( XMLSEC_ERRORS_HERE ,
                                 xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
                                 NULL ,
                                 XMLSEC_ERRORS_R_INVALID_STATUS ,
@@ -643,7 +643,7 @@ xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
                         return(-1);
                 }
         } else {
-                xmlSecError( XMLSEC_ERRORS_HERE , 
+                xmlSecError( XMLSEC_ERRORS_HERE ,
                         xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
                         NULL ,
                         XMLSEC_ERRORS_R_INVALID_STATUS ,
@@ -679,19 +679,19 @@ static xmlSecTransformKlass xmlSecNssRsaPkcs1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssKeyTransportExecute,                       /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssTransformRsaPkcs1GetKlass:
  *
  * The RSA-PKCS1 key transport transform klass.
  *
  * Returns: RSA-PKCS1 key transport transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformRsaPkcs1GetKlass(void) {
     return(&xmlSecNssRsaPkcs1Klass);
 }
@@ -722,19 +722,19 @@ static xmlSecTransformKlass xmlSecNssRsaOaepKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssKeyTransportExecute,                       /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssTransformRsaOaepGetKlass:
  *
  * The RSA-PKCS1 key transport transform klass.
  *
  * Returns: RSA-PKCS1 key transport transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformRsaOaepGetKlass(void) {
     return(&xmlSecNssRsaOaepKlass);
 }
diff --git a/src/nss/kw_aes.c b/src/nss/kw_aes.c
index d8dd5f9..8198e1d 100644
--- a/src/nss/kw_aes.c
+++ b/src/nss/kw_aes.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * AES Algorithm support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 #ifndef XMLSEC_NO_AES
@@ -35,9 +35,9 @@
 #define XMLSEC_NSS_AES_BLOCK_SIZE               16
 
 #ifndef NSS_AES_KEYWRAP_BUG_FIXED
-static PK11SymKey*      xmlSecNssMakeAesKey(const xmlSecByte *key, 
+static PK11SymKey*      xmlSecNssMakeAesKey(const xmlSecByte *key,
                                             xmlSecSize keySize, int enc);
-static void             xmlSecNssAesOp(PK11SymKey *aeskey, 
+static void             xmlSecNssAesOp(PK11SymKey *aeskey,
                                        const xmlSecByte *in, xmlSecByte *out,
                                        int enc);
 #endif /* NSS_AES_KEYWRAP_BUG_FIXED */
@@ -56,11 +56,11 @@ static void             xmlSecNssAesOp(PK11SymKey *aeskey,
 
 static int              xmlSecNssKWAesInitialize        (xmlSecTransformPtr transform);
 static void             xmlSecNssKWAesFinalize          (xmlSecTransformPtr transform);
-static int              xmlSecNssKWAesSetKeyReq         (xmlSecTransformPtr transform, 
+static int              xmlSecNssKWAesSetKeyReq         (xmlSecTransformPtr transform,
                                                          xmlSecKeyReqPtr keyReq);
-static int              xmlSecNssKWAesSetKey            (xmlSecTransformPtr transform, 
+static int              xmlSecNssKWAesSetKey            (xmlSecTransformPtr transform,
                                                          xmlSecKeyPtr key);
-static int              xmlSecNssKWAesExecute           (xmlSecTransformPtr transform, 
+static int              xmlSecNssKWAesExecute           (xmlSecTransformPtr transform,
                                                          int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 static xmlSecSize       xmlSecNssKWAesGetKeySize        (xmlSecTransformPtr transform);
@@ -94,7 +94,7 @@ static xmlSecTransformKlass xmlSecNssKWAes128Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssKWAesExecute,                      /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
@@ -121,7 +121,7 @@ static xmlSecTransformKlass xmlSecNssKWAes192Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssKWAesExecute,                      /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
@@ -148,7 +148,7 @@ static xmlSecTransformKlass xmlSecNssKWAes256Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssKWAesExecute,                      /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
@@ -160,49 +160,49 @@ static xmlSecTransformKlass xmlSecNssKWAes256Klass = {
      xmlSecTransformCheckId((transform), xmlSecNssTransformKWAes192Id) || \
      xmlSecTransformCheckId((transform), xmlSecNssTransformKWAes256Id))
 
-/** 
+/**
  * xmlSecNssTransformKWAes128GetKlass:
  *
  * The AES-128 key wrapper transform klass.
  *
  * Returns: AES-128 key wrapper transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformKWAes128GetKlass(void) {
     return(&xmlSecNssKWAes128Klass);
 }
 
-/** 
+/**
  * xmlSecNssTransformKWAes192GetKlass:
  *
  * The AES-192 key wrapper transform klass.
  *
  * Returns: AES-192 key wrapper transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformKWAes192GetKlass(void) {
     return(&xmlSecNssKWAes192Klass);
 }
 
-/** 
+/**
  * xmlSecNssTransformKWAes256GetKlass:
  *
  * The AES-256 key wrapper transform klass.
  *
  * Returns: AES-256 key wrapper transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformKWAes256GetKlass(void) {
     return(&xmlSecNssKWAes256Klass);
 }
 
-static int 
+static int
 xmlSecNssKWAesInitialize(xmlSecTransformPtr transform) {
     int ret;
-    
+
     xmlSecAssert2(xmlSecNssKWAesCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKWAesSize), -1);
-    
+
     ret = xmlSecBufferInitialize(xmlSecNssKWAesGetKey(transform), 0);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -212,21 +212,21 @@ xmlSecNssKWAesInitialize(xmlSecTransformPtr transform) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     return(0);
 }
 
-static void 
+static void
 xmlSecNssKWAesFinalize(xmlSecTransformPtr transform) {
     xmlSecAssert(xmlSecNssKWAesCheckId(transform));
     xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecNssKWAesSize));
-    
+
     if(xmlSecNssKWAesGetKey(transform) != NULL) {
         xmlSecBufferFinalize(xmlSecNssKWAesGetKey(transform));
     }
 }
 
-static int  
+static int
 xmlSecNssKWAesSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecAssert2(xmlSecNssKWAesCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
@@ -241,24 +241,24 @@ xmlSecNssKWAesSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
         keyReq->keyUsage = xmlSecKeyUsageDecrypt;
     }
     keyReq->keyBitsSize = 8 * xmlSecNssKWAesGetKeySize(transform);
-    
+
     return(0);
 }
 
-static int      
+static int
 xmlSecNssKWAesSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecBufferPtr buffer;
     xmlSecSize keySize;
     xmlSecSize expectedKeySize;
     int ret;
-    
+
     xmlSecAssert2(xmlSecNssKWAesCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKWAesSize), -1);
     xmlSecAssert2(xmlSecNssKWAesGetKey(transform) != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecNssKeyDataAesId), -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(xmlSecKeyGetValue(key));
     xmlSecAssert2(buffer != NULL, -1);
 
@@ -273,23 +273,23 @@ xmlSecNssKWAesSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                     keySize, expectedKeySize);
         return(-1);
     }
-        
+
     ret = xmlSecBufferSetData(xmlSecNssKWAesGetKey(transform),
-                            xmlSecBufferGetData(buffer), 
+                            xmlSecBufferGetData(buffer),
                             expectedKeySize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferSetData",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "expected-size=%d", expectedKeySize);
-        return(-1);    
+        return(-1);
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecNssKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecBufferPtr in, out, key;
     xmlSecSize inSize, outSize, keySize, expectedKeySize;
@@ -306,17 +306,17 @@ xmlSecNssKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtx
     keySize = xmlSecBufferGetSize(key);
     expectedKeySize = xmlSecNssKWAesGetKeySize(transform);
     xmlSecAssert2(keySize == expectedKeySize, -1);
-    
+
     in = &(transform->inBuf);
     out = &(transform->outBuf);
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
+    outSize = xmlSecBufferGetSize(out);
     xmlSecAssert2(outSize == 0, -1);
-    
+
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
         /* just do nothing */
     } else  if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
@@ -327,11 +327,11 @@ xmlSecNssKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtx
                         XMLSEC_ERRORS_R_INVALID_SIZE,
                         "size=%d(not 8 bytes aligned)", inSize);
             return(-1);
-        }       
-        
+        }
+
         if(transform->operation == xmlSecTransformOperationEncrypt) {
             /* the encoded key might be 8 bytes longer plus 8 bytes just in case */
-            outSize = inSize + XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE + 
+            outSize = inSize + XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE +
                                XMLSEC_NSS_AES_BLOCK_SIZE;
         } else {
             outSize = inSize + XMLSEC_NSS_AES_BLOCK_SIZE;
@@ -339,7 +339,7 @@ xmlSecNssKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtx
 
         ret = xmlSecBufferSetMaxSize(out, outSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferSetMaxSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -352,7 +352,7 @@ xmlSecNssKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtx
                                    xmlSecBufferGetData(in), inSize,
                                    xmlSecBufferGetData(out), outSize, 1);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecNssKWAesOp",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -365,7 +365,7 @@ xmlSecNssKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtx
                                    xmlSecBufferGetData(in), inSize,
                                    xmlSecBufferGetData(out), outSize, 0);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecNssKWAesOp",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -377,30 +377,30 @@ xmlSecNssKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtx
 
         ret = xmlSecBufferSetSize(out, outSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
-                        "xmlSecBufferSetSize", 
+                        "xmlSecBufferSetSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "outSize=%d", outSize);
             return(-1);
         }
-        
+
         ret = xmlSecBufferRemoveHead(in, inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "inSize%d", inSize);
             return(-1);
         }
-        
+
         transform->status = xmlSecTransformStatusFinished;
     } else if(transform->status == xmlSecTransformStatusFinished) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -410,7 +410,7 @@ xmlSecNssKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtx
     return(0);
 }
 
-static xmlSecSize  
+static xmlSecSize
 xmlSecNssKWAesGetKeySize(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecNssTransformKWAes128Id)) {
         return(XMLSEC_NSS_AES128_KEY_SIZE);
@@ -425,22 +425,22 @@ xmlSecNssKWAesGetKeySize(xmlSecTransformPtr transform) {
 /**
  * http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap:
  *
- * Assume that the data to be wrapped consists of N 64-bit data blocks 
- * denoted P(1), P(2), P(3) ... P(N). The result of wrapping will be N+1 
- * 64-bit blocks denoted C(0), C(1), C(2), ... C(N). The key encrypting 
- * key is represented by K. Assume integers i, j, and t and intermediate 
- * 64-bit register A, 128-bit register B, and array of 64-bit quantities 
+ * Assume that the data to be wrapped consists of N 64-bit data blocks
+ * denoted P(1), P(2), P(3) ... P(N). The result of wrapping will be N+1
+ * 64-bit blocks denoted C(0), C(1), C(2), ... C(N). The key encrypting
+ * key is represented by K. Assume integers i, j, and t and intermediate
+ * 64-bit register A, 128-bit register B, and array of 64-bit quantities
  * R(1) through R(N).
  *
- * "|" represents concatentation so x|y, where x and y and 64-bit quantities, 
- * is the 128-bit quantity with x in the most significant bits and y in the 
- * least significant bits. AES(K)enc(x) is the operation of AES encrypting 
- * the 128-bit quantity x under the key K. AES(K)dec(x) is the corresponding 
- * decryption opteration. XOR(x,y) is the bitwise exclusive or of x and y. 
- * MSB(x) and LSB(y) are the most significant 64 bits and least significant 
+ * "|" represents concatentation so x|y, where x and y and 64-bit quantities,
+ * is the 128-bit quantity with x in the most significant bits and y in the
+ * least significant bits. AES(K)enc(x) is the operation of AES encrypting
+ * the 128-bit quantity x under the key K. AES(K)dec(x) is the corresponding
+ * decryption opteration. XOR(x,y) is the bitwise exclusive or of x and y.
+ * MSB(x) and LSB(y) are the most significant 64 bits and least significant
  * 64 bits of x and y respectively.
  *
- * If N is 1, a single AES operation is performed for wrap or unwrap. 
+ * If N is 1, a single AES operation is performed for wrap or unwrap.
  * If N>1, then 6*N AES operations are performed for wrap or unwrap.
  *
  * The key wrap algorithm is as follows:
@@ -471,7 +471,7 @@ xmlSecNssKWAesGetKeySize(xmlSecTransformPtr transform) {
  *   1. If N is 1:
  *          * B=AES(K)dec(C(0)|C(1))
  *          * P(1)=LSB(B)
- *          * If MSB(B) is 0xA6A6A6A6A6A6A6A6, return success. Otherwise, 
+ *          * If MSB(B) is 0xA6A6A6A6A6A6A6A6, return success. Otherwise,
  *            return an integrity check failure error.
  *      If N>1, perform the following steps:
  *   2. Initialize the variables:
@@ -488,16 +488,16 @@ xmlSecNssKWAesGetKeySize(xmlSecTransformPtr transform) {
  *   4. Output the results:
  *          * For i=1 to N,
  *            P(i)=R(i)
- *          * If A is 0xA6A6A6A6A6A6A6A6, return success. Otherwise, return 
+ *          * If A is 0xA6A6A6A6A6A6A6A6, return success. Otherwise, return
  *            an integrity check failure error.
  */
 
 #ifndef NSS_AES_KEYWRAP_BUG_FIXED
-static const xmlSecByte xmlSecNssKWAesMagicBlock[XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE] = { 
+static const xmlSecByte xmlSecNssKWAesMagicBlock[XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE] = {
     0xA6,  0xA6,  0xA6,  0xA6,  0xA6,  0xA6,  0xA6,  0xA6
 };
-                                                
-static int      
+
+static int
 xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
                  const xmlSecByte *in, xmlSecSize inSize,
                  xmlSecByte *out, xmlSecSize outSize, int enc) {
@@ -506,7 +506,7 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
     int N, i, j, t;
     int result = -1;
     PK11SymKey *aeskey = NULL;
-    
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(keySize > 0, -1);
     xmlSecAssert2(in != NULL, -1);
@@ -517,14 +517,14 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
     if (enc == 1) {
         aeskey = xmlSecNssMakeAesKey(key, keySize, enc);
         if(aeskey == NULL) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlSecNssMakeAesKey",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             goto done;
         }
-    
+
         /* prepend magic block */
         if(in != out) {
             memcpy(out + XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE, in, inSize);
@@ -532,7 +532,7 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
             memmove(out + XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE, out, inSize);
         }
         memcpy(out, xmlSecNssKWAesMagicBlock, XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE);
-        
+
         N = (inSize / 8);
         if(N == 1) {
             xmlSecNssAesOp(aeskey, out, out, enc);
@@ -541,10 +541,10 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
                 for(i = 1; i <= N; ++i) {
                     t = i + (j * N);
                     p = out + i * 8;
-    
+
                     memcpy(block, out, 8);
                     memcpy(block + 8, p, 8);
-                
+
                     xmlSecNssAesOp(aeskey, block, block, enc);
                     block[7] ^=  t;
                     memcpy(out, block, 8);
@@ -552,24 +552,24 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
                 }
             }
         }
-        
+
         result = inSize + 8;
     } else {
         aeskey = xmlSecNssMakeAesKey(key, keySize, enc);
         if(aeskey == NULL) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlSecNssMakeAesKey",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             goto done;
         }
-        
+
         /* copy input */
         if(in != out) {
             memcpy(out, in, inSize);
         }
-            
+
         N = (inSize / 8) - 1;
         if(N == 1) {
             xmlSecNssAesOp(aeskey, out, out, enc);
@@ -578,11 +578,11 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
                 for(i = N; i > 0; --i) {
                     t = i + (j * N);
                     p = out + i * 8;
-    
+
                     memcpy(block, out, 8);
                     memcpy(block + 8, p, 8);
                     block[7] ^= t;
-                
+
                     xmlSecNssAesOp(aeskey, block, block, enc);
                     memcpy(out, block, 8);
                     memcpy(p, block + 8, 8);
@@ -591,16 +591,16 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
         }
         /* do not left data in memory */
         memset(block, 0, sizeof(block));
-        
+
         if(memcmp(xmlSecNssKWAesMagicBlock, out, XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE) != 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
                         "bad magic block");
             goto done;
         }
-        
+
         memmove(out, out + XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE, inSize - XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE);
         result = (inSize - XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE);
     }
@@ -619,7 +619,7 @@ xmlSecNssMakeAesKey(const xmlSecByte *key, xmlSecSize keySize, int enc) {
     PK11SlotInfo*      slot = NULL;
     PK11SymKey*        aeskey = NULL;
     SECItem            keyItem;
-    
+
     xmlSecAssert2(key != NULL, NULL);
     xmlSecAssert2(keySize > 0, NULL);
 
@@ -636,7 +636,7 @@ xmlSecNssMakeAesKey(const xmlSecByte *key, xmlSecSize keySize, int enc) {
 
     keyItem.data = (unsigned char *)key;
     keyItem.len = keySize;
-    aeskey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap, 
+    aeskey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap,
                                enc ? CKA_ENCRYPT : CKA_DECRYPT, &keyItem, NULL);
     if (aeskey == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -681,8 +681,8 @@ xmlSecNssAesOp(PK11SymKey *aeskey, const xmlSecByte *in, xmlSecByte *out,
         goto done;
     }
 
-    EncContext = PK11_CreateContextBySymKey(cipherMech, 
-                                            enc ? CKA_ENCRYPT : CKA_DECRYPT, 
+    EncContext = PK11_CreateContextBySymKey(cipherMech,
+                                            enc ? CKA_ENCRYPT : CKA_DECRYPT,
                                             aeskey, SecParam);
     if (EncContext == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -694,8 +694,8 @@ xmlSecNssAesOp(PK11SymKey *aeskey, const xmlSecByte *in, xmlSecByte *out,
     }
 
     tmp1_outlen = tmp2_outlen = 0;
-    rv = PK11_CipherOp(EncContext, out, &tmp1_outlen, 
-                       XMLSEC_NSS_AES_BLOCK_SIZE, (unsigned char *)in, 
+    rv = PK11_CipherOp(EncContext, out, &tmp1_outlen,
+                       XMLSEC_NSS_AES_BLOCK_SIZE, (unsigned char *)in,
                        XMLSEC_NSS_AES_BLOCK_SIZE);
     if (rv != SECSuccess) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -706,7 +706,7 @@ xmlSecNssAesOp(PK11SymKey *aeskey, const xmlSecByte *in, xmlSecByte *out,
         goto done;
     }
 
-    rv = PK11_DigestFinal(EncContext, out+tmp1_outlen, 
+    rv = PK11_DigestFinal(EncContext, out+tmp1_outlen,
                           &tmp2_outlen, XMLSEC_NSS_AES_BLOCK_SIZE-tmp1_outlen);
     if (rv != SECSuccess) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -740,9 +740,9 @@ done:
 
 /* NSS implements the AES Key Wrap algorithm described at
  * http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap
- */ 
+ */
 
-static int      
+static int
 xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
                  const xmlSecByte *in, xmlSecSize inSize,
                  xmlSecByte *out, xmlSecSize outSize, int enc) {
@@ -757,7 +757,7 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
     int                result_len = -1;
     int                tmp1_outlen;
     unsigned int       tmp2_outlen;
-    
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(keySize > 0, -1);
     xmlSecAssert2(in != NULL, -1);
@@ -778,7 +778,7 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
 
     keyItem.data = (unsigned char *)key;
     keyItem.len = keySize;
-    aeskey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap, 
+    aeskey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap,
                                enc ? CKA_ENCRYPT : CKA_DECRYPT, &keyItem, NULL);
     if (aeskey == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -799,8 +799,8 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
         goto done;
     }
 
-    EncContext = PK11_CreateContextBySymKey(cipherMech, 
-                                            enc ? CKA_ENCRYPT : CKA_DECRYPT, 
+    EncContext = PK11_CreateContextBySymKey(cipherMech,
+                                            enc ? CKA_ENCRYPT : CKA_DECRYPT,
                                             aeskey, SecParam);
     if (EncContext == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -823,7 +823,7 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
         goto done;
     }
 
-    rv = PK11_DigestFinal(EncContext, out+tmp1_outlen, 
+    rv = PK11_DigestFinal(EncContext, out+tmp1_outlen,
                           &tmp2_outlen, outSize-tmp1_outlen);
     if (rv != SECSuccess) {
         xmlSecError(XMLSEC_ERRORS_HERE,
diff --git a/src/nss/kw_des.c b/src/nss/kw_des.c
index c738c04..dd185d6 100644
--- a/src/nss/kw_des.c
+++ b/src/nss/kw_des.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * DES Algorithm support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for precise wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 
@@ -33,9 +33,9 @@
 #define XMLSEC_NSS_DES3_IV_LENGTH                           8
 #define XMLSEC_NSS_DES3_BLOCK_LENGTH                        8
 
-static xmlSecByte *xmlSecNssComputeSHA1(const xmlSecByte *in, 
-                                        xmlSecSize inSize, 
-                                        xmlSecByte *out, 
+static xmlSecByte *xmlSecNssComputeSHA1(const xmlSecByte *in,
+                                        xmlSecSize inSize,
+                                        xmlSecByte *out,
                                         xmlSecSize outSize);
 
 
@@ -53,11 +53,11 @@ static xmlSecByte *xmlSecNssComputeSHA1(const xmlSecByte *in,
 
 static int      xmlSecNssKWDes3Initialize               (xmlSecTransformPtr transform);
 static void     xmlSecNssKWDes3Finalize                 (xmlSecTransformPtr transform);
-static int      xmlSecNssKWDes3SetKeyReq                (xmlSecTransformPtr transform, 
+static int      xmlSecNssKWDes3SetKeyReq                (xmlSecTransformPtr transform,
                                                          xmlSecKeyReqPtr keyReq);
-static int      xmlSecNssKWDes3SetKey                   (xmlSecTransformPtr transform, 
+static int      xmlSecNssKWDes3SetKey                   (xmlSecTransformPtr transform,
                                                          xmlSecKeyPtr key);
-static int      xmlSecNssKWDes3Execute                  (xmlSecTransformPtr transform, 
+static int      xmlSecNssKWDes3Execute                  (xmlSecTransformPtr transform,
                                                          int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 static int      xmlSecNssKWDes3Encode                   (const xmlSecByte *key,
@@ -72,16 +72,16 @@ static int      xmlSecNssKWDes3Decode                   (const xmlSecByte *key,
                                                          xmlSecSize inSize,
                                                          xmlSecByte *out,
                                                          xmlSecSize outSize);
-static int      xmlSecNssKWDes3Encrypt                  (const xmlSecByte *key, 
+static int      xmlSecNssKWDes3Encrypt                  (const xmlSecByte *key,
                                                          xmlSecSize keySize,
                                                          const xmlSecByte *iv,
                                                          xmlSecSize ivSize,
-                                                         const xmlSecByte *in, 
+                                                         const xmlSecByte *in,
                                                          xmlSecSize inSize,
                                                          xmlSecByte *out,
-                                                         xmlSecSize outSize, 
+                                                         xmlSecSize outSize,
                                                          int enc);
-static int      xmlSecNssKWDes3BufferReverse            (xmlSecByte *buf, 
+static int      xmlSecNssKWDes3BufferReverse            (xmlSecByte *buf,
                                                          xmlSecSize size);
 
 static xmlSecTransformKlass xmlSecNssKWDes3Klass = {
@@ -106,30 +106,30 @@ static xmlSecTransformKlass xmlSecNssKWDes3Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssKWDes3Execute,                     /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssTransformKWDes3GetKlass:
- * 
+ *
  * The Triple DES key wrapper transform klass.
  *
  * Returns: Triple DES key wrapper transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformKWDes3GetKlass(void) {
     return(&xmlSecNssKWDes3Klass);
 }
 
-static int 
+static int
 xmlSecNssKWDes3Initialize(xmlSecTransformPtr transform) {
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecNssTransformKWDes3Id), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKWDes3Size), -1);
-    
+
     ret = xmlSecBufferInitialize(xmlSecNssKWDes3GetKey(transform), 0);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -139,21 +139,21 @@ xmlSecNssKWDes3Initialize(xmlSecTransformPtr transform) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     return(0);
 }
 
-static void 
+static void
 xmlSecNssKWDes3Finalize(xmlSecTransformPtr transform) {
     xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecNssTransformKWDes3Id));
     xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecNssKWDes3Size));
-    
+
     if(xmlSecNssKWDes3GetKey(transform) != NULL) {
         xmlSecBufferFinalize(xmlSecNssKWDes3GetKey(transform));
     }
 }
 
-static int  
+static int
 xmlSecNssKWDes3SetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecNssTransformKWDes3Id), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
@@ -171,19 +171,19 @@ xmlSecNssKWDes3SetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq)
     return(0);
 }
 
-static int      
+static int
 xmlSecNssKWDes3SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecBufferPtr buffer;
     xmlSecSize keySize;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecNssTransformKWDes3Id), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKWDes3Size), -1);
     xmlSecAssert2(xmlSecNssKWDes3GetKey(transform) != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecNssKeyDataDesId), -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(xmlSecKeyGetValue(key));
     xmlSecAssert2(buffer != NULL, -1);
 
@@ -197,23 +197,23 @@ xmlSecNssKWDes3SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                     keySize, XMLSEC_NSS_DES3_KEY_LENGTH);
         return(-1);
     }
-        
+
     ret = xmlSecBufferSetData(xmlSecNssKWDes3GetKey(transform),
-                            xmlSecBufferGetData(buffer), 
+                            xmlSecBufferGetData(buffer),
                             XMLSEC_NSS_DES3_KEY_LENGTH);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferSetData",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", XMLSEC_NSS_DES3_KEY_LENGTH);
-        return(-1);    
+        return(-1);
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecNssKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecBufferPtr in, out, key;
     xmlSecSize inSize, outSize, keySize;
@@ -229,17 +229,17 @@ xmlSecNssKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
 
     keySize = xmlSecBufferGetSize(key);
     xmlSecAssert2(keySize == XMLSEC_NSS_DES3_KEY_LENGTH, -1);
-    
+
     in = &(transform->inBuf);
     out = &(transform->outBuf);
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
+    outSize = xmlSecBufferGetSize(out);
     xmlSecAssert2(outSize == 0, -1);
-    
+
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
         /* just do nothing */
     } else  if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
@@ -248,11 +248,11 @@ xmlSecNssKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_SIZE,
-                        "%d bytes - not %d bytes aligned", 
+                        "%d bytes - not %d bytes aligned",
                         inSize, XMLSEC_NSS_DES3_BLOCK_LENGTH);
             return(-1);
-        }       
-        
+        }
+
         if(transform->operation == xmlSecTransformOperationEncrypt) {
             /* the encoded key might be 16 bytes longer plus one block just in case */
             outSize = inSize + XMLSEC_NSS_DES3_IV_LENGTH +
@@ -264,7 +264,7 @@ xmlSecNssKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
 
         ret = xmlSecBufferSetMaxSize(out, outSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferSetMaxSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -277,7 +277,7 @@ xmlSecNssKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
                                             xmlSecBufferGetData(in), inSize,
                                             xmlSecBufferGetData(out), outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecNssKWDes3Encode",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -291,7 +291,7 @@ xmlSecNssKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
                                             xmlSecBufferGetData(in), inSize,
                                             xmlSecBufferGetData(out), outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecNssKWDes3Decode",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -304,30 +304,30 @@ xmlSecNssKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
 
         ret = xmlSecBufferSetSize(out, outSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferSetSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", outSize);
             return(-1);
         }
-        
+
         ret = xmlSecBufferRemoveHead(in, inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", inSize);
             return(-1);
         }
-        
+
         transform->status = xmlSecTransformStatusFinished;
     } else if(transform->status == xmlSecTransformStatusFinished) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -337,39 +337,39 @@ xmlSecNssKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
     return(0);
 }
 
-static xmlSecByte xmlSecNssKWDes3Iv[XMLSEC_NSS_DES3_IV_LENGTH] = { 
-    0x4a, 0xdd, 0xa2, 0x2c, 0x79, 0xe8, 0x21, 0x05 
+static xmlSecByte xmlSecNssKWDes3Iv[XMLSEC_NSS_DES3_IV_LENGTH] = {
+    0x4a, 0xdd, 0xa2, 0x2c, 0x79, 0xe8, 0x21, 0x05
 };
 /**
  * CMS Triple DES Key Wrap
  *
  * http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap
  *
- * The following algorithm wraps (encrypts) a key (the wrapped key, WK) 
+ * The following algorithm wraps (encrypts) a key (the wrapped key, WK)
  * under a TRIPLEDES key-encryption-key (KEK) as specified in [CMS-Algorithms]:
  *
- * 1. Represent the key being wrapped as an octet sequence. If it is a 
- *    TRIPLEDES key, this is 24 octets (192 bits) with odd parity bit as 
+ * 1. Represent the key being wrapped as an octet sequence. If it is a
+ *    TRIPLEDES key, this is 24 octets (192 bits) with odd parity bit as
  *    the bottom bit of each octet.
  * 2. Compute the CMS key checksum (section 5.6.1) call this CKS.
  * 3. Let WKCKS = WK || CKS, where || is concatenation.
  * 4. Generate 8 random octets [RANDOM] and call this IV.
- * 5. Encrypt WKCKS in CBC mode using KEK as the key and IV as the 
+ * 5. Encrypt WKCKS in CBC mode using KEK as the key and IV as the
  *    initialization vector. Call the results TEMP1.
  * 6. Left TEMP2 = IV || TEMP1.
  * 7. Reverse the order of the octets in TEMP2 and call the result TEMP3.
- * 8. Encrypt TEMP3 in CBC mode using the KEK and an initialization vector 
- *    of 0x4adda22c79e82105. The resulting cipher text is the desired result. 
+ * 8. Encrypt TEMP3 in CBC mode using the KEK and an initialization vector
+ *    of 0x4adda22c79e82105. The resulting cipher text is the desired result.
  *    It is 40 octets long if a 168 bit key is being wrapped.
  *
  */
-static int      
+static int
 xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                         const xmlSecByte *in, xmlSecSize inSize,
                         xmlSecByte *out, xmlSecSize outSize) {
-    xmlSecByte sha1[SHA1_LENGTH];    
+    xmlSecByte sha1[SHA1_LENGTH];
     xmlSecByte iv[XMLSEC_NSS_DES3_IV_LENGTH];
-    xmlSecSize s;    
+    xmlSecSize s;
     int ret;
     SECStatus status;
 
@@ -387,13 +387,13 @@ xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecNssComputeSHA1",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
 
     /* step 3: construct WKCKS */
     memcpy(out, in, inSize);
     memcpy(out + inSize, sha1, XMLSEC_NSS_DES3_BLOCK_LENGTH);
-    
+
     /* step 4: generate random iv */
     status = PK11_GenerateRandom(iv, XMLSEC_NSS_DES3_IV_LENGTH);
     if(status != SECSuccess) {
@@ -402,13 +402,13 @@ xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                     "PK11_GenerateRandom",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);    
-    }   
+        return(-1);
+    }
 
     /* step 5: first encryption, result is TEMP1 */
-    ret = xmlSecNssKWDes3Encrypt(key, keySize, 
-                                    iv, XMLSEC_NSS_DES3_IV_LENGTH, 
-                                    out, inSize + XMLSEC_NSS_DES3_BLOCK_LENGTH, 
+    ret = xmlSecNssKWDes3Encrypt(key, keySize,
+                                    iv, XMLSEC_NSS_DES3_IV_LENGTH,
+                                    out, inSize + XMLSEC_NSS_DES3_BLOCK_LENGTH,
                                     out, outSize, 1);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -416,15 +416,15 @@ xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecNssKWDes3Encrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
 
     /* step 6: construct TEMP2=IV || TEMP1 */
-    memmove(out + XMLSEC_NSS_DES3_IV_LENGTH, out, 
+    memmove(out + XMLSEC_NSS_DES3_IV_LENGTH, out,
             inSize + XMLSEC_NSS_DES3_IV_LENGTH);
     memcpy(out, iv, XMLSEC_NSS_DES3_IV_LENGTH);
-    s = ret + XMLSEC_NSS_DES3_IV_LENGTH; 
-    
+    s = ret + XMLSEC_NSS_DES3_IV_LENGTH;
+
     /* step 7: reverse octets order, result is TEMP3 */
     ret = xmlSecNssKWDes3BufferReverse(out, s);
     if(ret < 0) {
@@ -433,11 +433,11 @@ xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecNssKWDes3BufferReverse",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
 
     /* step 8: second encryption with static IV */
-    ret = xmlSecNssKWDes3Encrypt(key, keySize, 
+    ret = xmlSecNssKWDes3Encrypt(key, keySize,
                                     xmlSecNssKWDes3Iv, XMLSEC_NSS_DES3_IV_LENGTH,
                                     out, s, out, outSize, 1);
     if(ret < 0) {
@@ -446,9 +446,9 @@ xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecNssKWDes3Encrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
-    s = ret; 
+    s = ret;
     return(s);
 }
 
@@ -457,33 +457,33 @@ xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
  *
  * http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap
  *
- * The following algorithm unwraps (decrypts) a key as specified in 
+ * The following algorithm unwraps (decrypts) a key as specified in
  * [CMS-Algorithms]:
  *
- * 1. Check if the length of the cipher text is reasonable given the key type. 
- *    It must be 40 bytes for a 168 bit key and either 32, 40, or 48 bytes for 
- *    a 128, 192, or 256 bit key. If the length is not supported or inconsistent 
+ * 1. Check if the length of the cipher text is reasonable given the key type.
+ *    It must be 40 bytes for a 168 bit key and either 32, 40, or 48 bytes for
+ *    a 128, 192, or 256 bit key. If the length is not supported or inconsistent
  *    with the algorithm for which the key is intended, return error.
- * 2. Decrypt the cipher text with TRIPLEDES in CBC mode using the KEK and 
+ * 2. Decrypt the cipher text with TRIPLEDES in CBC mode using the KEK and
  *    an initialization vector (IV) of 0x4adda22c79e82105. Call the output TEMP3.
  * 3. Reverse the order of the octets in TEMP3 and call the result TEMP2.
- * 4. Decompose TEMP2 into IV, the first 8 octets, and TEMP1, the remaining 
+ * 4. Decompose TEMP2 into IV, the first 8 octets, and TEMP1, the remaining
  *    octets.
- * 5. Decrypt TEMP1 using TRIPLEDES in CBC mode using the KEK and the IV found 
+ * 5. Decrypt TEMP1 using TRIPLEDES in CBC mode using the KEK and the IV found
  *    in the previous step. Call the result WKCKS.
- * 6. Decompose WKCKS. CKS is the last 8 octets and WK, the wrapped key, are 
+ * 6. Decompose WKCKS. CKS is the last 8 octets and WK, the wrapped key, are
  *    those octets before the CKS.
- * 7. Calculate a CMS key checksum (section 5.6.1) over the WK and compare 
- *    with the CKS extracted in the above step. If they are not equal, return 
+ * 7. Calculate a CMS key checksum (section 5.6.1) over the WK and compare
+ *    with the CKS extracted in the above step. If they are not equal, return
  *    error.
  * 8. WK is the wrapped key, now extracted for use in data decryption.
  */
-static int      
+static int
 xmlSecNssKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                         const xmlSecByte *in, xmlSecSize inSize,
                         xmlSecByte *out, xmlSecSize outSize) {
-    xmlSecByte sha1[SHA1_LENGTH];    
-    xmlSecSize s;    
+    xmlSecByte sha1[SHA1_LENGTH];
+    xmlSecSize s;
     int ret;
 
     xmlSecAssert2(key != NULL, -1);
@@ -494,7 +494,7 @@ xmlSecNssKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
     xmlSecAssert2(outSize >= inSize, -1);
 
     /* step 2: first decryption with static IV, result is TEMP3 */
-    ret = xmlSecNssKWDes3Encrypt(key, keySize, 
+    ret = xmlSecNssKWDes3Encrypt(key, keySize,
                                     xmlSecNssKWDes3Iv, XMLSEC_NSS_DES3_IV_LENGTH,
                                     in, inSize, out, outSize, 0);
     if((ret < 0) || (ret < XMLSEC_NSS_DES3_IV_LENGTH)) {
@@ -503,10 +503,10 @@ xmlSecNssKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecNssKWDes3Encrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
-    s = ret; 
-    
+    s = ret;
+
     /* step 3: reverse octets order in TEMP3, result is TEMP2 */
     ret = xmlSecNssKWDes3BufferReverse(out, s);
     if(ret < 0) {
@@ -515,14 +515,14 @@ xmlSecNssKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecNssKWDes3BufferReverse",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
 
     /* steps 4 and 5: get IV and decrypt second time, result is WKCKS */
-    ret = xmlSecNssKWDes3Encrypt(key, keySize, 
+    ret = xmlSecNssKWDes3Encrypt(key, keySize,
                                      out, XMLSEC_NSS_DES3_IV_LENGTH,
-                                     out + XMLSEC_NSS_DES3_IV_LENGTH, 
-                                     s - XMLSEC_NSS_DES3_IV_LENGTH, 
+                                     out + XMLSEC_NSS_DES3_IV_LENGTH,
+                                     s - XMLSEC_NSS_DES3_IV_LENGTH,
                                      out, outSize, 0);
     if((ret < 0) || (ret < XMLSEC_NSS_DES3_BLOCK_LENGTH)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -530,10 +530,10 @@ xmlSecNssKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecNssKWDes3Encrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
-    s = ret - XMLSEC_NSS_DES3_BLOCK_LENGTH; 
-    
+    s = ret - XMLSEC_NSS_DES3_BLOCK_LENGTH;
+
     /* steps 6 and 7: calculate SHA1 and validate it */
     if(xmlSecNssComputeSHA1(out, s, sha1, SHA1_LENGTH) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -541,7 +541,7 @@ xmlSecNssKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecNssComputeSHA1",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
 
     if(memcmp(sha1, out + s, XMLSEC_NSS_DES3_BLOCK_LENGTH) != 0) {
@@ -550,9 +550,9 @@ xmlSecNssKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_DATA,
                     "SHA1 does not match");
-        return(-1);         
+        return(-1);
     }
-    
+
     return(s);
 }
 
@@ -580,7 +580,7 @@ xmlSecNssKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
     xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
-    
+
     cipherMech = CKM_DES3_CBC;
     slot = PK11_GetBestSlot(cipherMech, NULL);
     if (slot == NULL) {
@@ -594,7 +594,7 @@ xmlSecNssKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
 
     keyItem.data = (unsigned char *)key;
     keyItem.len = keySize;
-    SymKey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap, 
+    SymKey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap,
                                enc ? CKA_ENCRYPT : CKA_DECRYPT, &keyItem, NULL);
     if (SymKey == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -618,7 +618,7 @@ xmlSecNssKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
         goto done;
     }
 
-    EncContext = PK11_CreateContextBySymKey(cipherMech, 
+    EncContext = PK11_CreateContextBySymKey(cipherMech,
                                             enc ? CKA_ENCRYPT : CKA_DECRYPT,
                                             SymKey, SecParam);
     if (EncContext == NULL) {
@@ -642,7 +642,7 @@ xmlSecNssKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
         goto done;
     }
 
-    rv = PK11_DigestFinal(EncContext, out+tmp1_outlen, 
+    rv = PK11_DigestFinal(EncContext, out+tmp1_outlen,
                           &tmp2_outlen, outSize-tmp1_outlen);
     if (rv != SECSuccess) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -670,16 +670,16 @@ done:
     }
 
     return(result_len);
-}             
+}
 
-static int 
+static int
 xmlSecNssKWDes3BufferReverse(xmlSecByte *buf, xmlSecSize size) {
     xmlSecSize s;
     xmlSecSize i;
     xmlSecByte c;
-    
+
     xmlSecAssert2(buf != NULL, -1);
-    
+
     s = size / 2;
     --size;
     for(i = 0; i < s; ++i) {
@@ -691,7 +691,7 @@ xmlSecNssKWDes3BufferReverse(xmlSecByte *buf, xmlSecSize size) {
 }
 
 static xmlSecByte *
-xmlSecNssComputeSHA1(const xmlSecByte *in, xmlSecSize inSize, 
+xmlSecNssComputeSHA1(const xmlSecByte *in, xmlSecSize inSize,
                      xmlSecByte *out, xmlSecSize outSize)
 {
     PK11Context *context = NULL;
@@ -715,7 +715,7 @@ xmlSecNssComputeSHA1(const xmlSecByte *in, xmlSecSize inSize,
     }
 
     s = PK11_DigestBegin(context);
-    if (s != SECSuccess) { 
+    if (s != SECSuccess) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "PK11_DigestBegin",
diff --git a/src/nss/pkikeys.c b/src/nss/pkikeys.c
index 818b2c8..ae9e29b 100644
--- a/src/nss/pkikeys.c
+++ b/src/nss/pkikeys.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 #include "globals.h"
@@ -30,12 +30,12 @@
  * Internal NSS PKI key CTX
  *
  *************************************************************************/
-typedef struct _xmlSecNssPKIKeyDataCtx  xmlSecNssPKIKeyDataCtx, 
+typedef struct _xmlSecNssPKIKeyDataCtx  xmlSecNssPKIKeyDataCtx,
                                                 *xmlSecNssPKIKeyDataCtxPtr;
 struct _xmlSecNssPKIKeyDataCtx {
     SECKEYPublicKey  *pubkey;
     SECKEYPrivateKey *privkey;
-};          
+};
 
 /******************************************************************************
  *
@@ -45,7 +45,7 @@ struct _xmlSecNssPKIKeyDataCtx {
  *
  *****************************************************************************/
 #define xmlSecNssPKIKeyDataSize \
-    (sizeof(xmlSecKeyData) + sizeof(xmlSecNssPKIKeyDataCtx))    
+    (sizeof(xmlSecKeyData) + sizeof(xmlSecNssPKIKeyDataCtx))
 #define xmlSecNssPKIKeyDataGetCtx(data) \
     ((xmlSecNssPKIKeyDataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
 
@@ -55,9 +55,9 @@ static void             xmlSecNssPKIKeyDataFinalize     (xmlSecKeyDataPtr data);
 
 
 static void             xmlSecNSSPKIKeyDataCtxFree      (xmlSecNssPKIKeyDataCtxPtr ctx);
-static int              xmlSecNSSPKIKeyDataCtxDup       (xmlSecNssPKIKeyDataCtxPtr ctxDst, 
+static int              xmlSecNSSPKIKeyDataCtxDup       (xmlSecNssPKIKeyDataCtxPtr ctxDst,
                                                          xmlSecNssPKIKeyDataCtxPtr ctxSrc);
-static int              xmlSecNssPKIKeyDataAdoptKey     (xmlSecKeyDataPtr data, 
+static int              xmlSecNssPKIKeyDataAdoptKey     (xmlSecKeyDataPtr data,
                                                          SECKEYPrivateKey *privkey,
                                                          SECKEYPublicKey  *pubkey);
 
@@ -81,19 +81,19 @@ xmlSecNssPKIKeyDataInitialize(xmlSecKeyDataPtr data) {
 static void
 xmlSecNssPKIKeyDataFinalize(xmlSecKeyDataPtr data) {
     xmlSecNssPKIKeyDataCtxPtr ctx;
-    
+
     xmlSecAssert(xmlSecKeyDataIsValid(data));
     xmlSecAssert(xmlSecKeyDataCheckSize(data, xmlSecNssPKIKeyDataSize));
 
     ctx = xmlSecNssPKIKeyDataGetCtx(data);
     xmlSecAssert(ctx != NULL);
-    
+
     xmlSecNSSPKIKeyDataCtxFree(ctx);
     memset(ctx, 0, sizeof(xmlSecNssPKIKeyDataCtx));
 }
 
 
-static void             
+static void
 xmlSecNSSPKIKeyDataCtxFree(xmlSecNssPKIKeyDataCtxPtr ctx)
 {
     xmlSecAssert(ctx != NULL);
@@ -110,8 +110,8 @@ xmlSecNSSPKIKeyDataCtxFree(xmlSecNssPKIKeyDataCtxPtr ctx)
 
 }
 
-static int              
-xmlSecNSSPKIKeyDataCtxDup(xmlSecNssPKIKeyDataCtxPtr ctxDst, 
+static int
+xmlSecNSSPKIKeyDataCtxDup(xmlSecNssPKIKeyDataCtxPtr ctxDst,
                           xmlSecNssPKIKeyDataCtxPtr ctxSrc)
 {
     xmlSecNSSPKIKeyDataCtxFree(ctxDst);
@@ -141,15 +141,15 @@ xmlSecNSSPKIKeyDataCtxDup(xmlSecNssPKIKeyDataCtxPtr ctxDst,
     return (0);
 }
 
-static int              
+static int
 xmlSecNssPKIKeyDataAdoptKey(xmlSecKeyDataPtr data,
-                            SECKEYPrivateKey *privkey,                        
+                            SECKEYPrivateKey *privkey,
                             SECKEYPublicKey  *pubkey)
 {
     xmlSecNssPKIKeyDataCtxPtr ctx;
         KeyType                                 pubType = nullKey ;
         KeyType                                 priType = nullKey ;
-    
+
     xmlSecAssert2(xmlSecKeyDataIsValid(data), -1);
     xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecNssPKIKeyDataSize), -1);
 
@@ -174,9 +174,9 @@ xmlSecNssPKIKeyDataAdoptKey(xmlSecKeyDataPtr data,
 
     ctx = xmlSecNssPKIKeyDataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     if (ctx->privkey) {
-        SECKEY_DestroyPrivateKey(ctx->privkey); 
+        SECKEY_DestroyPrivateKey(ctx->privkey);
     }
     ctx->privkey = privkey;
 
@@ -199,14 +199,14 @@ xmlSecNssPKIKeyDataAdoptKey(xmlSecKeyDataPtr data,
  * Returns: pointer to KeyData object or NULL if an error occurs.
  */
 xmlSecKeyDataPtr
-xmlSecNssPKIAdoptKey(SECKEYPrivateKey *privkey,                        
+xmlSecNssPKIAdoptKey(SECKEYPrivateKey *privkey,
                      SECKEYPublicKey  *pubkey)
 {
     xmlSecKeyDataPtr data = NULL;
     int ret;
         KeyType                                 pubType = nullKey ;
         KeyType                                 priType = nullKey ;
-    
+
         if( privkey != NULL ) {
                 priType = SECKEY_GetPrivateKeyType( privkey ) ;
         }
@@ -225,10 +225,10 @@ xmlSecNssPKIAdoptKey(SECKEYPrivateKey *privkey,
                         return( NULL ) ;
                 }
         }
-   
+
         pubType = priType != nullKey ? priType : pubType ;
-    switch(pubType) {   
-#ifndef XMLSEC_NO_RSA    
+    switch(pubType) {
+#ifndef XMLSEC_NO_RSA
     case rsaKey:
         data = xmlSecKeyDataCreate(xmlSecNssKeyDataRsaId);
         if(data == NULL) {
@@ -237,11 +237,11 @@ xmlSecNssPKIAdoptKey(SECKEYPrivateKey *privkey,
                         "xmlSecKeyDataCreate",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "xmlSecNssKeyDataRsaId");
-            return(NULL);           
+            return(NULL);
         }
         break;
-#endif /* XMLSEC_NO_RSA */      
-#ifndef XMLSEC_NO_DSA   
+#endif /* XMLSEC_NO_RSA */
+#ifndef XMLSEC_NO_DSA
     case dsaKey:
         data = xmlSecKeyDataCreate(xmlSecNssKeyDataDsaId);
         if(data == NULL) {
@@ -250,11 +250,11 @@ xmlSecNssPKIAdoptKey(SECKEYPrivateKey *privkey,
                         "xmlSecKeyDataCreate",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "xmlSecNssKeyDataDsaId");
-            return(NULL);           
+            return(NULL);
         }
         break;
-#endif /* XMLSEC_NO_DSA */      
-    default:    
+#endif /* XMLSEC_NO_DSA */
+    default:
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
@@ -263,16 +263,16 @@ xmlSecNssPKIAdoptKey(SECKEYPrivateKey *privkey,
         return(NULL);
     }
 
-    xmlSecAssert2(data != NULL, NULL);    
+    xmlSecAssert2(data != NULL, NULL);
     ret = xmlSecNssPKIKeyDataAdoptKey(data, privkey, pubkey);
-    if(ret < 0) {       
+    if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecNssPKIKeyDataAdoptKey",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDataDestroy(data);
-        return(NULL);       
+        return(NULL);
     }
     return(data);
 }
@@ -333,7 +333,7 @@ xmlSecNssPKIKeyDataGetPrivKey(xmlSecKeyDataPtr data) {
  *
  * Gets the Key Type from the key data.
  *
- * Returns: Key Type 
+ * Returns: Key Type
  */
 KeyType
 xmlSecNssPKIKeyDataGetKeyType(xmlSecKeyDataPtr data) {
@@ -345,7 +345,7 @@ xmlSecNssPKIKeyDataGetKeyType(xmlSecKeyDataPtr data) {
 
     ctx = xmlSecNssPKIKeyDataGetCtx(data);
     xmlSecAssert2(ctx != NULL, nullKey);
-    
+
     if (ctx->pubkey != NULL) {
         kt = SECKEY_GetPublicKeyType(ctx->pubkey);
     } else {
@@ -386,12 +386,12 @@ xmlSecNssPKIKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                 XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    } 
+    }
 
     return(0);
 }
 
-#ifndef XMLSEC_NO_DSA    
+#ifndef XMLSEC_NO_DSA
 /**************************************************************************
  *
  * <dsig:DSAKeyValue> processing
@@ -399,57 +399,57 @@ xmlSecNssPKIKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
  *
  * The DSAKeyValue Element (http://www.w3.org/TR/xmldsig-core/#sec-DSAKeyValue)
  *
- * DSA keys and the DSA signature algorithm are specified in [DSS]. 
+ * DSA keys and the DSA signature algorithm are specified in [DSS].
  * DSA public key values can have the following fields:
- *      
- *   * P - a prime modulus meeting the [DSS] requirements 
- *   * Q - an integer in the range 2**159 < Q < 2**160 which is a prime 
- *         divisor of P-1 
- *   * G - an integer with certain properties with respect to P and Q 
- *   * Y - G**X mod P (where X is part of the private key and not made 
- *         public) 
- *   * J - (P - 1) / Q 
- *   * seed - a DSA prime generation seed 
+ *
+ *   * P - a prime modulus meeting the [DSS] requirements
+ *   * Q - an integer in the range 2**159 < Q < 2**160 which is a prime
+ *         divisor of P-1
+ *   * G - an integer with certain properties with respect to P and Q
+ *   * Y - G**X mod P (where X is part of the private key and not made
+ *         public)
+ *   * J - (P - 1) / Q
+ *   * seed - a DSA prime generation seed
  *   * pgenCounter - a DSA prime generation counter
  *
- * Parameter J is available for inclusion solely for efficiency as it is 
- * calculatable from P and Q. Parameters seed and pgenCounter are used in the 
- * DSA prime number generation algorithm specified in [DSS]. As such, they are 
- * optional but must either both be present or both be absent. This prime 
- * generation algorithm is designed to provide assurance that a weak prime is 
- * not being used and it yields a P and Q value. Parameters P, Q, and G can be 
- * public and common to a group of users. They might be known from application 
- * context. As such, they are optional but P and Q must either both appear or 
- * both be absent. If all of P, Q, seed, and pgenCounter are present, 
- * implementations are not required to check if they are consistent and are 
- * free to use either P and Q or seed and pgenCounter. All parameters are 
+ * Parameter J is available for inclusion solely for efficiency as it is
+ * calculatable from P and Q. Parameters seed and pgenCounter are used in the
+ * DSA prime number generation algorithm specified in [DSS]. As such, they are
+ * optional but must either both be present or both be absent. This prime
+ * generation algorithm is designed to provide assurance that a weak prime is
+ * not being used and it yields a P and Q value. Parameters P, Q, and G can be
+ * public and common to a group of users. They might be known from application
+ * context. As such, they are optional but P and Q must either both appear or
+ * both be absent. If all of P, Q, seed, and pgenCounter are present,
+ * implementations are not required to check if they are consistent and are
+ * free to use either P and Q or seed and pgenCounter. All parameters are
  * encoded as base64 [MIME] values.
- *     
- * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are 
+ *
+ * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are
  * represented in XML as octet strings as defined by the ds:CryptoBinary type.
- *     
+ *
  * Schema Definition:
- *     
- * <element name="DSAKeyValue" type="ds:DSAKeyValueType"/> 
- * <complexType name="DSAKeyValueType"> 
+ *
+ * <element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
+ * <complexType name="DSAKeyValueType">
  *   <sequence>
  *     <sequence minOccurs="0">
- *        <element name="P" type="ds:CryptoBinary"/> 
+ *        <element name="P" type="ds:CryptoBinary"/>
  *        <element name="Q" type="ds:CryptoBinary"/>
  *     </sequence>
- *     <element name="G" type="ds:CryptoBinary" minOccurs="0"/> 
- *     <element name="Y" type="ds:CryptoBinary"/> 
+ *     <element name="G" type="ds:CryptoBinary" minOccurs="0"/>
+ *     <element name="Y" type="ds:CryptoBinary"/>
  *     <element name="J" type="ds:CryptoBinary" minOccurs="0"/>
  *     <sequence minOccurs="0">
- *       <element name="Seed" type="ds:CryptoBinary"/> 
- *       <element name="PgenCounter" type="ds:CryptoBinary"/> 
+ *       <element name="Seed" type="ds:CryptoBinary"/>
+ *       <element name="PgenCounter" type="ds:CryptoBinary"/>
  *     </sequence>
  *   </sequence>
  * </complexType>
- *     
+ *
  * DTD Definition:
- *     
- *  <!ELEMENT DSAKeyValue ((P, Q)?, G?, Y, J?, (Seed, PgenCounter)?) > 
+ *
+ *  <!ELEMENT DSAKeyValue ((P, Q)?, G?, Y, J?, (Seed, PgenCounter)?) >
  *  <!ELEMENT P (#PCDATA) >
  *  <!ELEMENT Q (#PCDATA) >
  *  <!ELEMENT G (#PCDATA) >
@@ -459,7 +459,7 @@ xmlSecNssPKIKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
  *  <!ELEMENT PgenCounter (#PCDATA) >
  *
  * ============================================================================
- * 
+ *
  * To support reading/writing private keys an X element added (before Y).
  * todo: The current implementation does not support Seed and PgenCounter!
  * by this the P, Q and G are *required*!
@@ -494,22 +494,22 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataDsaKlass = {
 
     /* data */
     xmlSecNameDSAKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                         /* xmlSecKeyDataUsage usage; */
     xmlSecHrefDSAKeyValue,              /* const xmlChar* href; */
     xmlSecNodeDSAKeyValue,              /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                       /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecNssKeyDataDsaInitialize,      /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecNssKeyDataDsaDuplicate,       /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecNssKeyDataDsaFinalize,        /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecNssKeyDataDsaGenerate,        /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecNssKeyDataDsaGetType,         /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecNssKeyDataDsaGetSize,         /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                               /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                               /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecNssKeyDataDsaXmlRead,         /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -528,12 +528,12 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataDsaKlass = {
 
 /**
  * xmlSecNssKeyDataDsaGetKlass:
- * 
+ *
  * The DSA key data klass.
  *
  * Returns: pointer to DSA key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecNssKeyDataDsaGetKlass(void) {
     return(&xmlSecNssKeyDataDsaKlass);
 }
@@ -557,7 +557,7 @@ xmlSecNssKeyDataDsaDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
 static void
 xmlSecNssKeyDataDsaFinalize(xmlSecKeyDataPtr data) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataDsaId));
-    
+
     xmlSecNssPKIKeyDataFinalize(data);
 }
 
@@ -610,7 +610,7 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
         goto done;
     }
 
-    pubkey = (SECKEYPublicKey *)PORT_ArenaZAlloc(arena, 
+    pubkey = (SECKEYPublicKey *)PORT_ArenaZAlloc(arena,
                                                  sizeof(SECKEYPublicKey));
     if(pubkey == NULL ) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -634,7 +634,7 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
         ret = -1;
         goto done;
@@ -642,9 +642,9 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     if(xmlSecNssNodeGetBigNumValue(arena, cur, &(pubkey->u.dsa.params.prime)) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
-                    "xmlSecNssNodeGetBigNumValue",                  
+                    "xmlSecNssNodeGetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
         ret = -1;
         goto done;
@@ -657,7 +657,7 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
         ret = -1;
         goto done;
@@ -667,7 +667,7 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecNssNodeGetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
         ret = -1;
         goto done;
@@ -680,7 +680,7 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
         ret = -1;
         goto done;
@@ -690,7 +690,7 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecNssNodeGetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
         ret = -1;
         goto done;
@@ -701,7 +701,7 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
         /* next is X node. It is REQUIRED for private key but
          * NSS does not support it, we just ignore it */
 
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
 
     /* next is Y node. */
@@ -710,7 +710,7 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAY));
         ret = -1;
         goto done;
@@ -725,20 +725,20 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
         goto done;
     }
     cur = xmlSecGetNextElementNode(cur->next);
-    
+
     /* todo: add support for J */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAJ, xmlSecDSigNs))) {
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
 
     /* todo: add support for seed */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSASeed, xmlSecDSigNs))) {
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
 
     /* todo: add support for pgencounter */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAPgenCounter, xmlSecDSigNs))) {
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
 
     if(cur != NULL) {
@@ -773,7 +773,7 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
     }
-    pubkey = NULL; 
+    pubkey = NULL;
 
     ret = xmlSecKeySetValue(key, data);
     if(ret < 0) {
@@ -803,13 +803,13 @@ done:
     return(ret);
 }
 
-static int 
+static int
 xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecNssPKIKeyDataCtxPtr ctx;
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecNssKeyDataDsaId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecNssKeyDataDsaId), -1);
@@ -823,8 +823,8 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     if(((xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate) & keyInfoCtx->keyReq.keyType) == 0) {
         /* we can have only private key or public key */
         return(0);
-    }    
-    
+    }
+
     /* first is P node */
     cur = xmlSecAddChild(node, xmlSecNodeDSAP, xmlSecDSigNs);
     if(cur == NULL) {
@@ -832,9 +832,9 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.dsa.params.prime), 1);
     if(ret < 0) {
@@ -842,10 +842,10 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecNssNodeSetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
         return(-1);
-    }    
+    }
 
     /* next is Q node. */
     cur = xmlSecAddChild(node, xmlSecNodeDSAQ, xmlSecDSigNs);
@@ -854,9 +854,9 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.dsa.params.subPrime), 1);
     if(ret < 0) {
@@ -864,7 +864,7 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecNssNodeSetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
         return(-1);
     }
@@ -876,9 +876,9 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.dsa.params.base), 1);
     if(ret < 0) {
@@ -886,7 +886,7 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecNssNodeSetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
         return(-1);
     }
@@ -900,9 +900,9 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAY));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.dsa.publicValue), 1);
     if(ret < 0) {
@@ -910,7 +910,7 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecNssNodeSetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAY));
         return(-1);
     }
@@ -929,7 +929,7 @@ xmlSecNssKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlSecKe
     SECKEYPublicKey  *pubkey = NULL;
     int               ret = -1;
     int               j;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataDsaId), -1);
     xmlSecAssert2(sizeBits > 0, -1);
 
@@ -965,7 +965,7 @@ xmlSecNssKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlSecKe
                     "PK11_GenerateKeyPair",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        
+
         goto done;
     }
 
@@ -1006,7 +1006,7 @@ done:
 static xmlSecKeyDataType
 xmlSecNssKeyDataDsaGetType(xmlSecKeyDataPtr data) {
     xmlSecNssPKIKeyDataCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataDsaId), xmlSecKeyDataTypeUnknown);
     ctx = xmlSecNssPKIKeyDataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
@@ -1016,11 +1016,11 @@ xmlSecNssKeyDataDsaGetType(xmlSecKeyDataPtr data) {
     } else {
         return(xmlSecKeyDataTypePublic);
     }
-       
+
     return(xmlSecKeyDataTypeUnknown);
 }
 
-static xmlSecSize 
+static xmlSecSize
 xmlSecNssKeyDataDsaGetSize(xmlSecKeyDataPtr data) {
     xmlSecNssPKIKeyDataCtxPtr ctx;
 
@@ -1032,12 +1032,12 @@ xmlSecNssKeyDataDsaGetSize(xmlSecKeyDataPtr data) {
     return(8 * SECKEY_PublicKeyStrength(ctx->pubkey));
 }
 
-static void 
+static void
 xmlSecNssKeyDataDsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataDsaId));
     xmlSecAssert(output != NULL);
-    
-    fprintf(output, "=== dsa key: size = %d\n", 
+
+    fprintf(output, "=== dsa key: size = %d\n",
             xmlSecNssKeyDataDsaGetSize(data));
 }
 
@@ -1045,8 +1045,8 @@ static void
 xmlSecNssKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataDsaId));
     xmlSecAssert(output != NULL);
-        
-    fprintf(output, "<DSAKeyValue size=\"%d\" />\n", 
+
+    fprintf(output, "<DSAKeyValue size=\"%d\" />\n",
             xmlSecNssKeyDataDsaGetSize(data));
 }
 
@@ -1070,27 +1070,27 @@ xmlSecNssKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
  *   <Exponent>AQAB</Exponent>
  * </RSAKeyValue>
  *
- * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are 
+ * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are
  * represented in XML as octet strings as defined by the ds:CryptoBinary type.
  *
  * Schema Definition:
- * 
+ *
  * <element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
  * <complexType name="RSAKeyValueType">
  *   <sequence>
- *     <element name="Modulus" type="ds:CryptoBinary"/> 
+ *     <element name="Modulus" type="ds:CryptoBinary"/>
  *     <element name="Exponent" type="ds:CryptoBinary"/>
  *   </sequence>
  * </complexType>
  *
  * DTD Definition:
- * 
- * <!ELEMENT RSAKeyValue (Modulus, Exponent) > 
+ *
+ * <!ELEMENT RSAKeyValue (Modulus, Exponent) >
  * <!ELEMENT Modulus (#PCDATA) >
  * <!ELEMENT Exponent (#PCDATA) >
  *
  * ============================================================================
- * 
+ *
  * To support reading/writing private keys an PrivateExponent element is added
  * to the end
  *
@@ -1125,22 +1125,22 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataRsaKlass = {
 
     /* data */
     xmlSecNameRSAKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                         /* xmlSecKeyDataUsage usage; */
     xmlSecHrefRSAKeyValue,              /* const xmlChar* href; */
     xmlSecNodeRSAKeyValue,              /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                       /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecNssKeyDataRsaInitialize,      /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecNssKeyDataRsaDuplicate,       /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecNssKeyDataRsaFinalize,        /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecNssKeyDataRsaGenerate,        /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecNssKeyDataRsaGetType,         /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecNssKeyDataRsaGetSize,         /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                               /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                               /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecNssKeyDataRsaXmlRead,         /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -1157,14 +1157,14 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataRsaKlass = {
     NULL,                               /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssKeyDataRsaGetKlass:
  *
  * The RSA key data klass.
  *
  * Returns: pointer to RSA key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecNssKeyDataRsaGetKlass(void) {
     return(&xmlSecNssKeyDataRsaKlass);
 }
@@ -1209,7 +1209,7 @@ xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     if(xmlSecKeyGetValue(key) != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
-                    NULL,                   
+                    NULL,
                     XMLSEC_ERRORS_R_INVALID_KEY_DATA,
                     "key already has a value");
         ret = -1;
@@ -1254,14 +1254,14 @@ xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     pubkey->keyType = rsaKey;
 
     cur = xmlSecGetNextElementNode(node->children);
-    
+
     /* first is Modulus node. It is REQUIRED because we do not support Seed and PgenCounter*/
     if((cur == NULL) || (!xmlSecCheckNodeName(cur,  xmlSecNodeRSAModulus, xmlSecDSigNs))) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
         ret = -1;
         goto done;
@@ -1271,7 +1271,7 @@ xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecNssNodeGetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
         ret = -1;
         goto done;
@@ -1284,7 +1284,7 @@ xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
         ret = -1;
         goto done;
@@ -1294,7 +1294,7 @@ xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecNssNodeGetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
         ret = -1;
         goto done;
@@ -1303,7 +1303,7 @@ xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
 
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeRSAPrivateExponent, xmlSecNs))) {
         /* next is X node. It is REQUIRED for private key but
-         * NSS does not support it. We just ignore it */ 
+         * NSS does not support it. We just ignore it */
         cur = xmlSecGetNextElementNode(cur->next);
     }
 
@@ -1339,7 +1339,7 @@ xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
         goto done;
     }
     pubkey = NULL;
-     
+
     ret = xmlSecKeySetValue(key, data);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1369,13 +1369,13 @@ done:
     return(ret);
 }
 
-static int 
+static int
 xmlSecNssKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                             xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecNssPKIKeyDataCtxPtr ctx;
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecNssKeyDataRsaId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecNssKeyDataRsaId), -1);
@@ -1390,7 +1390,7 @@ xmlSecNssKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     if(((xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate) & keyInfoCtx->keyReq.keyType) == 0) {
         /* we can have only private key or public key */
         return(0);
-    }    
+    }
 
     /* first is Modulus node */
     cur = xmlSecAddChild(node, xmlSecNodeRSAModulus, xmlSecDSigNs);
@@ -1399,9 +1399,9 @@ xmlSecNssKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.rsa.modulus), 1);
     if(ret < 0) {
@@ -1409,10 +1409,10 @@ xmlSecNssKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecNssNodeSetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
         return(-1);
-    }    
+    }
 
     /* next is Exponent node. */
     cur = xmlSecAddChild(node, xmlSecNodeRSAExponent, xmlSecDSigNs);
@@ -1421,9 +1421,9 @@ xmlSecNssKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.rsa.publicExponent), 1);
     if(ret < 0) {
@@ -1431,7 +1431,7 @@ xmlSecNssKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecNssNodeSetBigNumValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
         return(-1);
     }
@@ -1466,7 +1466,7 @@ xmlSecNssKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlSecKe
                     "PK11_GenerateKeyPair",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "error code=%d", PORT_GetError());
-        
+
         goto done;
     }
 
@@ -1502,9 +1502,9 @@ done:
 static xmlSecKeyDataType
 xmlSecNssKeyDataRsaGetType(xmlSecKeyDataPtr data) {
     xmlSecNssPKIKeyDataCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataRsaId), xmlSecKeyDataTypeUnknown);
-    
+
     ctx = xmlSecNssPKIKeyDataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->pubkey == NULL || SECKEY_GetPublicKeyType(ctx->pubkey) == rsaKey, -1);
@@ -1513,11 +1513,11 @@ xmlSecNssKeyDataRsaGetType(xmlSecKeyDataPtr data) {
     } else {
         return(xmlSecKeyDataTypePublic);
     }
-       
+
     return(xmlSecKeyDataTypeUnknown);
 }
 
-static xmlSecSize 
+static xmlSecSize
 xmlSecNssKeyDataRsaGetSize(xmlSecKeyDataPtr data) {
     xmlSecNssPKIKeyDataCtxPtr ctx;
 
@@ -1530,12 +1530,12 @@ xmlSecNssKeyDataRsaGetSize(xmlSecKeyDataPtr data) {
     return(8 * SECKEY_PublicKeyStrength(ctx->pubkey));
 }
 
-static void 
+static void
 xmlSecNssKeyDataRsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataRsaId));
     xmlSecAssert(output != NULL);
-    
-    fprintf(output, "=== rsa key: size = %d\n", 
+
+    fprintf(output, "=== rsa key: size = %d\n",
             xmlSecNssKeyDataRsaGetSize(data));
 }
 
@@ -1543,11 +1543,11 @@ static void
 xmlSecNssKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataRsaId));
     xmlSecAssert(output != NULL);
-        
-    fprintf(output, "<RSAKeyValue size=\"%d\" />\n", 
+
+    fprintf(output, "<RSAKeyValue size=\"%d\" />\n",
             xmlSecNssKeyDataRsaGetSize(data));
 }
-    
+
 #endif /* XMLSEC_NO_RSA */
 
 
diff --git a/src/nss/signatures.c b/src/nss/signatures.c
index e3723fd..53fb624 100644
--- a/src/nss/signatures.c
+++ b/src/nss/signatures.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 #include "globals.h"
@@ -29,7 +29,7 @@
  * Internal NSS signatures ctx
  *
  *****************************************************************************/
-typedef struct _xmlSecNssSignatureCtx   xmlSecNssSignatureCtx, 
+typedef struct _xmlSecNssSignatureCtx   xmlSecNssSignatureCtx,
                                         *xmlSecNssSignatureCtxPtr;
 struct _xmlSecNssSignatureCtx {
     xmlSecKeyDataId     keyId;
@@ -46,7 +46,7 @@ struct _xmlSecNssSignatureCtx {
             SECKEYPublicKey    *pubkey;
         } vfy;
     } u;
-};          
+};
 
 /******************************************************************************
  *
@@ -63,15 +63,15 @@ struct _xmlSecNssSignatureCtx {
 static int      xmlSecNssSignatureCheckId               (xmlSecTransformPtr transform);
 static int      xmlSecNssSignatureInitialize            (xmlSecTransformPtr transform);
 static void     xmlSecNssSignatureFinalize              (xmlSecTransformPtr transform);
-static int      xmlSecNssSignatureSetKeyReq             (xmlSecTransformPtr transform, 
+static int      xmlSecNssSignatureSetKeyReq             (xmlSecTransformPtr transform,
                                                                  xmlSecKeyReqPtr keyReq);
 static int      xmlSecNssSignatureSetKey                        (xmlSecTransformPtr transform,
                                                                  xmlSecKeyPtr key);
-static int      xmlSecNssSignatureVerify                        (xmlSecTransformPtr transform, 
+static int      xmlSecNssSignatureVerify                        (xmlSecTransformPtr transform,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecNssSignatureExecute               (xmlSecTransformPtr transform, 
+static int      xmlSecNssSignatureExecute               (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
@@ -92,16 +92,16 @@ xmlSecNssSignatureCheckId(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static int 
+static int
 xmlSecNssSignatureInitialize(xmlSecTransformPtr transform) {
     xmlSecNssSignatureCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecNssSignatureCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssSignatureSize), -1);
     ctx = xmlSecNssSignatureGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
 
-    memset(ctx, 0, sizeof(xmlSecNssSignatureCtx));    
+    memset(ctx, 0, sizeof(xmlSecNssSignatureCtx));
 
 #ifndef XMLSEC_NO_DSA
     if(xmlSecTransformCheckId(transform, xmlSecNssTransformDsaSha1Id)) {
@@ -110,22 +110,22 @@ xmlSecNssSignatureInitialize(xmlSecTransformPtr transform) {
         /* This creates a signature which is ASN1 encoded */
         /*ctx->alg      = SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST;*/
 
-        /* Fortezza uses the same DSA signature format as XML does. 
-         * DSA and FORTEZZA keys are treated as equivalent keys for doing 
+        /* Fortezza uses the same DSA signature format as XML does.
+         * DSA and FORTEZZA keys are treated as equivalent keys for doing
          * DSA signatures (which is how they are supposed to be treated).
          */
         ctx->alg        = SEC_OID_MISSI_DSS;
-    } else 
+    } else
 #endif /* XMLSEC_NO_DSA */
 
 #ifndef XMLSEC_NO_RSA
     if(xmlSecTransformCheckId(transform, xmlSecNssTransformRsaSha1Id)) {
         ctx->keyId      = xmlSecNssKeyDataRsaId;
         ctx->alg        = SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION;
-    } else 
+    } else
 #endif /* XMLSEC_NO_RSA */
         if(1) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_TRANSFORM,
@@ -136,7 +136,7 @@ xmlSecNssSignatureInitialize(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static void 
+static void
 xmlSecNssSignatureFinalize(xmlSecTransformPtr transform) {
     xmlSecNssSignatureCtxPtr ctx;
 
@@ -146,7 +146,7 @@ xmlSecNssSignatureFinalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecNssSignatureGetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     if (transform->operation == xmlSecTransformOperationSign) {
         SGN_DestroyContext(ctx->u.sig.sigctx, PR_TRUE);
         if (ctx->u.sig.privkey) {
@@ -159,10 +159,10 @@ xmlSecNssSignatureFinalize(xmlSecTransformPtr transform) {
         }
     }
 
-    memset(ctx, 0, sizeof(xmlSecNssSignatureCtx));    
+    memset(ctx, 0, sizeof(xmlSecNssSignatureCtx));
 }
 
-static int 
+static int
 xmlSecNssSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecNssSignatureCtxPtr ctx;
     xmlSecKeyDataPtr value;
@@ -179,7 +179,7 @@ xmlSecNssSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
 
     value = xmlSecKeyGetValue(key);
     xmlSecAssert2(value != NULL, -1);
-    
+
     if (transform->operation == xmlSecTransformOperationSign) {
         if (ctx->u.sig.privkey)
             SECKEY_DestroyPrivateKey(ctx->u.sig.privkey);
@@ -226,11 +226,11 @@ xmlSecNssSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
             return(-1);
         }
     }
-    
+
     return(0);
 }
 
-static int  
+static int
 xmlSecNssSignatureSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecNssSignatureCtxPtr ctx;
 
@@ -256,13 +256,13 @@ xmlSecNssSignatureSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyRe
 
 
 static int
-xmlSecNssSignatureVerify(xmlSecTransformPtr transform, 
+xmlSecNssSignatureVerify(xmlSecTransformPtr transform,
                         const xmlSecByte* data, xmlSecSize dataSize,
                         xmlSecTransformCtxPtr transformCtx) {
     xmlSecNssSignatureCtxPtr ctx;
     SECStatus status;
     SECItem   signature;
-    
+
     xmlSecAssert2(xmlSecNssSignatureCheckId(transform), -1);
     xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssSignatureSize), -1);
@@ -278,14 +278,14 @@ xmlSecNssSignatureVerify(xmlSecTransformPtr transform,
     status = VFY_EndWithSignature(ctx->u.vfy.vfyctx, &signature);
 
     if (status != SECSuccess) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "VFY_Update, VFY_End",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "error code=%d", PORT_GetError());
 
         if (PORT_GetError() == SEC_ERROR_PKCS7_BAD_SIGNATURE) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "VFY_End",
                         XMLSEC_ERRORS_R_DATA_NOT_MATCH,
@@ -299,7 +299,7 @@ xmlSecNssSignatureVerify(xmlSecTransformPtr transform,
     return(0);
 }
 
-static int 
+static int
 xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecNssSignatureCtxPtr ctx;
     xmlSecBufferPtr in, out;
@@ -307,7 +307,7 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
     SECStatus status;
     SECItem signature;
     int ret;
-    
+
     xmlSecAssert2(xmlSecNssSignatureCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssSignatureSize), -1);
@@ -319,8 +319,8 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
     in = &(transform->inBuf);
     out = &(transform->outBuf);
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
-    
+    outSize = xmlSecBufferGetSize(out);
+
     ctx = xmlSecNssSignatureGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     if(transform->operation == xmlSecTransformOperationSign) {
@@ -333,11 +333,11 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
 
     if(transform->status == xmlSecTransformStatusNone) {
         xmlSecAssert2(outSize == 0, -1);
-        
+
         if(transform->operation == xmlSecTransformOperationSign) {
             status = SGN_Begin(ctx->u.sig.sigctx);
             if(status != SECSuccess) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "SGN_Begin",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -347,7 +347,7 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
         } else {
             status = VFY_Begin(ctx->u.vfy.vfyctx);
             if(status != SECSuccess) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "VFY_Begin",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -357,14 +357,14 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
         }
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if((transform->status == xmlSecTransformStatusWorking) && (inSize > 0)) {
         xmlSecAssert2(outSize == 0, -1);
 
         if(transform->operation == xmlSecTransformOperationSign) {
             status = SGN_Update(ctx->u.sig.sigctx, xmlSecBufferGetData(in), inSize);
             if(status != SECSuccess) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "SGN_Update",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -374,7 +374,7 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
         } else {
             status = VFY_Update(ctx->u.vfy.vfyctx, xmlSecBufferGetData(in), inSize);
             if(status != SECSuccess) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "VFY_Update",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -382,10 +382,10 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
                 return(-1);
             }
         }
-            
+
         ret = xmlSecBufferRemoveHead(in, inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -400,7 +400,7 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
             memset(&signature, 0, sizeof(signature));
             status = SGN_End(ctx->u.sig.sigctx, &signature);
             if(status != SECSuccess) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "SGN_End",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -411,7 +411,7 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
             outSize = signature.len;
             ret = xmlSecBufferSetMaxSize(out, outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferSetMaxSize",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -419,12 +419,12 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
                 PR_Free(signature.data);
                 return(-1);
             }
-        
+
             memcpy(xmlSecBufferGetData(out), signature.data, signature.len);
 
             ret = xmlSecBufferSetSize(out, outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferSetSize",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -436,19 +436,19 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
         }
         transform->status = xmlSecTransformStatusFinished;
     }
-    
+
     if((transform->status == xmlSecTransformStatusWorking) || (transform->status == xmlSecTransformStatusFinished)) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -467,7 +467,7 @@ static xmlSecTransformKlass xmlSecNssDsaSha1Klass = {
     xmlSecNameDsaSha1,                          /* const xmlChar* name; */
     xmlSecHrefDsaSha1,                          /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecNssSignatureInitialize,       /* xmlSecTransformInitializeMethod initialize; */
     xmlSecNssSignatureFinalize,         /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -481,19 +481,19 @@ static xmlSecTransformKlass xmlSecNssDsaSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssSignatureExecute,          /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecNssTransformDsaSha1GetKlass:
- * 
+ *
  * The DSA-SHA1 signature transform klass.
  *
  * Returns: DSA-SHA1 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformDsaSha1GetKlass(void) {
     return(&xmlSecNssDsaSha1Klass);
 }
@@ -514,7 +514,7 @@ static xmlSecTransformKlass xmlSecNssRsaSha1Klass = {
     xmlSecNameRsaSha1,                          /* const xmlChar* name; */
     xmlSecHrefRsaSha1,                          /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecNssSignatureInitialize,       /* xmlSecTransformInitializeMethod initialize; */
     xmlSecNssSignatureFinalize,         /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -528,19 +528,19 @@ static xmlSecTransformKlass xmlSecNssRsaSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecNssSignatureExecute,          /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecNssTransformRsaSha1GetKlass:
- * 
+ *
  * The RSA-SHA1 signature transform klass.
  *
  * Returns: RSA-SHA1 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecNssTransformRsaSha1GetKlass(void) {
     return(&xmlSecNssRsaSha1Klass);
 }
diff --git a/src/nss/symkeys.c b/src/nss/symkeys.c
index 10b29a3..3da7a69 100644
--- a/src/nss/symkeys.c
+++ b/src/nss/symkeys.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * DES Algorithm support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -25,7 +25,7 @@
 #include <xmlsec/nss/crypto.h>
 
 /*****************************************************************************
- * 
+ *
  * Symmetic (binary) keys - just a wrapper for xmlSecKeyDataBinary
  *
  ****************************************************************************/
@@ -70,7 +70,7 @@ static int      xmlSecNssSymKeyDataKlassCheck   (xmlSecKeyDataKlass* klass);
 static int
 xmlSecNssSymKeyDataInitialize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecNssSymKeyDataCheckId(data), -1);
-    
+
     return(xmlSecKeyDataBinaryValueInitialize(data));
 }
 
@@ -79,14 +79,14 @@ xmlSecNssSymKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     xmlSecAssert2(xmlSecNssSymKeyDataCheckId(dst), -1);
     xmlSecAssert2(xmlSecNssSymKeyDataCheckId(src), -1);
     xmlSecAssert2(dst->id == src->id, -1);
-        
+
     return(xmlSecKeyDataBinaryValueDuplicate(dst, src));
 }
 
 static void
 xmlSecNssSymKeyDataFinalize(xmlSecKeyDataPtr data) {
     xmlSecAssert(xmlSecNssSymKeyDataCheckId(data));
-    
+
     xmlSecKeyDataBinaryValueFinalize(data);
 }
 
@@ -94,15 +94,15 @@ static int
 xmlSecNssSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecNssSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueXmlRead(id, key, node, keyInfoCtx));
 }
 
-static int 
+static int
 xmlSecNssSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                     xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecNssSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueXmlWrite(id, key, node, keyInfoCtx));
 }
 
@@ -111,7 +111,7 @@ xmlSecNssSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                     const xmlSecByte* buf, xmlSecSize bufSize,
                                     xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecNssSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueBinRead(id, key, buf, bufSize, keyInfoCtx));
 }
 
@@ -120,7 +120,7 @@ xmlSecNssSymKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                     xmlSecByte** buf, xmlSecSize* bufSize,
                                     xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecNssSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueBinWrite(id, key, buf, bufSize, keyInfoCtx));
 }
 
@@ -133,7 +133,7 @@ xmlSecNssSymKeyDataGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlSecKe
 
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecNssGenerateRandom(buffer, (sizeBits + 7) / 8));
 }
 
@@ -149,29 +149,29 @@ xmlSecNssSymKeyDataGetType(xmlSecKeyDataPtr data) {
     return((xmlSecBufferGetSize(buffer) > 0) ? xmlSecKeyDataTypeSymmetric : xmlSecKeyDataTypeUnknown);
 }
 
-static xmlSecSize 
+static xmlSecSize
 xmlSecNssSymKeyDataGetSize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecNssSymKeyDataCheckId(data), 0);
-    
+
     return(xmlSecKeyDataBinaryValueGetSize(data));
 }
 
-static void 
+static void
 xmlSecNssSymKeyDataDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecNssSymKeyDataCheckId(data));
-    
-    xmlSecKeyDataBinaryValueDebugDump(data, output);    
+
+    xmlSecKeyDataBinaryValueDebugDump(data, output);
 }
 
 static void
 xmlSecNssSymKeyDataDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecNssSymKeyDataCheckId(data));
-    
-    xmlSecKeyDataBinaryValueDebugXmlDump(data, output);    
+
+    xmlSecKeyDataBinaryValueDebugXmlDump(data, output);
 }
 
-static int 
-xmlSecNssSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {    
+static int
+xmlSecNssSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {
 #ifndef XMLSEC_NO_DES
     if(klass == xmlSecNssKeyDataDesId) {
         return(1);
@@ -205,18 +205,18 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataAesKlass = {
 
     /* data */
     xmlSecNameAESKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefAESKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeAESKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecNssSymKeyDataInitialize,              /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecNssSymKeyDataDuplicate,               /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecNssSymKeyDataFinalize,                /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecNssSymKeyDataGenerate,                /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecNssSymKeyDataGetType,                 /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecNssSymKeyDataGetSize,         /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -237,14 +237,14 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataAesKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssKeyDataAesGetKlass:
- * 
+ *
  * The AES key data klass.
  *
  * Returns: AES key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecNssKeyDataAesGetKlass(void) {
     return(&xmlSecNssKeyDataAesKlass);
 }
@@ -262,14 +262,14 @@ xmlSecNssKeyDataAesGetKlass(void) {
 int
 xmlSecNssKeyDataAesSet(xmlSecKeyDataPtr data, const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataAesId), -1);
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(bufSize > 0, -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecBufferSetData(buffer, buf, bufSize));
 }
 #endif /* XMLSEC_NO_AES */
@@ -286,18 +286,18 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataDesKlass = {
 
     /* data */
     xmlSecNameDESKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefDESKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeDESKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecNssSymKeyDataInitialize,              /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecNssSymKeyDataDuplicate,               /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecNssSymKeyDataFinalize,                /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecNssSymKeyDataGenerate,                /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecNssSymKeyDataGetType,                 /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecNssSymKeyDataGetSize,         /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -318,14 +318,14 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataDesKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssKeyDataDesGetKlass:
- * 
+ *
  * The DES key data klass.
  *
  * Returns: DES key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecNssKeyDataDesGetKlass(void) {
     return(&xmlSecNssKeyDataDesKlass);
 }
@@ -343,14 +343,14 @@ xmlSecNssKeyDataDesGetKlass(void) {
 int
 xmlSecNssKeyDataDesSet(xmlSecKeyDataPtr data, const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataDesId), -1);
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(bufSize > 0, -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecBufferSetData(buffer, buf, bufSize));
 }
 
@@ -368,18 +368,18 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataHmacKlass = {
 
     /* data */
     xmlSecNameHMACKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefHMACKeyValue,                     /* const xmlChar* href; */
     xmlSecNodeHMACKeyValue,                     /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecNssSymKeyDataInitialize,              /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecNssSymKeyDataDuplicate,               /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecNssSymKeyDataFinalize,                /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecNssSymKeyDataGenerate,                /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecNssSymKeyDataGetType,                 /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecNssSymKeyDataGetSize,         /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -400,14 +400,14 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataHmacKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssKeyDataHmacGetKlass:
- * 
+ *
  * The HMAC key data klass.
  *
  * Returns: HMAC key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecNssKeyDataHmacGetKlass(void) {
     return(&xmlSecNssKeyDataHmacKlass);
 }
@@ -425,14 +425,14 @@ xmlSecNssKeyDataHmacGetKlass(void) {
 int
 xmlSecNssKeyDataHmacSet(xmlSecKeyDataPtr data, const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataHmacId), -1);
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(bufSize > 0, -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecBufferSetData(buffer, buf, bufSize));
 }
 
diff --git a/src/nss/x509.c b/src/nss/x509.c
index a00a41c..9b0a78d 100644
--- a/src/nss/x509.c
+++ b/src/nss/x509.c
@@ -1,4 +1,4 @@
-/** 
+/**
  * XMLSec library
  *
  * X509 support
@@ -6,7 +6,7 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 #include "globals.h"
@@ -88,28 +88,28 @@ static int              xmlSecNssX509CRLNodeRead                (xmlSecKeyDataPt
 static int              xmlSecNssX509CRLNodeWrite               (CERTSignedCrl* crl,
                                                                  xmlNodePtr node,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int              xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, 
+static int              xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data,
                                                                 xmlSecKeyPtr key,
                                                                 xmlSecKeyInfoCtxPtr keyInfoCtx);
 
-static CERTCertificate* xmlSecNssX509CertDerRead                (const xmlSecByte* buf, 
+static CERTCertificate* xmlSecNssX509CertDerRead                (const xmlSecByte* buf,
                                                                  xmlSecSize size);
 static CERTCertificate* xmlSecNssX509CertBase64DerRead          (xmlChar* buf);
-static xmlChar*         xmlSecNssX509CertBase64DerWrite         (CERTCertificate* cert, 
+static xmlChar*         xmlSecNssX509CertBase64DerWrite         (CERTCertificate* cert,
                                                                  int base64LineWrap);
-static CERTSignedCrl*   xmlSecNssX509CrlDerRead                 (xmlSecByte* buf, 
+static CERTSignedCrl*   xmlSecNssX509CrlDerRead                 (xmlSecByte* buf,
                                                                  xmlSecSize size,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
 static CERTSignedCrl*   xmlSecNssX509CrlBase64DerRead           (xmlChar* buf,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
-static xmlChar*         xmlSecNssX509CrlBase64DerWrite          (CERTSignedCrl* crl, 
+static xmlChar*         xmlSecNssX509CrlBase64DerWrite          (CERTSignedCrl* crl,
                                                                  int base64LineWrap);
 static xmlChar*         xmlSecNssX509NameWrite                  (CERTName* nm);
 static xmlChar*         xmlSecNssASN1IntegerWrite               (SECItem *num);
 static xmlChar*         xmlSecNssX509SKIWrite                   (CERTCertificate* cert);
-static void             xmlSecNssX509CertDebugDump              (CERTCertificate* cert, 
+static void             xmlSecNssX509CertDebugDump              (CERTCertificate* cert,
                                                                  FILE* output);
-static void             xmlSecNssX509CertDebugXmlDump           (CERTCertificate* cert, 
+static void             xmlSecNssX509CertDebugXmlDump           (CERTCertificate* cert,
                                                                  FILE* output);
 static int              xmlSecNssX509CertGetTime                (PRTime* t,
                                                                  time_t* res);
@@ -134,7 +134,7 @@ struct _xmlSecNssX509DataCtx {
     CERTCertList*    certsList;
     unsigned int     numCerts;
 
-    xmlSecNssX509CrlNodePtr crlsList; 
+    xmlSecNssX509CrlNodePtr crlsList;
     unsigned int     numCrls;
 };
 
@@ -145,52 +145,52 @@ struct _xmlSecNssX509DataCtx {
  *
  * The X509Data  Element (http://www.w3.org/TR/xmldsig-core/#sec-X509Data)
  *
- * An X509Data element within KeyInfo contains one or more identifiers of keys 
- * or X509 certificates (or certificates' identifiers or a revocation list). 
+ * An X509Data element within KeyInfo contains one or more identifiers of keys
+ * or X509 certificates (or certificates' identifiers or a revocation list).
  * The content of X509Data is:
  *
  *  1. At least one element, from the following set of element types; any of these may appear together or more than once iff (if and only if) each instance describes or is related to the same certificate:
  *  2.
- *    * The X509IssuerSerial element, which contains an X.509 issuer 
- *      distinguished name/serial number pair that SHOULD be compliant 
+ *    * The X509IssuerSerial element, which contains an X.509 issuer
+ *      distinguished name/serial number pair that SHOULD be compliant
  *      with RFC2253 [LDAP-DN],
- *    * The X509SubjectName element, which contains an X.509 subject 
+ *    * The X509SubjectName element, which contains an X.509 subject
  *      distinguished name that SHOULD be compliant with RFC2253 [LDAP-DN],
- *    * The X509SKI element, which contains the base64 encoded plain (i.e. 
+ *    * The X509SKI element, which contains the base64 encoded plain (i.e.
  *      non-DER-encoded) value of a X509 V.3 SubjectKeyIdentifier extension.
- *    * The X509Certificate element, which contains a base64-encoded [X509v3] 
+ *    * The X509Certificate element, which contains a base64-encoded [X509v3]
  *      certificate, and
- *    * Elements from an external namespace which accompanies/complements any 
+ *    * Elements from an external namespace which accompanies/complements any
  *      of the elements above.
- *    * The X509CRL element, which contains a base64-encoded certificate 
+ *    * The X509CRL element, which contains a base64-encoded certificate
  *      revocation list (CRL) [X509v3].
  *
- * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that appear 
+ * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that appear
  * MUST refer to the certificate or certificates containing the validation key.
- * All such elements that refer to a particular individual certificate MUST be 
- * grouped inside a single X509Data element and if the certificate to which 
+ * All such elements that refer to a particular individual certificate MUST be
+ * grouped inside a single X509Data element and if the certificate to which
  * they refer appears, it MUST also be in that X509Data element.
  *
- * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that relate to 
- * the same key but different certificates MUST be grouped within a single 
+ * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that relate to
+ * the same key but different certificates MUST be grouped within a single
  * KeyInfo but MAY occur in multiple X509Data elements.
  *
- * All certificates appearing in an X509Data element MUST relate to the 
- * validation key by either containing it or being part of a certification 
+ * All certificates appearing in an X509Data element MUST relate to the
+ * validation key by either containing it or being part of a certification
  * chain that terminates in a certificate containing the validation key.
  *
  * No ordering is implied by the above constraints.
  *
- * Note, there is no direct provision for a PKCS#7 encoded "bag" of 
- * certificates or CRLs. However, a set of certificates and CRLs can occur 
- * within an X509Data element and multiple X509Data elements can occur in a 
- * KeyInfo. Whenever multiple certificates occur in an X509Data element, at 
- * least one such certificate must contain the public key which verifies the 
+ * Note, there is no direct provision for a PKCS#7 encoded "bag" of
+ * certificates or CRLs. However, a set of certificates and CRLs can occur
+ * within an X509Data element and multiple X509Data elements can occur in a
+ * KeyInfo. Whenever multiple certificates occur in an X509Data element, at
+ * least one such certificate must contain the public key which verifies the
  * signature.
  *
  * Schema Definition
  *
- *  <element name="X509Data" type="ds:X509DataType"/> 
+ *  <element name="X509Data" type="ds:X509DataType"/>
  *  <complexType name="X509DataType">
  *    <sequence maxOccurs="unbounded">
  *      <choice>
@@ -203,10 +203,10 @@ struct _xmlSecNssX509DataCtx {
  *      </choice>
  *    </sequence>
  *  </complexType>
- *  <complexType name="X509IssuerSerialType"> 
- *    <sequence> 
- *       <element name="X509IssuerName" type="string"/> 
- *       <element name="X509SerialNumber" type="integer"/> 
+ *  <complexType name="X509IssuerSerialType">
+ *    <sequence>
+ *       <element name="X509IssuerName" type="string"/>
+ *       <element name="X509SerialNumber" type="integer"/>
  *     </sequence>
  *  </complexType>
  *
@@ -228,7 +228,7 @@ struct _xmlSecNssX509DataCtx {
  *
  *************************************************************************/
 #define xmlSecNssX509DataSize   \
-    (sizeof(xmlSecKeyData) + sizeof(xmlSecNssX509DataCtx))      
+    (sizeof(xmlSecKeyData) + sizeof(xmlSecNssX509DataCtx))
 #define xmlSecNssX509DataGetCtx(data) \
     ((xmlSecNssX509DataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
 
@@ -260,12 +260,12 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataX509Klass = {
 
     /* data */
     xmlSecNameX509Data,
-    xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefX509Data,                         /* const xmlChar* href; */
     xmlSecNodeX509Data,                         /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecNssKeyDataX509Initialize,             /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecNssKeyDataX509Duplicate,              /* xmlSecKeyDataDuplicateMethod duplicate; */
@@ -275,7 +275,7 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataX509Klass = {
     /* get info */
     xmlSecNssKeyDataX509GetType,                /* xmlSecKeyDataGetTypeMethod getType; */
     NULL,                                       /* xmlSecKeyDataGetSizeMethod getSize; */
-    xmlSecNssKeyDataX509GetIdentifier,          /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    xmlSecNssKeyDataX509GetIdentifier,          /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecNssKeyDataX509XmlRead,                /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -292,14 +292,14 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataX509Klass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecNssKeyDataX509GetKlass:
- * 
+ *
  * The NSS X509 key data klass (http://www.w3.org/TR/xmldsig-core/#sec-X509Data).
  *
  * Returns: the X509 data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecNssKeyDataX509GetKlass(void) {
     return(&xmlSecNssKeyDataX509Klass);
 }
@@ -308,7 +308,7 @@ xmlSecNssKeyDataX509GetKlass(void) {
  * xmlSecNssKeyDataX509GetKeyCert:
  * @data:               the pointer to X509 key data.
  *
- * Gets the certificate from which the key was extracted. 
+ * Gets the certificate from which the key was extracted.
  *
  * Returns: the key's certificate or NULL if key data was not used for key
  * extraction or an error occurs.
@@ -316,7 +316,7 @@ xmlSecNssKeyDataX509GetKlass(void) {
 CERTCertificate*
 xmlSecNssKeyDataX509GetKeyCert(xmlSecKeyDataPtr data) {
     xmlSecNssX509DataCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataX509Id), NULL);
 
     ctx = xmlSecNssX509DataGetCtx(data);
@@ -343,7 +343,7 @@ xmlSecNssKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, CERTCertificate* cert) {
 
     ctx = xmlSecNssX509DataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     if(ctx->keyCert != NULL) {
         CERT_DestroyCertificate(ctx->keyCert);
     }
@@ -360,17 +360,17 @@ xmlSecNssKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, CERTCertificate* cert) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecNssKeyDataX509AdoptCert(xmlSecKeyDataPtr data, CERTCertificate* cert) {
     xmlSecNssX509DataCtxPtr ctx;
     SECStatus ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataX509Id), -1);
     xmlSecAssert2(cert != NULL, -1);
 
     ctx = xmlSecNssX509DataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     if(ctx->certsList == NULL) {
         ctx->certsList = CERT_NewCertList();
         if(ctx->certsList == NULL) {
@@ -379,10 +379,10 @@ xmlSecNssKeyDataX509AdoptCert(xmlSecKeyDataPtr data, CERTCertificate* cert) {
                         "CERT_NewCertList",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "error code=%d", PORT_GetError());
-            return(-1); 
+            return(-1);
         }
     }
-    
+
     ret = CERT_AddCertToListTail(ctx->certsList, cert);
     if(ret != SECSuccess) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -390,10 +390,10 @@ xmlSecNssKeyDataX509AdoptCert(xmlSecKeyDataPtr data, CERTCertificate* cert) {
                     "CERT_AddCertToListTail",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "error code=%d", PORT_GetError());
-        return(-1);     
+        return(-1);
     }
     ctx->numCerts++;
-        
+
     return(0);
 }
 
@@ -401,13 +401,13 @@ xmlSecNssKeyDataX509AdoptCert(xmlSecKeyDataPtr data, CERTCertificate* cert) {
  * xmlSecNssKeyDataX509GetCert:
  * @data:               the pointer to X509 key data.
  * @pos:                the desired certificate position.
- * 
+ *
  * Gets a certificate from X509 key data.
  *
- * Returns: the pointer to certificate or NULL if @pos is larger than the 
+ * Returns: the pointer to certificate or NULL if @pos is larger than the
  * number of certificates in @data or an error occurs.
  */
-CERTCertificate* 
+CERTCertificate*
 xmlSecNssKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
     xmlSecNssX509DataCtxPtr ctx;
     CERTCertListNode*       head;
@@ -437,7 +437,7 @@ xmlSecNssKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
  *
  * Returns: te number of certificates in @data.
  */
-xmlSecSize      
+xmlSecSize
 xmlSecNssKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
     xmlSecNssX509DataCtxPtr ctx;
 
@@ -458,17 +458,17 @@ xmlSecNssKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecNssKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, CERTSignedCrl* crl) {
     xmlSecNssX509DataCtxPtr ctx;
     xmlSecNssX509CrlNodePtr crlnode;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataX509Id), -1);
     xmlSecAssert2(crl != NULL, -1);
 
     ctx = xmlSecNssX509DataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     crlnode = (xmlSecNssX509CrlNodePtr)PR_Malloc(sizeof(xmlSecNssX509CrlNode));
 
     if(crlnode == NULL) {
@@ -477,9 +477,9 @@ xmlSecNssKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, CERTSignedCrl* crl) {
                     "PR_Malloc",
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     memset(crlnode, 0, sizeof(xmlSecNssX509CrlNode));
     crlnode->next = ctx->crlsList;
     crlnode->crl = crl;
@@ -541,7 +541,7 @@ xmlSecNssKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data) {
     return(ctx->numCrls);
 }
 
-static int      
+static int
 xmlSecNssKeyDataX509Initialize(xmlSecKeyDataPtr data) {
     xmlSecNssX509DataCtxPtr ctx;
 
@@ -565,7 +565,7 @@ xmlSecNssKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
 
     xmlSecAssert2(xmlSecKeyDataCheckId(dst, xmlSecNssKeyDataX509Id), -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(src, xmlSecNssKeyDataX509Id), -1);
-    
+
     /* copy certsList */
     size = xmlSecNssKeyDataX509GetCertsSize(src);
     for(pos = 0; pos < size; ++pos) {
@@ -581,7 +581,7 @@ xmlSecNssKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
                         "pos=%d", pos);
             return(-1);
         }
-        
+
         certDst = CERT_DupCertificate(certSrc);
         if(certDst == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -591,7 +591,7 @@ xmlSecNssKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
                         "error code=%d", PORT_GetError());
             return(-1);
         }
-        
+
         ret = xmlSecNssKeyDataX509AdoptCert(dst, certDst);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -708,12 +708,12 @@ xmlSecNssKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataPtr data;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecNssKeyDataX509Id, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
-    
+
     data = xmlSecKeyEnsureData(key, id);
     if(data == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -723,7 +723,7 @@ xmlSecNssKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecNssX509DataNodeRead(data, node, keyInfoCtx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -748,7 +748,7 @@ xmlSecNssKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     return(0);
 }
 
-static int 
+static int
 xmlSecNssKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataPtr data;
@@ -757,7 +757,7 @@ xmlSecNssKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     xmlSecSize size, pos;
     int content = 0;
     int ret;
-                                
+
     xmlSecAssert2(id == xmlSecNssKeyDataX509Id, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -780,7 +780,7 @@ xmlSecNssKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     data = xmlSecKeyGetData(key, id);
     if(data == NULL) {
         /* no x509 data in the key */
-        return(0);      
+        return(0);
     }
 
     /* write certs */
@@ -843,7 +843,7 @@ xmlSecNssKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                 return(-1);
             }
         }
-    }    
+    }
 
     /* write crls if needed */
     if((content & XMLSEC_X509DATA_CRL_NODE) != 0) {
@@ -858,7 +858,7 @@ xmlSecNssKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                             "pos=%d", pos);
                 return(-1);
             }
-            
+
             ret = xmlSecNssX509CRLNodeWrite(crl, node, keyInfoCtx);
             if(ret < 0) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -878,19 +878,19 @@ static xmlSecKeyDataType
 xmlSecNssKeyDataX509GetType(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataX509Id), xmlSecKeyDataTypeUnknown);
 
-    /* TODO: return verified/not verified status */    
+    /* TODO: return verified/not verified status */
     return(xmlSecKeyDataTypeUnknown);
 }
 
 static const xmlChar*
 xmlSecNssKeyDataX509GetIdentifier(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataX509Id), NULL);
-    
-    /* TODO */    
+
+    /* TODO */
     return(NULL);
 }
 
-static void 
+static void
 xmlSecNssKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) {
     CERTCertificate* cert;
     xmlSecSize size, pos;
@@ -904,7 +904,7 @@ xmlSecNssKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) {
         fprintf(output, "==== Key Certificate:\n");
         xmlSecNssX509CertDebugDump(cert, output);
     }
-    
+
     size = xmlSecNssKeyDataX509GetCertsSize(data);
     for(pos = 0; pos < size; ++pos) {
         cert = xmlSecNssKeyDataX509GetCert(data, pos);
@@ -919,7 +919,7 @@ xmlSecNssKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) {
         fprintf(output, "==== Certificate:\n");
         xmlSecNssX509CertDebugDump(cert, output);
     }
-    
+
     /* we don't print out crls */
 }
 
@@ -938,7 +938,7 @@ xmlSecNssKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
         xmlSecNssX509CertDebugXmlDump(cert, output);
         fprintf(output, "</KeyCertificate>\n");
     }
-    
+
     size = xmlSecNssKeyDataX509GetCertsSize(data);
     for(pos = 0; pos < size; ++pos) {
         cert = xmlSecNssKeyDataX509GetCert(data, pos);
@@ -954,24 +954,24 @@ xmlSecNssKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
         xmlSecNssX509CertDebugXmlDump(cert, output);
         fprintf(output, "</Certificate>\n");
     }
-    
+
     /* we don't print out crls */
     fprintf(output, "</X509Data>\n");
 }
 
 static int
 xmlSecNssX509DataNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
-    xmlNodePtr cur; 
+    xmlNodePtr cur;
     int ret;
-        
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataX509Id), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
-    
+
     for(cur = xmlSecGetNextElementNode(node->children);
         cur != NULL;
         cur = xmlSecGetNextElementNode(cur->next)) {
-        
+
         ret = 0;
         if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
             ret = xmlSecNssX509CertificateNodeRead(data, cur, keyInfoCtx);
@@ -998,14 +998,14 @@ xmlSecNssX509DataNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoC
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "read node failed");
-            return(-1);  
-        }       
+            return(-1);
+        }
     }
     return(0);
 }
 
 static int
-xmlSecNssX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {      
+xmlSecNssX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlChar *content;
     CERTCertificate* cert;
     int ret;
@@ -1039,8 +1039,8 @@ xmlSecNssX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecK
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFree(content);
         return(-1);
-    }    
-    
+    }
+
     ret = xmlSecNssKeyDataX509AdoptCert(data, cert);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1052,22 +1052,22 @@ xmlSecNssX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecK
         xmlFree(content);
         return(-1);
     }
-     
+
     xmlFree(content);
     return(0);
 }
 
-static int 
+static int
 xmlSecNssX509CertificateNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlChar* buf;
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(cert != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
-    
+
     /* set base64 lines size from context */
-    buf = xmlSecNssX509CertBase64DerWrite(cert, keyInfoCtx->base64LineSize); 
+    buf = xmlSecNssX509CertBase64DerWrite(cert, keyInfoCtx->base64LineSize);
     if(buf == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1076,7 +1076,7 @@ xmlSecNssX509CertificateNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSec
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     cur = xmlSecAddChild(node, xmlSecNodeX509Certificate, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1086,7 +1086,7 @@ xmlSecNssX509CertificateNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSec
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
         xmlFree(buf);
-        return(-1);     
+        return(-1);
     }
 
     /* todo: add \n around base64 data - from context */
@@ -1097,13 +1097,13 @@ xmlSecNssX509CertificateNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSec
     return(0);
 }
 
-static int              
-xmlSecNssX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {      
+static int
+xmlSecNssX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataStorePtr x509Store;
     xmlChar* subject;
     CERTCertificate* cert;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataX509Id), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
@@ -1143,7 +1143,7 @@ xmlSecNssX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecK
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                         NULL,
                         XMLSEC_ERRORS_R_CERT_NOT_FOUND,
-                        "subject=%s", 
+                        "subject=%s",
                         xmlSecErrorsSafeString(subject));
             xmlFree(subject);
             return(-1);
@@ -1164,7 +1164,7 @@ xmlSecNssX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecK
         xmlFree(subject);
         return(-1);
     }
-    
+
     xmlFree(subject);
     return(0);
 }
@@ -1203,12 +1203,12 @@ xmlSecNssX509SubjectNameNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSec
     return(0);
 }
 
-static int 
+static int
 xmlSecNssX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataStorePtr x509Store;
     xmlNodePtr cur;
     xmlChar *issuerName;
-    xmlChar *issuerSerial;    
+    xmlChar *issuerSerial;
     CERTCertificate* cert;
     int ret;
 
@@ -1240,7 +1240,7 @@ xmlSecNssX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSec
         }
         return(0);
     }
-    
+
     /* the first is required node X509IssuerName */
     if(!xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerName, xmlSecDSigNs)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1250,7 +1250,7 @@ xmlSecNssX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSec
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
         return(-1);
-    }    
+    }
     issuerName = xmlNodeGetContent(cur);
     if(issuerName == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1261,7 +1261,7 @@ xmlSecNssX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSec
                     xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
         return(-1);
     }
-    cur = xmlSecGetNextElementNode(cur->next); 
+    cur = xmlSecGetNextElementNode(cur->next);
 
     /* next is required node X509SerialNumber */
     if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs)) {
@@ -1273,7 +1273,7 @@ xmlSecNssX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSec
                     xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
         xmlFree(issuerName);
         return(-1);
-    }    
+    }
     issuerSerial = xmlNodeGetContent(cur);
     if(issuerSerial == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1285,7 +1285,7 @@ xmlSecNssX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSec
         xmlFree(issuerName);
         return(-1);
     }
-    cur = xmlSecGetNextElementNode(cur->next); 
+    cur = xmlSecGetNextElementNode(cur->next);
 
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1306,7 +1306,7 @@ xmlSecNssX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSec
                         NULL,
                         XMLSEC_ERRORS_R_CERT_NOT_FOUND,
                         "issuerName=%s;issuerSerial=%s",
-                        xmlSecErrorsSafeString(issuerName), 
+                        xmlSecErrorsSafeString(issuerName),
                         xmlSecErrorsSafeString(issuerSerial));
             xmlFree(issuerSerial);
             xmlFree(issuerName);
@@ -1315,7 +1315,7 @@ xmlSecNssX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSec
 
         xmlFree(issuerSerial);
         xmlFree(issuerName);
-        return(0);    
+        return(0);
     }
 
     ret = xmlSecNssKeyDataX509AdoptCert(data, cert);
@@ -1330,7 +1330,7 @@ xmlSecNssX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSec
         xmlFree(issuerName);
         return(-1);
     }
-    
+
     xmlFree(issuerSerial);
     xmlFree(issuerName);
     return(0);
@@ -1342,7 +1342,7 @@ xmlSecNssX509IssuerSerialNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSe
     xmlNodePtr issuerNameNode;
     xmlNodePtr issuerNumberNode;
     xmlChar* buf;
-    
+
     xmlSecAssert2(cert != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
@@ -1408,13 +1408,13 @@ xmlSecNssX509IssuerSerialNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSe
     return(0);
 }
 
-static int 
+static int
 xmlSecNssX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataStorePtr x509Store;
     xmlChar* ski;
     CERTCertificate* cert;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataX509Id), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
@@ -1429,7 +1429,7 @@ xmlSecNssX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCt
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ski = xmlNodeGetContent(node);
     if((ski == NULL) || (xmlSecIsEmptyString(ski) == 1)) {
         if(ski != NULL) {
@@ -1456,7 +1456,7 @@ xmlSecNssX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCt
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                         NULL,
                         XMLSEC_ERRORS_R_CERT_NOT_FOUND,
-                        "ski=%s", 
+                        "ski=%s",
                         xmlSecErrorsSafeString(ski));
             return(-1);
         }
@@ -1474,7 +1474,7 @@ xmlSecNssX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCt
         xmlFree(ski);
         return(-1);
     }
-    
+
     xmlFree(ski);
     return(0);
 }
@@ -1514,7 +1514,7 @@ xmlSecNssX509SKINodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSecKeyInfoC
     return(0);
 }
 
-static int 
+static int
 xmlSecNssX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlChar *content;
     CERTSignedCrl* crl;
@@ -1548,9 +1548,9 @@ xmlSecNssX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCt
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFree(content);
         return(-1);
-    }    
-    
-    SEC_DestroyCrl(crl); 
+    }
+
+    SEC_DestroyCrl(crl);
     xmlFree(content);
     return(0);
 }
@@ -1565,7 +1565,7 @@ xmlSecNssX509CRLNodeWrite(CERTSignedCrl* crl, xmlNodePtr node, xmlSecKeyInfoCtxP
     xmlSecAssert2(keyInfoCtx != NULL, -1);
 
     /* set base64 lines size from context */
-    buf = xmlSecNssX509CrlBase64DerWrite(crl, keyInfoCtx->base64LineSize); 
+    buf = xmlSecNssX509CrlBase64DerWrite(crl, keyInfoCtx->base64LineSize);
     if(buf == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1604,7 +1604,7 @@ xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
     int ret;
     SECStatus status;
     PRTime notBefore, notAfter;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecNssKeyDataX509Id), -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
@@ -1625,11 +1625,11 @@ xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
 
     if((ctx->keyCert == NULL) && (ctx->certsList != NULL) && (xmlSecKeyGetValue(key) == NULL)) {
         CERTCertificate* cert;
-        
+
         cert = xmlSecNssX509StoreVerify(x509Store, ctx->certsList, keyInfoCtx);
         if(cert != NULL) {
             xmlSecKeyDataPtr keyValue;
-            
+
             ctx->keyCert = CERT_DupCertificate(cert);
             if(ctx->keyCert == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1639,7 +1639,7 @@ xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-        
+
             keyValue = xmlSecNssX509CertGetKey(ctx->keyCert);
             if(keyValue == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1649,7 +1649,7 @@ xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-            
+
             /* verify that the key matches our expectations */
             if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), keyValue) != 1) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1659,8 +1659,8 @@ xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 xmlSecKeyDataDestroy(keyValue);
                 return(-1);
-            }   
-                
+            }
+
             ret = xmlSecKeySetValue(key, keyValue);
             if(ret < 0) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1670,8 +1670,8 @@ xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 xmlSecKeyDataDestroy(keyValue);
                 return(-1);
-            }       
-            
+            }
+
             status = CERT_GetCertTimes(ctx->keyCert, &notBefore, &notAfter);
             if (status == SECSuccess) {
                 ret = xmlSecNssX509CertGetTime(&notBefore, &(key->notValidBefore));
@@ -1709,7 +1709,7 @@ xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
 
 static int
 xmlSecNssX509CertGetTime(PRTime* t, time_t* res) {
-    
+
     PRTime tmp64_1, tmp64_2;
     PRUint32 tmp32 = 1000000;
 
@@ -1729,19 +1729,19 @@ xmlSecNssX509CertGetTime(PRTime* t, time_t* res) {
     return(0);
 }
 
-/** 
+/**
  * xmlSecNssX509CertGetKey:
  * @cert:               the certificate.
- * 
+ *
  * Extracts public key from the @cert.
  *
  * Returns: public key value or NULL if an error occurs.
  */
-xmlSecKeyDataPtr        
+xmlSecKeyDataPtr
 xmlSecNssX509CertGetKey(CERTCertificate* cert) {
     xmlSecKeyDataPtr data;
     SECKEYPublicKey *pubkey = NULL;
-    
+
     xmlSecAssert2(cert != NULL, NULL);
 
     pubkey = CERT_ExtractPublicKey(cert);
@@ -1752,7 +1752,7 @@ xmlSecNssX509CertGetKey(CERTCertificate* cert) {
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "error code=%d", PORT_GetError());
         return(NULL);
-    }    
+    }
 
     data = xmlSecNssPKIAdoptKey(NULL, pubkey);
     if(data == NULL) {
@@ -1762,9 +1762,9 @@ xmlSecNssX509CertGetKey(CERTCertificate* cert) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         SECKEY_DestroyPublicKey(pubkey);
-        return(NULL);       
-    }    
-    
+        return(NULL);
+    }
+
     return(data);
 }
 
@@ -1773,9 +1773,9 @@ xmlSecNssX509CertBase64DerRead(xmlChar* buf) {
     int ret;
 
     xmlSecAssert2(buf != NULL, NULL);
-    
+
     /* usual trick with base64 decoding "in-place" */
-    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf)); 
+    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1784,7 +1784,7 @@ xmlSecNssX509CertBase64DerRead(xmlChar* buf) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(xmlSecNssX509CertDerRead((xmlSecByte*)buf, ret));
 }
 
@@ -1796,7 +1796,7 @@ xmlSecNssX509CertDerRead(const xmlSecByte* buf, xmlSecSize size) {
 
     xmlSecAssert2(buf != NULL, NULL);
     xmlSecAssert2(size > 0, NULL);
-    
+
     derCert.data = (unsigned char *)buf;
     derCert.len = size;
 
@@ -1823,7 +1823,7 @@ xmlSecNssX509CertBase64DerWrite(CERTCertificate* cert, int base64LineWrap) {
     long size;
 
     xmlSecAssert2(cert != NULL, NULL);
-        
+
     p = cert->derCert.data;
     size = cert->derCert.len;
     if((size <= 0) || (p == NULL)){
@@ -1834,7 +1834,7 @@ xmlSecNssX509CertBase64DerWrite(CERTCertificate* cert, int base64LineWrap) {
                     "error code=%d", PORT_GetError());
         return(NULL);
     }
-    
+
     res = xmlSecBase64Encode(p, size, base64LineWrap);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1843,20 +1843,20 @@ xmlSecNssX509CertBase64DerWrite(CERTCertificate* cert, int base64LineWrap) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
-    }    
+    }
 
     return(res);
 }
 
 static CERTSignedCrl*
-xmlSecNssX509CrlBase64DerRead(xmlChar* buf, 
+xmlSecNssX509CrlBase64DerRead(xmlChar* buf,
                               xmlSecKeyInfoCtxPtr keyInfoCtx) {
     int ret;
 
     xmlSecAssert2(buf != NULL, NULL);
-    
+
     /* usual trick with base64 decoding "in-place" */
-    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf)); 
+    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1865,7 +1865,7 @@ xmlSecNssX509CrlBase64DerRead(xmlChar* buf,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(xmlSecNssX509CrlDerRead((xmlSecByte*)buf, ret, keyInfoCtx));
 }
 
@@ -1881,7 +1881,7 @@ xmlSecNssX509CrlDerRead(xmlSecByte* buf, xmlSecSize size,
     xmlSecAssert2(buf != NULL, NULL);
     xmlSecAssert2(keyInfoCtx != NULL, NULL);
     xmlSecAssert2(size > 0, NULL);
-    
+
     derCrl.data = buf;
     derCrl.len = size;
 
@@ -1901,7 +1901,7 @@ xmlSecNssX509CrlDerRead(xmlSecByte* buf, xmlSecSize size,
     if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS) != 0)
         importOptions |= CRL_IMPORT_BYPASS_CHECKS;
 
-    crl = PK11_ImportCRL(slot, &derCrl, NULL, SEC_CRL_TYPE, NULL, 
+    crl = PK11_ImportCRL(slot, &derCrl, NULL, SEC_CRL_TYPE, NULL,
                          importOptions, NULL, CRL_DECODE_DEFAULT_OPTIONS);
 
     if(crl == NULL) {
@@ -1945,7 +1945,7 @@ xmlSecNssX509CrlBase64DerWrite(CERTSignedCrl* crl, int base64LineWrap) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
-    }   
+    }
 
     return(res);
 }
@@ -1984,11 +1984,11 @@ xmlSecNssX509NameWrite(CERTName* nm) {
 static xmlChar*
 xmlSecNssASN1IntegerWrite(SECItem *num) {
     xmlChar *res = NULL;
-    
+
     xmlSecAssert2(num != NULL, NULL);
 
-    /* TODO : to be implemented after 
-     * NSS bug http://bugzilla.mozilla.org/show_bug.cgi?id=212864 is fixed 
+    /* TODO : to be implemented after
+     * NSS bug http://bugzilla.mozilla.org/show_bug.cgi?id=212864 is fixed
      */
     return(res);
 }
@@ -2025,12 +2025,12 @@ xmlSecNssX509SKIWrite(CERTCertificate* cert) {
         return(NULL);
     }
     SECITEM_FreeItem(&ski, PR_FALSE);
-    
+
     return(res);
 }
 
 
-static void 
+static void
 xmlSecNssX509CertDebugDump(CERTCertificate* cert, FILE* output) {
     SECItem *sn;
     unsigned int i;
@@ -2053,7 +2053,7 @@ xmlSecNssX509CertDebugDump(CERTCertificate* cert, FILE* output) {
 }
 
 
-static void 
+static void
 xmlSecNssX509CertDebugXmlDump(CERTCertificate* cert, FILE* output) {
     SECItem *sn;
     unsigned int i;
@@ -2100,12 +2100,12 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataRawX509CertKlass = {
 
     /* data */
     xmlSecNameRawX509Cert,
-    xmlSecKeyDataUsageRetrievalMethodNodeBin, 
+    xmlSecKeyDataUsageRetrievalMethodNodeBin,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefRawX509Cert,                      /* const xmlChar* href; */
     NULL,                                       /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     NULL,                                       /* xmlSecKeyDataInitializeMethod initialize; */
     NULL,                                       /* xmlSecKeyDataDuplicateMethod duplicate; */
@@ -2115,7 +2115,7 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataRawX509CertKlass = {
     /* get info */
     NULL,                                       /* xmlSecKeyDataGetTypeMethod getType; */
     NULL,                                       /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     NULL,                                       /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -2134,12 +2134,12 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataRawX509CertKlass = {
 
 /**
  * xmlSecNssKeyDataRawX509CertGetKlass:
- * 
+ *
  * The raw X509 certificates key data klass.
  *
  * Returns: raw X509 certificates key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecNssKeyDataRawX509CertGetKlass(void) {
     return(&xmlSecNssKeyDataRawX509CertKlass);
 }
@@ -2151,7 +2151,7 @@ xmlSecNssKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     xmlSecKeyDataPtr data;
     CERTCertificate* cert;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecNssKeyDataRawX509CertId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(buf != NULL, -1);
@@ -2178,7 +2178,7 @@ xmlSecNssKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
         CERT_DestroyCertificate(cert);
         return(-1);
     }
-    
+
     ret = xmlSecNssKeyDataX509AdoptCert(data, cert);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
diff --git a/src/nss/x509vfy.c b/src/nss/x509vfy.c
index 42cfddd..2dbede0 100644
--- a/src/nss/x509vfy.c
+++ b/src/nss/x509vfy.c
@@ -1,4 +1,4 @@
-/** 
+/**
  * XMLSec library
  *
  * X509 support
@@ -6,7 +6,7 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (c) 2003 America Online, Inc.  All rights reserved.
  */
 #include "globals.h"
@@ -40,11 +40,11 @@
  * Internal NSS X509 store CTX
  *
  *************************************************************************/
-typedef struct _xmlSecNssX509StoreCtx           xmlSecNssX509StoreCtx, 
+typedef struct _xmlSecNssX509StoreCtx           xmlSecNssX509StoreCtx,
                                                 *xmlSecNssX509StoreCtxPtr;
 struct _xmlSecNssX509StoreCtx {
     CERTCertList* certsList; /* just keeping a reference to destroy later */
-};          
+};
 
 /****************************************************************************
  *
@@ -58,16 +58,16 @@ struct _xmlSecNssX509StoreCtx {
                                     sizeof(xmlSecKeyDataStoreKlass)))
 #define xmlSecNssX509StoreSize  \
     (sizeof(xmlSecKeyDataStoreKlass) + sizeof(xmlSecNssX509StoreCtx))
- 
+
 static int              xmlSecNssX509StoreInitialize    (xmlSecKeyDataStorePtr store);
 static void             xmlSecNssX509StoreFinalize      (xmlSecKeyDataStorePtr store);
-static int              xmlSecNssX509NameStringRead     (xmlSecByte **str, 
-                                                         int *strLen, 
-                                                         xmlSecByte *res, 
+static int              xmlSecNssX509NameStringRead     (xmlSecByte **str,
+                                                         int *strLen,
+                                                         xmlSecByte *res,
                                                          int resLen,
-                                                         xmlSecByte delim, 
+                                                         xmlSecByte delim,
                                                          int ingoreTrailingSpaces);
-static xmlSecByte *     xmlSecNssX509NameRead           (xmlSecByte *str, 
+static xmlSecByte *     xmlSecNssX509NameRead           (xmlSecByte *str,
                                                          int len);
 
 static void             xmlSecNssNumToItem(SECItem *it, unsigned long num);
@@ -78,8 +78,8 @@ static xmlSecKeyDataStoreKlass xmlSecNssX509StoreKlass = {
     xmlSecNssX509StoreSize,
 
     /* data */
-    xmlSecNameX509Store,                        /* const xmlChar* name; */ 
-        
+    xmlSecNameX509Store,                        /* const xmlChar* name; */
+
     /* constructors/destructor */
     xmlSecNssX509StoreInitialize,               /* xmlSecKeyDataStoreInitializeMethod initialize; */
     xmlSecNssX509StoreFinalize,                 /* xmlSecKeyDataStoreFinalizeMethod finalize; */
@@ -95,14 +95,14 @@ static CERTCertificate*         xmlSecNssX509FindCert(xmlChar *subjectName,
                                                       xmlChar *ski);
 
 
-/** 
+/**
  * xmlSecNssX509StoreGetKlass:
- * 
+ *
  * The NSS X509 certificates key data store klass.
  *
  * Returns: pointer to NSS X509 certificates key data store klass.
  */
-xmlSecKeyDataStoreId 
+xmlSecKeyDataStoreId
 xmlSecNssX509StoreGetKlass(void) {
     return(&xmlSecNssX509StoreKlass);
 }
@@ -126,7 +126,7 @@ xmlSecNssX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectName,
                                 xmlChar *issuerName, xmlChar *issuerSerial,
                                 xmlChar *ski, xmlSecKeyInfoCtx* keyInfoCtx) {
     xmlSecNssX509StoreCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecNssX509StoreId), NULL);
     xmlSecAssert2(keyInfoCtx != NULL, NULL);
 
@@ -145,8 +145,8 @@ xmlSecNssX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectName,
  * Verifies @certs list.
  *
  * Returns: pointer to the first verified certificate from @certs.
- */ 
-CERTCertificate *       
+ */
+CERTCertificate *
 xmlSecNssX509StoreVerify(xmlSecKeyDataStorePtr store, CERTCertList* certs,
                              xmlSecKeyInfoCtx* keyInfoCtx) {
     xmlSecNssX509StoreCtxPtr ctx;
@@ -179,9 +179,9 @@ xmlSecNssX509StoreVerify(xmlSecKeyDataStorePtr store, CERTCertList* certs,
             timeboundary = PR_Now();
         }
 
-        /* if cert is the issuer of any other cert in the list, then it is 
+        /* if cert is the issuer of any other cert in the list, then it is
          * to be skipped */
-        for (head1 = CERT_LIST_HEAD(certs); 
+        for (head1 = CERT_LIST_HEAD(certs);
              !CERT_LIST_END(head1, certs);
              head1 = CERT_LIST_NEXT(head1)) {
 
@@ -200,8 +200,8 @@ xmlSecNssX509StoreVerify(xmlSecKeyDataStorePtr store, CERTCertList* certs,
             continue;
         }
 
-        status = CERT_VerifyCertificate(CERT_GetDefaultCertDB(), 
-                                        cert, PR_FALSE, 
+        status = CERT_VerifyCertificate(CERT_GetDefaultCertDB(),
+                                        cert, PR_FALSE,
                                         (SECCertificateUsage)0,
                                         timeboundary , NULL, NULL, NULL);
         if (status == SECSuccess) {
@@ -212,7 +212,7 @@ xmlSecNssX509StoreVerify(xmlSecKeyDataStorePtr store, CERTCertList* certs,
     if (status == SECSuccess) {
         return (cert);
     }
-    
+
     switch(PORT_GetError()) {
         case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:
         case SEC_ERROR_CA_CERT_INVALID:
@@ -250,7 +250,7 @@ xmlSecNssX509StoreVerify(xmlSecKeyDataStorePtr store, CERTCertList* certs,
                         PORT_GetError());
             break;
     }
-   
+
     return (NULL);
 }
 
@@ -310,7 +310,7 @@ xmlSecNssX509StoreInitialize(xmlSecKeyDataStorePtr store) {
 
     memset(ctx, 0, sizeof(xmlSecNssX509StoreCtx));
 
-    return(0);    
+    return(0);
 }
 
 static void
@@ -320,7 +320,7 @@ xmlSecNssX509StoreFinalize(xmlSecKeyDataStorePtr store) {
 
     ctx = xmlSecNssX509StoreGetCtx(store);
     xmlSecAssert(ctx != NULL);
-    
+
     if (ctx->certsList) {
         CERT_DestroyCertList(ctx->certsList);
         ctx->certsList = NULL;
@@ -335,8 +335,8 @@ xmlSecNssX509StoreFinalize(xmlSecKeyDataStorePtr store) {
  * Low-level x509 functions
  *
  *****************************************************************************/
-static CERTCertificate*         
-xmlSecNssX509FindCert(xmlChar *subjectName, xmlChar *issuerName, 
+static CERTCertificate*
+xmlSecNssX509FindCert(xmlChar *subjectName, xmlChar *issuerName,
                       xmlChar *issuerSerial, xmlChar *ski) {
     CERTCertificate *cert = NULL;
     xmlChar         *p = NULL;
@@ -444,7 +444,7 @@ xmlSecNssX509FindCert(xmlChar *subjectName, xmlChar *issuerName,
         /* TBD: serial num can be arbitrarily long */
         xmlSecNssNumToItem(&issuerAndSN.serialNumber, PORT_Atoi((char *)issuerSerial));
 
-        cert = CERT_FindCertByIssuerAndSN(CERT_GetDefaultCertDB(), 
+        cert = CERT_FindCertByIssuerAndSN(CERT_GetDefaultCertDB(),
                                           &issuerAndSN);
         SECITEM_FreeItem(&issuerAndSN.serialNumber, PR_FALSE);
         goto done;
@@ -468,7 +468,7 @@ xmlSecNssX509FindCert(xmlChar *subjectName, xmlChar *issuerName,
         memset(&subjKeyID, 0, sizeof(subjKeyID));
         subjKeyID.data = ski;
         subjKeyID.len = xmlStrlen(ski);
-        cert = CERT_FindCertBySubjectKeyID(CERT_GetDefaultCertDB(), 
+        cert = CERT_FindCertBySubjectKeyID(CERT_GetDefaultCertDB(),
                                            &subjKeyID);
     }
 
@@ -495,7 +495,7 @@ xmlSecNssX509NameRead(xmlSecByte *str, int len) {
     int nameLen, valueLen;
 
     xmlSecAssert2(str != NULL, NULL);
-    
+
     /* return string should be no longer than input string */
     retval = (xmlSecByte *)PORT_Alloc(len+1);
     if(retval == NULL) {
@@ -507,14 +507,14 @@ xmlSecNssX509NameRead(xmlSecByte *str, int len) {
         return(NULL);
     }
     p = retval;
-    
+
     while(len > 0) {
         /* skip spaces after comma or semicolon */
         while((len > 0) && isspace(*str)) {
             ++str; --len;
         }
 
-        nameLen = xmlSecNssX509NameStringRead(&str, &len, name, sizeof(name), '=', 0);  
+        nameLen = xmlSecNssX509NameStringRead(&str, &len, name, sizeof(name), '=', 0);
         if(nameLen < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -529,8 +529,8 @@ xmlSecNssX509NameRead(xmlSecByte *str, int len) {
         if(len > 0) {
             ++str; --len;
             if((*str) == '\"') {
-                valueLen = xmlSecNssX509NameStringRead(&str, &len, 
-                                        value, sizeof(value), '"', 1);  
+                valueLen = xmlSecNssX509NameStringRead(&str, &len,
+                                        value, sizeof(value), '"', 1);
                 if(valueLen < 0) {
                     xmlSecError(XMLSEC_ERRORS_HERE,
                                 NULL,
@@ -567,8 +567,8 @@ xmlSecNssX509NameRead(xmlSecByte *str, int len) {
                             "reading octect values is not implemented yet");
                 goto done;
             } else {
-                valueLen = xmlSecNssX509NameStringRead(&str, &len, 
-                                        value, sizeof(value), ',', 1);  
+                valueLen = xmlSecNssX509NameStringRead(&str, &len,
+                                        value, sizeof(value), ',', 1);
                 if(valueLen < 0) {
                     xmlSecError(XMLSEC_ERRORS_HERE,
                                 NULL,
@@ -581,44 +581,44 @@ xmlSecNssX509NameRead(xmlSecByte *str, int len) {
                 p+=valueLen;
                 if (len > 0)
                     *p++=',';
-            }                   
+            }
         } else {
             valueLen = 0;
         }
         if(len > 0) {
             ++str; --len;
-        }       
+        }
     }
 
     *p = 0;
     return(retval);
-    
+
 done:
     PORT_Free(retval);
     return (NULL);
 }
 
-static int 
-xmlSecNssX509NameStringRead(xmlSecByte **str, int *strLen, 
+static int
+xmlSecNssX509NameStringRead(xmlSecByte **str, int *strLen,
                             xmlSecByte *res, int resLen,
                             xmlSecByte delim, int ingoreTrailingSpaces) {
-    xmlSecByte *p, *q, *nonSpace; 
+    xmlSecByte *p, *q, *nonSpace;
 
     xmlSecAssert2(str != NULL, -1);
     xmlSecAssert2(strLen != NULL, -1);
     xmlSecAssert2(res != NULL, -1);
-    
+
     p = (*str);
     nonSpace = q = res;
-    while(((p - (*str)) < (*strLen)) && ((*p) != delim) && ((q - res) < resLen)) { 
+    while(((p - (*str)) < (*strLen)) && ((*p) != delim) && ((q - res) < resLen)) {
         if((*p) != '\\') {
             if(ingoreTrailingSpaces && !isspace(*p)) {
-                nonSpace = q;   
+                nonSpace = q;
             }
             *(q++) = *(p++);
         } else {
             ++p;
-            nonSpace = q;    
+            nonSpace = q;
             if(xmlSecIsHex((*p))) {
                 if((p - (*str) + 1) >= (*strLen)) {
                     xmlSecError(XMLSEC_ERRORS_HERE,
@@ -639,9 +639,9 @@ xmlSecNssX509NameStringRead(xmlSecByte **str, int *strLen,
                                 "escaped symbol missed");
                     return(-1);
                 }
-                *(q++) = *(p++); 
+                *(q++) = *(p++);
             }
-        }           
+        }
     }
     if(((p - (*str)) < (*strLen)) && ((*p) != delim)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
diff --git a/src/openssl/README b/src/openssl/README
index 462b184..0f1c625 100644
--- a/src/openssl/README
+++ b/src/openssl/README
@@ -5,13 +5,13 @@ OpenSSL 0.9.6 is supported but some functionality requires 0.9.7 or greater.
 KEYS MANAGER
 ------------------------------------------------------------------------
 
-OpenSSL does not have a keys or certificates storage implementation. The 
-default xmlsec-openssl key manager uses a simple keys store from xmlsec 
+OpenSSL does not have a keys or certificates storage implementation. The
+default xmlsec-openssl key manager uses a simple keys store from xmlsec
 core library based on plain keys list. Trusted/untrusted certificates
 are stored in STACK_OF(X509) structures.
 
 KNOWN ISSUES.
 ------------------------------------------------------------------------
-1) One day we might decide to drop OpenSSL 0.9.6 supprot and remove all 
+1) One day we might decide to drop OpenSSL 0.9.6 supprot and remove all
 these ifdef's to simplify the code.
 
diff --git a/src/openssl/app.c b/src/openssl/app.c
index cc0ff18..a52f507 100644
--- a/src/openssl/app.c
+++ b/src/openssl/app.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -42,7 +42,7 @@ static int      xmlSecOpenSSLDummyPasswordCallback  (char *buf, int bufsize, int
  * @config:             the path to certs.
  *
  * General crypto engine initialization. This function is used
- * by XMLSec command line utility and called before 
+ * by XMLSec command line utility and called before
  * @xmlSecInit function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -61,7 +61,7 @@ xmlSecOpenSSLAppInit(const char* config) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     if((config != NULL) && (xmlSecOpenSSLSetDefaultTrustedCertsFolder(BAD_CAST config) < 0)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -76,9 +76,9 @@ xmlSecOpenSSLAppInit(const char* config) {
 
 /**
  * xmlSecOpenSSLAppShutdown:
- * 
+ *
  * General crypto engine shutdown. This function is used
- * by XMLSec command line utility and called after 
+ * by XMLSec command line utility and called after
  * @xmlSecShutdown function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -87,15 +87,15 @@ int
 xmlSecOpenSSLAppShutdown(void) {
     xmlSecOpenSSLAppSaveRANDFile(NULL);
     RAND_cleanup();
-    EVP_cleanup();    
+    EVP_cleanup();
 
 #ifndef XMLSEC_NO_X509
     X509_TRUST_cleanup();
-#endif /* XMLSEC_NO_X509 */    
+#endif /* XMLSEC_NO_X509 */
 
 #ifndef XMLSEC_OPENSSL_096
     CRYPTO_cleanup_all_ex_data();
-#endif /* XMLSEC_OPENSSL_096 */     
+#endif /* XMLSEC_OPENSSL_096 */
 
     /* finally cleanup errors */
     ERR_remove_state(0);
@@ -118,11 +118,11 @@ xmlSecOpenSSLAppShutdown(void) {
  */
 xmlSecKeyPtr
 xmlSecOpenSSLAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
-                        const char *pwd, void* pwdCallback, 
+                        const char *pwd, void* pwdCallback,
                         void* pwdCallbackCtx) {
     BIO* bio;
     xmlSecKeyPtr key;
-    
+
     xmlSecAssert2(filename != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
 
@@ -132,10 +132,10 @@ xmlSecOpenSSLAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                     NULL,
                     "BIO_new_file",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                    "filename=%s;errno=%d", 
-                    xmlSecErrorsSafeString(filename), 
+                    "filename=%s;errno=%d",
+                    xmlSecErrorsSafeString(filename),
                     errno);
-        return(NULL);    
+        return(NULL);
     }
 
     key = xmlSecOpenSSLAppKeyLoadBIO (bio, format, pwd, pwdCallback, pwdCallbackCtx);
@@ -144,13 +144,13 @@ xmlSecOpenSSLAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                     NULL,
                     "xmlSecOpenSSLAppKeyLoadBIO",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s;errno=%d", 
-                    xmlSecErrorsSafeString(filename), 
+                    "filename=%s;errno=%d",
+                    xmlSecErrorsSafeString(filename),
                     errno);
         BIO_free(bio);
         return(NULL);
     }
-    
+
     BIO_free(bio);
     return(key);
 }
@@ -169,15 +169,15 @@ xmlSecOpenSSLAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
  * Returns: pointer to the key or NULL if an error occurs.
  */
 xmlSecKeyPtr
-xmlSecOpenSSLAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, 
-                        xmlSecKeyDataFormat format, const char *pwd, 
+xmlSecOpenSSLAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
+                        xmlSecKeyDataFormat format, const char *pwd,
                         void* pwdCallback, void* pwdCallbackCtx) {
     BIO* bio;
     xmlSecKeyPtr key;
-    
+
     xmlSecAssert2(data != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
-    
+
     /* this would be a read only BIO, cast from const is ok */
     bio = BIO_new_mem_buf((void*)data, dataSize);
     if(bio == NULL) {
@@ -185,9 +185,9 @@ xmlSecOpenSSLAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
                     NULL,
                     "BIO_new_mem_buf",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                    "errno=%d", 
+                    "errno=%d",
                     errno);
-        return(NULL);    
+        return(NULL);
     }
 
     key = xmlSecOpenSSLAppKeyLoadBIO (bio, format, pwd, pwdCallback, pwdCallbackCtx);
@@ -200,7 +200,7 @@ xmlSecOpenSSLAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
         BIO_free(bio);
         return(NULL);
     }
-    
+
     BIO_free(bio);
     return(key);
 }
@@ -220,12 +220,12 @@ xmlSecOpenSSLAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
  */
 xmlSecKeyPtr
 xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
-                        const char *pwd, void* pwdCallback, 
+                        const char *pwd, void* pwdCallback,
                         void* pwdCallbackCtx) {
 
     xmlSecKeyPtr key = NULL;
     xmlSecKeyDataPtr data;
-    EVP_PKEY* pKey = NULL;    
+    EVP_PKEY* pKey = NULL;
     int ret;
 
     xmlSecAssert2(bio != NULL, NULL);
@@ -233,13 +233,13 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
 
     switch(format) {
     case xmlSecKeyDataFormatPem:
-        /* try to read private key first */    
-            pKey = PEM_read_bio_PrivateKey(bio, NULL, 
-            (pwd != NULL) ? xmlSecOpenSSLDummyPasswordCallback : (pem_password_cb*)pwdCallback, 
+        /* try to read private key first */
+            pKey = PEM_read_bio_PrivateKey(bio, NULL,
+            (pwd != NULL) ? xmlSecOpenSSLDummyPasswordCallback : (pem_password_cb*)pwdCallback,
             (pwd != NULL) ? pwd : pwdCallbackCtx);
         if(pKey == NULL) {
             /* go to start of the file and try to read public key */
-            BIO_reset(bio); 
+            BIO_reset(bio);
             pKey = PEM_read_bio_PUBKEY(bio, NULL, (pem_password_cb*)pwdCallback, pwdCallbackCtx);
             if(pKey == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -252,11 +252,11 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
         }
         break;
     case xmlSecKeyDataFormatDer:
-        /* try to read private key first */    
+        /* try to read private key first */
         pKey = d2i_PrivateKey_bio(bio, NULL);
         if(pKey == NULL) {
             /* go to start of the file and try to read public key */
-            BIO_reset(bio); 
+            BIO_reset(bio);
             pKey = d2i_PUBKEY_bio(bio, NULL);
             if(pKey == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -269,7 +269,7 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
         }
         break;
     case xmlSecKeyDataFormatPkcs8Pem:
-        /* try to read private key first */    
+        /* try to read private key first */
         pKey = PEM_read_bio_PrivateKey(bio, NULL, (pem_password_cb*)pwdCallback, pwdCallbackCtx);
         if(pKey == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -277,11 +277,11 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
                         "PEM_read_bio_PrivateKey",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);       
+            return(NULL);
         }
         break;
     case xmlSecKeyDataFormatPkcs8Der:
-        /* try to read private key first */    
+        /* try to read private key first */
         pKey = d2i_PKCS8PrivateKey_bio(bio, NULL, (pem_password_cb*)pwdCallback, pwdCallbackCtx);
         if(pKey == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -301,12 +301,12 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
                         "xmlSecOpenSSLAppPkcs12LoadBIO",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);       
+            return(NULL);
         }
         return(key);
-        
+
     case xmlSecKeyDataFormatCertPem:
-    case xmlSecKeyDataFormatCertDer: 
+    case xmlSecKeyDataFormatCertDer:
         key = xmlSecOpenSSLAppKeyFromCertLoadBIO(bio, format);
         if(key == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -314,7 +314,7 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
                         "xmlSecOpenSSLAppKeyFromCertLoadBIO",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);       
+            return(NULL);
         }
         return(key);
 #endif /* XMLSEC_NO_X509 */
@@ -324,9 +324,9 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_FORMAT,
-                    "format=%d", format); 
+                    "format=%d", format);
         return(NULL);
-    }           
+    }
 
     data = xmlSecOpenSSLEvpKeyAdopt(pKey);
     if(data == NULL) {
@@ -336,8 +336,8 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         EVP_PKEY_free(pKey);
-        return(NULL);       
-    }    
+        return(NULL);
+    }
 
     key = xmlSecKeyCreate();
     if(key == NULL) {
@@ -349,7 +349,7 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
         xmlSecKeyDataDestroy(data);
         return(NULL);
     }
-    
+
     ret = xmlSecKeySetValue(key, data);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -362,7 +362,7 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
         xmlSecKeyDataDestroy(data);
         return(NULL);
     }
-    
+
     return(key);
 }
 
@@ -377,14 +377,14 @@ static X509*            xmlSecOpenSSLAppCertLoadBIO             (BIO* bio,
  * @format:             the certificate file format.
  *
  * Reads the certificate from $ filename and adds it to key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
+int
 xmlSecOpenSSLAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFormat format) {
     BIO* bio;
     int ret;
-        
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
@@ -395,10 +395,10 @@ xmlSecOpenSSLAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDat
                     NULL,
                     "BIO_new_file",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                    "filename=%s;errno=%d", 
-                    xmlSecErrorsSafeString(filename), 
+                    "filename=%s;errno=%d",
+                    xmlSecErrorsSafeString(filename),
                     errno);
-        return(-1);    
+        return(-1);
     }
 
     ret = xmlSecOpenSSLAppKeyCertLoadBIO (key, bio, format);
@@ -407,13 +407,13 @@ xmlSecOpenSSLAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDat
                     NULL,
                     "xmlSecOpenSSLAppKeyCertLoadBIO",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s;errno=%d", 
-                    xmlSecErrorsSafeString(filename), 
+                    "filename=%s;errno=%d",
+                    xmlSecErrorsSafeString(filename),
                     errno);
         BIO_free(bio);
         return(-1);
     }
-    
+
     BIO_free(bio);
     return(0);
 }
@@ -426,15 +426,15 @@ xmlSecOpenSSLAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDat
  * @format:             the certificate file format.
  *
  * Reads the certificate from memory buffer and adds it to key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
-xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize, 
+int
+xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
                                 xmlSecKeyDataFormat format) {
     BIO* bio;
     int ret;
-        
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
@@ -446,9 +446,9 @@ xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlS
                     NULL,
                     "BIO_new_mem_buf",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                    "errno=%d", 
+                    "errno=%d",
                     errno);
-        return(-1);    
+        return(-1);
     }
 
     ret = xmlSecOpenSSLAppKeyCertLoadBIO (key, bio, format);
@@ -461,7 +461,7 @@ xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlS
         BIO_free(bio);
         return(-1);
     }
-    
+
     BIO_free(bio);
     return(0);
 }
@@ -473,26 +473,26 @@ xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlS
  * @format:             the certificate file format.
  *
  * Reads the certificate from memory buffer and adds it to key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
+int
 xmlSecOpenSSLAppKeyCertLoadBIO(xmlSecKeyPtr key, BIO* bio, xmlSecKeyDataFormat format) {
 
     xmlSecKeyDataFormat certFormat;
     xmlSecKeyDataPtr data;
     X509 *cert;
     int ret;
-    
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(bio != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
-    
+
     data = xmlSecKeyEnsureData(key, xmlSecOpenSSLKeyDataX509Id);
     if(data == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecKeyEnsureData",                  
+                    "xmlSecKeyEnsureData",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecOpenSSLKeyDataX509Id)));
@@ -515,12 +515,12 @@ xmlSecOpenSSLAppKeyCertLoadBIO(xmlSecKeyPtr key, BIO* bio, xmlSecKeyDataFormat f
     if(cert == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecOpenSSLAppCertLoad", 
+                    "xmlSecOpenSSLAppCertLoad",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);    
-    }           
-    
+        return(-1);
+    }
+
     ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -530,10 +530,10 @@ xmlSecOpenSSLAppKeyCertLoadBIO(xmlSecKeyPtr key, BIO* bio, xmlSecKeyDataFormat f
                     "data=%s",
                     xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
         X509_free(cert);
-        return(-1);    
+        return(-1);
     }
-    
-    return(0);        
+
+    return(0);
 }
 
 /**
@@ -549,12 +549,12 @@ xmlSecOpenSSLAppKeyCertLoadBIO(xmlSecKeyPtr key, BIO* bio, xmlSecKeyDataFormat f
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
+xmlSecKeyPtr
 xmlSecOpenSSLAppPkcs12Load(const char *filename, const char *pwd,
                            void* pwdCallback, void* pwdCallbackCtx) {
     BIO* bio;
     xmlSecKeyPtr key;
-    
+
     xmlSecAssert2(filename != NULL, NULL);
 
     bio = BIO_new_file(filename, "rb");
@@ -563,10 +563,10 @@ xmlSecOpenSSLAppPkcs12Load(const char *filename, const char *pwd,
                     NULL,
                     "BIO_new_file",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                    "filename=%s;errno=%d", 
-                    xmlSecErrorsSafeString(filename), 
+                    "filename=%s;errno=%d",
+                    xmlSecErrorsSafeString(filename),
                     errno);
-        return(NULL);    
+        return(NULL);
     }
 
     key = xmlSecOpenSSLAppPkcs12LoadBIO (bio, pwd, pwdCallback, pwdCallbackCtx);
@@ -575,13 +575,13 @@ xmlSecOpenSSLAppPkcs12Load(const char *filename, const char *pwd,
                     NULL,
                     "xmlSecOpenSSLAppPkcs12LoadBIO",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s;errno=%d", 
-                    xmlSecErrorsSafeString(filename), 
+                    "filename=%s;errno=%d",
+                    xmlSecErrorsSafeString(filename),
                     errno);
         BIO_free(bio);
         return(NULL);
     }
-    
+
     BIO_free(bio);
     return(key);
 }
@@ -600,13 +600,13 @@ xmlSecOpenSSLAppPkcs12Load(const char *filename, const char *pwd,
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
-xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, 
-                           const char *pwd, void* pwdCallback, 
+xmlSecKeyPtr
+xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
+                           const char *pwd, void* pwdCallback,
                            void* pwdCallbackCtx) {
     BIO* bio;
     xmlSecKeyPtr key;
-    
+
     xmlSecAssert2(data != NULL, NULL);
 
     /* this would be a read only BIO, cast from const is ok */
@@ -616,9 +616,9 @@ xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
                     NULL,
                     "BIO_new_mem_buf",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                    "errno=%d", 
+                    "errno=%d",
                     errno);
-        return(NULL);    
+        return(NULL);
     }
 
     key = xmlSecOpenSSLAppPkcs12LoadBIO (bio, pwd, pwdCallback, pwdCallbackCtx);
@@ -631,7 +631,7 @@ xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
         BIO_free(bio);
         return(NULL);
     }
-    
+
     BIO_free(bio);
     return(key);
 }
@@ -649,9 +649,9 @@ xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
+xmlSecKeyPtr
 xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
-                           void* pwdCallback ATTRIBUTE_UNUSED, 
+                           void* pwdCallback ATTRIBUTE_UNUSED,
                            void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
 
     PKCS12 *p12 = NULL;
@@ -667,7 +667,7 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
     int ret;
 
     xmlSecAssert2(bio != NULL, NULL);
-        
+
     p12 = d2i_PKCS12_bio(bio, NULL);
     if(p12 == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -686,8 +686,8 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
-    }    
-        
+    }
+
     ret = PKCS12_parse(p12, pwd, &pKey, &cert, &chain);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -696,7 +696,7 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
-    }    
+    }
 
     data = xmlSecOpenSSLEvpKeyAdopt(pKey);
     if(data == NULL) {
@@ -705,9 +705,9 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
                     "xmlSecOpenSSLEvpKeyAdopt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        EVP_PKEY_free(pKey);    
+        EVP_PKEY_free(pKey);
         goto done;
-    }    
+    }
 
     x509Data = xmlSecKeyDataCreate(xmlSecOpenSSLKeyDataX509Id);
     if(x509Data == NULL) {
@@ -718,9 +718,9 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecOpenSSLKeyDataX509Id)));
         goto done;
-    }    
+    }
 
-    /* starting from openssl 1.0.0 the PKCS12_parse() call will not create certs 
+    /* starting from openssl 1.0.0 the PKCS12_parse() call will not create certs
        chain object if there is no certificates in the pkcs12 file and it will be null
      */
     if(chain == NULL) {
@@ -732,9 +732,9 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             goto done;
-        }    
-    } 
-    
+        }
+    }
+
         /*
         The documentation states (http://www.openssl.org/docs/crypto/PKCS12_parse.html):
 
@@ -753,7 +753,7 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
                         has_cert = 1;
                         break;
                 }
-        }       
+        }
         if(has_cert != 0) {
                 tmpcert = X509_dup(cert);
                 if(tmpcert == NULL) {
@@ -763,7 +763,7 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
                                 XMLSEC_ERRORS_R_CRYPTO_FAILED,
                                 "data=%s",
                                 xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
-                goto done;      
+                goto done;
                 }
 
                 ret = sk_X509_push(chain, tmpcert);
@@ -775,7 +775,7 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
                                 "data=%s",
                                 xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
                 X509_free(tmpcert);
-                goto done;      
+                goto done;
                 }
         }
 
@@ -803,9 +803,9 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
                         "data=%s",
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
             X509_free(tmpcert);
-            goto done;  
+            goto done;
         }
-        
+
         ret = xmlSecOpenSSLKeyDataX509AdoptCert(x509Data, tmpcert);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -817,7 +817,7 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
             goto done;
         }
     }
-        
+
     key = xmlSecKeyCreate();
     if(key == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -826,8 +826,8 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
-    }    
-    
+    }
+
     ret = xmlSecKeySetValue(key, data);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -855,8 +855,8 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
         goto done;
     }
     x509Data = NULL;
-    
-done: 
+
+done:
     if(x509Data != NULL) {
         xmlSecKeyDataDestroy(x509Data);
     }
@@ -864,7 +864,7 @@ done:
         xmlSecKeyDataDestroy(data);
     }
     if(chain != NULL) {
-        sk_X509_pop_free(chain, X509_free); 
+        sk_X509_pop_free(chain, X509_free);
     }
     if(cert != NULL) {
         X509_free(cert);
@@ -872,7 +872,7 @@ done:
     if(p12 != NULL) {
         PKCS12_free(p12);
     }
-    return(key);    
+    return(key);
 }
 
 /**
@@ -884,7 +884,7 @@ done:
  *
  * Returns: pointer to key or NULL if an error occurs.
  */
-xmlSecKeyPtr 
+xmlSecKeyPtr
 xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
     xmlSecKeyPtr key;
     xmlSecKeyDataPtr keyData;
@@ -894,7 +894,7 @@ xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
 
     xmlSecAssert2(bio != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
-    
+
     /* load cert */
     cert = xmlSecOpenSSLAppCertLoadBIO(bio, format);
     if(cert == NULL) {
@@ -903,7 +903,7 @@ xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
                     "xmlSecOpenSSLAppCertLoadBIO",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);    
+        return(NULL);
     }
 
     /* get key value */
@@ -915,9 +915,9 @@ xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         X509_free(cert);
-        return(NULL);    
+        return(NULL);
     }
-    
+
     /* create key */
     key = xmlSecKeyCreate();
     if(key == NULL) {
@@ -928,9 +928,9 @@ xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDataDestroy(keyData);
         X509_free(cert);
-        return(NULL);    
-    }    
-    
+        return(NULL);
+    }
+
     /* set key value */
     ret = xmlSecKeySetValue(key, keyData);
     if(ret < 0) {
@@ -942,20 +942,20 @@ xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
         xmlSecKeyDestroy(key);
         xmlSecKeyDataDestroy(keyData);
         X509_free(cert);
-        return(NULL);    
+        return(NULL);
     }
 
-    /* create cert data */ 
+    /* create cert data */
     certData = xmlSecKeyEnsureData(key, xmlSecOpenSSLKeyDataX509Id);
     if(certData == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecKeyEnsureData",                  
+                    "xmlSecKeyEnsureData",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDestroy(key);
         X509_free(cert);
-        return(NULL);    
+        return(NULL);
     }
 
     /* put cert in the cert data */
@@ -968,9 +968,9 @@ xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDestroy(key);
         X509_free(cert);
-        return(NULL);    
+        return(NULL);
     }
-    
+
     return(key);
 }
 
@@ -982,18 +982,18 @@ xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
  * @format:             the certificate file format.
  * @type:               the flag that indicates is the certificate in @filename
  *                      trusted or not.
- * 
+ *
  * Reads cert from @filename and adds to the list of trusted or known
  * untrusted certs in @store.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename, 
+xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
                             xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
     BIO* bio;
     int ret;
-        
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
@@ -1004,10 +1004,10 @@ xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
                     NULL,
                     "BIO_new_file",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                    "filename=%s;errno=%d", 
-                    xmlSecErrorsSafeString(filename), 
+                    "filename=%s;errno=%d",
+                    xmlSecErrorsSafeString(filename),
                     errno);
-        return(-1);    
+        return(-1);
     }
 
     ret = xmlSecOpenSSLAppKeysMngrCertLoadBIO(mngr, bio, format, type);
@@ -1016,13 +1016,13 @@ xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
                     NULL,
                     "xmlSecOpenSSLAppKeysMngrCertLoadBIO",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s;errno=%d", 
-                    xmlSecErrorsSafeString(filename), 
+                    "filename=%s;errno=%d",
+                    xmlSecErrorsSafeString(filename),
                     errno);
         BIO_free(bio);
         return(-1);
     }
-    
+
     BIO_free(bio);
     return(0);
 }
@@ -1034,7 +1034,7 @@ xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
  * @dataSize:           the certificate binary data size.
  * @format:             the certificate file format.
  * @type:               the flag that indicates is the certificate trusted or not.
- * 
+ *
  * Reads cert from binary buffer @data and adds to the list of trusted or known
  * untrusted certs in @store.
  *
@@ -1042,11 +1042,11 @@ xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
  */
 int
 xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
-                                    xmlSecSize dataSize, xmlSecKeyDataFormat format, 
+                                    xmlSecSize dataSize, xmlSecKeyDataFormat format,
                                     xmlSecKeyDataType type) {
     BIO* bio;
     int ret;
-        
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
@@ -1058,9 +1058,9 @@ xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
                     NULL,
                     "BIO_new_mem_buf",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                    "errno=%d", 
+                    "errno=%d",
                     errno);
-        return(-1);    
+        return(-1);
     }
 
     ret = xmlSecOpenSSLAppKeysMngrCertLoadBIO(mngr, bio, format, type);
@@ -1073,7 +1073,7 @@ xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
         BIO_free(bio);
         return(-1);
     }
-    
+
     BIO_free(bio);
     return(0);
 }
@@ -1084,14 +1084,14 @@ xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
  * @bio:                the certificate BIO.
  * @format:             the certificate file format.
  * @type:               the flag that indicates is the certificate trusted or not.
- * 
+ *
  * Reads cert from an OpenSSL BIO object and adds to the list of trusted or known
  * untrusted certs in @store.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr, BIO* bio, 
+xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr, BIO* bio,
                                     xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
     xmlSecKeyDataStorePtr x509Store;
     X509* cert;
@@ -1100,7 +1100,7 @@ xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr, BIO* bio,
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(bio != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
-    
+
     x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecOpenSSLX509StoreId);
     if(x509Store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1118,20 +1118,20 @@ xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr, BIO* bio,
                     "xmlSecOpenSSLAppCertLoadBIO",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);    
-    }           
-    
+        return(-1);
+    }
+
     ret = xmlSecOpenSSLX509StoreAdoptCert(x509Store, cert, type);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecOpenSSLX509StoreAdoptCert",              
+                    "xmlSecOpenSSLX509StoreAdoptCert",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         X509_free(cert);
-        return(-1);    
+        return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1139,7 +1139,7 @@ xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr, BIO* bio,
  * xmlSecOpenSSLAppKeysMngrAddCertsPath:
  * @mngr:               the keys manager.
  * @path:               the path to trusted certificates.
- * 
+ *
  * Reads cert from @path and adds to the list of trusted certificates.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -1151,7 +1151,7 @@ xmlSecOpenSSLAppKeysMngrAddCertsPath(xmlSecKeysMngrPtr mngr, const char *path) {
 
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(path != NULL, -1);
-    
+
     x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecOpenSSLX509StoreId);
     if(x509Store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1161,7 +1161,7 @@ xmlSecOpenSSLAppKeysMngrAddCertsPath(xmlSecKeysMngrPtr mngr, const char *path) {
                     "xmlSecOpenSSLX509StoreId");
         return(-1);
     }
-    
+
     ret = xmlSecOpenSSLX509StoreAddCertsPath(x509Store, path);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1169,9 +1169,9 @@ xmlSecOpenSSLAppKeysMngrAddCertsPath(xmlSecKeysMngrPtr mngr, const char *path) {
                     "xmlSecOpenSSLX509StoreAddCertsPath",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "path=%s", xmlSecErrorsSafeString(path));
-        return(-1);    
+        return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1216,10 +1216,10 @@ xmlSecOpenSSLAppKeysMngrAddCertsFile(xmlSecKeysMngrPtr mngr, const char *file) {
     return(0);
 }
 
-static X509*    
+static X509*
 xmlSecOpenSSLAppCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
     X509 *cert;
-    
+
     xmlSecAssert2(bio != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
 
@@ -1233,7 +1233,7 @@ xmlSecOpenSSLAppCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
                         "PEM_read_bio_X509_AUX",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);    
+            return(NULL);
         }
         break;
     case xmlSecKeyDataFormatDer:
@@ -1245,7 +1245,7 @@ xmlSecOpenSSLAppCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
                         "d2i_X509_bio",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);    
+            return(NULL);
         }
         break;
     default:
@@ -1253,10 +1253,10 @@ xmlSecOpenSSLAppCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_FORMAT,
-                    "format=%d", format); 
+                    "format=%d", format);
         return(NULL);
     }
-                
+
     return(cert);
 }
 
@@ -1270,14 +1270,14 @@ xmlSecOpenSSLAppCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
  * and a default OpenSSL crypto key data stores.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 int
 xmlSecOpenSSLAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
 
-    /* create simple keys store if needed */        
+    /* create simple keys store if needed */
     if(xmlSecKeysMngrGetKeysStore(mngr) == NULL) {
         xmlSecKeyStorePtr keysStore;
 
@@ -1290,7 +1290,7 @@ xmlSecOpenSSLAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         "xmlSecSimpleKeysStoreId");
             return(-1);
         }
-        
+
         ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1299,20 +1299,20 @@ xmlSecOpenSSLAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecKeyStoreDestroy(keysStore);
-            return(-1);        
+            return(-1);
         }
     }
 
-    ret = xmlSecOpenSSLKeysMngrInit(mngr);    
+    ret = xmlSecOpenSSLKeysMngrInit(mngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecOpenSSLKeysMngrInit",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1); 
+        return(-1);
     }
-    
+
     /* TODO */
     mngr->getKey = xmlSecKeysMngrGetKey;
     return(0);
@@ -1325,17 +1325,17 @@ xmlSecOpenSSLAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
  *
  * Adds @key to the keys manager @mngr created with #xmlSecOpenSSLAppDefaultKeysMngrInit
  * function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecOpenSSLAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1345,7 +1345,7 @@ xmlSecOpenSSLAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecSimpleKeysStoreAdoptKey(store, key);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1355,7 +1355,7 @@ xmlSecOpenSSLAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1364,19 +1364,19 @@ xmlSecOpenSSLAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key
  * @mngr:               the pointer to keys manager.
  * @uri:                the uri.
  *
- * Loads XML keys file from @uri to the keys manager @mngr created 
+ * Loads XML keys file from @uri to the keys manager @mngr created
  * with #xmlSecOpenSSLAppDefaultKeysMngrInit function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecOpenSSLAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(uri != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1386,7 +1386,7 @@ xmlSecOpenSSLAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecSimpleKeysStoreLoad(store, uri, mngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1396,7 +1396,7 @@ xmlSecOpenSSLAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     "uri=%s", xmlSecErrorsSafeString(uri));
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1407,18 +1407,18 @@ xmlSecOpenSSLAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
  * @type:               the type of keys to save (public/private/symmetric).
  *
  * Saves keys from @mngr to  XML keys file.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
-xmlSecOpenSSLAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename, 
+ */
+int
+xmlSecOpenSSLAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename,
                                     xmlSecKeyDataType type) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1428,7 +1428,7 @@ xmlSecOpenSSLAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecSimpleKeysStoreSave(store, filename, type);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1438,7 +1438,7 @@ xmlSecOpenSSLAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename
                     "filename%s", xmlSecErrorsSafeString(filename));
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1449,10 +1449,10 @@ xmlSecOpenSSLAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename
 static int seeded = 0;
 static int egdsocket = 0;
 
-static int 
+static int
 xmlSecOpenSSLAppLoadRANDFile(const char *file) {
     char buffer[1024];
-        
+
     if(file == NULL) {
         file = RAND_file_name(buffer, sizeof(buffer));
     }else if(RAND_egd(file) > 0) {
@@ -1476,10 +1476,10 @@ xmlSecOpenSSLAppLoadRANDFile(const char *file) {
     return 1;
 }
 
-static int 
+static int
 xmlSecOpenSSLAppSaveRANDFile(const char *file) {
     char buffer[1024];
-        
+
     if(egdsocket || !seeded) {
         /* If we did not manage to read the seed file,
          * we should not write a low-entropy seed file back --
@@ -1487,7 +1487,7 @@ xmlSecOpenSSLAppSaveRANDFile(const char *file) {
          * we want to use it. */
         return 0;
     }
-    
+
     if(file == NULL) {
         file = RAND_file_name(buffer, sizeof(buffer));
     }
@@ -1496,7 +1496,7 @@ xmlSecOpenSSLAppSaveRANDFile(const char *file) {
                     NULL,
                     "RAND_write_file",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                    "file=%s", 
+                    "file=%s",
                     xmlSecErrorsSafeString(file));
         return 0;
     }
@@ -1522,15 +1522,15 @@ xmlSecOpenSSLDefaultPasswordCallback(char *buf, int bufsize, int verify, void *u
     char* buf2;
     xmlChar prompt[2048];
     int i, ret;
-        
+
     xmlSecAssert2(buf != NULL, -1);
 
     /* try 3 times */
     for(i = 0; i < 3; i++) {
         if(filename != NULL) {
-            xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password for \"%s\" file: ", filename); 
+            xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password for \"%s\" file: ", filename);
         } else {
-            xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password: "); 
+            xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password: ");
         }
         ret = EVP_read_pw_string(buf, bufsize, (char*)prompt, 0);
         if(ret != 0) {
@@ -1541,16 +1541,16 @@ xmlSecOpenSSLDefaultPasswordCallback(char *buf, int bufsize, int verify, void *u
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-    
+
         /* if we don't need to verify password then we are done */
         if(verify == 0) {
             return(strlen(buf));
         }
 
         if(filename != NULL) {
-            xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password for \"%s\" file again: ", filename); 
+            xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password for \"%s\" file again: ", filename);
         } else {
-            xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password again: "); 
+            xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password again: ");
         }
 
         buf2 = (char*)xmlMalloc(bufsize);
@@ -1573,30 +1573,30 @@ xmlSecOpenSSLDefaultPasswordCallback(char *buf, int bufsize, int verify, void *u
             xmlFree(buf2);
             return(-1);
         }
-    
+
         /* check if passwords match */
         if(strcmp(buf, buf2) == 0) {
             memset(buf2, 0, bufsize);
         xmlFree(buf2);
-            return(strlen(buf));            
+            return(strlen(buf));
         }
-        
+
         /* try again */
         memset(buf2, 0, bufsize);
         xmlFree(buf2);
     }
-    
+
     return(-1);
 }
 
 static int
 xmlSecOpenSSLDummyPasswordCallback(char *buf, int bufsize, int verify, void *userdata) {
     char* password = (char*)userdata;
-    
+
     if((password == NULL) || (strlen(password) + 1 > bufsize)) {
         return(-1);
     }
-    
+
     strcpy(buf, password);
     return (strlen(buf));
 }
diff --git a/src/openssl/bn.c b/src/openssl/bn.c
index 222aa27..dfeae6e 100644
--- a/src/openssl/bn.c
+++ b/src/openssl/bn.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XMLSec library
- * 
+ *
  * Reading/writing BIGNUM values
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <libxml/tree.h> 
+#include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -28,8 +28,8 @@
  * @cur: the poitner to an XML node.
  * @a: the BIGNUM buffer.
  *
- * Converts the node content from CryptoBinary format 
- * (http://www.w3.org/TR/xmldsig-core/#sec-CryptoBinary) 
+ * Converts the node content from CryptoBinary format
+ * (http://www.w3.org/TR/xmldsig-core/#sec-CryptoBinary)
  * to a BIGNUM. If no BIGNUM buffer provided then a new
  * BIGNUM is created (caller is responsible for freeing it).
  *
@@ -51,8 +51,8 @@ xmlSecOpenSSLNodeGetBNValue(const xmlNodePtr cur, BIGNUM **a) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
-    }    
-    
+    }
+
     ret = xmlSecBufferBase64NodeContentRead(&buf, cur);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -62,10 +62,10 @@ xmlSecOpenSSLNodeGetBNValue(const xmlNodePtr cur, BIGNUM **a) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecBufferFinalize(&buf);
         return(NULL);
-    }    
-    
+    }
+
     (*a) = BN_bin2bn(xmlSecBufferGetData(&buf), xmlSecBufferGetSize(&buf), (*a));
-    if( (*a) == NULL) { 
+    if( (*a) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "BN_bin2bn",
@@ -82,16 +82,16 @@ xmlSecOpenSSLNodeGetBNValue(const xmlNodePtr cur, BIGNUM **a) {
  * xmlSecOpenSSLNodeSetBNValue:
  * @cur: the pointer to an XML node.
  * @a: the BIGNUM.
- * @addLineBreaks: if the flag is equal to 1 then 
+ * @addLineBreaks: if the flag is equal to 1 then
  *              linebreaks will be added before and after
  *              new buffer content.
  *
  * Converts BIGNUM to CryptoBinary string
- * (http://www.w3.org/TR/xmldsig-core/#sec-CryptoBinary) 
- * and sets it as the content of the given node. If the 
- * addLineBreaks is set then line breaks are added 
+ * (http://www.w3.org/TR/xmldsig-core/#sec-CryptoBinary)
+ * and sets it as the content of the given node. If the
+ * addLineBreaks is set then line breaks are added
  * before and after the CryptoBinary string.
- * 
+ *
  * Returns: 0 on success or -1 otherwise.
  */
 int
@@ -99,7 +99,7 @@ xmlSecOpenSSLNodeSetBNValue(xmlNodePtr cur, const BIGNUM *a, int addLineBreaks)
     xmlSecBuffer buf;
     xmlSecSize size;
     int ret;
-    
+
     xmlSecAssert2(a != NULL, -1);
     xmlSecAssert2(cur != NULL, -1);
 
@@ -111,7 +111,7 @@ xmlSecOpenSSLNodeSetBNValue(xmlNodePtr cur, const BIGNUM *a, int addLineBreaks)
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", BN_num_bytes(a) + 1);
         return(-1);
-    }    
+    }
 
     ret = BN_bn2bin(a, xmlSecBufferGetData(&buf));
     if(ret < 0) {
@@ -124,7 +124,7 @@ xmlSecOpenSSLNodeSetBNValue(xmlNodePtr cur, const BIGNUM *a, int addLineBreaks)
         return(-1);
     }
     size = ret;
-    
+
     ret = xmlSecBufferSetSize(&buf, size);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -141,7 +141,7 @@ xmlSecOpenSSLNodeSetBNValue(xmlNodePtr cur, const BIGNUM *a, int addLineBreaks)
     } else {
         xmlNodeSetContent(cur, xmlSecStringEmpty);
     }
-    
+
     ret = xmlSecBufferBase64NodeContentWrite(&buf, cur, xmlSecBase64GetDefaultLineSize());
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
diff --git a/src/openssl/ciphers.c b/src/openssl/ciphers.c
index 1a70c97..1b60062 100644
--- a/src/openssl/ciphers.c
+++ b/src/openssl/ciphers.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -58,7 +58,7 @@ static int      xmlSecOpenSSLEvpBlockCipherCtxFinal     (xmlSecOpenSSLEvpBlockCi
                                                          xmlSecBufferPtr out,
                                                          const xmlChar* cipherName,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int 
+static int
 xmlSecOpenSSLEvpBlockCipherCtxInit(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
                                 xmlSecBufferPtr in, xmlSecBufferPtr out,
                                 int encrypt,
@@ -78,7 +78,7 @@ xmlSecOpenSSLEvpBlockCipherCtxInit(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
     ivLen = EVP_CIPHER_iv_length(ctx->cipher);
     xmlSecAssert2(ivLen > 0, -1);
     xmlSecAssert2((xmlSecSize)ivLen <= sizeof(ctx->iv), -1);
-    
+
     if(encrypt) {
         /* generate random iv */
         ret = RAND_bytes(ctx->iv, ivLen);
@@ -88,35 +88,35 @@ xmlSecOpenSSLEvpBlockCipherCtxInit(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
                         "RAND_bytes",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "size=%d", ivLen);
-            return(-1);    
+            return(-1);
         }
 
         /* write iv to the output */
         ret = xmlSecBufferAppend(out, ctx->iv, ivLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferAppend",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", ivLen);
             return(-1);
         }
-        
+
     } else {
-        /* if we don't have enough data, exit and hope that 
+        /* if we don't have enough data, exit and hope that
          * we'll have iv next time */
         if(xmlSecBufferGetSize(in) < (xmlSecSize)ivLen) {
             return(0);
         }
-        
+
         /* copy iv to our buffer*/
         xmlSecAssert2(xmlSecBufferGetData(in) != NULL, -1);
         memcpy(ctx->iv, xmlSecBufferGetData(in), ivLen);
-        
+
         /* and remove from input */
         ret = xmlSecBufferRemoveHead(in, ivLen);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -128,7 +128,7 @@ xmlSecOpenSSLEvpBlockCipherCtxInit(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
     /* set iv */
     ret = EVP_CipherInit(&(ctx->cipherCtx), ctx->cipher, ctx->key, ctx->iv, encrypt);
     if(ret != 1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "EVP_CipherInit",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -137,20 +137,20 @@ xmlSecOpenSSLEvpBlockCipherCtxInit(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
     }
 
     ctx->ctxInitialized = 1;
-    
+
     /*
      * The padding used in XML Enc does not follow RFC 1423
      * and is not supported by OpenSSL. In the case of OpenSSL 0.9.7
      * it is possible to disable padding and do it by yourself
      * For OpenSSL 0.9.6 you have interop problems
      */
-#ifndef XMLSEC_OPENSSL_096      
-    EVP_CIPHER_CTX_set_padding(&(ctx->cipherCtx), 0);    
-#endif /* XMLSEC_OPENSSL_096 */ 
+#ifndef XMLSEC_OPENSSL_096
+    EVP_CIPHER_CTX_set_padding(&(ctx->cipherCtx), 0);
+#endif /* XMLSEC_OPENSSL_096 */
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
                                   xmlSecBufferPtr in, xmlSecBufferPtr out,
                                   const xmlChar* cipherName,
@@ -159,7 +159,7 @@ xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
     xmlSecSize inSize, outSize;
     xmlSecByte* outBuf;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->keyInitialized != 0, -1);
     xmlSecAssert2(ctx->ctxInitialized != 0, -1);
@@ -178,13 +178,13 @@ xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
         return(0);
     }
 
-    /* OpenSSL docs: The amount of data written depends on the block 
-     * alignment of the encrypted data: as a result the amount of data 
+    /* OpenSSL docs: The amount of data written depends on the block
+     * alignment of the encrypted data: as a result the amount of data
      * written may be anything from zero bytes to (inl + cipher_block_size - 1).
      */
     ret = xmlSecBufferSetMaxSize(out, outSize + inSize + blockLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -192,7 +192,7 @@ xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
         return(-1);
     }
     outBuf = xmlSecBufferGetData(out) + outSize;
-    
+
     /*
      * The padding used in XML Enc does not follow RFC 1423
      * and is not supported by OpenSSL. In the case of OpenSSL 0.9.7
@@ -219,7 +219,7 @@ xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
     /* encrypt/decrypt */
     ret = EVP_CipherUpdate(&(ctx->cipherCtx), outBuf, &outLen, xmlSecBufferGetData(in), inSize);
     if(ret != 1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "EVP_CipherUpdate",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -247,22 +247,22 @@ xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
         }
     }
 #endif /* XMLSEC_OPENSSL_096 */
-    
+
     /* set correct output buffer size */
     ret = xmlSecBufferSetSize(out, outSize + outLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", outSize + outLen);
         return(-1);
     }
-        
+
     /* remove the processed block from input */
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -272,7 +272,7 @@ xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
                                  xmlSecBufferPtr out,
                                  const xmlChar* cipherName,
@@ -281,7 +281,7 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
     xmlSecSize outSize;
     xmlSecByte* outBuf;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->keyInitialized != 0, -1);
     xmlSecAssert2(ctx->ctxInitialized != 0, -1);
@@ -292,14 +292,14 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
     xmlSecAssert2(blockLen > 0, -1);
 
     outSize = xmlSecBufferGetSize(out);
-        
-    /* OpenSSL docs: The encrypted final data is written to out which should 
-     * have sufficient space for one cipher block. We might have to write 
+
+    /* OpenSSL docs: The encrypted final data is written to out which should
+     * have sufficient space for one cipher block. We might have to write
      * one more block with padding
      */
     ret = xmlSecBufferSetMaxSize(out, outSize + 2 * blockLen);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -307,7 +307,7 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
         return(-1);
     }
     outBuf = xmlSecBufferGetData(out) + outSize;
-    
+
     /*
      * The padding used in XML Enc does not follow RFC 1423
      * and is not supported by OpenSSL. In the case of OpenSSL 0.9.7
@@ -322,12 +322,12 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
 #ifndef XMLSEC_OPENSSL_096
     if(ctx->cipherCtx.encrypt) {
         int padLen;
-        
+
         xmlSecAssert2(blockLen <= EVP_MAX_BLOCK_LENGTH, -1);
-    
+
         padLen = blockLen - ctx->cipherCtx.buf_len;
         xmlSecAssert2(padLen > 0, -1);
-    
+
         /* generate random padding */
         if(padLen > 1) {
             ret = RAND_bytes(ctx->pad, padLen - 1);
@@ -337,15 +337,15 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
                             "RAND_bytes",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
                             "size=%d", padLen - 1);
-                return(-1);    
+                return(-1);
             }
         }
         ctx->pad[padLen - 1] = padLen;
 
-        /* write padding */    
+        /* write padding */
         ret = EVP_CipherUpdate(&(ctx->cipherCtx), outBuf, &outLen, ctx->pad, padLen);
         if(ret != 1) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(cipherName),
                         "EVP_CipherUpdate",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -354,12 +354,12 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
         }
         outBuf += outLen;
     }
-#endif /* XMLSEC_OPENSSL_096 */                 
+#endif /* XMLSEC_OPENSSL_096 */
 
     /* finalize transform */
     ret = EVP_CipherFinal(&(ctx->cipherCtx), outBuf, &outLen2);
     if(ret != 1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "EVP_CipherFinal",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -380,13 +380,13 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
      */
 #ifndef XMLSEC_OPENSSL_096
      if(!ctx->cipherCtx.encrypt) {
-        /* we instructed openssl to do not use padding so there 
-         * should be no final block 
+        /* we instructed openssl to do not use padding so there
+         * should be no final block
          */
         xmlSecAssert2(outLen2 == 0, -1);
         xmlSecAssert2(ctx->cipherCtx.buf_len == 0, -1);
         xmlSecAssert2(ctx->cipherCtx.final_used, -1);
-            
+
         if(blockLen > 1) {
             outLen2 = blockLen - ctx->cipherCtx.final[blockLen - 1];
             if(outLen2 > 0) {
@@ -398,16 +398,16 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
                             XMLSEC_ERRORS_R_INVALID_DATA,
                             "padding=%d;buffer=%d",
                             ctx->cipherCtx.final[blockLen - 1], blockLen);
-                return(-1);     
+                return(-1);
             }
         }
-    } 
-#endif /* XMLSEC_OPENSSL_096 */                 
+    }
+#endif /* XMLSEC_OPENSSL_096 */
 
     /* set correct output buffer size */
     ret = xmlSecBufferSetSize(out, outSize + outLen + outLen2);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(cipherName),
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -424,7 +424,7 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
  * EVP Block Cipher transforms
  *
  * xmlSecOpenSSLEvpBlockCipherCtx block is located after xmlSecTransform structure
- * 
+ *
  *****************************************************************************/
 #define xmlSecOpenSSLEvpBlockCipherSize \
     (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLEvpBlockCipherCtx))
@@ -433,7 +433,7 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
 
 static int      xmlSecOpenSSLEvpBlockCipherInitialize   (xmlSecTransformPtr transform);
 static void     xmlSecOpenSSLEvpBlockCipherFinalize     (xmlSecTransformPtr transform);
-static int      xmlSecOpenSSLEvpBlockCipherSetKeyReq    (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLEvpBlockCipherSetKeyReq    (xmlSecTransformPtr transform,
                                                          xmlSecKeyReqPtr keyReq);
 static int      xmlSecOpenSSLEvpBlockCipherSetKey       (xmlSecTransformPtr transform,
                                                          xmlSecKeyPtr key);
@@ -441,7 +441,7 @@ static int      xmlSecOpenSSLEvpBlockCipherExecute      (xmlSecTransformPtr tran
                                                          int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 static int      xmlSecOpenSSLEvpBlockCipherCheckId      (xmlSecTransformPtr transform);
-                                                         
+
 
 
 static int
@@ -456,60 +456,60 @@ xmlSecOpenSSLEvpBlockCipherCheckId(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformAes128CbcId) ||
        xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformAes192CbcId) ||
        xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformAes256CbcId)) {
-       
+
        return(1);
     }
 #endif /* XMLSEC_NO_AES */
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLEvpBlockCipherInitialize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLEvpBlockCipherCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecOpenSSLEvpBlockCipherCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLEvpBlockCipherSize), -1);
 
     ctx = xmlSecOpenSSLEvpBlockCipherGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecOpenSSLEvpBlockCipherCtx));
 
 #ifndef XMLSEC_NO_DES
     if(transform->id == xmlSecOpenSSLTransformDes3CbcId) {
         ctx->cipher     = EVP_des_ede3_cbc();
         ctx->keyId      = xmlSecOpenSSLKeyDataDesId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_DES */
 
 #ifndef XMLSEC_NO_AES
     if(transform->id == xmlSecOpenSSLTransformAes128CbcId) {
-        ctx->cipher     = EVP_aes_128_cbc();    
+        ctx->cipher     = EVP_aes_128_cbc();
         ctx->keyId      = xmlSecOpenSSLKeyDataAesId;
     } else if(transform->id == xmlSecOpenSSLTransformAes192CbcId) {
-        ctx->cipher     = EVP_aes_192_cbc();    
+        ctx->cipher     = EVP_aes_192_cbc();
         ctx->keyId      = xmlSecOpenSSLKeyDataAesId;
     } else if(transform->id == xmlSecOpenSSLTransformAes256CbcId) {
-        ctx->cipher     = EVP_aes_256_cbc();    
+        ctx->cipher     = EVP_aes_256_cbc();
         ctx->keyId      = xmlSecOpenSSLKeyDataAesId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_AES */
 
     if(1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }        
-    
+    }
+
     EVP_CIPHER_CTX_init(&(ctx->cipherCtx));
     return(0);
 }
 
-static void 
+static void
 xmlSecOpenSSLEvpBlockCipherFinalize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLEvpBlockCipherCtxPtr ctx;
 
@@ -518,12 +518,12 @@ xmlSecOpenSSLEvpBlockCipherFinalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecOpenSSLEvpBlockCipherGetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     EVP_CIPHER_CTX_cleanup(&(ctx->cipherCtx));
     memset(ctx, 0, sizeof(xmlSecOpenSSLEvpBlockCipherCtx));
 }
 
-static int  
+static int
 xmlSecOpenSSLEvpBlockCipherSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecOpenSSLEvpBlockCipherCtxPtr ctx;
     int cipherKeyLen;
@@ -558,7 +558,7 @@ xmlSecOpenSSLEvpBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key
     xmlSecOpenSSLEvpBlockCipherCtxPtr ctx;
     xmlSecBufferPtr buffer;
     int cipherKeyLen;
-    
+
     xmlSecAssert2(xmlSecOpenSSLEvpBlockCipherCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLEvpBlockCipherSize), -1);
@@ -570,7 +570,7 @@ xmlSecOpenSSLEvpBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key
     xmlSecAssert2(ctx->keyInitialized == 0, -1);
     xmlSecAssert2(ctx->keyId != NULL, -1);
     xmlSecAssert2(xmlSecKeyCheckId(key, ctx->keyId), -1);
-    
+
     cipherKeyLen = EVP_CIPHER_key_length(ctx->cipher);
     xmlSecAssert2(cipherKeyLen > 0, -1);
     xmlSecAssert2((xmlSecSize)cipherKeyLen <= sizeof(ctx->key), -1);
@@ -587,20 +587,20 @@ xmlSecOpenSSLEvpBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key
                     xmlSecBufferGetSize(buffer), cipherKeyLen);
         return(-1);
     }
-    
+
     xmlSecAssert2(xmlSecBufferGetData(buffer) != NULL, -1);
     memcpy(ctx->key, xmlSecBufferGetData(buffer), cipherKeyLen);
-    
+
     ctx->keyInitialized = 1;
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLEvpBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLEvpBlockCipherCtxPtr ctx;
     xmlSecBufferPtr in, out;
     int ret;
-    
+
     xmlSecAssert2(xmlSecOpenSSLEvpBlockCipherCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLEvpBlockCipherSize), -1);
@@ -616,13 +616,13 @@ xmlSecOpenSSLEvpBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSe
         transform->status = xmlSecTransformStatusWorking;
     }
 
-    if(transform->status == xmlSecTransformStatusWorking) {    
+    if(transform->status == xmlSecTransformStatusWorking) {
         if(ctx->ctxInitialized == 0) {
-            ret = xmlSecOpenSSLEvpBlockCipherCtxInit(ctx, in, out, 
+            ret = xmlSecOpenSSLEvpBlockCipherCtxInit(ctx, in, out,
                         (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
                         xmlSecTransformGetName(transform), transformCtx);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecOpenSSLEvpBlockCipherCtxInit",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -631,7 +631,7 @@ xmlSecOpenSSLEvpBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSe
             }
         }
         if((ctx->ctxInitialized == 0) && (last != 0)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_DATA,
@@ -641,10 +641,10 @@ xmlSecOpenSSLEvpBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSe
 
         if(ctx->ctxInitialized != 0) {
             ret = xmlSecOpenSSLEvpBlockCipherCtxUpdate(ctx, in, out,
-                                                xmlSecTransformGetName(transform), 
+                                                xmlSecTransformGetName(transform),
                                                 transformCtx);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecOpenSSLEvpBlockCipherCtxUpdate",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -657,10 +657,10 @@ xmlSecOpenSSLEvpBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSe
             /* by now there should be no input */
             xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
             ret = xmlSecOpenSSLEvpBlockCipherCtxFinal(ctx, out,
-                                            xmlSecTransformGetName(transform), 
+                                            xmlSecTransformGetName(transform),
                                             transformCtx);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecOpenSSLEvpBlockCipherCtxFinal",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -668,7 +668,7 @@ xmlSecOpenSSLEvpBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSe
                 return(-1);
             }
             transform->status = xmlSecTransformStatusFinished;
-        } 
+        }
     } else if(transform->status == xmlSecTransformStatusFinished) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
@@ -676,14 +676,14 @@ xmlSecOpenSSLEvpBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSe
         /* the only way we can get here is if there is no enough data in the input */
         xmlSecAssert2(last == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -723,12 +723,12 @@ static xmlSecTransformKlass xmlSecOpenSSLAes128CbcKlass = {
 
 /**
  * xmlSecOpenSSLTransformAes128CbcGetKlass:
- * 
+ *
  * AES 128 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 128 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecOpenSSLTransformAes128CbcGetKlass(void) {
     return(&xmlSecOpenSSLAes128CbcKlass);
 }
@@ -755,19 +755,19 @@ static xmlSecTransformKlass xmlSecOpenSSLAes192CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpBlockCipherExecute,         /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecOpenSSLTransformAes192CbcGetKlass:
- * 
+ *
  * AES 192 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 192 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecOpenSSLTransformAes192CbcGetKlass(void) {
     return(&xmlSecOpenSSLAes192CbcKlass);
 }
@@ -794,19 +794,19 @@ static xmlSecTransformKlass xmlSecOpenSSLAes256CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpBlockCipherExecute,         /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecOpenSSLTransformAes256CbcGetKlass:
- * 
+ *
  * AES 256 CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to AES 256 CBC encryption transform.
- */ 
-xmlSecTransformId 
+ */
+xmlSecTransformId
 xmlSecOpenSSLTransformAes256CbcGetKlass(void) {
     return(&xmlSecOpenSSLAes256CbcKlass);
 }
@@ -836,19 +836,19 @@ static xmlSecTransformKlass xmlSecOpenSSLDes3CbcKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpBlockCipherExecute,         /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformDes3CbcGetKlass:
  *
  * Triple DES CBC encryption transform klass.
- * 
+ *
  * Returns: pointer to Triple DES encryption transform.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformDes3CbcGetKlass(void) {
     return(&xmlSecOpenSSLDes3CbcKlass);
 }
diff --git a/src/openssl/crypto.c b/src/openssl/crypto.c
index 7e81a8e..4c9219e 100644
--- a/src/openssl/crypto.c
+++ b/src/openssl/crypto.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -40,7 +40,7 @@ static xmlChar* gXmlSecOpenSSLTrustedCertsFolder = NULL;
 xmlSecCryptoDLFunctionsPtr
 xmlSecCryptoGetFunctions_openssl(void) {
     static xmlSecCryptoDLFunctions functions;
-    
+
     if(gXmlSecOpenSSLFunctions != NULL) {
         return(gXmlSecOpenSSLFunctions);
     }
@@ -48,7 +48,7 @@ xmlSecCryptoGetFunctions_openssl(void) {
     memset(&functions, 0, sizeof(functions));
     gXmlSecOpenSSLFunctions = &functions;
 
-    /**  
+    /**
      * Crypto Init/shutdown
      */
     gXmlSecOpenSSLFunctions->cryptoInit                 = xmlSecOpenSSLInit;
@@ -58,21 +58,21 @@ xmlSecCryptoGetFunctions_openssl(void) {
     /**
      * Key data ids
      */
-#ifndef XMLSEC_NO_AES    
+#ifndef XMLSEC_NO_AES
     gXmlSecOpenSSLFunctions->keyDataAesGetKlass         = xmlSecOpenSSLKeyDataAesGetKlass;
 #endif /* XMLSEC_NO_AES */
 
-#ifndef XMLSEC_NO_DES    
+#ifndef XMLSEC_NO_DES
     gXmlSecOpenSSLFunctions->keyDataDesGetKlass         = xmlSecOpenSSLKeyDataDesGetKlass;
 #endif /* XMLSEC_NO_DES */
 
 #ifndef XMLSEC_NO_DSA
     gXmlSecOpenSSLFunctions->keyDataDsaGetKlass         = xmlSecOpenSSLKeyDataDsaGetKlass;
-#endif /* XMLSEC_NO_DSA */    
+#endif /* XMLSEC_NO_DSA */
 
-#ifndef XMLSEC_NO_HMAC  
+#ifndef XMLSEC_NO_HMAC
     gXmlSecOpenSSLFunctions->keyDataHmacGetKlass        = xmlSecOpenSSLKeyDataHmacGetKlass;
-#endif /* XMLSEC_NO_HMAC */    
+#endif /* XMLSEC_NO_HMAC */
 
 #ifndef XMLSEC_NO_RSA
     gXmlSecOpenSSLFunctions->keyDataRsaGetKlass         = xmlSecOpenSSLKeyDataRsaGetKlass;
@@ -94,7 +94,7 @@ xmlSecCryptoGetFunctions_openssl(void) {
      * Crypto transforms ids
      */
     /******************************* AES ********************************/
-#ifndef XMLSEC_NO_AES    
+#ifndef XMLSEC_NO_AES
     gXmlSecOpenSSLFunctions->transformAes128CbcGetKlass         = xmlSecOpenSSLTransformAes128CbcGetKlass;
     gXmlSecOpenSSLFunctions->transformAes192CbcGetKlass         = xmlSecOpenSSLTransformAes192CbcGetKlass;
     gXmlSecOpenSSLFunctions->transformAes256CbcGetKlass         = xmlSecOpenSSLTransformAes256CbcGetKlass;
@@ -104,7 +104,7 @@ xmlSecCryptoGetFunctions_openssl(void) {
 #endif /* XMLSEC_NO_AES */
 
     /******************************* DES ********************************/
-#ifndef XMLSEC_NO_DES    
+#ifndef XMLSEC_NO_DES
     gXmlSecOpenSSLFunctions->transformDes3CbcGetKlass           = xmlSecOpenSSLTransformDes3CbcGetKlass;
     gXmlSecOpenSSLFunctions->transformKWDes3GetKlass            = xmlSecOpenSSLTransformKWDes3GetKlass;
 #endif /* XMLSEC_NO_DES */
@@ -112,7 +112,7 @@ xmlSecCryptoGetFunctions_openssl(void) {
 
     /******************************* DSA ********************************/
 #ifndef XMLSEC_NO_DSA
-#ifndef XMLSEC_NO_SHA1    
+#ifndef XMLSEC_NO_SHA1
     gXmlSecOpenSSLFunctions->transformDsaSha1GetKlass           = xmlSecOpenSSLTransformDsaSha1GetKlass;
 #endif /* XMLSEC_NO_SHA1 */
 #endif /* XMLSEC_NO_DSA */
@@ -127,7 +127,7 @@ xmlSecCryptoGetFunctions_openssl(void) {
     gXmlSecOpenSSLFunctions->transformHmacRipemd160GetKlass     = xmlSecOpenSSLTransformHmacRipemd160GetKlass;
 #endif /* XMLSEC_NO_RIPEMD160 */
 
-#ifndef XMLSEC_NO_SHA1    
+#ifndef XMLSEC_NO_SHA1
     gXmlSecOpenSSLFunctions->transformHmacSha1GetKlass          = xmlSecOpenSSLTransformHmacSha1GetKlass;
 #endif /* XMLSEC_NO_SHA1 */
 
@@ -170,19 +170,19 @@ xmlSecCryptoGetFunctions_openssl(void) {
     gXmlSecOpenSSLFunctions->transformRsaRipemd160GetKlass      = xmlSecOpenSSLTransformRsaRipemd160GetKlass;
 #endif /* XMLSEC_NO_RIPEMD160 */
 
-#ifndef XMLSEC_NO_SHA1    
+#ifndef XMLSEC_NO_SHA1
     gXmlSecOpenSSLFunctions->transformRsaSha1GetKlass           = xmlSecOpenSSLTransformRsaSha1GetKlass;
 #endif /* XMLSEC_NO_SHA1 */
 
-#ifndef XMLSEC_NO_SHA224    
+#ifndef XMLSEC_NO_SHA224
     gXmlSecOpenSSLFunctions->transformRsaSha224GetKlass         = xmlSecOpenSSLTransformRsaSha224GetKlass;
 #endif /* XMLSEC_NO_SHA224 */
 
-#ifndef XMLSEC_NO_SHA256    
+#ifndef XMLSEC_NO_SHA256
     gXmlSecOpenSSLFunctions->transformRsaSha256GetKlass         = xmlSecOpenSSLTransformRsaSha256GetKlass;
 #endif /* XMLSEC_NO_SHA256 */
 
-#ifndef XMLSEC_NO_SHA384    
+#ifndef XMLSEC_NO_SHA384
     gXmlSecOpenSSLFunctions->transformRsaSha384GetKlass         = xmlSecOpenSSLTransformRsaSha384GetKlass;
 #endif /* XMLSEC_NO_SHA384 */
 
@@ -195,7 +195,7 @@ xmlSecCryptoGetFunctions_openssl(void) {
 #endif /* XMLSEC_NO_RSA */
 
     /******************************* SHA ********************************/
-#ifndef XMLSEC_NO_SHA1    
+#ifndef XMLSEC_NO_SHA1
     gXmlSecOpenSSLFunctions->transformSha1GetKlass              = xmlSecOpenSSLTransformSha1GetKlass;
 #endif /* XMLSEC_NO_SHA1 */
 #ifndef XMLSEC_NO_SHA224
@@ -213,7 +213,7 @@ xmlSecCryptoGetFunctions_openssl(void) {
 
     /**
      * High level routines form xmlsec command line utility
-     */ 
+     */
     gXmlSecOpenSSLFunctions->cryptoAppInit                      = xmlSecOpenSSLAppInit;
     gXmlSecOpenSSLFunctions->cryptoAppShutdown                  = xmlSecOpenSSLAppShutdown;
     gXmlSecOpenSSLFunctions->cryptoAppDefaultKeysMngrInit       = xmlSecOpenSSLAppDefaultKeysMngrInit;
@@ -223,13 +223,13 @@ xmlSecCryptoGetFunctions_openssl(void) {
 #ifndef XMLSEC_NO_X509
     gXmlSecOpenSSLFunctions->cryptoAppKeysMngrCertLoad          = xmlSecOpenSSLAppKeysMngrCertLoad;
     gXmlSecOpenSSLFunctions->cryptoAppKeysMngrCertLoadMemory    = xmlSecOpenSSLAppKeysMngrCertLoadMemory;
-    gXmlSecOpenSSLFunctions->cryptoAppPkcs12Load                = xmlSecOpenSSLAppPkcs12Load; 
-    gXmlSecOpenSSLFunctions->cryptoAppPkcs12LoadMemory          = xmlSecOpenSSLAppPkcs12LoadMemory; 
+    gXmlSecOpenSSLFunctions->cryptoAppPkcs12Load                = xmlSecOpenSSLAppPkcs12Load;
+    gXmlSecOpenSSLFunctions->cryptoAppPkcs12LoadMemory          = xmlSecOpenSSLAppPkcs12LoadMemory;
     gXmlSecOpenSSLFunctions->cryptoAppKeyCertLoad               = xmlSecOpenSSLAppKeyCertLoad;
     gXmlSecOpenSSLFunctions->cryptoAppKeyCertLoadMemory         = xmlSecOpenSSLAppKeyCertLoadMemory;
 #endif /* XMLSEC_NO_X509 */
-    gXmlSecOpenSSLFunctions->cryptoAppKeyLoad                   = xmlSecOpenSSLAppKeyLoad; 
-    gXmlSecOpenSSLFunctions->cryptoAppKeyLoadMemory             = xmlSecOpenSSLAppKeyLoadMemory; 
+    gXmlSecOpenSSLFunctions->cryptoAppKeyLoad                   = xmlSecOpenSSLAppKeyLoad;
+    gXmlSecOpenSSLFunctions->cryptoAppKeyLoadMemory             = xmlSecOpenSSLAppKeyLoadMemory;
     gXmlSecOpenSSLFunctions->cryptoAppDefaultPwdCallback        = (void*)xmlSecOpenSSLAppGetDefaultPwdCallback();
 
     return(gXmlSecOpenSSLFunctions);
@@ -237,12 +237,12 @@ xmlSecCryptoGetFunctions_openssl(void) {
 
 /**
  * xmlSecOpenSSLInit:
- * 
- * XMLSec library specific crypto engine initialization. 
+ *
+ * XMLSec library specific crypto engine initialization.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecOpenSSLInit (void)  {
     /* Check loaded xmlsec library version */
     if(xmlSecCheckVersionExact() != 1) {
@@ -272,18 +272,18 @@ xmlSecOpenSSLInit (void)  {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
 /**
  * xmlSecOpenSSLShutdown:
- * 
- * XMLSec library specific crypto engine shutdown. 
+ *
+ * XMLSec library specific crypto engine shutdown.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecOpenSSLShutdown(void) {
     xmlSecOpenSSLSetDefaultTrustedCertsFolder(NULL);
     return(0);
@@ -300,7 +300,7 @@ xmlSecOpenSSLShutdown(void) {
 int
 xmlSecOpenSSLKeysMngrInit(xmlSecKeysMngrPtr mngr) {
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
 
 #ifndef XMLSEC_NO_X509
@@ -315,9 +315,9 @@ xmlSecOpenSSLKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         "xmlSecKeyDataStoreCreate",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "xmlSecOpenSSLX509StoreId");
-            return(-1);   
+            return(-1);
         }
-    
+
         ret = xmlSecKeysMngrAdoptDataStore(mngr, x509Store);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -326,10 +326,10 @@ xmlSecOpenSSLKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecKeyDataStoreDestroy(x509Store);
-            return(-1); 
+            return(-1);
         }
     }
-#endif /* XMLSEC_NO_X509 */    
+#endif /* XMLSEC_NO_X509 */
     return(0);
 }
 
@@ -343,32 +343,32 @@ xmlSecOpenSSLKeysMngrInit(xmlSecKeysMngrPtr mngr) {
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecOpenSSLGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {  
+xmlSecOpenSSLGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
     int ret;
-    
+
     xmlSecAssert2(buffer != NULL, -1);
     xmlSecAssert2(size > 0, -1);
 
     ret = xmlSecBufferSetSize(buffer, size);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", size);
         return(-1);
     }
-        
+
     /* get random data */
     ret = RAND_bytes((xmlSecByte*)xmlSecBufferGetData(buffer), size);
     if(ret != 1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "RAND_bytes",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "size=%d", size);
-        return(-1);    
-    }   
+        return(-1);
+    }
     return(0);
 }
 
@@ -377,33 +377,33 @@ xmlSecOpenSSLGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
  * @file:               the error location file name (__FILE__ macro).
  * @line:               the error location line number (__LINE__ macro).
  * @func:               the error location function name (__FUNCTION__ macro).
- * @errorObject:        the error specific error object 
+ * @errorObject:        the error specific error object
  * @errorSubject:       the error specific error subject.
  * @reason:             the error code.
  * @msg:                the additional error message.
  *
  * The default OpenSSL errors reporting callback function.
  */
-void 
+void
 xmlSecOpenSSLErrorsDefaultCallback(const char* file, int line, const char* func,
                                 const char* errorObject, const char* errorSubject,
                                 int reason, const char* msg) {
 
-    ERR_put_error(XMLSEC_OPENSSL_ERRORS_LIB, 
-                XMLSEC_OPENSSL_ERRORS_FUNCTION, 
+    ERR_put_error(XMLSEC_OPENSSL_ERRORS_LIB,
+                XMLSEC_OPENSSL_ERRORS_FUNCTION,
                 reason, file, line);
-    xmlSecErrorsDefaultCallback(file, line, func, 
-                errorObject, errorSubject, 
+    xmlSecErrorsDefaultCallback(file, line, func,
+                errorObject, errorSubject,
                 reason, msg);
 }
 
-static int 
+static int
 xmlSecOpenSSLErrorsInit(void) {
     static ERR_STRING_DATA xmlSecOpenSSLStrReasons[XMLSEC_ERRORS_MAX_NUMBER + 1];
     static ERR_STRING_DATA xmlSecOpenSSLStrLib[]= {
         { ERR_PACK(XMLSEC_OPENSSL_ERRORS_LIB,0,0),      "xmlsec routines"},
         { 0,                                            NULL}
-    }; 
+    };
     static ERR_STRING_DATA xmlSecOpenSSLStrDefReason[]= {
         { XMLSEC_OPENSSL_ERRORS_LIB,                    "xmlsec lib"},
         { 0,                                            NULL}
@@ -416,15 +416,15 @@ xmlSecOpenSSLErrorsInit(void) {
         xmlSecOpenSSLStrReasons[pos].error  = xmlSecErrorsGetCode(pos);
         xmlSecOpenSSLStrReasons[pos].string = xmlSecErrorsGetMsg(pos);
     }
-    
+
     /* finally load xmlsec strings in OpenSSL */
     ERR_load_strings(XMLSEC_OPENSSL_ERRORS_LIB, xmlSecOpenSSLStrLib); /* define xmlsec lib name */
     ERR_load_strings(XMLSEC_OPENSSL_ERRORS_LIB, xmlSecOpenSSLStrDefReason); /* define default reason */
-    ERR_load_strings(XMLSEC_OPENSSL_ERRORS_LIB, xmlSecOpenSSLStrReasons);     
-    
+    ERR_load_strings(XMLSEC_OPENSSL_ERRORS_LIB, xmlSecOpenSSLStrReasons);
+
     /* and set default errors callback for xmlsec to us */
     xmlSecErrorsSetCallback(xmlSecOpenSSLErrorsDefaultCallback);
-    
+
     return(0);
 }
 
@@ -436,7 +436,7 @@ xmlSecOpenSSLErrorsInit(void) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecOpenSSLSetDefaultTrustedCertsFolder(const xmlChar* path) {
     if(gXmlSecOpenSSLTrustedCertsFolder != NULL) {
         xmlFree(gXmlSecOpenSSLTrustedCertsFolder);
@@ -454,18 +454,18 @@ xmlSecOpenSSLSetDefaultTrustedCertsFolder(const xmlChar* path) {
             return(-1);
         }
     }
-    
+
     return(0);
 }
 
 /**
  * xmlSecOpenSSLGetDefaultTrustedCertsFolder:
- * 
+ *
  * Gets the default trusted certs folder.
  *
  * Returns: the default trusted cert folder.
  */
-const xmlChar*  
+const xmlChar*
 xmlSecOpenSSLGetDefaultTrustedCertsFolder(void) {
     return(gXmlSecOpenSSLTrustedCertsFolder);
 }
diff --git a/src/openssl/digests.c b/src/openssl/digests.c
index a755ce6..ff1d49e 100644
--- a/src/openssl/digests.c
+++ b/src/openssl/digests.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -31,7 +31,7 @@ struct _xmlSecOpenSSLDigestCtx {
     EVP_MD_CTX          digestCtx;
     xmlSecByte          dgst[EVP_MAX_MD_SIZE];
     xmlSecSize          dgstSize;       /* dgst size in bytes */
-};          
+};
 
 /******************************************************************************
  *
@@ -41,18 +41,18 @@ struct _xmlSecOpenSSLDigestCtx {
  *
  *****************************************************************************/
 #define xmlSecOpenSSLEvpDigestSize      \
-    (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLDigestCtx))  
+    (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLDigestCtx))
 #define xmlSecOpenSSLEvpDigestGetCtx(transform) \
     ((xmlSecOpenSSLDigestCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
 
 
 static int      xmlSecOpenSSLEvpDigestInitialize        (xmlSecTransformPtr transform);
 static void     xmlSecOpenSSLEvpDigestFinalize          (xmlSecTransformPtr transform);
-static int      xmlSecOpenSSLEvpDigestVerify            (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLEvpDigestVerify            (xmlSecTransformPtr transform,
                                                          const xmlSecByte* data,
                                                          xmlSecSize dataSize,
                                                          xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecOpenSSLEvpDigestExecute           (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLEvpDigestExecute           (xmlSecTransformPtr transform,
                                                          int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 static int      xmlSecOpenSSLEvpDigestCheckId           (xmlSecTransformPtr transform);
@@ -64,56 +64,56 @@ xmlSecOpenSSLEvpDigestCheckId(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformMd5Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_MD5 */    
+#endif /* XMLSEC_NO_MD5 */
 
 #ifndef XMLSEC_NO_RIPEMD160
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRipemd160Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_RIPEMD160 */    
+#endif /* XMLSEC_NO_RIPEMD160 */
 
 #ifndef XMLSEC_NO_SHA1
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha1Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_SHA1 */    
+#endif /* XMLSEC_NO_SHA1 */
 
 #ifndef XMLSEC_NO_SHA224
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha224Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_SHA224 */    
-    
+#endif /* XMLSEC_NO_SHA224 */
+
 #ifndef XMLSEC_NO_SHA256
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha256Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_SHA256 */    
+#endif /* XMLSEC_NO_SHA256 */
 
 #ifndef XMLSEC_NO_SHA384
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha384Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_SHA384 */    
+#endif /* XMLSEC_NO_SHA384 */
 
 #ifndef XMLSEC_NO_SHA512
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha512Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_SHA512 */    
+#endif /* XMLSEC_NO_SHA512 */
 
 
     {
         return(0);
     }
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLEvpDigestInitialize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLDigestCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecOpenSSLEvpDigestCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLEvpDigestSize), -1);
 
@@ -126,47 +126,47 @@ xmlSecOpenSSLEvpDigestInitialize(xmlSecTransformPtr transform) {
 #ifndef XMLSEC_NO_MD5
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformMd5Id)) {
         ctx->digest = EVP_md5();
-    } else 
+    } else
 #endif /* XMLSEC_NO_MD5 */
-    
-#ifndef XMLSEC_NO_RIPEMD160 
+
+#ifndef XMLSEC_NO_RIPEMD160
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRipemd160Id)) {
         ctx->digest = EVP_ripemd160();
-    } else 
+    } else
 #endif /* XMLSEC_NO_RIPEMD160 */
-    
+
 #ifndef XMLSEC_NO_SHA1
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha1Id)) {
         ctx->digest = EVP_sha1();
-    } else 
-#endif /* XMLSEC_NO_SHA1 */    
+    } else
+#endif /* XMLSEC_NO_SHA1 */
 
 #ifndef XMLSEC_NO_SHA224
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha224Id)) {
         ctx->digest = EVP_sha224();
-    } else 
-#endif /* XMLSEC_NO_SHA224 */    
+    } else
+#endif /* XMLSEC_NO_SHA224 */
 
 #ifndef XMLSEC_NO_SHA256
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha256Id)) {
         ctx->digest = EVP_sha256();
-    } else 
-#endif /* XMLSEC_NO_SHA256 */    
-    
+    } else
+#endif /* XMLSEC_NO_SHA256 */
+
 #ifndef XMLSEC_NO_SHA384
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha384Id)) {
         ctx->digest = EVP_sha384();
-    } else 
-#endif /* XMLSEC_NO_SHA384 */    
+    } else
+#endif /* XMLSEC_NO_SHA384 */
 
 #ifndef XMLSEC_NO_SHA512
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha512Id)) {
         ctx->digest = EVP_sha512();
-    } else 
-#endif /* XMLSEC_NO_SHA512 */    
+    } else
+#endif /* XMLSEC_NO_SHA512 */
 
     {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
@@ -177,11 +177,11 @@ xmlSecOpenSSLEvpDigestInitialize(xmlSecTransformPtr transform) {
 #ifndef XMLSEC_OPENSSL_096
     EVP_MD_CTX_init(&(ctx->digestCtx));
 #endif /* XMLSEC_OPENSSL_096 */
-    
+
     return(0);
 }
 
-static void 
+static void
 xmlSecOpenSSLEvpDigestFinalize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLDigestCtxPtr ctx;
 
@@ -190,7 +190,7 @@ xmlSecOpenSSLEvpDigestFinalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecOpenSSLEvpDigestGetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
 #ifndef XMLSEC_OPENSSL_096
     EVP_MD_CTX_cleanup(&(ctx->digestCtx));
 #endif /* XMLSEC_OPENSSL_096 */
@@ -198,11 +198,11 @@ xmlSecOpenSSLEvpDigestFinalize(xmlSecTransformPtr transform) {
 }
 
 static int
-xmlSecOpenSSLEvpDigestVerify(xmlSecTransformPtr transform, 
+xmlSecOpenSSLEvpDigestVerify(xmlSecTransformPtr transform,
                         const xmlSecByte* data, xmlSecSize dataSize,
                         xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLDigestCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecOpenSSLEvpDigestCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLEvpDigestSize), -1);
     xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1);
@@ -213,20 +213,20 @@ xmlSecOpenSSLEvpDigestVerify(xmlSecTransformPtr transform,
     ctx = xmlSecOpenSSLEvpDigestGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->dgstSize > 0, -1);
-    
+
     if(dataSize != ctx->dgstSize) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_SIZE,
-                    "data_size=%d;dgst_size=%d", 
+                    "data_size=%d;dgst_size=%d",
                     dataSize, ctx->dgstSize);
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-    
+
     if(memcmp(ctx->dgst, data, ctx->dgstSize) != 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_DATA,
@@ -234,17 +234,17 @@ xmlSecOpenSSLEvpDigestVerify(xmlSecTransformPtr transform,
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-    
+
     transform->status = xmlSecTransformStatusOk;
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLEvpDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLDigestCtxPtr ctx;
     xmlSecBufferPtr in, out;
     int ret;
-    
+
     xmlSecAssert2(xmlSecOpenSSLEvpDigestCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLEvpDigestSize), -1);
@@ -259,12 +259,12 @@ xmlSecOpenSSLEvpDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTran
     ctx = xmlSecOpenSSLEvpDigestGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->digest != NULL, -1);
-    
+
     if(transform->status == xmlSecTransformStatusNone) {
 #ifndef XMLSEC_OPENSSL_096
         ret = EVP_DigestInit(&(ctx->digestCtx), ctx->digest);
         if(ret != 1) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "EVP_DigestInit",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -276,16 +276,16 @@ xmlSecOpenSSLEvpDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTran
 #endif /* XMLSEC_OPENSSL_096 */
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if(transform->status == xmlSecTransformStatusWorking) {
         xmlSecSize inSize;
-        
+
         inSize = xmlSecBufferGetSize(in);
         if(inSize > 0) {
 #ifndef XMLSEC_OPENSSL_096
             ret = EVP_DigestUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
             if(ret != 1) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "EVP_DigestUpdate",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -295,10 +295,10 @@ xmlSecOpenSSLEvpDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTran
 #else /* XMLSEC_OPENSSL_096 */
             EVP_DigestUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
 #endif /* XMLSEC_OPENSSL_096 */
-            
+
             ret = xmlSecBufferRemoveHead(in, inSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferRemoveHead",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -308,11 +308,11 @@ xmlSecOpenSSLEvpDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTran
         }
         if(last) {
             xmlSecAssert2((xmlSecSize)EVP_MD_size(ctx->digest) <= sizeof(ctx->dgst), -1);
-                
+
 #ifndef XMLSEC_OPENSSL_096
             ret = EVP_DigestFinal(&(ctx->digestCtx), ctx->dgst, &ctx->dgstSize);
             if(ret != 1) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "EVP_DigestFinal",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -323,12 +323,12 @@ xmlSecOpenSSLEvpDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTran
             EVP_DigestFinal(&(ctx->digestCtx), ctx->dgst, &ctx->dgstSize);
 #endif /* XMLSEC_OPENSSL_096 */
             xmlSecAssert2(ctx->dgstSize > 0, -1);
-            
+
             /* copy result to output */
             if(transform->operation == xmlSecTransformOperationSign) {
                 ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferAppend",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -342,14 +342,14 @@ xmlSecOpenSSLEvpDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTran
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -368,7 +368,7 @@ static xmlSecTransformKlass xmlSecOpenSSLMd5Klass = {
     xmlSecNameMd5,                              /* const xmlChar* name; */
     xmlSecHrefMd5,                              /* const xmlChar* href; */
     xmlSecTransformUsageDigestMethod,           /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpDigestInitialize,           /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpDigestFinalize,             /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -382,19 +382,19 @@ static xmlSecTransformKlass xmlSecOpenSSLMd5Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpDigestExecute,              /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformMd5GetKlass:
  *
  * MD5 digest transform klass.
  *
  * Returns: pointer to MD5 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformMd5GetKlass(void) {
     return(&xmlSecOpenSSLMd5Klass);
 }
@@ -414,7 +414,7 @@ static xmlSecTransformKlass xmlSecOpenSSLRipemd160Klass = {
     xmlSecNameRipemd160,                        /* const xmlChar* name; */
     xmlSecHrefRipemd160,                        /* const xmlChar* href; */
     xmlSecTransformUsageDigestMethod,           /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpDigestInitialize,           /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpDigestFinalize,             /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -428,19 +428,19 @@ static xmlSecTransformKlass xmlSecOpenSSLRipemd160Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpDigestExecute,              /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformRipemd160GetKlass:
  *
  * RIPEMD-160 digest transform klass.
  *
  * Returns: pointer to RIPEMD-160 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformRipemd160GetKlass(void) {
     return(&xmlSecOpenSSLRipemd160Klass);
 }
@@ -461,7 +461,7 @@ static xmlSecTransformKlass xmlSecOpenSSLSha1Klass = {
     xmlSecNameSha1,                             /* const xmlChar* name; */
     xmlSecHrefSha1,                             /* const xmlChar* href; */
     xmlSecTransformUsageDigestMethod,           /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpDigestInitialize,           /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpDigestFinalize,             /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -475,19 +475,19 @@ static xmlSecTransformKlass xmlSecOpenSSLSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpDigestExecute,              /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformSha1GetKlass:
  *
  * SHA-1 digest transform klass.
  *
  * Returns: pointer to SHA-1 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformSha1GetKlass(void) {
     return(&xmlSecOpenSSLSha1Klass);
 }
@@ -507,7 +507,7 @@ static xmlSecTransformKlass xmlSecOpenSSLSha224Klass = {
     xmlSecNameSha224,                           /* const xmlChar* name; */
     xmlSecHrefSha224,                           /* const xmlChar* href; */
     xmlSecTransformUsageDigestMethod,           /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpDigestInitialize,           /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpDigestFinalize,             /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -521,19 +521,19 @@ static xmlSecTransformKlass xmlSecOpenSSLSha224Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpDigestExecute,              /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformSha224GetKlass:
  *
  * SHA-224 digest transform klass.
  *
  * Returns: pointer to SHA-224 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformSha224GetKlass(void) {
     return(&xmlSecOpenSSLSha224Klass);
 }
@@ -553,7 +553,7 @@ static xmlSecTransformKlass xmlSecOpenSSLSha256Klass = {
     xmlSecNameSha256,                           /* const xmlChar* name; */
     xmlSecHrefSha256,                           /* const xmlChar* href; */
     xmlSecTransformUsageDigestMethod,           /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpDigestInitialize,           /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpDigestFinalize,             /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -567,19 +567,19 @@ static xmlSecTransformKlass xmlSecOpenSSLSha256Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpDigestExecute,              /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformSha256GetKlass:
  *
  * SHA-256 digest transform klass.
  *
  * Returns: pointer to SHA-256 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformSha256GetKlass(void) {
     return(&xmlSecOpenSSLSha256Klass);
 }
@@ -599,7 +599,7 @@ static xmlSecTransformKlass xmlSecOpenSSLSha384Klass = {
     xmlSecNameSha384,                           /* const xmlChar* name; */
     xmlSecHrefSha384,                           /* const xmlChar* href; */
     xmlSecTransformUsageDigestMethod,           /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpDigestInitialize,           /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpDigestFinalize,             /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -613,19 +613,19 @@ static xmlSecTransformKlass xmlSecOpenSSLSha384Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpDigestExecute,              /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformSha384GetKlass:
  *
  * SHA-384 digest transform klass.
  *
  * Returns: pointer to SHA-384 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformSha384GetKlass(void) {
     return(&xmlSecOpenSSLSha384Klass);
 }
@@ -645,7 +645,7 @@ static xmlSecTransformKlass xmlSecOpenSSLSha512Klass = {
     xmlSecNameSha512,                           /* const xmlChar* name; */
     xmlSecHrefSha512,                           /* const xmlChar* href; */
     xmlSecTransformUsageDigestMethod,           /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpDigestInitialize,           /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpDigestFinalize,             /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -659,19 +659,19 @@ static xmlSecTransformKlass xmlSecOpenSSLSha512Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpDigestExecute,              /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformSha512GetKlass:
  *
  * SHA-512 digest transform klass.
  *
  * Returns: pointer to SHA-512 digest transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformSha512GetKlass(void) {
     return(&xmlSecOpenSSLSha512Klass);
 }
diff --git a/src/openssl/evp.c b/src/openssl/evp.c
index 60b4685..e48defd 100644
--- a/src/openssl/evp.c
+++ b/src/openssl/evp.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -29,11 +29,11 @@
  * Internal OpenSSL EVP key CTX
  *
  *************************************************************************/
-typedef struct _xmlSecOpenSSLEvpKeyDataCtx      xmlSecOpenSSLEvpKeyDataCtx, 
+typedef struct _xmlSecOpenSSLEvpKeyDataCtx      xmlSecOpenSSLEvpKeyDataCtx,
                                                 *xmlSecOpenSSLEvpKeyDataCtxPtr;
 struct _xmlSecOpenSSLEvpKeyDataCtx {
     EVP_PKEY*           pKey;
-};          
+};
 
 /******************************************************************************
  *
@@ -43,7 +43,7 @@ struct _xmlSecOpenSSLEvpKeyDataCtx {
  *
  *****************************************************************************/
 #define xmlSecOpenSSLEvpKeyDataSize     \
-    (sizeof(xmlSecKeyData) + sizeof(xmlSecOpenSSLEvpKeyDataCtx))        
+    (sizeof(xmlSecKeyData) + sizeof(xmlSecOpenSSLEvpKeyDataCtx))
 #define xmlSecOpenSSLEvpKeyDataGetCtx(data) \
     ((xmlSecOpenSSLEvpKeyDataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
 
@@ -61,17 +61,17 @@ static void             xmlSecOpenSSLEvpKeyDataFinalize         (xmlSecKeyDataPt
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecOpenSSLEvpKeyDataAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) {
     xmlSecOpenSSLEvpKeyDataCtxPtr ctx;
 
     xmlSecAssert2(xmlSecKeyDataIsValid(data), -1);
     xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecOpenSSLEvpKeyDataSize), -1);
     xmlSecAssert2(pKey != NULL, -1);
-    
+
     ctx = xmlSecOpenSSLEvpKeyDataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     if(ctx->pKey != NULL) {
         EVP_PKEY_free(ctx->pKey);
     }
@@ -87,7 +87,7 @@ xmlSecOpenSSLEvpKeyDataAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) {
  *
  * Returns: pointer to EVP_PKEY or NULL if an error occurs.
  */
-EVP_PKEY* 
+EVP_PKEY*
 xmlSecOpenSSLEvpKeyDataGetEvp(xmlSecKeyDataPtr data) {
     xmlSecOpenSSLEvpKeyDataCtxPtr ctx;
 
@@ -141,8 +141,8 @@ xmlSecOpenSSLEvpKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
-    } 
+        }
+    }
 
     return(0);
 }
@@ -150,13 +150,13 @@ xmlSecOpenSSLEvpKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
 static void
 xmlSecOpenSSLEvpKeyDataFinalize(xmlSecKeyDataPtr data) {
     xmlSecOpenSSLEvpKeyDataCtxPtr ctx;
-    
+
     xmlSecAssert(xmlSecKeyDataIsValid(data));
     xmlSecAssert(xmlSecKeyDataCheckSize(data, xmlSecOpenSSLEvpKeyDataSize));
 
     ctx = xmlSecOpenSSLEvpKeyDataGetCtx(data);
     xmlSecAssert(ctx != NULL);
-    
+
     if(ctx->pKey != NULL) {
         EVP_PKEY_free(ctx->pKey);
     }
@@ -176,12 +176,12 @@ xmlSecOpenSSLEvpKeyDataFinalize(xmlSecKeyDataPtr data) {
  *
  * Returns: pointer to newly created EVP_PKEY object or NULL if an error occurs.
  */
-EVP_PKEY* 
+EVP_PKEY*
 xmlSecOpenSSLEvpKeyDup(EVP_PKEY* pKey) {
     int ret;
 
     xmlSecAssert2(pKey != NULL, NULL);
-    
+
     ret = CRYPTO_add(&pKey->references,1,CRYPTO_LOCK_EVP_PKEY);
     if(ret <= 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -189,9 +189,9 @@ xmlSecOpenSSLEvpKeyDup(EVP_PKEY* pKey) {
                     "CRYPTO_add",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     return(pKey);
 }
 
@@ -207,11 +207,11 @@ xmlSecKeyDataPtr
 xmlSecOpenSSLEvpKeyAdopt(EVP_PKEY *pKey) {
     xmlSecKeyDataPtr data = NULL;
     int ret;
-    
+
     xmlSecAssert2(pKey != NULL, NULL);
 
-    switch(pKey->type) {        
-#ifndef XMLSEC_NO_RSA    
+    switch(pKey->type) {
+#ifndef XMLSEC_NO_RSA
     case EVP_PKEY_RSA:
         data = xmlSecKeyDataCreate(xmlSecOpenSSLKeyDataRsaId);
         if(data == NULL) {
@@ -220,11 +220,11 @@ xmlSecOpenSSLEvpKeyAdopt(EVP_PKEY *pKey) {
                         "xmlSecKeyDataCreate",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "xmlSecOpenSSLKeyDataRsaId");
-            return(NULL);           
+            return(NULL);
         }
         break;
-#endif /* XMLSEC_NO_RSA */      
-#ifndef XMLSEC_NO_DSA   
+#endif /* XMLSEC_NO_RSA */
+#ifndef XMLSEC_NO_DSA
     case EVP_PKEY_DSA:
         data = xmlSecKeyDataCreate(xmlSecOpenSSLKeyDataDsaId);
         if(data == NULL) {
@@ -233,11 +233,11 @@ xmlSecOpenSSLEvpKeyAdopt(EVP_PKEY *pKey) {
                         "xmlSecKeyDataCreate",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "xmlSecOpenSSLKeyDataDsaId");
-            return(NULL);           
+            return(NULL);
         }
         break;
-#endif /* XMLSEC_NO_DSA */      
-    default:    
+#endif /* XMLSEC_NO_DSA */
+    default:
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
@@ -246,21 +246,21 @@ xmlSecOpenSSLEvpKeyAdopt(EVP_PKEY *pKey) {
         return(NULL);
     }
 
-    xmlSecAssert2(data != NULL, NULL);    
+    xmlSecAssert2(data != NULL, NULL);
     ret = xmlSecOpenSSLEvpKeyDataAdoptEvp(data, pKey);
-    if(ret < 0) {       
+    if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecOpenSSLEvpKeyDataAdoptEvp",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDataDestroy(data);
-        return(NULL);       
+        return(NULL);
     }
     return(data);
 }
 
-#ifndef XMLSEC_NO_DSA    
+#ifndef XMLSEC_NO_DSA
 /**************************************************************************
  *
  * <dsig:DSAKeyValue> processing
@@ -268,57 +268,57 @@ xmlSecOpenSSLEvpKeyAdopt(EVP_PKEY *pKey) {
  *
  * The DSAKeyValue Element (http://www.w3.org/TR/xmldsig-core/#sec-DSAKeyValue)
  *
- * DSA keys and the DSA signature algorithm are specified in [DSS]. 
+ * DSA keys and the DSA signature algorithm are specified in [DSS].
  * DSA public key values can have the following fields:
- *      
- *   * P - a prime modulus meeting the [DSS] requirements 
- *   * Q - an integer in the range 2**159 < Q < 2**160 which is a prime 
- *         divisor of P-1 
- *   * G - an integer with certain properties with respect to P and Q 
- *   * Y - G**X mod P (where X is part of the private key and not made 
- *         public) 
- *   * J - (P - 1) / Q 
- *   * seed - a DSA prime generation seed 
+ *
+ *   * P - a prime modulus meeting the [DSS] requirements
+ *   * Q - an integer in the range 2**159 < Q < 2**160 which is a prime
+ *         divisor of P-1
+ *   * G - an integer with certain properties with respect to P and Q
+ *   * Y - G**X mod P (where X is part of the private key and not made
+ *         public)
+ *   * J - (P - 1) / Q
+ *   * seed - a DSA prime generation seed
  *   * pgenCounter - a DSA prime generation counter
  *
- * Parameter J is available for inclusion solely for efficiency as it is 
- * calculatable from P and Q. Parameters seed and pgenCounter are used in the 
- * DSA prime number generation algorithm specified in [DSS]. As such, they are 
- * optional but must either both be present or both be absent. This prime 
- * generation algorithm is designed to provide assurance that a weak prime is 
- * not being used and it yields a P and Q value. Parameters P, Q, and G can be 
- * public and common to a group of users. They might be known from application 
- * context. As such, they are optional but P and Q must either both appear or 
- * both be absent. If all of P, Q, seed, and pgenCounter are present, 
- * implementations are not required to check if they are consistent and are 
- * free to use either P and Q or seed and pgenCounter. All parameters are 
+ * Parameter J is available for inclusion solely for efficiency as it is
+ * calculatable from P and Q. Parameters seed and pgenCounter are used in the
+ * DSA prime number generation algorithm specified in [DSS]. As such, they are
+ * optional but must either both be present or both be absent. This prime
+ * generation algorithm is designed to provide assurance that a weak prime is
+ * not being used and it yields a P and Q value. Parameters P, Q, and G can be
+ * public and common to a group of users. They might be known from application
+ * context. As such, they are optional but P and Q must either both appear or
+ * both be absent. If all of P, Q, seed, and pgenCounter are present,
+ * implementations are not required to check if they are consistent and are
+ * free to use either P and Q or seed and pgenCounter. All parameters are
  * encoded as base64 [MIME] values.
- *     
- * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are 
+ *
+ * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are
  * represented in XML as octet strings as defined by the ds:CryptoBinary type.
- *     
+ *
  * Schema Definition:
- *     
- * <element name="DSAKeyValue" type="ds:DSAKeyValueType"/> 
- * <complexType name="DSAKeyValueType"> 
+ *
+ * <element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
+ * <complexType name="DSAKeyValueType">
  *   <sequence>
  *     <sequence minOccurs="0">
- *        <element name="P" type="ds:CryptoBinary"/> 
+ *        <element name="P" type="ds:CryptoBinary"/>
  *        <element name="Q" type="ds:CryptoBinary"/>
  *     </sequence>
- *     <element name="G" type="ds:CryptoBinary" minOccurs="0"/> 
- *     <element name="Y" type="ds:CryptoBinary"/> 
+ *     <element name="G" type="ds:CryptoBinary" minOccurs="0"/>
+ *     <element name="Y" type="ds:CryptoBinary"/>
  *     <element name="J" type="ds:CryptoBinary" minOccurs="0"/>
  *     <sequence minOccurs="0">
- *       <element name="Seed" type="ds:CryptoBinary"/> 
- *       <element name="PgenCounter" type="ds:CryptoBinary"/> 
+ *       <element name="Seed" type="ds:CryptoBinary"/>
+ *       <element name="PgenCounter" type="ds:CryptoBinary"/>
  *     </sequence>
  *   </sequence>
  * </complexType>
- *     
+ *
  * DTD Definition:
- *     
- *  <!ELEMENT DSAKeyValue ((P, Q)?, G?, Y, J?, (Seed, PgenCounter)?) > 
+ *
+ *  <!ELEMENT DSAKeyValue ((P, Q)?, G?, Y, J?, (Seed, PgenCounter)?) >
  *  <!ELEMENT P (#PCDATA) >
  *  <!ELEMENT Q (#PCDATA) >
  *  <!ELEMENT G (#PCDATA) >
@@ -328,7 +328,7 @@ xmlSecOpenSSLEvpKeyAdopt(EVP_PKEY *pKey) {
  *  <!ELEMENT PgenCounter (#PCDATA) >
  *
  * ============================================================================
- * 
+ *
  * To support reading/writing private keys an X element added (before Y).
  * todo: The current implementation does not support Seed and PgenCounter!
  * by this the P, Q and G are *required*!
@@ -363,22 +363,22 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataDsaKlass = {
 
     /* data */
     xmlSecNameDSAKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefDSAKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeDSAKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecOpenSSLKeyDataDsaInitialize,          /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecOpenSSLKeyDataDsaDuplicate,           /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecOpenSSLKeyDataDsaFinalize,            /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecOpenSSLKeyDataDsaGenerate,            /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecOpenSSLKeyDataDsaGetType,             /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecOpenSSLKeyDataDsaGetSize,             /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecOpenSSLKeyDataDsaXmlRead,             /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -397,12 +397,12 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataDsaKlass = {
 
 /**
  * xmlSecOpenSSLKeyDataDsaGetKlass:
- * 
+ *
  * The DSA key data klass.
  *
  * Returns: pointer to DSA key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecOpenSSLKeyDataDsaGetKlass(void) {
     return(&xmlSecOpenSSLKeyDataDsaKlass);
 }
@@ -415,14 +415,14 @@ xmlSecOpenSSLKeyDataDsaGetKlass(void) {
  * Sets the value of DSA key data.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 int
 xmlSecOpenSSLKeyDataDsaAdoptDsa(xmlSecKeyDataPtr data, DSA* dsa) {
     EVP_PKEY* pKey = NULL;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataDsaId), -1);
-    
+
     /* construct new EVP_PKEY */
     if(dsa != NULL) {
         pKey = EVP_PKEY_new();
@@ -434,7 +434,7 @@ xmlSecOpenSSLKeyDataDsaAdoptDsa(xmlSecKeyDataPtr data, DSA* dsa) {
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-        
+
         ret = EVP_PKEY_assign_DSA(pKey, dsa);
         if(ret != 1) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -443,9 +443,9 @@ xmlSecOpenSSLKeyDataDsaAdoptDsa(xmlSecKeyDataPtr data, DSA* dsa) {
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
+        }
     }
-    
+
     ret = xmlSecOpenSSLKeyDataDsaAdoptEvp(data, pKey);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -458,7 +458,7 @@ xmlSecOpenSSLKeyDataDsaAdoptDsa(xmlSecKeyDataPtr data, DSA* dsa) {
         }
         return(-1);
     }
-    return(0);    
+    return(0);
 }
 
 /**
@@ -469,19 +469,19 @@ xmlSecOpenSSLKeyDataDsaAdoptDsa(xmlSecKeyDataPtr data, DSA* dsa) {
  *
  * Returns: pointer to OpenSSL DSA key or NULL if an error occurs.
  */
-DSA* 
+DSA*
 xmlSecOpenSSLKeyDataDsaGetDsa(xmlSecKeyDataPtr data) {
     EVP_PKEY* pKey;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataDsaId), NULL);
-    
+
     pKey = xmlSecOpenSSLKeyDataDsaGetEvp(data);
     xmlSecAssert2((pKey == NULL) || (pKey->type == EVP_PKEY_DSA), NULL);
-    
+
     return((pKey != NULL) ? pKey->pkey.dsa : (DSA*)NULL);
 }
 
-/** 
+/**
  * xmlSecOpenSSLKeyDataDsaAdoptEvp:
  * @data:               the pointer to DSA key data.
  * @pKey:               the pointer to OpenSSL EVP key.
@@ -490,12 +490,12 @@ xmlSecOpenSSLKeyDataDsaGetDsa(xmlSecKeyDataPtr data) {
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecOpenSSLKeyDataDsaAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataDsaId), -1);
     xmlSecAssert2(pKey != NULL, -1);
     xmlSecAssert2(pKey->type == EVP_PKEY_DSA, -1);
-    
+
     return(xmlSecOpenSSLEvpKeyDataAdoptEvp(data, pKey));
 }
 
@@ -507,7 +507,7 @@ xmlSecOpenSSLKeyDataDsaAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) {
  *
  * Returns: pointer to OpenSSL EVP key or NULL if an error occurs.
  */
-EVP_PKEY* 
+EVP_PKEY*
 xmlSecOpenSSLKeyDataDsaGetEvp(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataDsaId), NULL);
 
@@ -532,7 +532,7 @@ xmlSecOpenSSLKeyDataDsaDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
 static void
 xmlSecOpenSSLKeyDataDsaFinalize(xmlSecKeyDataPtr data) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataDsaId));
-    
+
     xmlSecOpenSSLEvpKeyDataFinalize(data);
 }
 
@@ -555,7 +555,7 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_KEY_DATA,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     dsa = DSA_new();
@@ -567,7 +567,7 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     cur = xmlSecGetNextElementNode(node->children);
 
     /* first is P node. It is REQUIRED because we do not support Seed and PgenCounter*/
@@ -576,17 +576,17 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
-        DSA_free(dsa);  
+        DSA_free(dsa);
         return(-1);
     }
     if(xmlSecOpenSSLNodeGetBNValue(cur, &(dsa->p)) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
-                    "xmlSecOpenSSLNodeGetBNValue",                  
+                    "xmlSecOpenSSLNodeGetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
         DSA_free(dsa);
         return(-1);
@@ -599,7 +599,7 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
         DSA_free(dsa);
         return(-1);
@@ -609,7 +609,7 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecOpenSSLNodeGetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
         DSA_free(dsa);
         return(-1);
@@ -622,7 +622,7 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
         DSA_free(dsa);
         return(-1);
@@ -632,7 +632,7 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecOpenSSLNodeGetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
         DSA_free(dsa);
         return(-1);
@@ -647,7 +647,7 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                         "xmlSecOpenSSLNodeGetBNValue",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "node=%s", 
+                        "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeDSAX));
             DSA_free(dsa);
             return(-1);
@@ -661,7 +661,7 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAY));
         DSA_free(dsa);
         return(-1);
@@ -679,17 +679,17 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
 
     /* todo: add support for J */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAJ, xmlSecDSigNs))) {
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     /* todo: add support for seed */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSASeed, xmlSecDSigNs))) {
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
 
     /* todo: add support for pgencounter */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAPgenCounter, xmlSecDSigNs))) {
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
 
     if(cur != NULL) {
@@ -733,19 +733,19 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDataDestroy(data);
-        return(-1);     
+        return(-1);
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlNodePtr cur;
     DSA* dsa;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecOpenSSLKeyDataDsaId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecOpenSSLKeyDataDsaId), -1);
@@ -754,12 +754,12 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
 
     dsa = xmlSecOpenSSLKeyDataDsaGetDsa(xmlSecKeyGetValue(key));
     xmlSecAssert2(dsa != NULL, -1);
-    
+
     if(((xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate) & keyInfoCtx->keyReq.keyType) == 0) {
         /* we can have only private key or public key */
         return(0);
-    }    
-    
+    }
+
     /* first is P node */
     xmlSecAssert2(dsa->p != NULL, -1);
     cur = xmlSecAddChild(node, xmlSecNodeDSAP, xmlSecDSigNs);
@@ -768,9 +768,9 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->p, 1);
     if(ret < 0) {
@@ -778,10 +778,10 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecOpenSSLNodeSetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAP));
         return(-1);
-    }    
+    }
 
     /* next is Q node. */
     xmlSecAssert2(dsa->q != NULL, -1);
@@ -791,9 +791,9 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->q, 1);
     if(ret < 0) {
@@ -801,7 +801,7 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecOpenSSLNodeSetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAQ));
         return(-1);
     }
@@ -814,9 +814,9 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->g, 1);
     if(ret < 0) {
@@ -824,7 +824,7 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecOpenSSLNodeSetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAG));
         return(-1);
     }
@@ -837,9 +837,9 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                         "xmlSecAddChild",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "node=%s", 
+                        "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeDSAX));
-            return(-1); 
+            return(-1);
         }
         ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->priv_key, 1);
         if(ret < 0) {
@@ -847,7 +847,7 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                         "xmlSecOpenSSLNodeSetBNValue",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "node=%s", 
+                        "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeDSAX));
             return(-1);
         }
@@ -861,9 +861,9 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAY));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->pub_key, 1);
     if(ret < 0) {
@@ -871,7 +871,7 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecOpenSSLNodeSetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDSAY));
         return(-1);
     }
@@ -884,18 +884,18 @@ xmlSecOpenSSLKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlS
     int counter_ret;
     unsigned long h_ret;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataDsaId), -1);
     xmlSecAssert2(sizeBits > 0, -1);
 
-    dsa = DSA_generate_parameters(sizeBits, NULL, 0, &counter_ret, &h_ret, NULL, NULL); 
+    dsa = DSA_generate_parameters(sizeBits, NULL, 0, &counter_ret, &h_ret, NULL, NULL);
     if(dsa == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                     "DSA_generate_parameters",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "size=%d", sizeBits);
-        return(-1);    
+        return(-1);
     }
 
     ret = DSA_generate_key(dsa);
@@ -906,7 +906,7 @@ xmlSecOpenSSLKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlS
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         DSA_free(dsa);
-        return(-1);    
+        return(-1);
     }
 
     ret = xmlSecOpenSSLKeyDataDsaAdoptDsa(data, dsa);
@@ -926,13 +926,13 @@ xmlSecOpenSSLKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlS
 static xmlSecKeyDataType
 xmlSecOpenSSLKeyDataDsaGetType(xmlSecKeyDataPtr data) {
     DSA* dsa;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataDsaId), xmlSecKeyDataTypeUnknown);
-    
+
     dsa = xmlSecOpenSSLKeyDataDsaGetDsa(data);
-    if((dsa != NULL) && (dsa->p != NULL) && (dsa->q != NULL) && 
+    if((dsa != NULL) && (dsa->p != NULL) && (dsa->q != NULL) &&
        (dsa->g != NULL) && (dsa->pub_key != NULL)) {
-       
+
         if(dsa->priv_key != NULL) {
             return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
         } else if(dsa->engine != NULL) {
@@ -951,7 +951,7 @@ xmlSecOpenSSLKeyDataDsaGetType(xmlSecKeyDataPtr data) {
     return(xmlSecKeyDataTypeUnknown);
 }
 
-static xmlSecSize 
+static xmlSecSize
 xmlSecOpenSSLKeyDataDsaGetSize(xmlSecKeyDataPtr data) {
     DSA* dsa;
 
@@ -960,16 +960,16 @@ xmlSecOpenSSLKeyDataDsaGetSize(xmlSecKeyDataPtr data) {
     dsa = xmlSecOpenSSLKeyDataDsaGetDsa(data);
     if((dsa != NULL) && (dsa->p != NULL)) {
         return(BN_num_bits(dsa->p));
-    }    
+    }
     return(0);
 }
 
-static void 
+static void
 xmlSecOpenSSLKeyDataDsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataDsaId));
     xmlSecAssert(output != NULL);
-    
-    fprintf(output, "=== dsa key: size = %d\n", 
+
+    fprintf(output, "=== dsa key: size = %d\n",
             xmlSecOpenSSLKeyDataDsaGetSize(data));
 }
 
@@ -977,8 +977,8 @@ static void
 xmlSecOpenSSLKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataDsaId));
     xmlSecAssert(output != NULL);
-        
-    fprintf(output, "<DSAKeyValue size=\"%d\" />\n", 
+
+    fprintf(output, "<DSAKeyValue size=\"%d\" />\n",
             xmlSecOpenSSLKeyDataDsaGetSize(data));
 }
 
@@ -1002,27 +1002,27 @@ xmlSecOpenSSLKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
  *   <Exponent>AQAB</Exponent>
  * </RSAKeyValue>
  *
- * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are 
+ * Arbitrary-length integers (e.g. "bignums" such as RSA moduli) are
  * represented in XML as octet strings as defined by the ds:CryptoBinary type.
  *
  * Schema Definition:
- * 
+ *
  * <element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
  * <complexType name="RSAKeyValueType">
  *   <sequence>
- *     <element name="Modulus" type="ds:CryptoBinary"/> 
+ *     <element name="Modulus" type="ds:CryptoBinary"/>
  *     <element name="Exponent" type="ds:CryptoBinary"/>
  *   </sequence>
  * </complexType>
  *
  * DTD Definition:
- * 
- * <!ELEMENT RSAKeyValue (Modulus, Exponent) > 
+ *
+ * <!ELEMENT RSAKeyValue (Modulus, Exponent) >
  * <!ELEMENT Modulus (#PCDATA) >
  * <!ELEMENT Exponent (#PCDATA) >
  *
  * ============================================================================
- * 
+ *
  * To support reading/writing private keys an PrivateExponent element is added
  * to the end
  *
@@ -1056,22 +1056,22 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataRsaKlass = {
 
     /* data */
     xmlSecNameRSAKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefRSAKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeRSAKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecOpenSSLKeyDataRsaInitialize,          /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecOpenSSLKeyDataRsaDuplicate,           /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecOpenSSLKeyDataRsaFinalize,            /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecOpenSSLKeyDataRsaGenerate,            /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecOpenSSLKeyDataRsaGetType,             /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecOpenSSLKeyDataRsaGetSize,             /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecOpenSSLKeyDataRsaXmlRead,             /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -1088,14 +1088,14 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataRsaKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLKeyDataRsaGetKlass:
  *
  * The OpenSSL RSA key data klass.
  *
  * Returns: pointer to OpenSSL RSA key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecOpenSSLKeyDataRsaGetKlass(void) {
     return(&xmlSecOpenSSLKeyDataRsaKlass);
 }
@@ -1108,14 +1108,14 @@ xmlSecOpenSSLKeyDataRsaGetKlass(void) {
  * Sets the value of RSA key data.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 int
 xmlSecOpenSSLKeyDataRsaAdoptRsa(xmlSecKeyDataPtr data, RSA* rsa) {
     EVP_PKEY* pKey = NULL;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataRsaId), -1);
-    
+
     /* construct new EVP_PKEY */
     if(rsa != NULL) {
         pKey = EVP_PKEY_new();
@@ -1127,7 +1127,7 @@ xmlSecOpenSSLKeyDataRsaAdoptRsa(xmlSecKeyDataPtr data, RSA* rsa) {
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-        
+
         ret = EVP_PKEY_assign_RSA(pKey, rsa);
         if(ret != 1) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1136,9 +1136,9 @@ xmlSecOpenSSLKeyDataRsaAdoptRsa(xmlSecKeyDataPtr data, RSA* rsa) {
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
+        }
     }
-    
+
     ret = xmlSecOpenSSLKeyDataRsaAdoptEvp(data, pKey);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1151,7 +1151,7 @@ xmlSecOpenSSLKeyDataRsaAdoptRsa(xmlSecKeyDataPtr data, RSA* rsa) {
         }
         return(-1);
     }
-    return(0);    
+    return(0);
 }
 
 /**
@@ -1162,19 +1162,19 @@ xmlSecOpenSSLKeyDataRsaAdoptRsa(xmlSecKeyDataPtr data, RSA* rsa) {
  *
  * Returns: pointer to OpenSSL RSA key or NULL if an error occurs.
  */
-RSA* 
+RSA*
 xmlSecOpenSSLKeyDataRsaGetRsa(xmlSecKeyDataPtr data) {
     EVP_PKEY* pKey;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataRsaId), NULL);
-    
+
     pKey = xmlSecOpenSSLKeyDataRsaGetEvp(data);
     xmlSecAssert2((pKey == NULL) || (pKey->type == EVP_PKEY_RSA), NULL);
-    
+
     return((pKey != NULL) ? pKey->pkey.rsa : (RSA*)NULL);
 }
 
-/** 
+/**
  * xmlSecOpenSSLKeyDataRsaAdoptEvp:
  * @data:               the pointer to RSA key data.
  * @pKey:               the pointer to OpenSSL EVP key.
@@ -1183,12 +1183,12 @@ xmlSecOpenSSLKeyDataRsaGetRsa(xmlSecKeyDataPtr data) {
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecOpenSSLKeyDataRsaAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataRsaId), -1);
     xmlSecAssert2(pKey != NULL, -1);
     xmlSecAssert2(pKey->type == EVP_PKEY_RSA, -1);
-    
+
     return(xmlSecOpenSSLEvpKeyDataAdoptEvp(data, pKey));
 }
 
@@ -1200,7 +1200,7 @@ xmlSecOpenSSLKeyDataRsaAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) {
  *
  * Returns: pointer to OpenSSL EVP key or NULL if an error occurs.
  */
-EVP_PKEY* 
+EVP_PKEY*
 xmlSecOpenSSLKeyDataRsaGetEvp(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataRsaId), NULL);
 
@@ -1245,10 +1245,10 @@ xmlSecOpenSSLKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     if(xmlSecKeyGetValue(key) != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
-                    NULL,                   
+                    NULL,
                     XMLSEC_ERRORS_R_INVALID_KEY_DATA,
                     "key already has a value");
-        return(-1);     
+        return(-1);
     }
 
     rsa = RSA_new();
@@ -1262,16 +1262,16 @@ xmlSecOpenSSLKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     }
 
     cur = xmlSecGetNextElementNode(node->children);
-    
+
     /* first is Modulus node. It is REQUIRED because we do not support Seed and PgenCounter*/
     if((cur == NULL) || (!xmlSecCheckNodeName(cur,  xmlSecNodeRSAModulus, xmlSecDSigNs))) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
-        RSA_free(rsa);  
+        RSA_free(rsa);
         return(-1);
     }
     if(xmlSecOpenSSLNodeGetBNValue(cur, &(rsa->n)) == NULL) {
@@ -1279,7 +1279,7 @@ xmlSecOpenSSLKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecOpenSSLNodeGetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
         RSA_free(rsa);
         return(-1);
@@ -1292,7 +1292,7 @@ xmlSecOpenSSLKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
         RSA_free(rsa);
         return(-1);
@@ -1302,7 +1302,7 @@ xmlSecOpenSSLKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecOpenSSLNodeGetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
         RSA_free(rsa);
         return(-1);
@@ -1317,7 +1317,7 @@ xmlSecOpenSSLKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                         "xmlSecOpenSSLNodeGetBNValue",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "node=%s", 
+                        "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent));
             RSA_free(rsa);
             return(-1);
@@ -1366,19 +1366,19 @@ xmlSecOpenSSLKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecKeyDataDestroy(data);
-        return(-1);     
+        return(-1);
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                             xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlNodePtr cur;
     RSA* rsa;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecOpenSSLKeyDataRsaId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecOpenSSLKeyDataRsaId), -1);
@@ -1387,11 +1387,11 @@ xmlSecOpenSSLKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
 
     rsa = xmlSecOpenSSLKeyDataRsaGetRsa(xmlSecKeyGetValue(key));
     xmlSecAssert2(rsa != NULL, -1);
-    
+
     if(((xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate) & keyInfoCtx->keyReq.keyType) == 0) {
         /* we can have only private key or public key */
         return(0);
-    }    
+    }
 
     /* first is Modulus node */
     cur = xmlSecAddChild(node, xmlSecNodeRSAModulus, xmlSecDSigNs);
@@ -1400,9 +1400,9 @@ xmlSecOpenSSLKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecOpenSSLNodeSetBNValue(cur, rsa->n, 1);
     if(ret < 0) {
@@ -1410,10 +1410,10 @@ xmlSecOpenSSLKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecOpenSSLNodeSetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
         return(-1);
-    }    
+    }
 
     /* next is Exponent node. */
     cur = xmlSecAddChild(node, xmlSecNodeRSAExponent, xmlSecDSigNs);
@@ -1422,9 +1422,9 @@ xmlSecOpenSSLKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
-        return(-1);     
+        return(-1);
     }
     ret = xmlSecOpenSSLNodeSetBNValue(cur, rsa->e, 1);
     if(ret < 0) {
@@ -1432,7 +1432,7 @@ xmlSecOpenSSLKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                     "xmlSecOpenSSLNodeSetBNValue",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
         return(-1);
     }
@@ -1445,9 +1445,9 @@ xmlSecOpenSSLKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                         "xmlSecAddChild",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "node=%s", 
+                        "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent));
-            return(-1); 
+            return(-1);
         }
         ret = xmlSecOpenSSLNodeSetBNValue(cur, rsa->d, 1);
         if(ret < 0) {
@@ -1455,12 +1455,12 @@ xmlSecOpenSSLKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
                         "xmlSecOpenSSLNodeSetBNValue",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "node=%s", 
+                        "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent));
             return(-1);
         }
     }
-    
+
     return(0);
 }
 
@@ -1468,18 +1468,18 @@ static int
 xmlSecOpenSSLKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
     RSA* rsa;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataRsaId), -1);
     xmlSecAssert2(sizeBits > 0, -1);
 
-    rsa = RSA_generate_key(sizeBits, 3, NULL, NULL); 
+    rsa = RSA_generate_key(sizeBits, 3, NULL, NULL);
     if(rsa == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                     "RSA_generate_key",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "sizeBits=%d", sizeBits);
-        return(-1);    
+        return(-1);
     }
 
     ret = xmlSecOpenSSLKeyDataRsaAdoptRsa(data, rsa);
@@ -1499,9 +1499,9 @@ xmlSecOpenSSLKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlS
 static xmlSecKeyDataType
 xmlSecOpenSSLKeyDataRsaGetType(xmlSecKeyDataPtr data) {
     RSA* rsa;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataRsaId), xmlSecKeyDataTypeUnknown);
-    
+
     rsa = xmlSecOpenSSLKeyDataRsaGetRsa(data);
     if((rsa != NULL) && (rsa->n != NULL) && (rsa->e != NULL)) {
         if(rsa->d != NULL) {
@@ -1522,7 +1522,7 @@ xmlSecOpenSSLKeyDataRsaGetType(xmlSecKeyDataPtr data) {
     return(xmlSecKeyDataTypeUnknown);
 }
 
-static xmlSecSize 
+static xmlSecSize
 xmlSecOpenSSLKeyDataRsaGetSize(xmlSecKeyDataPtr data) {
     RSA* rsa;
 
@@ -1531,16 +1531,16 @@ xmlSecOpenSSLKeyDataRsaGetSize(xmlSecKeyDataPtr data) {
     rsa = xmlSecOpenSSLKeyDataRsaGetRsa(data);
     if((rsa != NULL) && (rsa->n != NULL)) {
         return(BN_num_bits(rsa->n));
-    }    
+    }
     return(0);
 }
 
-static void 
+static void
 xmlSecOpenSSLKeyDataRsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataRsaId));
     xmlSecAssert(output != NULL);
-    
-    fprintf(output, "=== rsa key: size = %d\n", 
+
+    fprintf(output, "=== rsa key: size = %d\n",
             xmlSecOpenSSLKeyDataRsaGetSize(data));
 }
 
@@ -1548,11 +1548,11 @@ static void
 xmlSecOpenSSLKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataRsaId));
     xmlSecAssert(output != NULL);
-        
-    fprintf(output, "<RSAKeyValue size=\"%d\" />\n", 
+
+    fprintf(output, "<RSAKeyValue size=\"%d\" />\n",
             xmlSecOpenSSLKeyDataRsaGetSize(data));
 }
-    
+
 #endif /* XMLSEC_NO_RSA */
 
 
diff --git a/src/openssl/globals.h b/src/openssl/globals.h
index 272a27b..770b6db 100644
--- a/src/openssl/globals.h
+++ b/src/openssl/globals.h
@@ -5,14 +5,14 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_GLOBALS_H__
 #define __XMLSEC_GLOBALS_H__
 
 /**
- * Use autoconf defines if present. 
+ * Use autoconf defines if present.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/src/openssl/hmac.c b/src/openssl/hmac.c
index cfaa6af..de8a9c8 100644
--- a/src/openssl/hmac.c
+++ b/src/openssl/hmac.c
@@ -1,18 +1,18 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * HMAC Algorithm support (http://www.w3.org/TR/xmldsig-core/#sec-HMAC):
- * The HMAC algorithm (RFC2104 [HMAC]) takes the truncation length in bits 
- * as a parameter; if the parameter is not specified then all the bits of the 
- * hash are output. An example of an HMAC SignatureMethod element:  
+ * The HMAC algorithm (RFC2104 [HMAC]) takes the truncation length in bits
+ * as a parameter; if the parameter is not specified then all the bits of the
+ * hash are output. An example of an HMAC SignatureMethod element:
  * <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1";>
  *   <HMACOutputLength>128</HMACOutputLength>
  * </SignatureMethod>
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef XMLSEC_NO_HMAC
@@ -45,10 +45,10 @@
 static int g_xmlsec_openssl_hmac_min_length = XMLSEC_OPENSSL_MIN_HMAC_SIZE;
 
 /**
- * xmlSecOpenSSLHmacGetMinOutputLength: 
- * 
+ * xmlSecOpenSSLHmacGetMinOutputLength:
+ *
  * Gets the value of min HMAC length.
- * 
+ *
  * Returns: the min HMAC output length
  */
 int xmlSecOpenSSLHmacGetMinOutputLength(void)
@@ -57,9 +57,9 @@ int xmlSecOpenSSLHmacGetMinOutputLength(void)
 }
 
 /**
- * xmlSecOpenSSLHmacSetMinOutputLength: 
- * @min_length: the new min length 
- * 
+ * xmlSecOpenSSLHmacSetMinOutputLength:
+ * @min_length: the new min length
+ *
  * Sets the min HMAC output length
  */
 void xmlSecOpenSSLHmacSetMinOutputLength(int min_length)
@@ -79,7 +79,7 @@ struct _xmlSecOpenSSLHmacCtx {
     int                 ctxInitialized;
     xmlSecByte          dgst[XMLSEC_OPENSSL_MAX_HMAC_SIZE];
     xmlSecSize          dgstSize;       /* dgst size in bits */
-};          
+};
 
 /**************************************************************************
  *
@@ -99,15 +99,15 @@ static void     xmlSecOpenSSLHmacFinalize                       (xmlSecTransform
 static int      xmlSecOpenSSLHmacNodeRead                       (xmlSecTransformPtr transform,
                                                                  xmlNodePtr node,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecOpenSSLHmacSetKeyReq                      (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLHmacSetKeyReq                      (xmlSecTransformPtr transform,
                                                                  xmlSecKeyReqPtr keyReq);
-static int      xmlSecOpenSSLHmacSetKey                         (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLHmacSetKey                         (xmlSecTransformPtr transform,
                                                                  xmlSecKeyPtr key);
-static int      xmlSecOpenSSLHmacVerify                         (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLHmacVerify                         (xmlSecTransformPtr transform,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecOpenSSLHmacExecute                        (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLHmacExecute                        (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
@@ -119,110 +119,110 @@ xmlSecOpenSSLHmacCheckId(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha1Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_SHA1 */    
+#endif /* XMLSEC_NO_SHA1 */
 
 #ifndef XMLSEC_NO_SHA224
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha224Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_SHA224 */    
-    
+#endif /* XMLSEC_NO_SHA224 */
+
 #ifndef XMLSEC_NO_SHA256
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha256Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_SHA256 */    
+#endif /* XMLSEC_NO_SHA256 */
 
 #ifndef XMLSEC_NO_SHA384
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha384Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_SHA384 */    
+#endif /* XMLSEC_NO_SHA384 */
 
 #ifndef XMLSEC_NO_SHA512
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha512Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_SHA512 */    
+#endif /* XMLSEC_NO_SHA512 */
 
 #ifndef XMLSEC_NO_RIPEMD160
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacRipemd160Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_RIPEMD160 */    
+#endif /* XMLSEC_NO_RIPEMD160 */
 
 #ifndef XMLSEC_NO_MD5
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacMd5Id)) {
         return(1);
     } else
-#endif /* XMLSEC_NO_MD5 */    
+#endif /* XMLSEC_NO_MD5 */
 
     {
         return(0);
     }
-    
+
     return(0);
 }
 
 
 
-static int 
+static int
 xmlSecOpenSSLHmacInitialize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLHmacCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecOpenSSLHmacCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLHmacSize), -1);
 
     ctx = xmlSecOpenSSLHmacGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     /* initialize context */
     memset(ctx, 0, sizeof(xmlSecOpenSSLHmacCtx));
 
 #ifndef XMLSEC_NO_SHA1
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha1Id)) {
         ctx->hmacDgst = EVP_sha1();
-    } else 
-#endif /* XMLSEC_NO_SHA1 */    
+    } else
+#endif /* XMLSEC_NO_SHA1 */
 
 #ifndef XMLSEC_NO_SHA224
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha224Id)) {
         ctx->hmacDgst = EVP_sha224();
-    } else 
-#endif /* XMLSEC_NO_SHA224 */    
+    } else
+#endif /* XMLSEC_NO_SHA224 */
 
 #ifndef XMLSEC_NO_SHA256
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha256Id)) {
         ctx->hmacDgst = EVP_sha256();
-    } else 
-#endif /* XMLSEC_NO_SHA256 */    
-    
+    } else
+#endif /* XMLSEC_NO_SHA256 */
+
 #ifndef XMLSEC_NO_SHA384
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha384Id)) {
         ctx->hmacDgst = EVP_sha384();
-    } else 
-#endif /* XMLSEC_NO_SHA384 */    
+    } else
+#endif /* XMLSEC_NO_SHA384 */
 
 #ifndef XMLSEC_NO_SHA512
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha512Id)) {
         ctx->hmacDgst = EVP_sha512();
-    } else 
-#endif /* XMLSEC_NO_SHA512 */    
+    } else
+#endif /* XMLSEC_NO_SHA512 */
 
-#ifndef XMLSEC_NO_RIPEMD160 
+#ifndef XMLSEC_NO_RIPEMD160
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacRipemd160Id)) {
         ctx->hmacDgst = EVP_ripemd160();
-    } else 
+    } else
 #endif /* XMLSEC_NO_RIPEMD160 */
 
 #ifndef XMLSEC_NO_MD5
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacMd5Id)) {
         ctx->hmacDgst = EVP_md5();
-    } else 
+    } else
 #endif /* XMLSEC_NO_MD5 */
-    
+
     {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
@@ -236,7 +236,7 @@ xmlSecOpenSSLHmacInitialize(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static void 
+static void
 xmlSecOpenSSLHmacFinalize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLHmacCtxPtr ctx;
 
@@ -245,7 +245,7 @@ xmlSecOpenSSLHmacFinalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecOpenSSLHmacGetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
 #ifndef XMLSEC_OPENSSL_096
     HMAC_CTX_cleanup(&(ctx->hmacCtx));
 #endif /* XMLSEC_OPENSSL_096 */
@@ -265,24 +265,24 @@ xmlSecOpenSSLHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecT
     ctx = xmlSecOpenSSLHmacGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
 
-    cur = xmlSecGetNextElementNode(node->children); 
-    if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) {  
+    cur = xmlSecGetNextElementNode(node->children);
+    if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) {
         xmlChar *content;
-        
+
         content = xmlNodeGetContent(cur);
         if(content != NULL) {
-            ctx->dgstSize = atoi((char*)content);           
+            ctx->dgstSize = atoi((char*)content);
             xmlFree(content);
         }
 
         /* Ensure that HMAC length is greater than min specified.
-           Otherwise, an attacker can set this lenght to 0 or very 
+           Otherwise, an attacker can set this lenght to 0 or very
            small value
         */
         if((int)ctx->dgstSize < xmlSecOpenSSLHmacGetMinOutputLength()) {
            xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
-                    xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),                 
+                    xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
                     "HMAC output length is too small");
            return(-1);
@@ -290,7 +290,7 @@ xmlSecOpenSSLHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecT
 
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -299,10 +299,10 @@ xmlSecOpenSSLHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecT
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    return(0); 
+    return(0);
 }
 
-static int  
+static int
 xmlSecOpenSSLHmacSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecAssert2(xmlSecOpenSSLHmacCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
@@ -316,7 +316,7 @@ xmlSecOpenSSLHmacSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq
     } else {
         keyReq->keyUsage = xmlSecKeyUsageVerify;
     }
-    
+
     return(0);
 }
 
@@ -335,7 +335,7 @@ xmlSecOpenSSLHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->hmacDgst != NULL, -1);
     xmlSecAssert2(ctx->ctxInitialized == 0, -1);
-    
+
     value = xmlSecKeyGetValue(key);
     xmlSecAssert2(xmlSecKeyDataCheckId(value, xmlSecOpenSSLKeyDataHmacId), -1);
 
@@ -343,33 +343,33 @@ xmlSecOpenSSLHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecAssert2(buffer != NULL, -1);
 
     if(xmlSecBufferGetSize(buffer) == 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
                     "keySize=0");
-        return(-1);    
+        return(-1);
     }
-    
+
     xmlSecAssert2(xmlSecBufferGetData(buffer) != NULL, -1);
-    HMAC_Init(&(ctx->hmacCtx), 
-                xmlSecBufferGetData(buffer),  
-                xmlSecBufferGetSize(buffer), 
-                ctx->hmacDgst); 
+    HMAC_Init(&(ctx->hmacCtx),
+                xmlSecBufferGetData(buffer),
+                xmlSecBufferGetSize(buffer),
+                ctx->hmacDgst);
     ctx->ctxInitialized = 1;
     return(0);
 }
 
 static int
-xmlSecOpenSSLHmacVerify(xmlSecTransformPtr transform, 
+xmlSecOpenSSLHmacVerify(xmlSecTransformPtr transform,
                         const xmlSecByte* data, xmlSecSize dataSize,
                         xmlSecTransformCtxPtr transformCtx) {
-    static xmlSecByte last_byte_masks[] =       
+    static xmlSecByte last_byte_masks[] =
                 { 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
 
     xmlSecOpenSSLHmacCtxPtr ctx;
     xmlSecByte mask;
-        
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLHmacSize), -1);
     xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1);
@@ -380,7 +380,7 @@ xmlSecOpenSSLHmacVerify(xmlSecTransformPtr transform,
     ctx = xmlSecOpenSSLHmacGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->dgstSize > 0, -1);
-    
+
     /* compare the digest size in bytes */
     if(dataSize != ((ctx->dgstSize + 7) / 8)){
         /* NO COMMIT */
@@ -391,7 +391,7 @@ xmlSecOpenSSLHmacVerify(xmlSecTransformPtr transform,
         fprintf(stderr, "%s\n", a);
         xmlFree(a);
 
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_SIZE,
@@ -405,7 +405,7 @@ xmlSecOpenSSLHmacVerify(xmlSecTransformPtr transform,
     xmlSecAssert2(dataSize > 0, -1);
     mask = last_byte_masks[ctx->dgstSize % 8];
     if((ctx->dgst[dataSize - 1] & mask) != (data[dataSize - 1]  & mask)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_DATA_NOT_MATCH,
@@ -416,7 +416,7 @@ xmlSecOpenSSLHmacVerify(xmlSecTransformPtr transform,
 
     /* now check the rest of the digest */
     if((dataSize > 1) && (memcmp(ctx->dgst, data, dataSize - 1) != 0)) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_DATA_NOT_MATCH,
@@ -424,17 +424,17 @@ xmlSecOpenSSLHmacVerify(xmlSecTransformPtr transform,
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-    
+
     transform->status = xmlSecTransformStatusOk;
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLHmacCtxPtr ctx;
     xmlSecBufferPtr in, out;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLHmacSize), -1);
@@ -446,22 +446,22 @@ xmlSecOpenSSLHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransform
     ctx = xmlSecOpenSSLHmacGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->ctxInitialized != 0, -1);
-    
+
     if(transform->status == xmlSecTransformStatusNone) {
         /* we should be already initialized when we set key */
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if(transform->status == xmlSecTransformStatusWorking) {
         xmlSecSize inSize;
-        
+
         inSize = xmlSecBufferGetSize(in);
         if(inSize > 0) {
             HMAC_Update(&(ctx->hmacCtx), xmlSecBufferGetData(in), inSize);
-            
+
             ret = xmlSecBufferRemoveHead(in, inSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferRemoveHead",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -469,20 +469,20 @@ xmlSecOpenSSLHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransform
                 return(-1);
             }
         }
-        
+
         if(last) {
             xmlSecSize dgstSize;
-            
+
             HMAC_Final(&(ctx->hmacCtx), ctx->dgst, &dgstSize);
             xmlSecAssert2(dgstSize > 0, -1);
-                    
+
             /* check/set the result digest size */
             if(ctx->dgstSize == 0) {
                 ctx->dgstSize = dgstSize * 8; /* no dgst size specified, use all we have */
             } else if(ctx->dgstSize <= 8 * dgstSize) {
                 dgstSize = ((ctx->dgstSize + 7) / 8); /* we need to truncate result digest */
             } else {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             NULL,
                             XMLSEC_ERRORS_R_INVALID_SIZE,
@@ -490,12 +490,12 @@ xmlSecOpenSSLHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransform
                             8 * dgstSize, ctx->dgstSize);
                 return(-1);
             }
-            
-            /* finally write result to output */    
+
+            /* finally write result to output */
             if(transform->operation == xmlSecTransformOperationSign) {
                 ret = xmlSecBufferAppend(out, ctx->dgst, dgstSize);
                 if(ret < 0) {
-                    xmlSecError(XMLSEC_ERRORS_HERE, 
+                    xmlSecError(XMLSEC_ERRORS_HERE,
                                 xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                                 "xmlSecBufferAppend",
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -509,20 +509,20 @@ xmlSecOpenSSLHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransform
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
-#ifndef XMLSEC_NO_MD5 
+#ifndef XMLSEC_NO_MD5
 
-/** 
+/**
  * HMAC MD5
  */
 static xmlSecTransformKlass xmlSecOpenSSLHmacMd5Klass = {
@@ -533,7 +533,7 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacMd5Klass = {
     xmlSecNameHmacMd5,                          /* const xmlChar* name; */
     xmlSecHrefHmacMd5,                          /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-        
+
     xmlSecOpenSSLHmacInitialize,                /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLHmacFinalize,                  /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecOpenSSLHmacNodeRead,                  /* xmlSecTransformNodeReadMethod readNode; */
@@ -547,19 +547,19 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacMd5Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLHmacExecute,                   /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformHmacMd5GetKlass:
  *
  * The HMAC-MD5 transform klass.
  *
  * Returns: the HMAC-MD5 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformHmacMd5GetKlass(void) {
     return(&xmlSecOpenSSLHmacMd5Klass);
 }
@@ -567,9 +567,9 @@ xmlSecOpenSSLTransformHmacMd5GetKlass(void) {
 #endif /* XMLSEC_NO_MD5 */
 
 
-#ifndef XMLSEC_NO_RIPEMD160 
-/** 
- * HMAC RIPEMD160 
+#ifndef XMLSEC_NO_RIPEMD160
+/**
+ * HMAC RIPEMD160
  */
 static xmlSecTransformKlass xmlSecOpenSSLHmacRipemd160Klass = {
     /* klass/object sizes */
@@ -579,7 +579,7 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacRipemd160Klass = {
     xmlSecNameHmacRipemd160,                    /* const xmlChar* name; */
     xmlSecHrefHmacRipemd160,                    /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLHmacInitialize,                /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLHmacFinalize,                  /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecOpenSSLHmacNodeRead,                  /* xmlSecTransformNodeReadMethod readNode; */
@@ -593,26 +593,26 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacRipemd160Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLHmacExecute,                   /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformHmacRipemd160GetKlass:
  *
  * The HMAC-RIPEMD160 transform klass.
  *
  * Returns: the HMAC-RIPEMD160 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformHmacRipemd160GetKlass(void) {
     return(&xmlSecOpenSSLHmacRipemd160Klass);
 }
 #endif /* XMLSEC_NO_RIPEMD160 */
 
 #ifndef XMLSEC_NO_SHA1
-/** 
+/**
  * HMAC SHA1
  */
 static xmlSecTransformKlass xmlSecOpenSSLHmacSha1Klass = {
@@ -623,7 +623,7 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacSha1Klass = {
     xmlSecNameHmacSha1,                         /* const xmlChar* name; */
     xmlSecHrefHmacSha1,                         /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLHmacInitialize,                /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLHmacFinalize,                  /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecOpenSSLHmacNodeRead,                  /* xmlSecTransformNodeReadMethod readNode; */
@@ -637,19 +637,19 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLHmacExecute,                   /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformHmacSha1GetKlass:
  *
  * The HMAC-SHA1 transform klass.
  *
  * Returns: the HMAC-SHA1 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformHmacSha1GetKlass(void) {
     return(&xmlSecOpenSSLHmacSha1Klass);
 }
@@ -657,7 +657,7 @@ xmlSecOpenSSLTransformHmacSha1GetKlass(void) {
 #endif /* XMLSEC_NO_SHA1 */
 
 #ifndef XMLSEC_NO_SHA224
-/** 
+/**
  * HMAC SHA224
  */
 static xmlSecTransformKlass xmlSecOpenSSLHmacSha224Klass = {
@@ -668,7 +668,7 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacSha224Klass = {
     xmlSecNameHmacSha224,                       /* const xmlChar* name; */
     xmlSecHrefHmacSha224,                       /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLHmacInitialize,                /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLHmacFinalize,                  /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecOpenSSLHmacNodeRead,                  /* xmlSecTransformNodeReadMethod readNode; */
@@ -682,19 +682,19 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacSha224Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLHmacExecute,                   /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformHmacSha224GetKlass:
  *
  * The HMAC-SHA224 transform klass.
  *
  * Returns: the HMAC-SHA224 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformHmacSha224GetKlass(void) {
     return(&xmlSecOpenSSLHmacSha224Klass);
 }
@@ -702,7 +702,7 @@ xmlSecOpenSSLTransformHmacSha224GetKlass(void) {
 #endif /* XMLSEC_NO_SHA224 */
 
 #ifndef XMLSEC_NO_SHA256
-/** 
+/**
  * HMAC SHA256
  */
 static xmlSecTransformKlass xmlSecOpenSSLHmacSha256Klass = {
@@ -713,7 +713,7 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacSha256Klass = {
     xmlSecNameHmacSha256,                       /* const xmlChar* name; */
     xmlSecHrefHmacSha256,                       /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLHmacInitialize,                /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLHmacFinalize,                  /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecOpenSSLHmacNodeRead,                  /* xmlSecTransformNodeReadMethod readNode; */
@@ -727,19 +727,19 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacSha256Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLHmacExecute,                   /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformHmacSha256GetKlass:
  *
  * The HMAC-SHA256 transform klass.
  *
  * Returns: the HMAC-SHA256 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformHmacSha256GetKlass(void) {
     return(&xmlSecOpenSSLHmacSha256Klass);
 }
@@ -747,7 +747,7 @@ xmlSecOpenSSLTransformHmacSha256GetKlass(void) {
 #endif /* XMLSEC_NO_SHA256 */
 
 #ifndef XMLSEC_NO_SHA384
-/** 
+/**
  * HMAC SHA384
  */
 static xmlSecTransformKlass xmlSecOpenSSLHmacSha384Klass = {
@@ -758,7 +758,7 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacSha384Klass = {
     xmlSecNameHmacSha384,                       /* const xmlChar* name; */
     xmlSecHrefHmacSha384,                       /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLHmacInitialize,                /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLHmacFinalize,                  /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecOpenSSLHmacNodeRead,                  /* xmlSecTransformNodeReadMethod readNode; */
@@ -772,19 +772,19 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacSha384Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLHmacExecute,                   /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformHmacSha384GetKlass:
  *
  * The HMAC-SHA384 transform klass.
  *
  * Returns: the HMAC-SHA384 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformHmacSha384GetKlass(void) {
     return(&xmlSecOpenSSLHmacSha384Klass);
 }
@@ -792,7 +792,7 @@ xmlSecOpenSSLTransformHmacSha384GetKlass(void) {
 #endif /* XMLSEC_NO_SHA384 */
 
 #ifndef XMLSEC_NO_SHA512
-/** 
+/**
  * HMAC SHA512
  */
 static xmlSecTransformKlass xmlSecOpenSSLHmacSha512Klass = {
@@ -803,7 +803,7 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacSha512Klass = {
     xmlSecNameHmacSha512,                       /* const xmlChar* name; */
     xmlSecHrefHmacSha512,                       /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLHmacInitialize,                /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLHmacFinalize,                  /* xmlSecTransformFinalizeMethod finalize; */
     xmlSecOpenSSLHmacNodeRead,                  /* xmlSecTransformNodeReadMethod readNode; */
@@ -817,19 +817,19 @@ static xmlSecTransformKlass xmlSecOpenSSLHmacSha512Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLHmacExecute,                   /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformHmacSha512GetKlass:
  *
  * The HMAC-SHA512 transform klass.
  *
  * Returns: the HMAC-SHA512 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformHmacSha512GetKlass(void) {
     return(&xmlSecOpenSSLHmacSha512Klass);
 }
diff --git a/src/openssl/kt_rsa.c b/src/openssl/kt_rsa.c
index 9c9dd8b..c41b168 100644
--- a/src/openssl/kt_rsa.c
+++ b/src/openssl/kt_rsa.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * RSA Algorithms support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -40,11 +40,11 @@
  * Internal OpenSSL RSA PKCS1 CTX
  *
  *************************************************************************/
-typedef struct _xmlSecOpenSSLRsaPkcs1Ctx        xmlSecOpenSSLRsaPkcs1Ctx, 
+typedef struct _xmlSecOpenSSLRsaPkcs1Ctx        xmlSecOpenSSLRsaPkcs1Ctx,
                                                 *xmlSecOpenSSLRsaPkcs1CtxPtr;
 struct _xmlSecOpenSSLRsaPkcs1Ctx {
     EVP_PKEY*           pKey;
-};          
+};
 
 /*********************************************************************
  *
@@ -54,20 +54,20 @@ struct _xmlSecOpenSSLRsaPkcs1Ctx {
  *
  ********************************************************************/
 #define xmlSecOpenSSLRsaPkcs1Size       \
-    (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLRsaPkcs1Ctx))        
+    (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLRsaPkcs1Ctx))
 #define xmlSecOpenSSLRsaPkcs1GetCtx(transform) \
     ((xmlSecOpenSSLRsaPkcs1CtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
 
 static int      xmlSecOpenSSLRsaPkcs1Initialize                 (xmlSecTransformPtr transform);
 static void     xmlSecOpenSSLRsaPkcs1Finalize                   (xmlSecTransformPtr transform);
-static int      xmlSecOpenSSLRsaPkcs1SetKeyReq                  (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLRsaPkcs1SetKeyReq                  (xmlSecTransformPtr transform,
                                                                  xmlSecKeyReqPtr keyReq);
-static int      xmlSecOpenSSLRsaPkcs1SetKey                     (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLRsaPkcs1SetKey                     (xmlSecTransformPtr transform,
                                                                  xmlSecKeyPtr key);
-static int      xmlSecOpenSSLRsaPkcs1Execute                    (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLRsaPkcs1Execute                    (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecOpenSSLRsaPkcs1Process                    (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLRsaPkcs1Process                    (xmlSecTransformPtr transform,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
 static xmlSecTransformKlass xmlSecOpenSSLRsaPkcs1Klass = {
@@ -92,38 +92,38 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaPkcs1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLRsaPkcs1Execute,               /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformRsaPkcs1GetKlass:
  *
  * The RSA-PKCS1 key transport transform klass.
  *
  * Returns: RSA-PKCS1 key transport transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformRsaPkcs1GetKlass(void) {
     return(&xmlSecOpenSSLRsaPkcs1Klass);
 }
 
-static int 
+static int
 xmlSecOpenSSLRsaPkcs1Initialize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLRsaPkcs1CtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaPkcs1Id), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLRsaPkcs1Size), -1);
 
     ctx = xmlSecOpenSSLRsaPkcs1GetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecOpenSSLRsaPkcs1Ctx));
     return(0);
 }
 
-static void 
+static void
 xmlSecOpenSSLRsaPkcs1Finalize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLRsaPkcs1CtxPtr ctx;
 
@@ -132,14 +132,14 @@ xmlSecOpenSSLRsaPkcs1Finalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecOpenSSLRsaPkcs1GetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     if(ctx->pKey != NULL) {
         EVP_PKEY_free(ctx->pKey);
     }
     memset(ctx, 0, sizeof(xmlSecOpenSSLRsaPkcs1Ctx));
 }
 
-static int  
+static int
 xmlSecOpenSSLRsaPkcs1SetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecOpenSSLRsaPkcs1CtxPtr ctx;
 
@@ -158,15 +158,15 @@ xmlSecOpenSSLRsaPkcs1SetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr ke
     } else {
         keyReq->keyType  = xmlSecKeyDataTypePrivate;
         keyReq->keyUsage = xmlSecKeyUsageDecrypt;
-    }    
+    }
     return(0);
 }
 
-static int      
+static int
 xmlSecOpenSSLRsaPkcs1SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecOpenSSLRsaPkcs1CtxPtr ctx;
     EVP_PKEY* pKey;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaPkcs1Id), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLRsaPkcs1Size), -1);
@@ -186,23 +186,23 @@ xmlSecOpenSSLRsaPkcs1SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    xmlSecAssert2(pKey->type == EVP_PKEY_RSA, -1);    
-    xmlSecAssert2(pKey->pkey.rsa != NULL, -1);    
-    
-    ctx->pKey = xmlSecOpenSSLEvpKeyDup(pKey);    
+    xmlSecAssert2(pKey->type == EVP_PKEY_RSA, -1);
+    xmlSecAssert2(pKey->pkey.rsa != NULL, -1);
+
+    ctx->pKey = xmlSecOpenSSLEvpKeyDup(pKey);
     if(ctx->pKey == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecOpenSSLEvpKeyDup",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);    
+        return(-1);
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLRsaPkcs1Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLRsaPkcs1CtxPtr ctx;
     int ret;
@@ -218,14 +218,14 @@ xmlSecOpenSSLRsaPkcs1Execute(xmlSecTransformPtr transform, int last, xmlSecTrans
 
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
-    } 
-    
+    }
+
     if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
         /* just do nothing */
     } else  if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
         ret = xmlSecOpenSSLRsaPkcs1Process(transform, transformCtx);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecOpenSSLRsaPkcs1Process",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -237,7 +237,7 @@ xmlSecOpenSSLRsaPkcs1Execute(xmlSecTransformPtr transform, int last, xmlSecTrans
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -247,7 +247,7 @@ xmlSecOpenSSLRsaPkcs1Execute(xmlSecTransformPtr transform, int last, xmlSecTrans
     return(0);
 }
 
-static int  
+static int
 xmlSecOpenSSLRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLRsaPkcs1CtxPtr ctx;
     xmlSecBufferPtr in, out;
@@ -263,17 +263,17 @@ xmlSecOpenSSLRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
     ctx = xmlSecOpenSSLRsaPkcs1GetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->pKey != NULL, -1);
-    xmlSecAssert2(ctx->pKey->type == EVP_PKEY_RSA, -1);    
-    xmlSecAssert2(ctx->pKey->pkey.rsa != NULL, -1);    
-    
+    xmlSecAssert2(ctx->pKey->type == EVP_PKEY_RSA, -1);
+    xmlSecAssert2(ctx->pKey->pkey.rsa != NULL, -1);
+
     keySize = RSA_size(ctx->pKey->pkey.rsa);
     xmlSecAssert2(keySize > 0, -1);
-    
+
     in = &(transform->inBuf);
     out = &(transform->outBuf);
-        
+
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
+    outSize = xmlSecBufferGetSize(out);
     xmlSecAssert2(outSize == 0, -1);
 
     /* the encoded size is equal to the keys size so we could not
@@ -293,11 +293,11 @@ xmlSecOpenSSLRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
                     "%d when expected %d", inSize, keySize);
         return(-1);
     }
-        
-    outSize = keySize; 
+
+    outSize = keySize;
     ret = xmlSecBufferSetMaxSize(out, outSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -307,10 +307,10 @@ xmlSecOpenSSLRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
 
     if(transform->operation == xmlSecTransformOperationEncrypt) {
         ret = RSA_public_encrypt(inSize, xmlSecBufferGetData(in),
-                                xmlSecBufferGetData(out), 
+                                xmlSecBufferGetData(out),
                                 ctx->pKey->pkey.rsa, RSA_PKCS1_PADDING);
         if(ret <= 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "RSA_public_encrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -320,10 +320,10 @@ xmlSecOpenSSLRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
         outSize = ret;
     } else {
         ret = RSA_private_decrypt(inSize, xmlSecBufferGetData(in),
-                                xmlSecBufferGetData(out), 
+                                xmlSecBufferGetData(out),
                                 ctx->pKey->pkey.rsa, RSA_PKCS1_PADDING);
         if(ret <= 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "RSA_private_decrypt",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -335,24 +335,24 @@ xmlSecOpenSSLRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
 
     ret = xmlSecBufferSetSize(out, outSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
-                    "xmlSecBufferSetSize",                  
+                    "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", outSize);
         return(-1);
     }
-        
+
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", inSize);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -361,12 +361,12 @@ xmlSecOpenSSLRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
  * Internal OpenSSL RSA OAPE CTX
  *
  *************************************************************************/
-typedef struct _xmlSecOpenSSLRsaOaepCtx         xmlSecOpenSSLRsaOaepCtx, 
+typedef struct _xmlSecOpenSSLRsaOaepCtx         xmlSecOpenSSLRsaOaepCtx,
                                                 *xmlSecOpenSSLRsaOaepCtxPtr;
 struct _xmlSecOpenSSLRsaOaepCtx {
     EVP_PKEY*           pKey;
     xmlSecBuffer        oaepParams;
-};          
+};
 
 /*********************************************************************
  *
@@ -376,23 +376,23 @@ struct _xmlSecOpenSSLRsaOaepCtx {
  *
  ********************************************************************/
 #define xmlSecOpenSSLRsaOaepSize        \
-    (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLRsaOaepCtx)) 
+    (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLRsaOaepCtx))
 #define xmlSecOpenSSLRsaOaepGetCtx(transform) \
     ((xmlSecOpenSSLRsaOaepCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
 
 static int      xmlSecOpenSSLRsaOaepInitialize                  (xmlSecTransformPtr transform);
 static void     xmlSecOpenSSLRsaOaepFinalize                    (xmlSecTransformPtr transform);
-static int      xmlSecOpenSSLRsaOaepNodeRead                    (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLRsaOaepNodeRead                    (xmlSecTransformPtr transform,
                                                                  xmlNodePtr node,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecOpenSSLRsaOaepSetKeyReq                   (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLRsaOaepSetKeyReq                   (xmlSecTransformPtr transform,
                                                                  xmlSecKeyReqPtr keyReq);
-static int      xmlSecOpenSSLRsaOaepSetKey                      (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLRsaOaepSetKey                      (xmlSecTransformPtr transform,
                                                                  xmlSecKeyPtr key);
-static int      xmlSecOpenSSLRsaOaepExecute                     (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLRsaOaepExecute                     (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecOpenSSLRsaOaepProcess                     (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLRsaOaepProcess                     (xmlSecTransformPtr transform,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
 static xmlSecTransformKlass xmlSecOpenSSLRsaOaepKlass = {
@@ -417,35 +417,35 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaOaepKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLRsaOaepExecute,                /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformRsaOaepGetKlass:
  *
  * The RSA-OAEP key transport transform klass.
  *
  * Returns: RSA-OAEP key transport transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformRsaOaepGetKlass(void) {
     return(&xmlSecOpenSSLRsaOaepKlass);
 }
 
-static int 
+static int
 xmlSecOpenSSLRsaOaepInitialize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLRsaOaepCtxPtr ctx;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaOaepId), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLRsaOaepSize), -1);
 
     ctx = xmlSecOpenSSLRsaOaepGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
 
-    memset(ctx, 0, sizeof(xmlSecOpenSSLRsaOaepCtx));    
+    memset(ctx, 0, sizeof(xmlSecOpenSSLRsaOaepCtx));
 
     ret = xmlSecBufferInitialize(&(ctx->oaepParams), 0);
     if(ret < 0) {
@@ -459,7 +459,7 @@ xmlSecOpenSSLRsaOaepInitialize(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static void 
+static void
 xmlSecOpenSSLRsaOaepFinalize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLRsaOaepCtxPtr ctx;
 
@@ -468,20 +468,20 @@ xmlSecOpenSSLRsaOaepFinalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecOpenSSLRsaOaepGetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     if(ctx->pKey != NULL) {
         EVP_PKEY_free(ctx->pKey);
     }
     xmlSecBufferFinalize(&(ctx->oaepParams));
-    memset(ctx, 0, sizeof(xmlSecOpenSSLRsaOaepCtx));    
+    memset(ctx, 0, sizeof(xmlSecOpenSSLRsaOaepCtx));
 }
 
-static int      
+static int
 xmlSecOpenSSLRsaOaepNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLRsaOaepCtxPtr ctx;
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaOaepId), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLRsaOaepSize), -1);
     xmlSecAssert2(node != NULL, -1);
@@ -490,7 +490,7 @@ xmlSecOpenSSLRsaOaepNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
     ctx = xmlSecOpenSSLRsaOaepGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(xmlSecBufferGetSize(&(ctx->oaepParams)) == 0, -1);
-    
+
     cur = xmlSecGetNextElementNode(node->children);
     if((cur != NULL) && xmlSecCheckNodeName(cur,  xmlSecNodeRsaOAEPparams, xmlSecEncNs)) {
         ret = xmlSecBufferBase64NodeContentRead(&(ctx->oaepParams), cur);
@@ -504,7 +504,7 @@ xmlSecOpenSSLRsaOaepNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
         }
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     if((cur != NULL) && xmlSecCheckNodeName(cur,  xmlSecNodeDigestMethod, xmlSecDSigNs)) {
         xmlChar* algorithm;
 
@@ -515,12 +515,12 @@ xmlSecOpenSSLRsaOaepNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
                         XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
-                        "node=%s", 
+                        "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
-            return(-1);         
+            return(-1);
         }
 
-        /* for now we support only sha1 */      
+        /* for now we support only sha1 */
         if(xmlStrcmp(algorithm, xmlSecHrefSha1) != 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -528,10 +528,10 @@ xmlSecOpenSSLRsaOaepNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
                         XMLSEC_ERRORS_R_INVALID_TRANSFORM,
                         "digest algorithm is not supported for rsa/oaep");
             xmlFree(algorithm);
-            return(-1);         
+            return(-1);
         }
         xmlFree(algorithm);
-        
+
         cur = xmlSecGetNextElementNode(cur->next);
     }
 
@@ -543,11 +543,11 @@ xmlSecOpenSSLRsaOaepNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     return(0);
 }
 
-static int  
+static int
 xmlSecOpenSSLRsaOaepSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecOpenSSLRsaOaepCtxPtr ctx;
 
@@ -567,15 +567,15 @@ xmlSecOpenSSLRsaOaepSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr key
         keyReq->keyType  = xmlSecKeyDataTypePrivate;
         keyReq->keyUsage = xmlSecKeyUsageDecrypt;
     }
-    
+
     return(0);
 }
 
-static int      
+static int
 xmlSecOpenSSLRsaOaepSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecOpenSSLRsaOaepCtxPtr ctx;
     EVP_PKEY* pKey;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaOaepId), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLRsaOaepSize), -1);
@@ -595,23 +595,23 @@ xmlSecOpenSSLRsaOaepSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    xmlSecAssert2(pKey->type == EVP_PKEY_RSA, -1);    
-    xmlSecAssert2(pKey->pkey.rsa != NULL, -1);    
-    
-    ctx->pKey = xmlSecOpenSSLEvpKeyDup(pKey);    
+    xmlSecAssert2(pKey->type == EVP_PKEY_RSA, -1);
+    xmlSecAssert2(pKey->pkey.rsa != NULL, -1);
+
+    ctx->pKey = xmlSecOpenSSLEvpKeyDup(pKey);
     if(ctx->pKey == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecOpenSSLEvpKeyDup",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);    
+        return(-1);
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLRsaOaepExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLRsaOaepCtxPtr ctx;
     int ret;
@@ -627,14 +627,14 @@ xmlSecOpenSSLRsaOaepExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
 
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
-    } 
-    
+    }
+
     if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
         /* just do nothing */
     } else  if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
         ret = xmlSecOpenSSLRsaOaepProcess(transform, transformCtx);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecOpenSSLRsaOaepProcess",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -646,7 +646,7 @@ xmlSecOpenSSLRsaOaepExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -656,7 +656,7 @@ xmlSecOpenSSLRsaOaepExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
     return(0);
 }
 
-static int  
+static int
 xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLRsaOaepCtxPtr ctx;
     xmlSecSize paramsSize;
@@ -673,17 +673,17 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
     ctx = xmlSecOpenSSLRsaOaepGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->pKey != NULL, -1);
-    xmlSecAssert2(ctx->pKey->type == EVP_PKEY_RSA, -1);    
-    xmlSecAssert2(ctx->pKey->pkey.rsa != NULL, -1);    
-    
+    xmlSecAssert2(ctx->pKey->type == EVP_PKEY_RSA, -1);
+    xmlSecAssert2(ctx->pKey->pkey.rsa != NULL, -1);
+
     keySize = RSA_size(ctx->pKey->pkey.rsa);
     xmlSecAssert2(keySize > 0, -1);
-    
+
     in = &(transform->inBuf);
     out = &(transform->outBuf);
-        
+
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
+    outSize = xmlSecBufferGetSize(out);
     xmlSecAssert2(outSize == 0, -1);
 
     /* the encoded size is equal to the keys size so we could not
@@ -703,11 +703,11 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
                     "%d when expected %d", inSize, keySize);
         return(-1);
     }
-        
-    outSize = keySize; 
+
+    outSize = keySize;
     ret = xmlSecBufferSetMaxSize(out, outSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferSetMaxSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -719,12 +719,12 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
     if((transform->operation == xmlSecTransformOperationEncrypt) && (paramsSize == 0)) {
         /* encode w/o OAEPParams --> simple */
         ret = RSA_public_encrypt(inSize, xmlSecBufferGetData(in),
-                                xmlSecBufferGetData(out), 
+                                xmlSecBufferGetData(out),
                                 ctx->pKey->pkey.rsa, RSA_PKCS1_OAEP_PADDING);
         if(ret <= 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
-                        "RSA_public_encrypt(RSA_PKCS1_OAEP_PADDING)",                   
+                        "RSA_public_encrypt(RSA_PKCS1_OAEP_PADDING)",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
@@ -732,22 +732,22 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
         outSize = ret;
     } else if((transform->operation == xmlSecTransformOperationEncrypt) && (paramsSize > 0)) {
         xmlSecAssert2(xmlSecBufferGetData(&(ctx->oaepParams)) != NULL, -1);
-        
+
         /* add space for padding */
         ret = xmlSecBufferSetMaxSize(in, keySize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferSetMaxSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", keySize);
             return(-1);
         }
-        
+
         /* add padding */
-        ret = RSA_padding_add_PKCS1_OAEP(xmlSecBufferGetData(in), keySize, 
+        ret = RSA_padding_add_PKCS1_OAEP(xmlSecBufferGetData(in), keySize,
                                          xmlSecBufferGetData(in), inSize,
-                                         xmlSecBufferGetData(&(ctx->oaepParams)), 
+                                         xmlSecBufferGetData(&(ctx->oaepParams)),
                                          paramsSize);
         if(ret != 1) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -756,15 +756,15 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
+        }
         inSize = keySize;
 
         /* encode with OAEPParams */
         ret = RSA_public_encrypt(inSize, xmlSecBufferGetData(in),
-                                xmlSecBufferGetData(out), 
+                                xmlSecBufferGetData(out),
                                 ctx->pKey->pkey.rsa, RSA_NO_PADDING);
         if(ret <= 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "RSA_public_encrypt(RSA_NO_PADDING)",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -774,10 +774,10 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
         outSize = ret;
     } else if((transform->operation == xmlSecTransformOperationDecrypt) && (paramsSize == 0)) {
         ret = RSA_private_decrypt(inSize, xmlSecBufferGetData(in),
-                                xmlSecBufferGetData(out), 
+                                xmlSecBufferGetData(out),
                                 ctx->pKey->pkey.rsa, RSA_PKCS1_OAEP_PADDING);
         if(ret <= 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "RSA_private_decrypt(RSA_PKCS1_OAEP_PADDING)",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -787,21 +787,21 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
         outSize = ret;
     } else if((transform->operation == xmlSecTransformOperationDecrypt) && (paramsSize != 0)) {
         BIGNUM bn;
-        
+
         ret = RSA_private_decrypt(inSize, xmlSecBufferGetData(in),
-                                xmlSecBufferGetData(out), 
+                                xmlSecBufferGetData(out),
                                 ctx->pKey->pkey.rsa, RSA_NO_PADDING);
         if(ret <= 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
-                        "RSA_private_decrypt(RSA_NO_PADDING)",                  
+                        "RSA_private_decrypt(RSA_NO_PADDING)",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
         outSize = ret;
-        
-        /* 
+
+        /*
          * the private decrypt w/o padding adds '0's at the begginning.
          * it's not clear for me can I simply skip all '0's from the
          * beggining so I have to do decode it back to BIGNUM and dump
@@ -815,9 +815,9 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         "size=%d", outSize);
             BN_clear_free(&bn);
-            return(-1);             
+            return(-1);
         }
-        
+
         ret = BN_bn2bin(&bn, xmlSecBufferGetData(out));
         if(ret <= 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -826,7 +826,7 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             BN_clear_free(&bn);
-            return(-1);             
+            return(-1);
         }
         BN_clear_free(&bn);
         outSize = ret;
@@ -834,7 +834,7 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
         ret = RSA_padding_check_PKCS1_OAEP(xmlSecBufferGetData(out), outSize,
                                            xmlSecBufferGetData(out), outSize,
                                            keySize,
-                                           xmlSecBufferGetData(&(ctx->oaepParams)), 
+                                           xmlSecBufferGetData(&(ctx->oaepParams)),
                                            paramsSize);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -843,8 +843,8 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
-        outSize = ret;  
+        }
+        outSize = ret;
     } else {
         xmlSecAssert2("we could not be here" == NULL, -1);
         return(-1);
@@ -852,24 +852,24 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
 
     ret = xmlSecBufferSetSize(out, outSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferSetSize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", outSize);
         return(-1);
     }
-        
+
     ret = xmlSecBufferRemoveHead(in, inSize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferRemoveHead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", inSize);
         return(-1);
     }
-    
+
     return(0);
 }
 
diff --git a/src/openssl/kw_aes.c b/src/openssl/kw_aes.c
index bbaf3e4..76c6ed0 100644
--- a/src/openssl/kw_aes.c
+++ b/src/openssl/kw_aes.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * AES Algorithm support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef XMLSEC_NO_AES
@@ -49,11 +49,11 @@
 
 static int      xmlSecOpenSSLKWAesInitialize                    (xmlSecTransformPtr transform);
 static void     xmlSecOpenSSLKWAesFinalize                      (xmlSecTransformPtr transform);
-static int      xmlSecOpenSSLKWAesSetKeyReq                     (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLKWAesSetKeyReq                     (xmlSecTransformPtr transform,
                                                                  xmlSecKeyReqPtr keyReq);
-static int      xmlSecOpenSSLKWAesSetKey                        (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLKWAesSetKey                        (xmlSecTransformPtr transform,
                                                                  xmlSecKeyPtr key);
-static int      xmlSecOpenSSLKWAesExecute                       (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLKWAesExecute                       (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
 static xmlSecSize       xmlSecOpenSSLKWAesGetKeySize                    (xmlSecTransformPtr transform);
@@ -92,7 +92,7 @@ static xmlSecTransformKlass xmlSecOpenSSLKWAes128Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLKWAesExecute,                  /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
@@ -119,7 +119,7 @@ static xmlSecTransformKlass xmlSecOpenSSLKWAes192Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLKWAesExecute,                  /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
@@ -146,7 +146,7 @@ static xmlSecTransformKlass xmlSecOpenSSLKWAes256Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLKWAesExecute,                  /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
@@ -158,49 +158,49 @@ static xmlSecTransformKlass xmlSecOpenSSLKWAes256Klass = {
      xmlSecTransformCheckId((transform), xmlSecOpenSSLTransformKWAes192Id) || \
      xmlSecTransformCheckId((transform), xmlSecOpenSSLTransformKWAes256Id))
 
-/** 
+/**
  * xmlSecOpenSSLTransformKWAes128GetKlass:
  *
  * The AES-128 kew wrapper transform klass.
  *
  * Returns: AES-128 kew wrapper transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformKWAes128GetKlass(void) {
     return(&xmlSecOpenSSLKWAes128Klass);
 }
 
-/** 
+/**
  * xmlSecOpenSSLTransformKWAes192GetKlass:
  *
  * The AES-192 kew wrapper transform klass.
  *
  * Returns: AES-192 kew wrapper transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformKWAes192GetKlass(void) {
     return(&xmlSecOpenSSLKWAes192Klass);
 }
 
-/** 
+/**
  * xmlSecOpenSSLTransformKWAes256GetKlass:
  *
  * The AES-256 kew wrapper transform klass.
  *
  * Returns: AES-256 kew wrapper transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformKWAes256GetKlass(void) {
     return(&xmlSecOpenSSLKWAes256Klass);
 }
 
-static int 
+static int
 xmlSecOpenSSLKWAesInitialize(xmlSecTransformPtr transform) {
     int ret;
-    
+
     xmlSecAssert2(xmlSecOpenSSLKWAesCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLKWAesSize), -1);
-    
+
     ret = xmlSecBufferInitialize(xmlSecOpenSSLKWAesGetKey(transform), 0);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -210,21 +210,21 @@ xmlSecOpenSSLKWAesInitialize(xmlSecTransformPtr transform) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     return(0);
 }
 
-static void 
+static void
 xmlSecOpenSSLKWAesFinalize(xmlSecTransformPtr transform) {
     xmlSecAssert(xmlSecOpenSSLKWAesCheckId(transform));
     xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecOpenSSLKWAesSize));
-    
+
     if(xmlSecOpenSSLKWAesGetKey(transform) != NULL) {
         xmlSecBufferFinalize(xmlSecOpenSSLKWAesGetKey(transform));
     }
 }
 
-static int  
+static int
 xmlSecOpenSSLKWAesSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecAssert2(xmlSecOpenSSLKWAesCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
@@ -239,24 +239,24 @@ xmlSecOpenSSLKWAesSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyRe
         keyReq->keyUsage = xmlSecKeyUsageDecrypt;
     }
     keyReq->keyBitsSize = 8 * xmlSecOpenSSLKWAesGetKeySize(transform);
-    
+
     return(0);
 }
 
-static int      
+static int
 xmlSecOpenSSLKWAesSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecBufferPtr buffer;
     xmlSecSize keySize;
     xmlSecSize expectedKeySize;
     int ret;
-    
+
     xmlSecAssert2(xmlSecOpenSSLKWAesCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLKWAesSize), -1);
     xmlSecAssert2(xmlSecOpenSSLKWAesGetKey(transform) != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecOpenSSLKeyDataAesId), -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(xmlSecKeyGetValue(key));
     xmlSecAssert2(buffer != NULL, -1);
 
@@ -271,23 +271,23 @@ xmlSecOpenSSLKWAesSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                     keySize, expectedKeySize);
         return(-1);
     }
-        
+
     ret = xmlSecBufferSetData(xmlSecOpenSSLKWAesGetKey(transform),
-                            xmlSecBufferGetData(buffer), 
+                            xmlSecBufferGetData(buffer),
                             expectedKeySize);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferSetData",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "expected-size=%d", expectedKeySize);
-        return(-1);    
+        return(-1);
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecBufferPtr in, out, key;
     xmlSecSize inSize, outSize, keySize, expectedKeySize;
@@ -304,17 +304,17 @@ xmlSecOpenSSLKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
     keySize = xmlSecBufferGetSize(key);
     expectedKeySize = xmlSecOpenSSLKWAesGetKeySize(transform);
     xmlSecAssert2(keySize == expectedKeySize, -1);
-    
+
     in = &(transform->inBuf);
     out = &(transform->outBuf);
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
+    outSize = xmlSecBufferGetSize(out);
     xmlSecAssert2(outSize == 0, -1);
-    
+
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
         /* just do nothing */
     } else  if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
@@ -325,11 +325,11 @@ xmlSecOpenSSLKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
                         XMLSEC_ERRORS_R_INVALID_SIZE,
                         "size=%d(not 8 bytes aligned)", inSize);
             return(-1);
-        }       
-        
+        }
+
         if(transform->operation == xmlSecTransformOperationEncrypt) {
             /* the encoded key might be 8 bytes longer plus 8 bytes just in case */
-            outSize = inSize + XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE + 
+            outSize = inSize + XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE +
                                XMLSEC_OPENSSL_AES_BLOCK_SIZE;
         } else {
             outSize = inSize + XMLSEC_OPENSSL_AES_BLOCK_SIZE;
@@ -337,7 +337,7 @@ xmlSecOpenSSLKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
 
         ret = xmlSecBufferSetMaxSize(out, outSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferSetMaxSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -350,7 +350,7 @@ xmlSecOpenSSLKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
                                             xmlSecBufferGetData(in), inSize,
                                             xmlSecBufferGetData(out), outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecOpenSSLKWAesEncode",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -363,7 +363,7 @@ xmlSecOpenSSLKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
                                             xmlSecBufferGetData(in), inSize,
                                             xmlSecBufferGetData(out), outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecOpenSSLKWAesDecode",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -375,30 +375,30 @@ xmlSecOpenSSLKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
 
         ret = xmlSecBufferSetSize(out, outSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
-                        "xmlSecBufferSetSize", 
+                        "xmlSecBufferSetSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "outSize=%d", outSize);
             return(-1);
         }
-        
+
         ret = xmlSecBufferRemoveHead(in, inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "inSize%d", inSize);
             return(-1);
         }
-        
+
         transform->status = xmlSecTransformStatusFinished;
     } else if(transform->status == xmlSecTransformStatusFinished) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -408,7 +408,7 @@ xmlSecOpenSSLKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
     return(0);
 }
 
-static xmlSecSize  
+static xmlSecSize
 xmlSecOpenSSLKWAesGetKeySize(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformKWAes128Id)) {
         return(XMLSEC_OPENSSL_AES128_KEY_SIZE);
@@ -423,22 +423,22 @@ xmlSecOpenSSLKWAesGetKeySize(xmlSecTransformPtr transform) {
 /**
  * http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap:
  *
- * Assume that the data to be wrapped consists of N 64-bit data blocks 
- * denoted P(1), P(2), P(3) ... P(N). The result of wrapping will be N+1 
- * 64-bit blocks denoted C(0), C(1), C(2), ... C(N). The key encrypting 
- * key is represented by K. Assume integers i, j, and t and intermediate 
- * 64-bit register A, 128-bit register B, and array of 64-bit quantities 
+ * Assume that the data to be wrapped consists of N 64-bit data blocks
+ * denoted P(1), P(2), P(3) ... P(N). The result of wrapping will be N+1
+ * 64-bit blocks denoted C(0), C(1), C(2), ... C(N). The key encrypting
+ * key is represented by K. Assume integers i, j, and t and intermediate
+ * 64-bit register A, 128-bit register B, and array of 64-bit quantities
  * R(1) through R(N).
  *
- * "|" represents concatentation so x|y, where x and y and 64-bit quantities, 
- * is the 128-bit quantity with x in the most significant bits and y in the 
- * least significant bits. AES(K)enc(x) is the operation of AES encrypting 
- * the 128-bit quantity x under the key K. AES(K)dec(x) is the corresponding 
- * decryption opteration. XOR(x,y) is the bitwise exclusive or of x and y. 
- * MSB(x) and LSB(y) are the most significant 64 bits and least significant 
+ * "|" represents concatentation so x|y, where x and y and 64-bit quantities,
+ * is the 128-bit quantity with x in the most significant bits and y in the
+ * least significant bits. AES(K)enc(x) is the operation of AES encrypting
+ * the 128-bit quantity x under the key K. AES(K)dec(x) is the corresponding
+ * decryption opteration. XOR(x,y) is the bitwise exclusive or of x and y.
+ * MSB(x) and LSB(y) are the most significant 64 bits and least significant
  * 64 bits of x and y respectively.
  *
- * If N is 1, a single AES operation is performed for wrap or unwrap. 
+ * If N is 1, a single AES operation is performed for wrap or unwrap.
  * If N>1, then 6*N AES operations are performed for wrap or unwrap.
  *
  * The key wrap algorithm is as follows:
@@ -469,7 +469,7 @@ xmlSecOpenSSLKWAesGetKeySize(xmlSecTransformPtr transform) {
  *   1. If N is 1:
  *          * B=AES(K)dec(C(0)|C(1))
  *          * P(1)=LSB(B)
- *          * If MSB(B) is 0xA6A6A6A6A6A6A6A6, return success. Otherwise, 
+ *          * If MSB(B) is 0xA6A6A6A6A6A6A6A6, return success. Otherwise,
  *            return an integrity check failure error.
  *      If N>1, perform the following steps:
  *   2. Initialize the variables:
@@ -486,14 +486,14 @@ xmlSecOpenSSLKWAesGetKeySize(xmlSecTransformPtr transform) {
  *   4. Output the results:
  *          * For i=1 to N,
  *            P(i)=R(i)
- *          * If A is 0xA6A6A6A6A6A6A6A6, return success. Otherwise, return 
+ *          * If A is 0xA6A6A6A6A6A6A6A6, return success. Otherwise, return
  *            an integrity check failure error.
  */
-static const xmlSecByte xmlSecOpenSSLKWAesMagicBlock[XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE] = { 
+static const xmlSecByte xmlSecOpenSSLKWAesMagicBlock[XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE] = {
     0xA6,  0xA6,  0xA6,  0xA6,  0xA6,  0xA6,  0xA6,  0xA6
 };
-                                                
-static int      
+
+static int
 xmlSecOpenSSLKWAesEncode(const xmlSecByte *key, xmlSecSize keySize,
                          const xmlSecByte *in, xmlSecSize inSize,
                          xmlSecByte *out, xmlSecSize outSize) {
@@ -502,7 +502,7 @@ xmlSecOpenSSLKWAesEncode(const xmlSecByte *key, xmlSecSize keySize,
     xmlSecByte *p;
     int N, i, j, t;
     int ret;
-    
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(keySize > 0, -1);
     xmlSecAssert2(in != NULL, -1);
@@ -512,12 +512,12 @@ xmlSecOpenSSLKWAesEncode(const xmlSecByte *key, xmlSecSize keySize,
 
     ret = AES_set_encrypt_key(key, 8 * keySize, &aesKey);
     if(ret != 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "AES_set_encrypt_key",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     /* prepend magic block */
@@ -527,10 +527,10 @@ xmlSecOpenSSLKWAesEncode(const xmlSecByte *key, xmlSecSize keySize,
         memmove(out + XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE, out, inSize);
     }
     memcpy(out, xmlSecOpenSSLKWAesMagicBlock, XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE);
-    
+
     N = (inSize / 8);
     if(N == 1) {
-        AES_encrypt(out, out, &aesKey); 
+        AES_encrypt(out, out, &aesKey);
     } else {
         for(j = 0; j <= 5; ++j) {
             for(i = 1; i <= N; ++i) {
@@ -539,7 +539,7 @@ xmlSecOpenSSLKWAesEncode(const xmlSecByte *key, xmlSecSize keySize,
 
                 memcpy(block, out, 8);
                 memcpy(block + 8, p, 8);
-                
+
                 AES_encrypt(block, block, &aesKey);
                 block[7] ^=  t;
                 memcpy(out, block, 8);
@@ -547,11 +547,11 @@ xmlSecOpenSSLKWAesEncode(const xmlSecByte *key, xmlSecSize keySize,
             }
         }
     }
-    
+
     return(inSize + 8);
 }
 
-static int      
+static int
 xmlSecOpenSSLKWAesDecode(const xmlSecByte *key, xmlSecSize keySize,
                          const xmlSecByte *in, xmlSecSize inSize,
                          xmlSecByte *out, xmlSecSize outSize) {
@@ -567,22 +567,22 @@ xmlSecOpenSSLKWAesDecode(const xmlSecByte *key, xmlSecSize keySize,
     xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
-    
+
     ret = AES_set_decrypt_key(key, 8 * keySize, &aesKey);
     if(ret != 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "AES_set_decrypt_key",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     /* copy input */
     if(in != out) {
         memcpy(out, in, inSize);
     }
-        
+
     N = (inSize / 8) - 1;
     if(N == 1) {
         AES_decrypt(out, out, &aesKey);
@@ -595,7 +595,7 @@ xmlSecOpenSSLKWAesDecode(const xmlSecByte *key, xmlSecSize keySize,
                 memcpy(block, out, 8);
                 memcpy(block + 8, p, 8);
                 block[7] ^= t;
-                
+
                 AES_decrypt(block, block, &aesKey);
                 memcpy(out, block, 8);
                 memcpy(p, block + 8, 8);
@@ -604,16 +604,16 @@ xmlSecOpenSSLKWAesDecode(const xmlSecByte *key, xmlSecSize keySize,
     }
     /* do not left data in memory */
     memset(block, 0, sizeof(block));
-    
+
     if(memcmp(xmlSecOpenSSLKWAesMagicBlock, out, XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE) != 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_DATA,
                     "bad magic block");
-        return(-1);     
+        return(-1);
     }
-        
+
     memmove(out, out + XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE, inSize - XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE);
     return(inSize - XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE);
 }
diff --git a/src/openssl/kw_des.c b/src/openssl/kw_des.c
index 5f92ba5..e98304a 100644
--- a/src/openssl/kw_des.c
+++ b/src/openssl/kw_des.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * DES Algorithm support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef XMLSEC_NO_DES
@@ -46,11 +46,11 @@
 
 static int      xmlSecOpenSSLKWDes3Initialize                   (xmlSecTransformPtr transform);
 static void     xmlSecOpenSSLKWDes3Finalize                     (xmlSecTransformPtr transform);
-static int      xmlSecOpenSSLKWDes3SetKeyReq                    (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLKWDes3SetKeyReq                    (xmlSecTransformPtr transform,
                                                                  xmlSecKeyReqPtr keyReq);
-static int      xmlSecOpenSSLKWDes3SetKey                       (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLKWDes3SetKey                       (xmlSecTransformPtr transform,
                                                                  xmlSecKeyPtr key);
-static int      xmlSecOpenSSLKWDes3Execute                      (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLKWDes3Execute                      (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
 static int      xmlSecOpenSSLKWDes3Encode                       (const xmlSecByte *key,
@@ -65,16 +65,16 @@ static int      xmlSecOpenSSLKWDes3Decode                       (const xmlSecByt
                                                                  xmlSecSize inSize,
                                                                  xmlSecByte *out,
                                                                  xmlSecSize outSize);
-static int      xmlSecOpenSSLKWDes3Encrypt                      (const xmlSecByte *key, 
+static int      xmlSecOpenSSLKWDes3Encrypt                      (const xmlSecByte *key,
                                                                  xmlSecSize keySize,
                                                                  const xmlSecByte *iv,
                                                                  xmlSecSize ivSize,
-                                                                 const xmlSecByte *in, 
+                                                                 const xmlSecByte *in,
                                                                  xmlSecSize inSize,
                                                                  xmlSecByte *out,
-                                                                 xmlSecSize outSize, 
+                                                                 xmlSecSize outSize,
                                                                  int enc);
-static int      xmlSecOpenSSLKWDes3BufferReverse                (xmlSecByte *buf, 
+static int      xmlSecOpenSSLKWDes3BufferReverse                (xmlSecByte *buf,
                                                                  xmlSecSize size);
 
 static xmlSecTransformKlass xmlSecOpenSSLKWDes3Klass = {
@@ -99,30 +99,30 @@ static xmlSecTransformKlass xmlSecOpenSSLKWDes3Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLKWDes3Execute,                 /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLTransformKWDes3GetKlass:
- * 
+ *
  * The Triple DES key wrapper transform klass.
  *
  * Returns: Triple DES key wrapper transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformKWDes3GetKlass(void) {
     return(&xmlSecOpenSSLKWDes3Klass);
 }
 
-static int 
+static int
 xmlSecOpenSSLKWDes3Initialize(xmlSecTransformPtr transform) {
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformKWDes3Id), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLKWDes3Size), -1);
-    
+
     ret = xmlSecBufferInitialize(xmlSecOpenSSLKWDes3GetKey(transform), 0);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -132,21 +132,21 @@ xmlSecOpenSSLKWDes3Initialize(xmlSecTransformPtr transform) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     return(0);
 }
 
-static void 
+static void
 xmlSecOpenSSLKWDes3Finalize(xmlSecTransformPtr transform) {
     xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformKWDes3Id));
     xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecOpenSSLKWDes3Size));
-    
+
     if(xmlSecOpenSSLKWDes3GetKey(transform) != NULL) {
         xmlSecBufferFinalize(xmlSecOpenSSLKWDes3GetKey(transform));
     }
 }
 
-static int  
+static int
 xmlSecOpenSSLKWDes3SetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformKWDes3Id), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
@@ -164,19 +164,19 @@ xmlSecOpenSSLKWDes3SetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyR
     return(0);
 }
 
-static int      
+static int
 xmlSecOpenSSLKWDes3SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecBufferPtr buffer;
     xmlSecSize keySize;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformKWDes3Id), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLKWDes3Size), -1);
     xmlSecAssert2(xmlSecOpenSSLKWDes3GetKey(transform) != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(xmlSecKeyGetValue(key), xmlSecOpenSSLKeyDataDesId), -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(xmlSecKeyGetValue(key));
     xmlSecAssert2(buffer != NULL, -1);
 
@@ -190,23 +190,23 @@ xmlSecOpenSSLKWDes3SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
                     keySize, XMLSEC_OPENSSL_DES3_KEY_LENGTH);
         return(-1);
     }
-        
+
     ret = xmlSecBufferSetData(xmlSecOpenSSLKWDes3GetKey(transform),
-                            xmlSecBufferGetData(buffer), 
+                            xmlSecBufferGetData(buffer),
                             XMLSEC_OPENSSL_DES3_KEY_LENGTH);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "xmlSecBufferSetData",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", XMLSEC_OPENSSL_DES3_KEY_LENGTH);
-        return(-1);    
+        return(-1);
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecBufferPtr in, out, key;
     xmlSecSize inSize, outSize, keySize;
@@ -222,17 +222,17 @@ xmlSecOpenSSLKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransfo
 
     keySize = xmlSecBufferGetSize(key);
     xmlSecAssert2(keySize == XMLSEC_OPENSSL_DES3_KEY_LENGTH, -1);
-    
+
     in = &(transform->inBuf);
     out = &(transform->outBuf);
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
+    outSize = xmlSecBufferGetSize(out);
     xmlSecAssert2(outSize == 0, -1);
-    
+
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
         /* just do nothing */
     } else  if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
@@ -241,11 +241,11 @@ xmlSecOpenSSLKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransfo
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_SIZE,
-                        "%d bytes - not %d bytes aligned", 
+                        "%d bytes - not %d bytes aligned",
                         inSize, XMLSEC_OPENSSL_DES3_BLOCK_LENGTH);
             return(-1);
-        }       
-        
+        }
+
         if(transform->operation == xmlSecTransformOperationEncrypt) {
             /* the encoded key might be 16 bytes longer plus one block just in case */
             outSize = inSize + XMLSEC_OPENSSL_DES3_IV_LENGTH +
@@ -257,7 +257,7 @@ xmlSecOpenSSLKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransfo
 
         ret = xmlSecBufferSetMaxSize(out, outSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferSetMaxSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -270,7 +270,7 @@ xmlSecOpenSSLKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransfo
                                             xmlSecBufferGetData(in), inSize,
                                             xmlSecBufferGetData(out), outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecOpenSSLKWDes3Encode",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -284,7 +284,7 @@ xmlSecOpenSSLKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransfo
                                             xmlSecBufferGetData(in), inSize,
                                             xmlSecBufferGetData(out), outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecOpenSSLKWDes3Decode",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -297,30 +297,30 @@ xmlSecOpenSSLKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransfo
 
         ret = xmlSecBufferSetSize(out, outSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferSetSize",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", outSize);
             return(-1);
         }
-        
+
         ret = xmlSecBufferRemoveHead(in, inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", inSize);
             return(-1);
         }
-        
+
         transform->status = xmlSecTransformStatusFinished;
     } else if(transform->status == xmlSecTransformStatusFinished) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -330,39 +330,39 @@ xmlSecOpenSSLKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransfo
     return(0);
 }
 
-static xmlSecByte xmlSecOpenSSLKWDes3Iv[XMLSEC_OPENSSL_DES3_IV_LENGTH] = { 
-    0x4a, 0xdd, 0xa2, 0x2c, 0x79, 0xe8, 0x21, 0x05 
+static xmlSecByte xmlSecOpenSSLKWDes3Iv[XMLSEC_OPENSSL_DES3_IV_LENGTH] = {
+    0x4a, 0xdd, 0xa2, 0x2c, 0x79, 0xe8, 0x21, 0x05
 };
 /**
  * CMS Triple DES Key Wrap
  *
  * http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap
  *
- * The following algorithm wraps (encrypts) a key (the wrapped key, WK) 
+ * The following algorithm wraps (encrypts) a key (the wrapped key, WK)
  * under a TRIPLEDES key-encryption-key (KEK) as specified in [CMS-Algorithms]:
  *
- * 1. Represent the key being wrapped as an octet sequence. If it is a 
- *    TRIPLEDES key, this is 24 octets (192 bits) with odd parity bit as 
+ * 1. Represent the key being wrapped as an octet sequence. If it is a
+ *    TRIPLEDES key, this is 24 octets (192 bits) with odd parity bit as
  *    the bottom bit of each octet.
  * 2. Compute the CMS key checksum (section 5.6.1) call this CKS.
  * 3. Let WKCKS = WK || CKS, where || is concatenation.
  * 4. Generate 8 random octets [RANDOM] and call this IV.
- * 5. Encrypt WKCKS in CBC mode using KEK as the key and IV as the 
+ * 5. Encrypt WKCKS in CBC mode using KEK as the key and IV as the
  *    initialization vector. Call the results TEMP1.
  * 6. Left TEMP2 = IV || TEMP1.
  * 7. Reverse the order of the octets in TEMP2 and call the result TEMP3.
- * 8. Encrypt TEMP3 in CBC mode using the KEK and an initialization vector 
- *    of 0x4adda22c79e82105. The resulting cipher text is the desired result. 
+ * 8. Encrypt TEMP3 in CBC mode using the KEK and an initialization vector
+ *    of 0x4adda22c79e82105. The resulting cipher text is the desired result.
  *    It is 40 octets long if a 168 bit key is being wrapped.
  *
  */
-static int      
+static int
 xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                         const xmlSecByte *in, xmlSecSize inSize,
                         xmlSecByte *out, xmlSecSize outSize) {
-    xmlSecByte sha1[SHA_DIGEST_LENGTH];    
+    xmlSecByte sha1[SHA_DIGEST_LENGTH];
     xmlSecByte iv[XMLSEC_OPENSSL_DES3_IV_LENGTH];
-    xmlSecSize s;    
+    xmlSecSize s;
     int ret;
 
     xmlSecAssert2(key != NULL, -1);
@@ -379,13 +379,13 @@ xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                     "SHA1",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
 
     /* step 3: construct WKCKS */
     memcpy(out, in, inSize);
     memcpy(out + inSize, sha1, XMLSEC_OPENSSL_DES3_BLOCK_LENGTH);
-    
+
     /* step 4: generate random iv */
     ret = RAND_bytes(iv, XMLSEC_OPENSSL_DES3_IV_LENGTH);
     if(ret != 1) {
@@ -394,13 +394,13 @@ xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                     "RAND_bytes",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     "ret=%d", ret);
-        return(-1);    
-    }   
+        return(-1);
+    }
 
     /* step 5: first encryption, result is TEMP1 */
-    ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize, 
-                                    iv, XMLSEC_OPENSSL_DES3_IV_LENGTH, 
-                                    out, inSize + XMLSEC_OPENSSL_DES3_BLOCK_LENGTH, 
+    ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize,
+                                    iv, XMLSEC_OPENSSL_DES3_IV_LENGTH,
+                                    out, inSize + XMLSEC_OPENSSL_DES3_BLOCK_LENGTH,
                                     out, outSize, 1);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -408,15 +408,15 @@ xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecOpenSSLKWDes3Encrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
 
     /* step 6: construct TEMP2=IV || TEMP1 */
-    memmove(out + XMLSEC_OPENSSL_DES3_IV_LENGTH, out, 
+    memmove(out + XMLSEC_OPENSSL_DES3_IV_LENGTH, out,
             inSize + XMLSEC_OPENSSL_DES3_IV_LENGTH);
     memcpy(out, iv, XMLSEC_OPENSSL_DES3_IV_LENGTH);
-    s = ret + XMLSEC_OPENSSL_DES3_IV_LENGTH; 
-    
+    s = ret + XMLSEC_OPENSSL_DES3_IV_LENGTH;
+
     /* step 7: reverse octets order, result is TEMP3 */
     ret = xmlSecOpenSSLKWDes3BufferReverse(out, s);
     if(ret < 0) {
@@ -425,11 +425,11 @@ xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecOpenSSLKWDes3BufferReverse",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
 
     /* step 8: second encryption with static IV */
-    ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize, 
+    ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize,
                                     xmlSecOpenSSLKWDes3Iv, XMLSEC_OPENSSL_DES3_IV_LENGTH,
                                     out, s, out, outSize, 1);
     if(ret < 0) {
@@ -438,9 +438,9 @@ xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecOpenSSLKWDes3Encrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
-    s = ret; 
+    s = ret;
     return(s);
 }
 
@@ -449,33 +449,33 @@ xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
  *
  * http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap
  *
- * The following algorithm unwraps (decrypts) a key as specified in 
+ * The following algorithm unwraps (decrypts) a key as specified in
  * [CMS-Algorithms]:
  *
- * 1. Check if the length of the cipher text is reasonable given the key type. 
- *    It must be 40 bytes for a 168 bit key and either 32, 40, or 48 bytes for 
- *    a 128, 192, or 256 bit key. If the length is not supported or inconsistent 
+ * 1. Check if the length of the cipher text is reasonable given the key type.
+ *    It must be 40 bytes for a 168 bit key and either 32, 40, or 48 bytes for
+ *    a 128, 192, or 256 bit key. If the length is not supported or inconsistent
  *    with the algorithm for which the key is intended, return error.
- * 2. Decrypt the cipher text with TRIPLEDES in CBC mode using the KEK and 
+ * 2. Decrypt the cipher text with TRIPLEDES in CBC mode using the KEK and
  *    an initialization vector (IV) of 0x4adda22c79e82105. Call the output TEMP3.
  * 3. Reverse the order of the octets in TEMP3 and call the result TEMP2.
- * 4. Decompose TEMP2 into IV, the first 8 octets, and TEMP1, the remaining 
+ * 4. Decompose TEMP2 into IV, the first 8 octets, and TEMP1, the remaining
  *    octets.
- * 5. Decrypt TEMP1 using TRIPLEDES in CBC mode using the KEK and the IV found 
+ * 5. Decrypt TEMP1 using TRIPLEDES in CBC mode using the KEK and the IV found
  *    in the previous step. Call the result WKCKS.
- * 6. Decompose WKCKS. CKS is the last 8 octets and WK, the wrapped key, are 
+ * 6. Decompose WKCKS. CKS is the last 8 octets and WK, the wrapped key, are
  *    those octets before the CKS.
- * 7. Calculate a CMS key checksum (section 5.6.1) over the WK and compare 
- *    with the CKS extracted in the above step. If they are not equal, return 
+ * 7. Calculate a CMS key checksum (section 5.6.1) over the WK and compare
+ *    with the CKS extracted in the above step. If they are not equal, return
  *    error.
  * 8. WK is the wrapped key, now extracted for use in data decryption.
  */
-static int      
+static int
 xmlSecOpenSSLKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                         const xmlSecByte *in, xmlSecSize inSize,
                         xmlSecByte *out, xmlSecSize outSize) {
-    xmlSecByte sha1[SHA_DIGEST_LENGTH];    
-    xmlSecSize s;    
+    xmlSecByte sha1[SHA_DIGEST_LENGTH];
+    xmlSecSize s;
     int ret;
 
     xmlSecAssert2(key != NULL, -1);
@@ -486,7 +486,7 @@ xmlSecOpenSSLKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
     xmlSecAssert2(outSize >= inSize, -1);
 
     /* step 2: first decryption with static IV, result is TEMP3 */
-    ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize, 
+    ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize,
                                     xmlSecOpenSSLKWDes3Iv, XMLSEC_OPENSSL_DES3_IV_LENGTH,
                                     in, inSize, out, outSize, 0);
     if((ret < 0) || (ret < XMLSEC_OPENSSL_DES3_IV_LENGTH)) {
@@ -495,10 +495,10 @@ xmlSecOpenSSLKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecOpenSSLKWDes3Encrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
-    s = ret; 
-    
+    s = ret;
+
     /* step 3: reverse octets order in TEMP3, result is TEMP2 */
     ret = xmlSecOpenSSLKWDes3BufferReverse(out, s);
     if(ret < 0) {
@@ -507,14 +507,14 @@ xmlSecOpenSSLKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecOpenSSLKWDes3BufferReverse",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
 
     /* steps 4 and 5: get IV and decrypt second time, result is WKCKS */
-    ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize, 
+    ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize,
                                      out, XMLSEC_OPENSSL_DES3_IV_LENGTH,
-                                     out + XMLSEC_OPENSSL_DES3_IV_LENGTH, 
-                                     s - XMLSEC_OPENSSL_DES3_IV_LENGTH, 
+                                     out + XMLSEC_OPENSSL_DES3_IV_LENGTH,
+                                     s - XMLSEC_OPENSSL_DES3_IV_LENGTH,
                                      out, outSize, 0);
     if((ret < 0) || (ret < XMLSEC_OPENSSL_DES3_BLOCK_LENGTH)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -522,10 +522,10 @@ xmlSecOpenSSLKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                     "xmlSecOpenSSLKWDes3Encrypt",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
-    s = ret - XMLSEC_OPENSSL_DES3_BLOCK_LENGTH; 
-    
+    s = ret - XMLSEC_OPENSSL_DES3_BLOCK_LENGTH;
+
     /* steps 6 and 7: calculate SHA1 and validate it */
     if(SHA1(out, s, sha1) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -533,7 +533,7 @@ xmlSecOpenSSLKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                     "SHA1",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);         
+        return(-1);
     }
 
     if(memcmp(sha1, out + s, XMLSEC_OPENSSL_DES3_BLOCK_LENGTH) != 0) {
@@ -542,9 +542,9 @@ xmlSecOpenSSLKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_DATA,
                     "SHA1 does not match");
-        return(-1);         
+        return(-1);
     }
-    
+
     return(s);
 }
 
@@ -557,7 +557,7 @@ xmlSecOpenSSLKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
     int updateLen;
     int finalLen;
     int ret;
-    
+
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(keySize == (xmlSecSize)EVP_CIPHER_key_length(EVP_des_ede3_cbc()), -1);
     xmlSecAssert2(iv != NULL, -1);
@@ -566,22 +566,22 @@ xmlSecOpenSSLKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
     xmlSecAssert2(inSize > 0, -1);
     xmlSecAssert2(out != NULL, -1);
     xmlSecAssert2(outSize >= inSize, -1);
-    
+
     EVP_CIPHER_CTX_init(&cipherCtx);
-    ret = EVP_CipherInit(&cipherCtx, EVP_des_ede3_cbc(), key, iv, enc);  
+    ret = EVP_CipherInit(&cipherCtx, EVP_des_ede3_cbc(), key, iv, enc);
     if(ret != 1) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "EVP_CipherInit",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
 #ifndef XMLSEC_OPENSSL_096
-    EVP_CIPHER_CTX_set_padding(&cipherCtx, 0);    
-#endif /* XMLSEC_OPENSSL_096 */ 
-    
+    EVP_CIPHER_CTX_set_padding(&cipherCtx, 0);
+#endif /* XMLSEC_OPENSSL_096 */
+
     ret = EVP_CipherUpdate(&cipherCtx, out, &updateLen, in, inSize);
     if(ret != 1) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -589,9 +589,9 @@ xmlSecOpenSSLKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
                     "EVP_CipherUpdate",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     ret = EVP_CipherFinal(&cipherCtx, out + updateLen, &finalLen);
     if(ret != 1) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -599,21 +599,21 @@ xmlSecOpenSSLKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
                     "EVP_CipherFinal",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
-    }    
+        return(-1);
+    }
     EVP_CIPHER_CTX_cleanup(&cipherCtx);
 
     return(updateLen + finalLen);
-}             
+}
 
-static int 
+static int
 xmlSecOpenSSLKWDes3BufferReverse(xmlSecByte *buf, xmlSecSize size) {
     xmlSecSize s;
     xmlSecSize i;
     xmlSecByte c;
-    
+
     xmlSecAssert2(buf != NULL, -1);
-    
+
     s = size / 2;
     --size;
     for(i = 0; i < s; ++i) {
diff --git a/src/openssl/signatures.c b/src/openssl/signatures.c
index b6e3737..3d8c506 100644
--- a/src/openssl/signatures.c
+++ b/src/openssl/signatures.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -33,14 +33,14 @@ static const EVP_MD *xmlSecOpenSSLDsaSha1Evp                    (void);
  * Internal OpenSSL evp signatures ctx
  *
  *****************************************************************************/
-typedef struct _xmlSecOpenSSLEvpSignatureCtx    xmlSecOpenSSLEvpSignatureCtx, 
+typedef struct _xmlSecOpenSSLEvpSignatureCtx    xmlSecOpenSSLEvpSignatureCtx,
                                                 *xmlSecOpenSSLEvpSignatureCtxPtr;
 struct _xmlSecOpenSSLEvpSignatureCtx {
     const EVP_MD*       digest;
     EVP_MD_CTX          digestCtx;
     xmlSecKeyDataId     keyId;
     EVP_PKEY*           pKey;
-};          
+};
 
 /******************************************************************************
  *
@@ -57,15 +57,15 @@ struct _xmlSecOpenSSLEvpSignatureCtx {
 static int      xmlSecOpenSSLEvpSignatureCheckId                (xmlSecTransformPtr transform);
 static int      xmlSecOpenSSLEvpSignatureInitialize             (xmlSecTransformPtr transform);
 static void     xmlSecOpenSSLEvpSignatureFinalize               (xmlSecTransformPtr transform);
-static int      xmlSecOpenSSLEvpSignatureSetKeyReq              (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLEvpSignatureSetKeyReq              (xmlSecTransformPtr transform,
                                                                  xmlSecKeyReqPtr keyReq);
 static int      xmlSecOpenSSLEvpSignatureSetKey                 (xmlSecTransformPtr transform,
                                                                  xmlSecKeyPtr key);
-static int      xmlSecOpenSSLEvpSignatureVerify                 (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLEvpSignatureVerify                 (xmlSecTransformPtr transform,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int      xmlSecOpenSSLEvpSignatureExecute                (xmlSecTransformPtr transform, 
+static int      xmlSecOpenSSLEvpSignatureExecute                (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
@@ -86,65 +86,65 @@ xmlSecOpenSSLEvpSignatureCheckId(xmlSecTransformPtr transform) {
 #ifndef XMLSEC_NO_MD5
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaMd5Id)) {
         return(1);
-    } else 
+    } else
 #endif /* XMLSEC_NO_MD5 */
 
 #ifndef XMLSEC_NO_RIPEMD160
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaRipemd160Id)) {
         return(1);
-    } else 
+    } else
 #endif /* XMLSEC_NO_RIPEMD160 */
 
 #ifndef XMLSEC_NO_SHA1
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha1Id)) {
         return(1);
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA1 */
 
 #ifndef XMLSEC_NO_SHA224
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha224Id)) {
         return(1);
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA224 */
 
 #ifndef XMLSEC_NO_SHA256
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha256Id)) {
         return(1);
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA256 */
 
 #ifndef XMLSEC_NO_SHA384
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha384Id)) {
         return(1);
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA384 */
 
 #ifndef XMLSEC_NO_SHA512
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha512Id)) {
         return(1);
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA512 */
 
 #endif /* XMLSEC_NO_RSA */
-    
+
     {
         return(0);
     }
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLEvpSignatureInitialize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLEvpSignatureCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecOpenSSLEvpSignatureCheckId(transform), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLEvpSignatureSize), -1);
 
     ctx = xmlSecOpenSSLEvpSignatureGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
 
-    memset(ctx, 0, sizeof(xmlSecOpenSSLEvpSignatureCtx));    
+    memset(ctx, 0, sizeof(xmlSecOpenSSLEvpSignatureCtx));
 
 #ifndef XMLSEC_NO_DSA
 
@@ -152,7 +152,7 @@ xmlSecOpenSSLEvpSignatureInitialize(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformDsaSha1Id)) {
         ctx->digest     = xmlSecOpenSSLDsaSha1Evp();
         ctx->keyId      = xmlSecOpenSSLKeyDataDsaId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA1 */
 
 #endif /* XMLSEC_NO_DSA */
@@ -163,55 +163,55 @@ xmlSecOpenSSLEvpSignatureInitialize(xmlSecTransformPtr transform) {
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaMd5Id)) {
         ctx->digest     = EVP_md5();
         ctx->keyId      = xmlSecOpenSSLKeyDataRsaId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_MD5 */
 
 #ifndef XMLSEC_NO_RIPEMD160
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaRipemd160Id)) {
         ctx->digest     = EVP_ripemd160();
         ctx->keyId      = xmlSecOpenSSLKeyDataRsaId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_RIPEMD160 */
 
 #ifndef XMLSEC_NO_SHA1
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha1Id)) {
         ctx->digest     = EVP_sha1();
         ctx->keyId      = xmlSecOpenSSLKeyDataRsaId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA1 */
 
 #ifndef XMLSEC_NO_SHA224
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha224Id)) {
         ctx->digest     = EVP_sha224();
         ctx->keyId      = xmlSecOpenSSLKeyDataRsaId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA224 */
 
 #ifndef XMLSEC_NO_SHA256
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha256Id)) {
         ctx->digest     = EVP_sha256();
         ctx->keyId      = xmlSecOpenSSLKeyDataRsaId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA256 */
 
 #ifndef XMLSEC_NO_SHA384
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha384Id)) {
         ctx->digest     = EVP_sha384();
         ctx->keyId      = xmlSecOpenSSLKeyDataRsaId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA384 */
 
 #ifndef XMLSEC_NO_SHA512
     if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha512Id)) {
         ctx->digest     = EVP_sha512();
         ctx->keyId      = xmlSecOpenSSLKeyDataRsaId;
-    } else 
+    } else
 #endif /* XMLSEC_NO_SHA512 */
 
 #endif /* XMLSEC_NO_RSA */
 
     if(1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
@@ -225,7 +225,7 @@ xmlSecOpenSSLEvpSignatureInitialize(xmlSecTransformPtr transform) {
     return(0);
 }
 
-static void 
+static void
 xmlSecOpenSSLEvpSignatureFinalize(xmlSecTransformPtr transform) {
     xmlSecOpenSSLEvpSignatureCtxPtr ctx;
 
@@ -234,7 +234,7 @@ xmlSecOpenSSLEvpSignatureFinalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecOpenSSLEvpSignatureGetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     if(ctx->pKey != NULL) {
         EVP_PKEY_free(ctx->pKey);
     }
@@ -242,10 +242,10 @@ xmlSecOpenSSLEvpSignatureFinalize(xmlSecTransformPtr transform) {
 #ifndef XMLSEC_OPENSSL_096
     EVP_MD_CTX_cleanup(&(ctx->digestCtx));
 #endif /* XMLSEC_OPENSSL_096 */
-    memset(ctx, 0, sizeof(xmlSecOpenSSLEvpSignatureCtx));    
+    memset(ctx, 0, sizeof(xmlSecOpenSSLEvpSignatureCtx));
 }
 
-static int 
+static int
 xmlSecOpenSSLEvpSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecOpenSSLEvpSignatureCtxPtr ctx;
     xmlSecKeyDataPtr value;
@@ -264,7 +264,7 @@ xmlSecOpenSSLEvpSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key)
 
     value = xmlSecKeyGetValue(key);
     xmlSecAssert2(value != NULL, -1);
-    
+
     pKey = xmlSecOpenSSLEvpKeyDataGetEvp(value);
     if(pKey == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -274,7 +274,7 @@ xmlSecOpenSSLEvpSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key)
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     if(ctx->pKey != NULL) {
         EVP_PKEY_free(ctx->pKey);
     }
@@ -292,7 +292,7 @@ xmlSecOpenSSLEvpSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key)
     return(0);
 }
 
-static int  
+static int
 xmlSecOpenSSLEvpSignatureSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPtr keyReq) {
     xmlSecOpenSSLEvpSignatureCtxPtr ctx;
 
@@ -318,12 +318,12 @@ xmlSecOpenSSLEvpSignatureSetKeyReq(xmlSecTransformPtr transform,  xmlSecKeyReqPt
 
 
 static int
-xmlSecOpenSSLEvpSignatureVerify(xmlSecTransformPtr transform, 
+xmlSecOpenSSLEvpSignatureVerify(xmlSecTransformPtr transform,
                         const xmlSecByte* data, xmlSecSize dataSize,
                         xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLEvpSignatureCtxPtr ctx;
     int ret;
-    
+
     xmlSecAssert2(xmlSecOpenSSLEvpSignatureCheckId(transform), -1);
     xmlSecAssert2(transform->operation == xmlSecTransformOperationVerify, -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLEvpSignatureSize), -1);
@@ -336,14 +336,14 @@ xmlSecOpenSSLEvpSignatureVerify(xmlSecTransformPtr transform,
 
     ret = EVP_VerifyFinal(&(ctx->digestCtx), (xmlSecByte*)data, dataSize, ctx->pKey);
     if(ret < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "EVP_VerifyFinal",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     } else if(ret != 1) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     "EVP_VerifyFinal",
                     XMLSEC_ERRORS_R_DATA_NOT_MATCH,
@@ -351,18 +351,18 @@ xmlSecOpenSSLEvpSignatureVerify(xmlSecTransformPtr transform,
         transform->status = xmlSecTransformStatusFail;
         return(0);
     }
-        
+
     transform->status = xmlSecTransformStatusOk;
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecOpenSSLEvpSignatureCtxPtr ctx;
     xmlSecBufferPtr in, out;
     xmlSecSize inSize, outSize;
     int ret;
-    
+
     xmlSecAssert2(xmlSecOpenSSLEvpSignatureCheckId(transform), -1);
     xmlSecAssert2((transform->operation == xmlSecTransformOperationSign) || (transform->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLEvpSignatureSize), -1);
@@ -374,8 +374,8 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
     in = &(transform->inBuf);
     out = &(transform->outBuf);
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
-    
+    outSize = xmlSecBufferGetSize(out);
+
     ctx = xmlSecOpenSSLEvpSignatureGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->digest != NULL, -1);
@@ -383,12 +383,12 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
 
     if(transform->status == xmlSecTransformStatusNone) {
         xmlSecAssert2(outSize == 0, -1);
-        
+
         if(transform->operation == xmlSecTransformOperationSign) {
 #ifndef XMLSEC_OPENSSL_096
             ret = EVP_SignInit(&(ctx->digestCtx), ctx->digest);
             if(ret != 1) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "EVP_SignInit",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -402,7 +402,7 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
 #ifndef XMLSEC_OPENSSL_096
             ret = EVP_VerifyInit(&(ctx->digestCtx), ctx->digest);
             if(ret != 1) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "EVP_VerifyInit",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -415,7 +415,7 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
         }
         transform->status = xmlSecTransformStatusWorking;
     }
-    
+
     if((transform->status == xmlSecTransformStatusWorking) && (inSize > 0)) {
         xmlSecAssert2(outSize == 0, -1);
 
@@ -423,7 +423,7 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
 #ifndef XMLSEC_OPENSSL_096
             ret = EVP_SignUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
             if(ret != 1) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "EVP_SignUpdate",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -437,7 +437,7 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
 #ifndef XMLSEC_OPENSSL_096
             ret = EVP_VerifyUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
             if(ret != 1) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "EVP_VerifyUpdate",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
@@ -448,10 +448,10 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
             EVP_VerifyUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
 #endif /* XMLSEC_OPENSSL_096 */
         }
-            
+
         ret = xmlSecBufferRemoveHead(in, inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -463,39 +463,39 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
     if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
         xmlSecAssert2(outSize == 0, -1);
         if(transform->operation == xmlSecTransformOperationSign) {
-            /* this is a hack: for rsa signatures 
+            /* this is a hack: for rsa signatures
              * we get size from EVP_PKEY_size(),
              * for dsa signature we use a fixed constant */
             outSize = EVP_PKEY_size(ctx->pKey);
-#ifndef XMLSEC_NO_DSA 
+#ifndef XMLSEC_NO_DSA
             if(outSize < XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE) {
                 outSize = XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE;
             }
-#endif /* XMLSEC_NO_DSA */ 
+#endif /* XMLSEC_NO_DSA */
 
             ret = xmlSecBufferSetMaxSize(out, outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferSetMaxSize",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             "size=%d", outSize);
                 return(-1);
             }
-        
+
             ret = EVP_SignFinal(&(ctx->digestCtx), xmlSecBufferGetData(out), &outSize, ctx->pKey);
             if(ret != 1) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "EVP_SignFinal",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-                
+
             ret = xmlSecBufferSetSize(out, outSize);
             if(ret < 0) {
-                xmlSecError(XMLSEC_ERRORS_HERE, 
+                xmlSecError(XMLSEC_ERRORS_HERE,
                             xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                             "xmlSecBufferSetSize",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -505,19 +505,19 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
         }
         transform->status = xmlSecTransformStatusFinished;
     }
-    
+
     if((transform->status == xmlSecTransformStatusWorking) || (transform->status == xmlSecTransformStatusFinished)) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
                     "status=%d", transform->status);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -538,7 +538,7 @@ static xmlSecTransformKlass xmlSecOpenSSLDsaSha1Klass = {
     xmlSecNameDsaSha1,                          /* const xmlChar* name; */
     xmlSecHrefDsaSha1,                          /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpSignatureInitialize,        /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpSignatureFinalize,          /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -552,19 +552,19 @@ static xmlSecTransformKlass xmlSecOpenSSLDsaSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpSignatureExecute,           /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecOpenSSLTransformDsaSha1GetKlass:
- * 
+ *
  * The DSA-SHA1 signature transform klass.
  *
  * Returns: DSA-SHA1 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformDsaSha1GetKlass(void) {
     return(&xmlSecOpenSSLDsaSha1Klass);
 }
@@ -573,50 +573,50 @@ xmlSecOpenSSLTransformDsaSha1GetKlass(void) {
  *
  * DSA-SHA1 EVP
  *
- * XMLDSig specifies dsa signature packing not supported by OpenSSL so 
+ * XMLDSig specifies dsa signature packing not supported by OpenSSL so
  * we created our own EVP_MD.
  *
  * http://www.w3.org/TR/xmldsig-core/#sec-SignatureAlg:
- * 
- * The output of the DSA algorithm consists of a pair of integers 
- * usually referred by the pair (r, s). The signature value consists of 
- * the base64 encoding of the concatenation of two octet-streams that 
- * respectively result from the octet-encoding of the values r and s in 
- * that order. Integer to octet-stream conversion must be done according 
- * to the I2OSP operation defined in the RFC 2437 [PKCS1] specification 
- * with a l parameter equal to 20. For example, the SignatureValue element 
+ *
+ * The output of the DSA algorithm consists of a pair of integers
+ * usually referred by the pair (r, s). The signature value consists of
+ * the base64 encoding of the concatenation of two octet-streams that
+ * respectively result from the octet-encoding of the values r and s in
+ * that order. Integer to octet-stream conversion must be done according
+ * to the I2OSP operation defined in the RFC 2437 [PKCS1] specification
+ * with a l parameter equal to 20. For example, the SignatureValue element
  * for a DSA signature (r, s) with values specified in hexadecimal:
  *
- *  r = 8BAC1AB6 6410435C B7181F95 B16AB97C 92B341C0 
+ *  r = 8BAC1AB6 6410435C B7181F95 B16AB97C 92B341C0
  *  s = 41E2345F 1F56DF24 58F426D1 55B4BA2D B6DCD8C8
- *       
+ *
  * from the example in Appendix 5 of the DSS standard would be
- *        
+ *
  * <SignatureValue>i6watmQQQ1y3GB+VsWq5fJKzQcBB4jRfH1bfJFj0JtFVtLotttzYyA==</SignatureValue>
  *
  ***************************************************************************/
 #ifndef XMLSEC_OPENSSL_096
-static int 
+static int
 xmlSecOpenSSLDsaSha1EvpInit(EVP_MD_CTX *ctx)
-{ 
-    return SHA1_Init(ctx->md_data); 
+{
+    return SHA1_Init(ctx->md_data);
 }
 
-static int 
+static int
 xmlSecOpenSSLDsaSha1EvpUpdate(EVP_MD_CTX *ctx, const void *data, size_t count)
-{ 
-    return SHA1_Update(ctx->md_data,data,count); 
+{
+    return SHA1_Update(ctx->md_data,data,count);
 }
 
-static int 
+static int
 xmlSecOpenSSLDsaSha1EvpFinal(EVP_MD_CTX *ctx, unsigned char *md)
-{ 
-    return SHA1_Final(md,ctx->md_data); 
+{
+    return SHA1_Final(md,ctx->md_data);
 }
 #endif /* XMLSEC_OPENSSL_096 */
 
-static int      
-xmlSecOpenSSLDsaSha1EvpSign(int type ATTRIBUTE_UNUSED, 
+static int
+xmlSecOpenSSLDsaSha1EvpSign(int type ATTRIBUTE_UNUSED,
                         const unsigned char *dgst, unsigned int dlen,
                         unsigned char *sig, unsigned int *siglen, void *dsa) {
     DSA_SIG *s;
@@ -637,11 +637,11 @@ xmlSecOpenSSLDsaSha1EvpSign(int type ATTRIBUTE_UNUSED,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_SIZE,
-                    "size(r)=%d or size(s)=%d > %d", 
+                    "size(r)=%d or size(s)=%d > %d",
                     rSize, sSize, XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2);
         DSA_SIG_free(s);
         return(0);
-    }   
+    }
 
     memset(sig, 0, XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE);
     BN_bn2bin(s->r, sig + (XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2) - rSize);
@@ -649,15 +649,15 @@ xmlSecOpenSSLDsaSha1EvpSign(int type ATTRIBUTE_UNUSED,
     *siglen = XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE;
 
     DSA_SIG_free(s);
-    return(1);    
+    return(1);
 }
 
-static int 
-xmlSecOpenSSLDsaSha1EvpVerify(int type ATTRIBUTE_UNUSED, 
+static int
+xmlSecOpenSSLDsaSha1EvpVerify(int type ATTRIBUTE_UNUSED,
                         const unsigned char *dgst, unsigned int dgst_len,
                         const unsigned char *sigbuf, unsigned int siglen,
                         void *dsa) {
-    DSA_SIG *s;    
+    DSA_SIG *s;
     int ret = -1;
 
     s = DSA_SIG_new();
@@ -676,7 +676,7 @@ xmlSecOpenSSLDsaSha1EvpVerify(int type ATTRIBUTE_UNUSED,
     }
 
     s->r = BN_bin2bn(sigbuf, XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2, NULL);
-    s->s = BN_bin2bn(sigbuf + (XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2), 
+    s->s = BN_bin2bn(sigbuf + (XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2),
                        XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2, NULL);
     if((s->r == NULL) || (s->s == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -741,7 +741,7 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaMd5Klass = {
     xmlSecNameRsaMd5,                           /* const xmlChar* name; */
     xmlSecHrefRsaMd5,                           /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpSignatureInitialize,        /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpSignatureFinalize,          /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -755,19 +755,19 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaMd5Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpSignatureExecute,           /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecOpenSSLTransformRsaMd5GetKlass:
- * 
+ *
  * The RSA-MD5 signature transform klass.
  *
  * Returns: RSA-MD5 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformRsaMd5GetKlass(void) {
     return(&xmlSecOpenSSLRsaMd5Klass);
 }
@@ -788,7 +788,7 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaRipemd160Klass = {
     xmlSecNameRsaRipemd160,                             /* const xmlChar* name; */
     xmlSecHrefRsaRipemd160,                             /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpSignatureInitialize,        /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpSignatureFinalize,          /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -802,19 +802,19 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaRipemd160Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpSignatureExecute,           /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecOpenSSLTransformRsaRipemd160GetKlass:
- * 
+ *
  * The RSA-RIPEMD160 signature transform klass.
  *
  * Returns: RSA-RIPEMD160 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformRsaRipemd160GetKlass(void) {
     return(&xmlSecOpenSSLRsaRipemd160Klass);
 }
@@ -835,7 +835,7 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaSha1Klass = {
     xmlSecNameRsaSha1,                          /* const xmlChar* name; */
     xmlSecHrefRsaSha1,                          /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpSignatureInitialize,        /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpSignatureFinalize,          /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -849,19 +849,19 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaSha1Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpSignatureExecute,           /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecOpenSSLTransformRsaSha1GetKlass:
- * 
+ *
  * The RSA-SHA1 signature transform klass.
  *
  * Returns: RSA-SHA1 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformRsaSha1GetKlass(void) {
     return(&xmlSecOpenSSLRsaSha1Klass);
 }
@@ -882,7 +882,7 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaSha224Klass = {
     xmlSecNameRsaSha224,                                /* const xmlChar* name; */
     xmlSecHrefRsaSha224,                                /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpSignatureInitialize,        /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpSignatureFinalize,          /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -896,19 +896,19 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaSha224Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpSignatureExecute,           /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecOpenSSLTransformRsaSha224GetKlass:
- * 
+ *
  * The RSA-SHA224 signature transform klass.
  *
  * Returns: RSA-SHA224 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformRsaSha224GetKlass(void) {
     return(&xmlSecOpenSSLRsaSha224Klass);
 }
@@ -929,7 +929,7 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaSha256Klass = {
     xmlSecNameRsaSha256,                                /* const xmlChar* name; */
     xmlSecHrefRsaSha256,                                /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpSignatureInitialize,        /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpSignatureFinalize,          /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -943,19 +943,19 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaSha256Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpSignatureExecute,           /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecOpenSSLTransformRsaSha256GetKlass:
- * 
+ *
  * The RSA-SHA256 signature transform klass.
  *
  * Returns: RSA-SHA256 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformRsaSha256GetKlass(void) {
     return(&xmlSecOpenSSLRsaSha256Klass);
 }
@@ -976,7 +976,7 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaSha384Klass = {
     xmlSecNameRsaSha384,                                /* const xmlChar* name; */
     xmlSecHrefRsaSha384,                                /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpSignatureInitialize,        /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpSignatureFinalize,          /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -990,19 +990,19 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaSha384Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpSignatureExecute,           /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecOpenSSLTransformRsaSha384GetKlass:
- * 
+ *
  * The RSA-SHA384 signature transform klass.
  *
  * Returns: RSA-SHA384 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformRsaSha384GetKlass(void) {
     return(&xmlSecOpenSSLRsaSha384Klass);
 }
@@ -1023,7 +1023,7 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaSha512Klass = {
     xmlSecNameRsaSha512,                                /* const xmlChar* name; */
     xmlSecHrefRsaSha512,                                /* const xmlChar* href; */
     xmlSecTransformUsageSignatureMethod,        /* xmlSecTransformUsage usage; */
-    
+
     xmlSecOpenSSLEvpSignatureInitialize,        /* xmlSecTransformInitializeMethod initialize; */
     xmlSecOpenSSLEvpSignatureFinalize,          /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -1037,19 +1037,19 @@ static xmlSecTransformKlass xmlSecOpenSSLRsaSha512Klass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecOpenSSLEvpSignatureExecute,           /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
 
 /**
  * xmlSecOpenSSLTransformRsaSha512GetKlass:
- * 
+ *
  * The RSA-SHA512 signature transform klass.
  *
  * Returns: RSA-SHA512 signature transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecOpenSSLTransformRsaSha512GetKlass(void) {
     return(&xmlSecOpenSSLRsaSha512Klass);
 }
diff --git a/src/openssl/symkeys.c b/src/openssl/symkeys.c
index 52b417b..6195ed6 100644
--- a/src/openssl/symkeys.c
+++ b/src/openssl/symkeys.c
@@ -1,12 +1,12 @@
-/** 
+/**
  *
  * XMLSec library
- * 
+ *
  * DES Algorithm support
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -27,7 +27,7 @@
 #include <xmlsec/openssl/crypto.h>
 
 /*****************************************************************************
- * 
+ *
  * Symmetic (binary) keys - just a wrapper for xmlSecKeyDataBinary
  *
  ****************************************************************************/
@@ -72,7 +72,7 @@ static int      xmlSecOpenSSLSymKeyDataKlassCheck       (xmlSecKeyDataKlass* kla
 static int
 xmlSecOpenSSLSymKeyDataInitialize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecOpenSSLSymKeyDataCheckId(data), -1);
-    
+
     return(xmlSecKeyDataBinaryValueInitialize(data));
 }
 
@@ -81,14 +81,14 @@ xmlSecOpenSSLSymKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
     xmlSecAssert2(xmlSecOpenSSLSymKeyDataCheckId(dst), -1);
     xmlSecAssert2(xmlSecOpenSSLSymKeyDataCheckId(src), -1);
     xmlSecAssert2(dst->id == src->id, -1);
-        
+
     return(xmlSecKeyDataBinaryValueDuplicate(dst, src));
 }
 
 static void
 xmlSecOpenSSLSymKeyDataFinalize(xmlSecKeyDataPtr data) {
     xmlSecAssert(xmlSecOpenSSLSymKeyDataCheckId(data));
-    
+
     xmlSecKeyDataBinaryValueFinalize(data);
 }
 
@@ -96,15 +96,15 @@ static int
 xmlSecOpenSSLSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecOpenSSLSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueXmlRead(id, key, node, keyInfoCtx));
 }
 
-static int 
+static int
 xmlSecOpenSSLSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                     xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecOpenSSLSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueXmlWrite(id, key, node, keyInfoCtx));
 }
 
@@ -113,7 +113,7 @@ xmlSecOpenSSLSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                     const xmlSecByte* buf, xmlSecSize bufSize,
                                     xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecOpenSSLSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueBinRead(id, key, buf, bufSize, keyInfoCtx));
 }
 
@@ -122,7 +122,7 @@ xmlSecOpenSSLSymKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                     xmlSecByte** buf, xmlSecSize* bufSize,
                                     xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecAssert2(xmlSecOpenSSLSymKeyDataKlassCheck(id), -1);
-    
+
     return(xmlSecKeyDataBinaryValueBinWrite(id, key, buf, bufSize, keyInfoCtx));
 }
 
@@ -135,7 +135,7 @@ xmlSecOpenSSLSymKeyDataGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlS
 
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecOpenSSLGenerateRandom(buffer, (sizeBits + 7) / 8));
 }
 
@@ -151,29 +151,29 @@ xmlSecOpenSSLSymKeyDataGetType(xmlSecKeyDataPtr data) {
     return((xmlSecBufferGetSize(buffer) > 0) ? xmlSecKeyDataTypeSymmetric : xmlSecKeyDataTypeUnknown);
 }
 
-static xmlSecSize 
+static xmlSecSize
 xmlSecOpenSSLSymKeyDataGetSize(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecOpenSSLSymKeyDataCheckId(data), 0);
-    
+
     return(xmlSecKeyDataBinaryValueGetSize(data));
 }
 
-static void 
+static void
 xmlSecOpenSSLSymKeyDataDebugDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecOpenSSLSymKeyDataCheckId(data));
-    
-    xmlSecKeyDataBinaryValueDebugDump(data, output);    
+
+    xmlSecKeyDataBinaryValueDebugDump(data, output);
 }
 
 static void
 xmlSecOpenSSLSymKeyDataDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
     xmlSecAssert(xmlSecOpenSSLSymKeyDataCheckId(data));
-    
-    xmlSecKeyDataBinaryValueDebugXmlDump(data, output);    
+
+    xmlSecKeyDataBinaryValueDebugXmlDump(data, output);
 }
 
-static int 
-xmlSecOpenSSLSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {    
+static int
+xmlSecOpenSSLSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {
 #ifndef XMLSEC_NO_DES
     if(klass == xmlSecOpenSSLKeyDataDesId) {
         return(1);
@@ -210,18 +210,18 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataAesKlass = {
 
     /* data */
     xmlSecNameAESKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefAESKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeAESKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecOpenSSLSymKeyDataInitialize,          /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecOpenSSLSymKeyDataDuplicate,           /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecOpenSSLSymKeyDataFinalize,            /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecOpenSSLSymKeyDataGenerate,            /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecOpenSSLSymKeyDataGetType,             /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecOpenSSLSymKeyDataGetSize,             /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -242,14 +242,14 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataAesKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLKeyDataAesGetKlass:
- * 
+ *
  * The AES key data klass.
  *
  * Returns: AES key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecOpenSSLKeyDataAesGetKlass(void) {
     return(&xmlSecOpenSSLKeyDataAesKlass);
 }
@@ -267,14 +267,14 @@ xmlSecOpenSSLKeyDataAesGetKlass(void) {
 int
 xmlSecOpenSSLKeyDataAesSet(xmlSecKeyDataPtr data, const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataAesId), -1);
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(bufSize > 0, -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecBufferSetData(buffer, buf, bufSize));
 }
 
@@ -293,18 +293,18 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataDesKlass = {
 
     /* data */
     xmlSecNameDESKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefDESKeyValue,                      /* const xmlChar* href; */
     xmlSecNodeDESKeyValue,                      /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecOpenSSLSymKeyDataInitialize,          /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecOpenSSLSymKeyDataDuplicate,           /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecOpenSSLSymKeyDataFinalize,            /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecOpenSSLSymKeyDataGenerate,            /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecOpenSSLSymKeyDataGetType,             /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecOpenSSLSymKeyDataGetSize,             /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -325,14 +325,14 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataDesKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLKeyDataDesGetKlass:
- * 
+ *
  * The DES key data klass.
  *
  * Returns: DES key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecOpenSSLKeyDataDesGetKlass(void) {
     return(&xmlSecOpenSSLKeyDataDesKlass);
 }
@@ -350,14 +350,14 @@ xmlSecOpenSSLKeyDataDesGetKlass(void) {
 int
 xmlSecOpenSSLKeyDataDesSet(xmlSecKeyDataPtr data, const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataDesId), -1);
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(bufSize > 0, -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecBufferSetData(buffer, buf, bufSize));
 }
 
@@ -375,18 +375,18 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataHmacKlass = {
 
     /* data */
     xmlSecNameHMACKeyValue,
-    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefHMACKeyValue,                     /* const xmlChar* href; */
     xmlSecNodeHMACKeyValue,                     /* const xmlChar* dataNodeName; */
     xmlSecNs,                                   /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecOpenSSLSymKeyDataInitialize,          /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecOpenSSLSymKeyDataDuplicate,           /* xmlSecKeyDataDuplicateMethod duplicate; */
     xmlSecOpenSSLSymKeyDataFinalize,            /* xmlSecKeyDataFinalizeMethod finalize; */
     xmlSecOpenSSLSymKeyDataGenerate,            /* xmlSecKeyDataGenerateMethod generate; */
-    
+
     /* get info */
     xmlSecOpenSSLSymKeyDataGetType,             /* xmlSecKeyDataGetTypeMethod getType; */
     xmlSecOpenSSLSymKeyDataGetSize,             /* xmlSecKeyDataGetSizeMethod getSize; */
@@ -407,14 +407,14 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataHmacKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLKeyDataHmacGetKlass:
- * 
+ *
  * The HMAC key data klass.
  *
  * Returns: HMAC key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecOpenSSLKeyDataHmacGetKlass(void) {
     return(&xmlSecOpenSSLKeyDataHmacKlass);
 }
@@ -432,14 +432,14 @@ xmlSecOpenSSLKeyDataHmacGetKlass(void) {
 int
 xmlSecOpenSSLKeyDataHmacSet(xmlSecKeyDataPtr data, const xmlSecByte* buf, xmlSecSize bufSize) {
     xmlSecBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataHmacId), -1);
     xmlSecAssert2(buf != NULL, -1);
     xmlSecAssert2(bufSize > 0, -1);
-    
+
     buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
     xmlSecAssert2(buffer != NULL, -1);
-    
+
     return(xmlSecBufferSetData(buffer, buf, bufSize));
 }
 
diff --git a/src/openssl/x509.c b/src/openssl/x509.c
index 2617791..459a312 100644
--- a/src/openssl/x509.c
+++ b/src/openssl/x509.c
@@ -1,4 +1,4 @@
-/** 
+/**
  * XMLSec library
  *
  * X509 support
@@ -6,7 +6,7 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -78,25 +78,25 @@ static int              xmlSecOpenSSLX509CRLNodeRead            (xmlSecKeyDataPt
 static int              xmlSecOpenSSLX509CRLNodeWrite           (X509_CRL* crl,
                                                                  xmlNodePtr node,
                                                                  xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int              xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, 
+static int              xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data,
                                                                 xmlSecKeyPtr key,
                                                                 xmlSecKeyInfoCtxPtr keyInfoCtx);
-static X509*            xmlSecOpenSSLX509CertDerRead            (const xmlSecByte* buf, 
+static X509*            xmlSecOpenSSLX509CertDerRead            (const xmlSecByte* buf,
                                                                  xmlSecSize size);
 static X509*            xmlSecOpenSSLX509CertBase64DerRead      (xmlChar* buf);
-static xmlChar*         xmlSecOpenSSLX509CertBase64DerWrite     (X509* cert, 
+static xmlChar*         xmlSecOpenSSLX509CertBase64DerWrite     (X509* cert,
                                                                  int base64LineWrap);
-static X509_CRL*        xmlSecOpenSSLX509CrlDerRead             (xmlSecByte* buf, 
+static X509_CRL*        xmlSecOpenSSLX509CrlDerRead             (xmlSecByte* buf,
                                                                  xmlSecSize size);
 static X509_CRL*        xmlSecOpenSSLX509CrlBase64DerRead       (xmlChar* buf);
-static xmlChar*         xmlSecOpenSSLX509CrlBase64DerWrite      (X509_CRL* crl, 
+static xmlChar*         xmlSecOpenSSLX509CrlBase64DerWrite      (X509_CRL* crl,
                                                                  int base64LineWrap);
 static xmlChar*         xmlSecOpenSSLX509NameWrite              (X509_NAME* nm);
 static xmlChar*         xmlSecOpenSSLASN1IntegerWrite           (ASN1_INTEGER *asni);
 static xmlChar*         xmlSecOpenSSLX509SKIWrite               (X509* cert);
-static void             xmlSecOpenSSLX509CertDebugDump          (X509* cert, 
+static void             xmlSecOpenSSLX509CertDebugDump          (X509* cert,
                                                                  FILE* output);
-static void             xmlSecOpenSSLX509CertDebugXmlDump       (X509* cert, 
+static void             xmlSecOpenSSLX509CertDebugXmlDump       (X509* cert,
                                                                  FILE* output);
 static int              xmlSecOpenSSLX509CertGetTime            (ASN1_TIME* t,
                                                                  time_t* res);
@@ -121,52 +121,52 @@ struct _xmlSecOpenSSLX509DataCtx {
  *
  * The X509Data  Element (http://www.w3.org/TR/xmldsig-core/#sec-X509Data)
  *
- * An X509Data element within KeyInfo contains one or more identifiers of keys 
- * or X509 certificates (or certificates' identifiers or a revocation list). 
+ * An X509Data element within KeyInfo contains one or more identifiers of keys
+ * or X509 certificates (or certificates' identifiers or a revocation list).
  * The content of X509Data is:
  *
  *  1. At least one element, from the following set of element types; any of these may appear together or more than once iff (if and only if) each instance describes or is related to the same certificate:
  *  2.
- *    * The X509IssuerSerial element, which contains an X.509 issuer 
- *      distinguished name/serial number pair that SHOULD be compliant 
+ *    * The X509IssuerSerial element, which contains an X.509 issuer
+ *      distinguished name/serial number pair that SHOULD be compliant
  *      with RFC2253 [LDAP-DN],
- *    * The X509SubjectName element, which contains an X.509 subject 
+ *    * The X509SubjectName element, which contains an X.509 subject
  *      distinguished name that SHOULD be compliant with RFC2253 [LDAP-DN],
- *    * The X509SKI element, which contains the base64 encoded plain (i.e. 
+ *    * The X509SKI element, which contains the base64 encoded plain (i.e.
  *      non-DER-encoded) value of a X509 V.3 SubjectKeyIdentifier extension.
- *    * The X509Certificate element, which contains a base64-encoded [X509v3] 
+ *    * The X509Certificate element, which contains a base64-encoded [X509v3]
  *      certificate, and
- *    * Elements from an external namespace which accompanies/complements any 
+ *    * Elements from an external namespace which accompanies/complements any
  *      of the elements above.
- *    * The X509CRL element, which contains a base64-encoded certificate 
+ *    * The X509CRL element, which contains a base64-encoded certificate
  *      revocation list (CRL) [X509v3].
  *
- * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that appear 
+ * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that appear
  * MUST refer to the certificate or certificates containing the validation key.
- * All such elements that refer to a particular individual certificate MUST be 
- * grouped inside a single X509Data element and if the certificate to which 
+ * All such elements that refer to a particular individual certificate MUST be
+ * grouped inside a single X509Data element and if the certificate to which
  * they refer appears, it MUST also be in that X509Data element.
  *
- * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that relate to 
- * the same key but different certificates MUST be grouped within a single 
+ * Any X509IssuerSerial, X509SKI, and X509SubjectName elements that relate to
+ * the same key but different certificates MUST be grouped within a single
  * KeyInfo but MAY occur in multiple X509Data elements.
  *
- * All certificates appearing in an X509Data element MUST relate to the 
- * validation key by either containing it or being part of a certification 
+ * All certificates appearing in an X509Data element MUST relate to the
+ * validation key by either containing it or being part of a certification
  * chain that terminates in a certificate containing the validation key.
  *
  * No ordering is implied by the above constraints.
  *
- * Note, there is no direct provision for a PKCS#7 encoded "bag" of 
- * certificates or CRLs. However, a set of certificates and CRLs can occur 
- * within an X509Data element and multiple X509Data elements can occur in a 
- * KeyInfo. Whenever multiple certificates occur in an X509Data element, at 
- * least one such certificate must contain the public key which verifies the 
+ * Note, there is no direct provision for a PKCS#7 encoded "bag" of
+ * certificates or CRLs. However, a set of certificates and CRLs can occur
+ * within an X509Data element and multiple X509Data elements can occur in a
+ * KeyInfo. Whenever multiple certificates occur in an X509Data element, at
+ * least one such certificate must contain the public key which verifies the
  * signature.
  *
  * Schema Definition
  *
- *  <element name="X509Data" type="ds:X509DataType"/> 
+ *  <element name="X509Data" type="ds:X509DataType"/>
  *  <complexType name="X509DataType">
  *    <sequence maxOccurs="unbounded">
  *      <choice>
@@ -179,10 +179,10 @@ struct _xmlSecOpenSSLX509DataCtx {
  *      </choice>
  *    </sequence>
  *  </complexType>
- *  <complexType name="X509IssuerSerialType"> 
- *    <sequence> 
- *       <element name="X509IssuerName" type="string"/> 
- *       <element name="X509SerialNumber" type="integer"/> 
+ *  <complexType name="X509IssuerSerialType">
+ *    <sequence>
+ *       <element name="X509IssuerName" type="string"/>
+ *       <element name="X509SerialNumber" type="integer"/>
  *     </sequence>
  *  </complexType>
  *
@@ -204,7 +204,7 @@ struct _xmlSecOpenSSLX509DataCtx {
  *
  *************************************************************************/
 #define xmlSecOpenSSLX509DataSize       \
-    (sizeof(xmlSecKeyData) + sizeof(xmlSecOpenSSLX509DataCtx))  
+    (sizeof(xmlSecKeyData) + sizeof(xmlSecOpenSSLX509DataCtx))
 #define xmlSecOpenSSLX509DataGetCtx(data) \
     ((xmlSecOpenSSLX509DataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
 
@@ -236,12 +236,12 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataX509Klass = {
 
     /* data */
     xmlSecNameX509Data,
-    xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml, 
+    xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefX509Data,                         /* const xmlChar* href; */
     xmlSecNodeX509Data,                         /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     xmlSecOpenSSLKeyDataX509Initialize,         /* xmlSecKeyDataInitializeMethod initialize; */
     xmlSecOpenSSLKeyDataX509Duplicate,          /* xmlSecKeyDataDuplicateMethod duplicate; */
@@ -251,7 +251,7 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataX509Klass = {
     /* get info */
     xmlSecOpenSSLKeyDataX509GetType,            /* xmlSecKeyDataGetTypeMethod getType; */
     NULL,                                       /* xmlSecKeyDataGetSizeMethod getSize; */
-    xmlSecOpenSSLKeyDataX509GetIdentifier,      /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    xmlSecOpenSSLKeyDataX509GetIdentifier,      /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     xmlSecOpenSSLKeyDataX509XmlRead,            /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -268,14 +268,14 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataX509Klass = {
     NULL,                                       /* void* reserved1; */
 };
 
-/** 
+/**
  * xmlSecOpenSSLKeyDataX509GetKlass:
- * 
+ *
  * The OpenSSL X509 key data klass (http://www.w3.org/TR/xmldsig-core/#sec-X509Data).
  *
  * Returns: the X509 data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecOpenSSLKeyDataX509GetKlass(void) {
     return(&xmlSecOpenSSLKeyDataX509Klass);
 }
@@ -284,15 +284,15 @@ xmlSecOpenSSLKeyDataX509GetKlass(void) {
  * xmlSecOpenSSLKeyDataX509GetKeyCert:
  * @data:               the pointer to X509 key data.
  *
- * Gets the certificate from which the key was extracted. 
+ * Gets the certificate from which the key was extracted.
  *
  * Returns: the key's certificate or NULL if key data was not used for key
  * extraction or an error occurs.
  */
-X509*   
+X509*
 xmlSecOpenSSLKeyDataX509GetKeyCert(xmlSecKeyDataPtr data) {
     xmlSecOpenSSLX509DataCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataX509Id), NULL);
 
     ctx = xmlSecOpenSSLX509DataGetCtx(data);
@@ -319,7 +319,7 @@ xmlSecOpenSSLKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, X509* cert) {
 
     ctx = xmlSecOpenSSLX509DataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     if(ctx->keyCert != NULL) {
         X509_free(ctx->keyCert);
     }
@@ -336,17 +336,17 @@ xmlSecOpenSSLKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, X509* cert) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecOpenSSLKeyDataX509AdoptCert(xmlSecKeyDataPtr data, X509* cert) {
     xmlSecOpenSSLX509DataCtxPtr ctx;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataX509Id), -1);
     xmlSecAssert2(cert != NULL, -1);
 
     ctx = xmlSecOpenSSLX509DataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     if(ctx->certsList == NULL) {
         ctx->certsList = sk_X509_new_null();
         if(ctx->certsList == NULL) {
@@ -355,10 +355,10 @@ xmlSecOpenSSLKeyDataX509AdoptCert(xmlSecKeyDataPtr data, X509* cert) {
                         "sk_X509_new_null",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1); 
+            return(-1);
         }
     }
-    
+
     ret = sk_X509_push(ctx->certsList, cert);
     if(ret < 1) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -366,9 +366,9 @@ xmlSecOpenSSLKeyDataX509AdoptCert(xmlSecKeyDataPtr data, X509* cert) {
                     "sk_X509_push",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-        
+
     return(0);
 }
 
@@ -376,13 +376,13 @@ xmlSecOpenSSLKeyDataX509AdoptCert(xmlSecKeyDataPtr data, X509* cert) {
  * xmlSecOpenSSLKeyDataX509GetCert:
  * @data:               the pointer to X509 key data.
  * @pos:                the desired certificate position.
- * 
+ *
  * Gets a certificate from X509 key data.
  *
- * Returns: the pointer to certificate or NULL if @pos is larger than the 
+ * Returns: the pointer to certificate or NULL if @pos is larger than the
  * number of certificates in @data or an error occurs.
  */
-X509* 
+X509*
 xmlSecOpenSSLKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
     xmlSecOpenSSLX509DataCtxPtr ctx;
 
@@ -404,7 +404,7 @@ xmlSecOpenSSLKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
  *
  * Returns: te number of certificates in @data.
  */
-xmlSecSize      
+xmlSecSize
 xmlSecOpenSSLKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
     xmlSecOpenSSLX509DataCtxPtr ctx;
 
@@ -425,17 +425,17 @@ xmlSecOpenSSLKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecOpenSSLKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, X509_CRL* crl) {
     xmlSecOpenSSLX509DataCtxPtr ctx;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataX509Id), -1);
     xmlSecAssert2(crl != NULL, -1);
 
     ctx = xmlSecOpenSSLX509DataGetCtx(data);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     if(ctx->crlsList == NULL) {
         ctx->crlsList = sk_X509_CRL_new_null();
         if(ctx->crlsList == NULL) {
@@ -444,10 +444,10 @@ xmlSecOpenSSLKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, X509_CRL* crl) {
                         "sk_X509_CRL_new_null",
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1); 
+            return(-1);
         }
     }
-    
+
     ret = sk_X509_CRL_push(ctx->crlsList, crl);
     if(ret < 1) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -455,9 +455,9 @@ xmlSecOpenSSLKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, X509_CRL* crl) {
                     "sk_X509_CRL_push",
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-        
+
     return(0);
 }
 
@@ -465,13 +465,13 @@ xmlSecOpenSSLKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, X509_CRL* crl) {
  * xmlSecOpenSSLKeyDataX509GetCrl:
  * @data:               the pointer to X509 key data.
  * @pos:                the desired CRL position.
- * 
+ *
  * Gets a CRL from X509 key data.
  *
- * Returns: the pointer to CRL or NULL if @pos is larger than the 
+ * Returns: the pointer to CRL or NULL if @pos is larger than the
  * number of CRLs in @data or an error occurs.
  */
-X509_CRL* 
+X509_CRL*
 xmlSecOpenSSLKeyDataX509GetCrl(xmlSecKeyDataPtr data, xmlSecSize pos) {
     xmlSecOpenSSLX509DataCtxPtr ctx;
 
@@ -494,7 +494,7 @@ xmlSecOpenSSLKeyDataX509GetCrl(xmlSecKeyDataPtr data, xmlSecSize pos) {
  *
  * Returns: te number of CRLs in @data.
  */
-xmlSecSize 
+xmlSecSize
 xmlSecOpenSSLKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data) {
     xmlSecOpenSSLX509DataCtxPtr ctx;
 
@@ -506,7 +506,7 @@ xmlSecOpenSSLKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data) {
     return((ctx->crlsList != NULL) ? sk_X509_CRL_num(ctx->crlsList) : 0);
 }
 
-static int      
+static int
 xmlSecOpenSSLKeyDataX509Initialize(xmlSecKeyDataPtr data) {
     xmlSecOpenSSLX509DataCtxPtr ctx;
 
@@ -530,7 +530,7 @@ xmlSecOpenSSLKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
 
     xmlSecAssert2(xmlSecKeyDataCheckId(dst, xmlSecOpenSSLKeyDataX509Id), -1);
     xmlSecAssert2(xmlSecKeyDataCheckId(src, xmlSecOpenSSLKeyDataX509Id), -1);
-    
+
     /* copy certsList */
     size = xmlSecOpenSSLKeyDataX509GetCertsSize(src);
     for(pos = 0; pos < size; ++pos) {
@@ -543,7 +543,7 @@ xmlSecOpenSSLKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
                         "pos=%d", pos);
             return(-1);
         }
-        
+
         certDst = X509_dup(certSrc);
         if(certDst == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -553,7 +553,7 @@ xmlSecOpenSSLKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-        
+
         ret = xmlSecOpenSSLKeyDataX509AdoptCert(dst, certDst);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -578,7 +578,7 @@ xmlSecOpenSSLKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
                         "pos=%d", pos);
             return(-1);
         }
-        
+
         crlDst = X509_CRL_dup(crlSrc);
         if(crlDst == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -588,7 +588,7 @@ xmlSecOpenSSLKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-        
+
         ret = xmlSecOpenSSLKeyDataX509AdoptCrl(dst, crlDst);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -637,10 +637,10 @@ xmlSecOpenSSLKeyDataX509Finalize(xmlSecKeyDataPtr data) {
     xmlSecAssert(ctx != NULL);
 
     if(ctx->certsList != NULL) {
-        sk_X509_pop_free(ctx->certsList, X509_free);    
+        sk_X509_pop_free(ctx->certsList, X509_free);
     }
     if(ctx->crlsList != NULL) {
-        sk_X509_CRL_pop_free(ctx->crlsList, X509_CRL_free);     
+        sk_X509_CRL_pop_free(ctx->crlsList, X509_CRL_free);
     }
     if(ctx->keyCert != NULL) {
         X509_free(ctx->keyCert);
@@ -653,12 +653,12 @@ xmlSecOpenSSLKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataPtr data;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecOpenSSLKeyDataX509Id, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
-    
+
     data = xmlSecKeyEnsureData(key, id);
     if(data == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -668,7 +668,7 @@ xmlSecOpenSSLKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecOpenSSLX509DataNodeRead(data, node, keyInfoCtx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -693,7 +693,7 @@ xmlSecOpenSSLKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                                 xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataPtr data;
@@ -702,7 +702,7 @@ xmlSecOpenSSLKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     xmlSecSize size, pos;
     int content;
     int ret;
-                        
+
     xmlSecAssert2(id == xmlSecOpenSSLKeyDataX509Id, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -725,7 +725,7 @@ xmlSecOpenSSLKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
     data = xmlSecKeyGetData(key, id);
     if(data == NULL) {
         /* no x509 data in the key */
-        return(0);      
+        return(0);
     }
 
     /* write certs */
@@ -740,7 +740,7 @@ xmlSecOpenSSLKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                         "pos=%d", pos);
             return(-1);
         }
-        
+
         if((content & XMLSEC_X509DATA_CERTIFICATE_NODE) != 0) {
             ret = xmlSecOpenSSLX509CertificateNodeWrite(cert, node, keyInfoCtx);
             if(ret < 0) {
@@ -788,7 +788,7 @@ xmlSecOpenSSLKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                 return(-1);
             }
         }
-    }    
+    }
 
     /* write crls if needed */
     if((content & XMLSEC_X509DATA_CRL_NODE) != 0) {
@@ -803,7 +803,7 @@ xmlSecOpenSSLKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
                             "pos=%d", pos);
                 return(-1);
             }
-            
+
             ret = xmlSecOpenSSLX509CRLNodeWrite(crl, node, keyInfoCtx);
             if(ret < 0) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -815,7 +815,7 @@ xmlSecOpenSSLKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
             }
         }
     }
-    
+
     return(0);
 }
 
@@ -824,19 +824,19 @@ static xmlSecKeyDataType
 xmlSecOpenSSLKeyDataX509GetType(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataX509Id), xmlSecKeyDataTypeUnknown);
 
-    /* TODO: return verified/not verified status */    
+    /* TODO: return verified/not verified status */
     return(xmlSecKeyDataTypeUnknown);
 }
 
 static const xmlChar*
 xmlSecOpenSSLKeyDataX509GetIdentifier(xmlSecKeyDataPtr data) {
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataX509Id), NULL);
-    
-    /* TODO */    
+
+    /* TODO */
     return(NULL);
 }
 
-static void 
+static void
 xmlSecOpenSSLKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) {
     X509* cert;
     xmlSecSize size, pos;
@@ -850,7 +850,7 @@ xmlSecOpenSSLKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) {
         fprintf(output, "==== Key Certificate:\n");
         xmlSecOpenSSLX509CertDebugDump(cert, output);
     }
-    
+
     size = xmlSecOpenSSLKeyDataX509GetCertsSize(data);
     for(pos = 0; pos < size; ++pos) {
         cert = xmlSecOpenSSLKeyDataX509GetCert(data, pos);
@@ -865,7 +865,7 @@ xmlSecOpenSSLKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) {
         fprintf(output, "==== Certificate:\n");
         xmlSecOpenSSLX509CertDebugDump(cert, output);
     }
-    
+
     /* we don't print out crls */
 }
 
@@ -884,7 +884,7 @@ xmlSecOpenSSLKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
         xmlSecOpenSSLX509CertDebugXmlDump(cert, output);
         fprintf(output, "</KeyCertificate>\n");
     }
-    
+
     size = xmlSecOpenSSLKeyDataX509GetCertsSize(data);
     for(pos = 0; pos < size; ++pos) {
         cert = xmlSecOpenSSLKeyDataX509GetCert(data, pos);
@@ -900,24 +900,24 @@ xmlSecOpenSSLKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
         xmlSecOpenSSLX509CertDebugXmlDump(cert, output);
         fprintf(output, "</Certificate>\n");
     }
-    
+
     /* we don't print out crls */
     fprintf(output, "</X509Data>\n");
 }
 
 static int
 xmlSecOpenSSLX509DataNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
-    xmlNodePtr cur; 
+    xmlNodePtr cur;
     int ret;
-        
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataX509Id), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
-    
+
     for(cur = xmlSecGetNextElementNode(node->children);
         cur != NULL;
         cur = xmlSecGetNextElementNode(cur->next)) {
-        
+
         ret = 0;
         if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
             ret = xmlSecOpenSSLX509CertificateNodeRead(data, cur, keyInfoCtx);
@@ -944,14 +944,14 @@ xmlSecOpenSSLX509DataNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyI
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "read node failed");
-            return(-1);  
-        }       
+            return(-1);
+        }
     }
     return(0);
 }
 
 static int
-xmlSecOpenSSLX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {  
+xmlSecOpenSSLX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlChar *content;
     X509* cert;
     int ret;
@@ -985,8 +985,8 @@ xmlSecOpenSSLX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xml
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFree(content);
         return(-1);
-    }    
-    
+    }
+
     ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -998,22 +998,22 @@ xmlSecOpenSSLX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xml
         xmlFree(content);
         return(-1);
     }
-     
+
     xmlFree(content);
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLX509CertificateNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlChar* buf;
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(cert != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
-    
+
     /* set base64 lines size from context */
-    buf = xmlSecOpenSSLX509CertBase64DerWrite(cert, keyInfoCtx->base64LineSize); 
+    buf = xmlSecOpenSSLX509CertBase64DerWrite(cert, keyInfoCtx->base64LineSize);
     if(buf == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1022,7 +1022,7 @@ xmlSecOpenSSLX509CertificateNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInfo
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     cur = xmlSecAddChild(node, xmlSecNodeX509Certificate, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1032,7 +1032,7 @@ xmlSecOpenSSLX509CertificateNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInfo
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
         xmlFree(buf);
-        return(-1);     
+        return(-1);
     }
 
     /* todo: add \n around base64 data - from context */
@@ -1043,14 +1043,14 @@ xmlSecOpenSSLX509CertificateNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInfo
     return(0);
 }
 
-static int              
-xmlSecOpenSSLX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {  
+static int
+xmlSecOpenSSLX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataStorePtr x509Store;
     xmlChar* subject;
     X509* cert;
     X509* cert2;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataX509Id), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
@@ -1090,13 +1090,13 @@ xmlSecOpenSSLX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xml
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                         NULL,
                         XMLSEC_ERRORS_R_CERT_NOT_FOUND,
-                        "subject=%s", 
+                        "subject=%s",
                         xmlSecErrorsSafeString(subject));
             xmlFree(subject);
             return(-1);
         }
 
-        xmlFree(subject);       
+        xmlFree(subject);
         return(0);
     }
 
@@ -1111,7 +1111,7 @@ xmlSecOpenSSLX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xml
         xmlFree(subject);
         return(-1);
     }
-    
+
     ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert2);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1123,7 +1123,7 @@ xmlSecOpenSSLX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xml
         xmlFree(subject);
         return(-1);
     }
-    
+
     xmlFree(subject);
     return(0);
 }
@@ -1162,12 +1162,12 @@ xmlSecOpenSSLX509SubjectNameNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInfo
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataStorePtr x509Store;
     xmlNodePtr cur;
     xmlChar *issuerName;
-    xmlChar *issuerSerial;    
+    xmlChar *issuerSerial;
     X509* cert;
     X509* cert2;
     int ret;
@@ -1200,7 +1200,7 @@ xmlSecOpenSSLX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
         }
         return(0);
     }
-    
+
     /* the first is required node X509IssuerName */
     if(!xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerName, xmlSecDSigNs)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1210,7 +1210,7 @@ xmlSecOpenSSLX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
         return(-1);
-    }    
+    }
     issuerName = xmlNodeGetContent(cur);
     if(issuerName == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1221,7 +1221,7 @@ xmlSecOpenSSLX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
                     xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
         return(-1);
     }
-    cur = xmlSecGetNextElementNode(cur->next); 
+    cur = xmlSecGetNextElementNode(cur->next);
 
     /* next is required node X509SerialNumber */
     if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs)) {
@@ -1233,7 +1233,7 @@ xmlSecOpenSSLX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
                     xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
         xmlFree(issuerName);
         return(-1);
-    }    
+    }
     issuerSerial = xmlNodeGetContent(cur);
     if(issuerSerial == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1245,7 +1245,7 @@ xmlSecOpenSSLX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
         xmlFree(issuerName);
         return(-1);
     }
-    cur = xmlSecGetNextElementNode(cur->next); 
+    cur = xmlSecGetNextElementNode(cur->next);
 
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1267,7 +1267,7 @@ xmlSecOpenSSLX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
                         NULL,
                         XMLSEC_ERRORS_R_CERT_NOT_FOUND,
                         "issuerName=%s;issuerSerial=%s",
-                        xmlSecErrorsSafeString(issuerName), 
+                        xmlSecErrorsSafeString(issuerName),
                         xmlSecErrorsSafeString(issuerSerial));
             xmlFree(issuerSerial);
             xmlFree(issuerName);
@@ -1275,7 +1275,7 @@ xmlSecOpenSSLX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
         }
         xmlFree(issuerSerial);
         xmlFree(issuerName);
-        return(0);    
+        return(0);
     }
 
     cert2 = X509_dup(cert);
@@ -1302,7 +1302,7 @@ xmlSecOpenSSLX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
         xmlFree(issuerName);
         return(-1);
     }
-    
+
     xmlFree(issuerSerial);
     xmlFree(issuerName);
     return(0);
@@ -1314,7 +1314,7 @@ xmlSecOpenSSLX509IssuerSerialNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInf
     xmlNodePtr issuerNameNode;
     xmlNodePtr issuerNumberNode;
     xmlChar* buf;
-    
+
     xmlSecAssert2(cert != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
@@ -1381,14 +1381,14 @@ xmlSecOpenSSLX509IssuerSerialNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInf
 }
 
 
-static int 
+static int
 xmlSecOpenSSLX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlSecKeyDataStorePtr x509Store;
     xmlChar* ski;
     X509* cert;
     X509* cert2;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataX509Id), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
@@ -1403,7 +1403,7 @@ xmlSecOpenSSLX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyIn
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ski = xmlNodeGetContent(node);
     if((ski == NULL) || (xmlSecIsEmptyString(ski) == 1)) {
         if(ski != NULL) {
@@ -1430,7 +1430,7 @@ xmlSecOpenSSLX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyIn
                         xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
                         NULL,
                         XMLSEC_ERRORS_R_CERT_NOT_FOUND,
-                        "ski=%s", 
+                        "ski=%s",
                         xmlSecErrorsSafeString(ski));
             return(-1);
         }
@@ -1459,7 +1459,7 @@ xmlSecOpenSSLX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyIn
         xmlFree(ski);
         return(-1);
     }
-    
+
     xmlFree(ski);
     return(0);
 }
@@ -1499,7 +1499,7 @@ xmlSecOpenSSLX509SKINodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInfoCtxPtr k
     return(0);
 }
 
-static int 
+static int
 xmlSecOpenSSLX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
     xmlChar *content;
     X509_CRL* crl;
@@ -1534,8 +1534,8 @@ xmlSecOpenSSLX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyIn
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFree(content);
         return(-1);
-    }    
-    
+    }
+
     ret = xmlSecOpenSSLKeyDataX509AdoptCrl(data, crl);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1547,7 +1547,7 @@ xmlSecOpenSSLX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyIn
         xmlFree(content);
         return(-1);
     }
-     
+
     xmlFree(content);
     return(0);
 }
@@ -1562,7 +1562,7 @@ xmlSecOpenSSLX509CRLNodeWrite(X509_CRL* crl, xmlNodePtr node, xmlSecKeyInfoCtxPt
     xmlSecAssert2(keyInfoCtx != NULL, -1);
 
     /* set base64 lines size from context */
-    buf = xmlSecOpenSSLX509CrlBase64DerWrite(crl, keyInfoCtx->base64LineSize); 
+    buf = xmlSecOpenSSLX509CrlBase64DerWrite(crl, keyInfoCtx->base64LineSize);
     if(buf == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1598,7 +1598,7 @@ xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
     xmlSecOpenSSLX509DataCtxPtr ctx;
     xmlSecKeyDataStorePtr x509Store;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecOpenSSLKeyDataX509Id), -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(keyInfoCtx != NULL, -1);
@@ -1619,11 +1619,11 @@ xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
 
     if((ctx->keyCert == NULL) && (ctx->certsList != NULL) && (xmlSecKeyGetValue(key) == NULL)) {
         X509* cert;
-        
+
         cert = xmlSecOpenSSLX509StoreVerify(x509Store, ctx->certsList, ctx->crlsList, keyInfoCtx);
         if(cert != NULL) {
             xmlSecKeyDataPtr keyValue;
-            
+
             ctx->keyCert = X509_dup(cert);
             if(ctx->keyCert == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1633,7 +1633,7 @@ xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-        
+
             keyValue = xmlSecOpenSSLX509CertGetKey(ctx->keyCert);
             if(keyValue == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1643,7 +1643,7 @@ xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-            
+
             /* verify that the key matches our expectations */
             if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), keyValue) != 1) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1653,8 +1653,8 @@ xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
                             XMLSEC_ERRORS_NO_MESSAGE);
                 xmlSecKeyDataDestroy(keyValue);
                 return(-1);
-            }   
-                
+            }
+
             ret = xmlSecKeySetValue(key, keyValue);
             if(ret < 0) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1664,8 +1664,8 @@ xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
                             XMLSEC_ERRORS_NO_MESSAGE);
                 xmlSecKeyDataDestroy(keyValue);
                 return(-1);
-            }       
-            
+            }
+
             if((X509_get_notBefore(ctx->keyCert) != NULL) && (X509_get_notAfter(ctx->keyCert) != NULL)) {
                 ret = xmlSecOpenSSLX509CertGetTime(X509_get_notBefore(ctx->keyCert), &(key->notValidBefore));
                 if(ret < 0) {
@@ -1710,32 +1710,32 @@ extern time_t timegm (struct tm *tm);
  * If you system has a native struct tm --> GMT time_t conversion function
  * (like timegm) use it instead.
  */
-static time_t 
-my_timegm(struct tm *t) {  
-    time_t tl, tb;  
-    struct tm *tg;  
+static time_t
+my_timegm(struct tm *t) {
+    time_t tl, tb;
+    struct tm *tg;
 
-    tl = mktime (t);  
+    tl = mktime (t);
     if(tl == -1) {
         t->tm_hour--;
         tl = mktime (t);
         if (tl == -1) {
             return -1;
         }
-        tl += 3600;    
-    }  
-    tg = gmtime (&tl);  
-    tg->tm_isdst = 0;  
-    tb = mktime (tg);  
+        tl += 3600;
+    }
+    tg = gmtime (&tl);
+    tg->tm_isdst = 0;
+    tb = mktime (tg);
     if (tb == -1) {
         tg->tm_hour--;
         tb = mktime (tg);
         if (tb == -1) {
             return -1;
         }
-        tb += 3600;    
-    }  
-    return (tl - (tb - tl)); 
+        tb += 3600;
+    }
+    return (tl - (tb - tl));
 }
 
 #define timegm(tm) my_timegm(tm)
@@ -1746,7 +1746,7 @@ static int
 xmlSecOpenSSLX509CertGetTime(ASN1_TIME* t, time_t* res) {
     struct tm tm;
     int offset;
-    
+
     xmlSecAssert2(t != NULL, -1);
     xmlSecAssert2(res != NULL, -1);
 
@@ -1761,15 +1761,15 @@ xmlSecOpenSSLX509CertGetTime(ASN1_TIME* t, time_t* res) {
         return(-1);
     }
 #endif /* XMLSEC_OPENSSL_096 */
-        
+
     memset(&tm, 0, sizeof(tm));
 
 #define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
     if(t->type == V_ASN1_UTCTIME) {
         xmlSecAssert2(t->length > 12, -1);
 
-        
-        /* this code is copied from OpenSSL asn1/a_utctm.c file */      
+
+        /* this code is copied from OpenSSL asn1/a_utctm.c file */
         tm.tm_year = g2(t->data);
         if(tm.tm_year < 50) {
             tm.tm_year += 100;
@@ -1783,7 +1783,7 @@ xmlSecOpenSSLX509CertGetTime(ASN1_TIME* t, time_t* res) {
             offset = 0;
         } else {
             xmlSecAssert2(t->length > 16, -1);
-            
+
             offset = g2(t->data + 13) * 60 + g2(t->data + 15);
             if(t->data[12] == '-') {
                 offset = -offset;
@@ -1792,7 +1792,7 @@ xmlSecOpenSSLX509CertGetTime(ASN1_TIME* t, time_t* res) {
         tm.tm_isdst = -1;
     } else {
         xmlSecAssert2(t->length > 14, -1);
-        
+
         tm.tm_year = g2(t->data) * 100 + g2(t->data + 2);
         tm.tm_mon  = g2(t->data + 4) - 1;
         tm.tm_mday = g2(t->data + 6);
@@ -1803,7 +1803,7 @@ xmlSecOpenSSLX509CertGetTime(ASN1_TIME* t, time_t* res) {
             offset = 0;
         } else {
             xmlSecAssert2(t->length > 18, -1);
-            
+
             offset = g2(t->data + 15) * 60 + g2(t->data + 17);
             if(t->data[14] == '-') {
                 offset = -offset;
@@ -1816,19 +1816,19 @@ xmlSecOpenSSLX509CertGetTime(ASN1_TIME* t, time_t* res) {
     return(0);
 }
 
-/** 
+/**
  * xmlSecOpenSSLX509CertGetKey:
  * @cert:               the certificate.
- * 
+ *
  * Extracts public key from the @cert.
  *
  * Returns: public key value or NULL if an error occurs.
  */
-xmlSecKeyDataPtr        
+xmlSecKeyDataPtr
 xmlSecOpenSSLX509CertGetKey(X509* cert) {
     xmlSecKeyDataPtr data;
     EVP_PKEY *pKey = NULL;
-    
+
     xmlSecAssert2(cert != NULL, NULL);
 
     pKey = X509_get_pubkey(cert);
@@ -1839,7 +1839,7 @@ xmlSecOpenSSLX509CertGetKey(X509* cert) {
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
-    }    
+    }
 
     data = xmlSecOpenSSLEvpKeyAdopt(pKey);
     if(data == NULL) {
@@ -1849,9 +1849,9 @@ xmlSecOpenSSLX509CertGetKey(X509* cert) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         EVP_PKEY_free(pKey);
-        return(NULL);       
-    }    
-    
+        return(NULL);
+    }
+
     return(data);
 }
 
@@ -1860,9 +1860,9 @@ xmlSecOpenSSLX509CertBase64DerRead(xmlChar* buf) {
     int ret;
 
     xmlSecAssert2(buf != NULL, NULL);
-    
+
     /* usual trick with base64 decoding "in-place" */
-    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf)); 
+    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1871,7 +1871,7 @@ xmlSecOpenSSLX509CertBase64DerRead(xmlChar* buf) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(xmlSecOpenSSLX509CertDerRead((xmlSecByte*)buf, ret));
 }
 
@@ -1883,7 +1883,7 @@ xmlSecOpenSSLX509CertDerRead(const xmlSecByte* buf, xmlSecSize size) {
 
     xmlSecAssert2(buf != NULL, NULL);
     xmlSecAssert2(size > 0, NULL);
-    
+
     mem = BIO_new(BIO_s_mem());
     if(mem == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1893,7 +1893,7 @@ xmlSecOpenSSLX509CertDerRead(const xmlSecByte* buf, xmlSecSize size) {
                     "BIO_s_mem");
         return(NULL);
     }
-    
+
     ret = BIO_write(mem, buf, size);
     if(ret <= 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1928,7 +1928,7 @@ xmlSecOpenSSLX509CertBase64DerWrite(X509* cert, int base64LineWrap) {
     long size;
 
     xmlSecAssert2(cert != NULL, NULL);
-        
+
     mem = BIO_new(BIO_s_mem());
     if(mem == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1942,7 +1942,7 @@ xmlSecOpenSSLX509CertBase64DerWrite(X509* cert, int base64LineWrap) {
     /* todo: add error checks */
     i2d_X509_bio(mem, cert);
     BIO_flush(mem);
-        
+
     size = BIO_get_mem_data(mem, &p);
     if((size <= 0) || (p == NULL)){
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1953,7 +1953,7 @@ xmlSecOpenSSLX509CertBase64DerWrite(X509* cert, int base64LineWrap) {
         BIO_free_all(mem);
         return(NULL);
     }
-    
+
     res = xmlSecBase64Encode(p, size, base64LineWrap);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1963,7 +1963,7 @@ xmlSecOpenSSLX509CertBase64DerWrite(X509* cert, int base64LineWrap) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         BIO_free_all(mem);
         return(NULL);
-    }    
+    }
 
     BIO_free_all(mem);
     return(res);
@@ -1974,9 +1974,9 @@ xmlSecOpenSSLX509CrlBase64DerRead(xmlChar* buf) {
     int ret;
 
     xmlSecAssert2(buf != NULL, NULL);
-    
+
     /* usual trick with base64 decoding "in-place" */
-    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf)); 
+    ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1985,7 +1985,7 @@ xmlSecOpenSSLX509CrlBase64DerRead(xmlChar* buf) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(xmlSecOpenSSLX509CrlDerRead((xmlSecByte*)buf, ret));
 }
 
@@ -1997,7 +1997,7 @@ xmlSecOpenSSLX509CrlDerRead(xmlSecByte* buf, xmlSecSize size) {
 
     xmlSecAssert2(buf != NULL, NULL);
     xmlSecAssert2(size > 0, NULL);
-    
+
     mem = BIO_new(BIO_s_mem());
     if(mem == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2007,7 +2007,7 @@ xmlSecOpenSSLX509CrlDerRead(xmlSecByte* buf, xmlSecSize size) {
                     "BIO_s_mem");
         return(NULL);
     }
-    
+
     ret = BIO_write(mem, buf, size);
     if(ret <= 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2042,7 +2042,7 @@ xmlSecOpenSSLX509CrlBase64DerWrite(X509_CRL* crl, int base64LineWrap) {
     long size;
 
     xmlSecAssert2(crl != NULL, NULL);
-        
+
     mem = BIO_new(BIO_s_mem());
     if(mem == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2056,7 +2056,7 @@ xmlSecOpenSSLX509CrlBase64DerWrite(X509_CRL* crl, int base64LineWrap) {
     /* todo: add error checks */
     i2d_X509_CRL_bio(mem, crl);
     BIO_flush(mem);
-        
+
     size = BIO_get_mem_data(mem, &p);
     if((size <= 0) || (p == NULL)){
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2067,7 +2067,7 @@ xmlSecOpenSSLX509CrlBase64DerWrite(X509_CRL* crl, int base64LineWrap) {
         BIO_free_all(mem);
         return(NULL);
     }
-    
+
     res = xmlSecBase64Encode(p, size, base64LineWrap);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2077,9 +2077,9 @@ xmlSecOpenSSLX509CrlBase64DerWrite(X509_CRL* crl, int base64LineWrap) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         BIO_free_all(mem);
         return(NULL);
-    }    
+    }
 
-    BIO_free_all(mem);    
+    BIO_free_all(mem);
     return(res);
 }
 
@@ -2137,7 +2137,7 @@ xmlSecOpenSSLASN1IntegerWrite(ASN1_INTEGER *asni) {
     xmlChar *res = NULL;
     BIGNUM *bn;
     char *p;
-    
+
     xmlSecAssert2(asni != NULL, NULL);
 
     bn = ASN1_INTEGER_to_BN(asni, NULL);
@@ -2200,7 +2200,7 @@ xmlSecOpenSSLX509SKIWrite(X509* cert) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     ext = X509_get_ext(cert, index);
     if (ext == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2233,11 +2233,11 @@ xmlSecOpenSSLX509SKIWrite(X509* cert) {
         return(NULL);
     }
     M_ASN1_OCTET_STRING_free(keyId);
-    
+
     return(res);
 }
 
-static void 
+static void
 xmlSecOpenSSLX509CertDebugDump(X509* cert, FILE* output) {
     char buf[1024];
     BIGNUM *bn = NULL;
@@ -2245,10 +2245,10 @@ xmlSecOpenSSLX509CertDebugDump(X509* cert, FILE* output) {
     xmlSecAssert(cert != NULL);
     xmlSecAssert(output != NULL);
 
-    fprintf(output, "==== Subject Name: %s\n", 
-        X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf))); 
-    fprintf(output, "==== Issuer Name: %s\n", 
-        X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf))); 
+    fprintf(output, "==== Subject Name: %s\n",
+        X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf)));
+    fprintf(output, "==== Issuer Name: %s\n",
+        X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf)));
     fprintf(output, "==== Issuer Serial: ");
     bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(cert),NULL);
     if(bn != NULL) {
@@ -2261,24 +2261,24 @@ xmlSecOpenSSLX509CertDebugDump(X509* cert, FILE* output) {
 }
 
 
-static void 
+static void
 xmlSecOpenSSLX509CertDebugXmlDump(X509* cert, FILE* output) {
     char buf[1024];
     BIGNUM *bn = NULL;
 
     xmlSecAssert(cert != NULL);
     xmlSecAssert(output != NULL);
-    
+
     fprintf(output, "<SubjectName>");
-    xmlSecPrintXmlString(output, 
+    xmlSecPrintXmlString(output,
         BAD_CAST X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf))
     );
     fprintf(output, "</SubjectName>\n");
-    
-    
+
+
     fprintf(output, "<IssuerName>");
-    xmlSecPrintXmlString(output, 
-        BAD_CAST X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf))); 
+    xmlSecPrintXmlString(output,
+        BAD_CAST X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf)));
     fprintf(output, "</IssuerName>\n");
 
     fprintf(output, "<SerialNumber>");
@@ -2309,12 +2309,12 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataRawX509CertKlass = {
 
     /* data */
     xmlSecNameRawX509Cert,
-    xmlSecKeyDataUsageRetrievalMethodNodeBin, 
+    xmlSecKeyDataUsageRetrievalMethodNodeBin,
                                                 /* xmlSecKeyDataUsage usage; */
     xmlSecHrefRawX509Cert,                      /* const xmlChar* href; */
     NULL,                                       /* const xmlChar* dataNodeName; */
     xmlSecDSigNs,                               /* const xmlChar* dataNodeNs; */
-    
+
     /* constructors/destructor */
     NULL,                                       /* xmlSecKeyDataInitializeMethod initialize; */
     NULL,                                       /* xmlSecKeyDataDuplicateMethod duplicate; */
@@ -2324,7 +2324,7 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataRawX509CertKlass = {
     /* get info */
     NULL,                                       /* xmlSecKeyDataGetTypeMethod getType; */
     NULL,                                       /* xmlSecKeyDataGetSizeMethod getSize; */
-    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */    
+    NULL,                                       /* xmlSecKeyDataGetIdentifier getIdentifier; */
 
     /* read/write */
     NULL,                                       /* xmlSecKeyDataXmlReadMethod xmlRead; */
@@ -2343,12 +2343,12 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataRawX509CertKlass = {
 
 /**
  * xmlSecOpenSSLKeyDataRawX509CertGetKlass:
- * 
+ *
  * The raw X509 certificates key data klass.
  *
  * Returns: raw X509 certificates key data klass.
  */
-xmlSecKeyDataId 
+xmlSecKeyDataId
 xmlSecOpenSSLKeyDataRawX509CertGetKlass(void) {
     return(&xmlSecOpenSSLKeyDataRawX509CertKlass);
 }
@@ -2360,7 +2360,7 @@ xmlSecOpenSSLKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
     xmlSecKeyDataPtr data;
     X509* cert;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecOpenSSLKeyDataRawX509CertId, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(buf != NULL, -1);
@@ -2387,7 +2387,7 @@ xmlSecOpenSSLKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
         X509_free(cert);
         return(-1);
     }
-    
+
     ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
diff --git a/src/openssl/x509vfy.c b/src/openssl/x509vfy.c
index 668d7ad..0fbeadb 100644
--- a/src/openssl/x509vfy.c
+++ b/src/openssl/x509vfy.c
@@ -6,7 +6,7 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -42,17 +42,17 @@
  * Internal OpenSSL X509 store CTX
  *
  *************************************************************************/
-typedef struct _xmlSecOpenSSLX509StoreCtx               xmlSecOpenSSLX509StoreCtx, 
+typedef struct _xmlSecOpenSSLX509StoreCtx               xmlSecOpenSSLX509StoreCtx,
                                                         *xmlSecOpenSSLX509StoreCtxPtr;
 struct _xmlSecOpenSSLX509StoreCtx {
     X509_STORE*         xst;
     STACK_OF(X509)*     untrusted;
     STACK_OF(X509_CRL)* crls;
-    
+
 #if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
-    X509_VERIFY_PARAM * vpm;        
+    X509_VERIFY_PARAM * vpm;
 #endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
-};          
+};
 
 /****************************************************************************
  *
@@ -66,7 +66,7 @@ struct _xmlSecOpenSSLX509StoreCtx {
                                     sizeof(xmlSecKeyDataStoreKlass)))
 #define xmlSecOpenSSLX509StoreSize      \
     (sizeof(xmlSecKeyDataStoreKlass) + sizeof(xmlSecOpenSSLX509StoreCtx))
- 
+
 static int              xmlSecOpenSSLX509StoreInitialize        (xmlSecKeyDataStorePtr store);
 static void             xmlSecOpenSSLX509StoreFinalize          (xmlSecKeyDataStorePtr store);
 
@@ -75,8 +75,8 @@ static xmlSecKeyDataStoreKlass xmlSecOpenSSLX509StoreKlass = {
     xmlSecOpenSSLX509StoreSize,
 
     /* data */
-    xmlSecNameX509Store,                        /* const xmlChar* name; */ 
-        
+    xmlSecNameX509Store,                        /* const xmlChar* name; */
+
     /* constructors/destructor */
     xmlSecOpenSSLX509StoreInitialize,           /* xmlSecKeyDataStoreInitializeMethod initialize; */
     xmlSecOpenSSLX509StoreFinalize,             /* xmlSecKeyDataStoreFinalizeMethod finalize; */
@@ -86,24 +86,24 @@ static xmlSecKeyDataStoreKlass xmlSecOpenSSLX509StoreKlass = {
     NULL,                                       /* void* reserved1; */
 };
 
-static int              xmlSecOpenSSLX509VerifyCRL                      (X509_STORE* xst, 
+static int              xmlSecOpenSSLX509VerifyCRL                      (X509_STORE* xst,
                                                                          X509_CRL *crl );
 static X509*            xmlSecOpenSSLX509FindCert                       (STACK_OF(X509) *certs,
                                                                          xmlChar *subjectName,
-                                                                         xmlChar *issuerName, 
+                                                                         xmlChar *issuerName,
                                                                          xmlChar *issuerSerial,
                                                                          xmlChar *ski);
-static X509*            xmlSecOpenSSLX509FindNextChainCert              (STACK_OF(X509) *chain, 
+static X509*            xmlSecOpenSSLX509FindNextChainCert              (STACK_OF(X509) *chain,
                                                                          X509 *cert);
-static int              xmlSecOpenSSLX509VerifyCertAgainstCrls          (STACK_OF(X509_CRL) *crls, 
+static int              xmlSecOpenSSLX509VerifyCertAgainstCrls          (STACK_OF(X509_CRL) *crls,
                                                                          X509* cert);
-static X509_NAME*       xmlSecOpenSSLX509NameRead                       (xmlSecByte *str, 
+static X509_NAME*       xmlSecOpenSSLX509NameRead                       (xmlSecByte *str,
                                                                          int len);
-static int              xmlSecOpenSSLX509NameStringRead                 (xmlSecByte **str, 
-                                                                         int *strLen, 
-                                                                         xmlSecByte *res, 
-                                                                         int resLen, 
-                                                                         xmlSecByte delim, 
+static int              xmlSecOpenSSLX509NameStringRead                 (xmlSecByte **str,
+                                                                         int *strLen,
+                                                                         xmlSecByte *res,
+                                                                         int resLen,
+                                                                         xmlSecByte delim,
                                                                          int ingoreTrailingSpaces);
 static int              xmlSecOpenSSLX509NamesCompare                   (X509_NAME *a,
                                                                          X509_NAME *b);
@@ -112,14 +112,14 @@ static int              xmlSecOpenSSLX509_NAME_cmp                      (const X
 static int              xmlSecOpenSSLX509_NAME_ENTRY_cmp                (const X509_NAME_ENTRY * const *a,
                                                                          const X509_NAME_ENTRY * const *b);
 
-/** 
+/**
  * xmlSecOpenSSLX509StoreGetKlass:
- * 
+ *
  * The OpenSSL X509 certificates key data store klass.
  *
  * Returns: pointer to OpenSSL X509 certificates key data store klass.
  */
-xmlSecKeyDataStoreId 
+xmlSecKeyDataStoreId
 xmlSecOpenSSLX509StoreGetKlass(void) {
     return(&xmlSecOpenSSLX509StoreKlass);
 }
@@ -138,13 +138,13 @@ xmlSecOpenSSLX509StoreGetKlass(void) {
  * Returns: pointer to found certificate or NULL if certificate is not found
  * or an error occurs.
  */
-X509* 
+X509*
 xmlSecOpenSSLX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectName,
                                 xmlChar *issuerName, xmlChar *issuerSerial,
                                 xmlChar *ski, xmlSecKeyInfoCtx* keyInfoCtx) {
     xmlSecOpenSSLX509StoreCtxPtr ctx;
     X509* res = NULL;
-    
+
     xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecOpenSSLX509StoreId), NULL);
     xmlSecAssert2(keyInfoCtx != NULL, NULL);
 
@@ -167,8 +167,8 @@ xmlSecOpenSSLX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectName
  * Verifies @certs list.
  *
  * Returns: pointer to the first verified certificate from @certs.
- */ 
-X509*   
+ */
+X509*
 xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509* certs,
                              XMLSEC_STACK_OF_X509_CRL* crls, xmlSecKeyInfoCtx* keyInfoCtx) {
     xmlSecOpenSSLX509StoreCtxPtr ctx;
@@ -189,7 +189,7 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
     ctx = xmlSecOpenSSLX509StoreGetCtx(store);
     xmlSecAssert2(ctx != NULL, NULL);
     xmlSecAssert2(ctx->xst != NULL, NULL);
-    
+
     /* dup certs */
     certs2 = sk_X509_dup(certs);
     if(certs2 == NULL) {
@@ -203,7 +203,7 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
 
     /* add untrusted certs from the store */
     if(ctx->untrusted != NULL) {
-        for(i = 0; i < sk_X509_num(ctx->untrusted); ++i) { 
+        for(i = 0; i < sk_X509_num(ctx->untrusted); ++i) {
             ret = sk_X509_push(certs2, sk_X509_value(ctx->untrusted, i));
             if(ret < 1) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -215,7 +215,7 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
             }
         }
     }
-    
+
     /* dup crls but remove all non-verified */
     if(crls != NULL) {
         crls2 = sk_X509_CRL_dup(crls);
@@ -228,7 +228,7 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
             goto done;
         }
 
-        for(i = 0; i < sk_X509_CRL_num(crls2); ) { 
+        for(i = 0; i < sk_X509_CRL_num(crls2); ) {
             ret = xmlSecOpenSSLX509VerifyCRL(ctx->xst, sk_X509_CRL_value(crls2, i));
             if(ret == 1) {
                 ++i;
@@ -242,11 +242,11 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
                             XMLSEC_ERRORS_NO_MESSAGE);
                 goto done;
             }
-        }       
+        }
     }
-    
+
     /* remove all revoked certs */
-    for(i = 0; i < sk_X509_num(certs2);) { 
+    for(i = 0; i < sk_X509_num(certs2);) {
         cert = sk_X509_value(certs2, i);
 
         if(crls2 != NULL) {
@@ -262,7 +262,7 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
                             XMLSEC_ERRORS_NO_MESSAGE);
                 goto done;
             }
-        }                   
+        }
 
         if(ctx->crls != NULL) {
             ret = xmlSecOpenSSLX509VerifyCertAgainstCrls(ctx->crls, cert);
@@ -279,16 +279,16 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
             }
         }
         ++i;
-    }   
+    }
 
     /* get one cert after another and try to verify */
-    for(i = 0; i < sk_X509_num(certs2); ++i) { 
+    for(i = 0; i < sk_X509_num(certs2); ++i) {
         cert = sk_X509_value(certs2, i);
         if(xmlSecOpenSSLX509FindNextChainCert(certs2, cert) == NULL) {
-            X509_STORE_CTX xsc; 
+            X509_STORE_CTX xsc;
 
 #if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
-            X509_VERIFY_PARAM * vpm = NULL;         
+            X509_VERIFY_PARAM * vpm = NULL;
             unsigned long vpm_flags = 0;
 
             vpm = X509_VERIFY_PARAM_new();
@@ -306,14 +306,14 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
 */
             vpm_flags &= (~X509_V_FLAG_CRL_CHECK);
 
-            X509_VERIFY_PARAM_set_depth(vpm, 9);  
+            X509_VERIFY_PARAM_set_depth(vpm, 9);
             X509_VERIFY_PARAM_set_flags(vpm, vpm_flags);
 #endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
-    
+
 
             X509_STORE_CTX_init (&xsc, ctx->xst, cert, certs2);
 
-            if(keyInfoCtx->certsVerificationTime > 0) { 
+            if(keyInfoCtx->certsVerificationTime > 0) {
 #if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
                 vpm_flags |= X509_V_FLAG_USE_CHECK_TIME;
                 X509_VERIFY_PARAM_set_time(vpm, keyInfoCtx->certsVerificationTime);
@@ -322,23 +322,23 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
             }
 
 #if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
-            X509_STORE_CTX_set0_param(&xsc, vpm);           
+            X509_STORE_CTX_set0_param(&xsc, vpm);
 #endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
 
-            
-            ret         = X509_verify_cert(&xsc); 
+
+            ret         = X509_verify_cert(&xsc);
             err_cert    = X509_STORE_CTX_get_current_cert(&xsc);
             err         = X509_STORE_CTX_get_error(&xsc);
             depth       = X509_STORE_CTX_get_error_depth(&xsc);
-            
-            X509_STORE_CTX_cleanup (&xsc);  
-            
+
+            X509_STORE_CTX_cleanup (&xsc);
+
             if(ret == 1) {
                 res = cert;
                 goto done;
             } else if(ret < 0) {
                 const char* err_msg;
-                
+
                 buf[0] = '\0';
                 X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof buf);
                 err_msg = X509_verify_cert_error_string(err);
@@ -346,14 +346,14 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
                             xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
                             "X509_verify_cert",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                            "subj=%s;err=%d;msg=%s", 
+                            "subj=%s;err=%d;msg=%s",
                             xmlSecErrorsSafeString(buf),
-                            err, 
+                            err,
                             xmlSecErrorsSafeString(err_msg));
                 goto done;
             } else if(ret == 0) {
                 const char* err_msg;
-                
+
                 buf[0] = '\0';
                 X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof buf);
                 err_msg = X509_verify_cert_error_string(err);
@@ -361,9 +361,9 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
                             xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
                             "X509_verify_cert",
                             XMLSEC_ERRORS_R_CRYPTO_FAILED,
-                            "subj=%s;err=%d;msg=%s", 
+                            "subj=%s;err=%d;msg=%s",
                             xmlSecErrorsSafeString(buf),
-                            err, 
+                            err,
                             xmlSecErrorsSafeString(err_msg));
             }
         }
@@ -381,8 +381,8 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
                         xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
                         NULL,
                         XMLSEC_ERRORS_R_CERT_ISSUER_FAILED,
-                        "err=%d;msg=%s;issuer=%s", 
-                        err, 
+                        "err=%d;msg=%s;issuer=%s",
+                        err,
                         xmlSecErrorsSafeString(err_msg),
                         xmlSecErrorsSafeString(buf));
             break;
@@ -404,17 +404,17 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
                         "err=%d;msg=%s", err,
                         xmlSecErrorsSafeString(err_msg));
             break;
-        default:                        
+        default:
             xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
                         NULL,
                         XMLSEC_ERRORS_R_CERT_VERIFY_FAILED,
                         "err=%d;msg=%s", err,
                         xmlSecErrorsSafeString(err_msg));
-        }                   
+        }
     }
-    
-done:    
+
+done:
     if(certs2 != NULL) {
         sk_X509_free(certs2);
     }
@@ -434,11 +434,11 @@ done:
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecOpenSSLX509StoreAdoptCert(xmlSecKeyDataStorePtr store, X509* cert, xmlSecKeyDataType type) {
     xmlSecOpenSSLX509StoreCtxPtr ctx;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecOpenSSLX509StoreId), -1);
     xmlSecAssert2(cert != NULL, -1);
 
@@ -484,11 +484,11 @@ xmlSecOpenSSLX509StoreAdoptCert(xmlSecKeyDataStorePtr store, X509* cert, xmlSecK
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecOpenSSLX509StoreAdoptCrl(xmlSecKeyDataStorePtr store, X509_CRL* crl) {
     xmlSecOpenSSLX509StoreCtxPtr ctx;
     int ret;
-    
+
     xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecOpenSSLX509StoreId), -1);
     xmlSecAssert2(crl != NULL, -1);
 
@@ -519,7 +519,7 @@ xmlSecOpenSSLX509StoreAdoptCrl(xmlSecKeyDataStorePtr store, X509_CRL* crl) {
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecOpenSSLX509StoreAddCertsPath(xmlSecKeyDataStorePtr store, const char *path) {
     xmlSecOpenSSLX509StoreCtxPtr ctx;
     X509_LOOKUP *lookup = NULL;
@@ -530,7 +530,7 @@ xmlSecOpenSSLX509StoreAddCertsPath(xmlSecKeyDataStorePtr store, const char *path
     ctx = xmlSecOpenSSLX509StoreGetCtx(store);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->xst != NULL, -1);
-    
+
     lookup = X509_STORE_add_lookup(ctx->xst, X509_LOOKUP_hash_dir());
     if(lookup == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -539,7 +539,7 @@ xmlSecOpenSSLX509StoreAddCertsPath(xmlSecKeyDataStorePtr store, const char *path
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
     if(!X509_LOOKUP_add_dir(lookup, path, X509_FILETYPE_PEM)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
@@ -601,7 +601,7 @@ static int
 xmlSecOpenSSLX509StoreInitialize(xmlSecKeyDataStorePtr store) {
     const xmlChar* path;
     X509_LOOKUP *lookup = NULL;
-    
+
     xmlSecOpenSSLX509StoreCtxPtr ctx;
     xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecOpenSSLX509StoreId), -1);
 
@@ -619,7 +619,7 @@ xmlSecOpenSSLX509StoreInitialize(xmlSecKeyDataStorePtr store) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     if(!X509_STORE_set_default_paths(ctx->xst)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
@@ -628,8 +628,8 @@ xmlSecOpenSSLX509StoreInitialize(xmlSecKeyDataStorePtr store) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
-        
+
+
     lookup = X509_STORE_add_lookup(ctx->xst, X509_LOOKUP_hash_dir());
     if(lookup == NULL) {
          xmlSecError(XMLSEC_ERRORS_HERE,
@@ -638,7 +638,7 @@ xmlSecOpenSSLX509StoreInitialize(xmlSecKeyDataStorePtr store) {
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
          return(-1);
-    }    
+    }
 
     path = xmlSecOpenSSLGetDefaultTrustedCertsFolder();
     if(path != NULL) {
@@ -651,7 +651,7 @@ xmlSecOpenSSLX509StoreInitialize(xmlSecKeyDataStorePtr store) {
                     xmlSecErrorsSafeString(path)
             );
             return(-1);
-        }    
+        }
     } else {
         if(!X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -661,7 +661,7 @@ xmlSecOpenSSLX509StoreInitialize(xmlSecKeyDataStorePtr store) {
                     XMLSEC_ERRORS_NO_MESSAGE
             );
             return(-1);
-        }    
+        }
     }
 
     ctx->untrusted = sk_X509_new_null();
@@ -672,7 +672,7 @@ xmlSecOpenSSLX509StoreInitialize(xmlSecKeyDataStorePtr store) {
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
 
     ctx->crls = sk_X509_CRL_new_null();
     if(ctx->crls == NULL) {
@@ -682,8 +682,8 @@ xmlSecOpenSSLX509StoreInitialize(xmlSecKeyDataStorePtr store) {
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
-    
+    }
+
 #if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
     ctx->vpm = X509_VERIFY_PARAM_new();
     if(ctx->vpm == NULL) {
@@ -693,15 +693,15 @@ xmlSecOpenSSLX509StoreInitialize(xmlSecKeyDataStorePtr store) {
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
-    X509_VERIFY_PARAM_set_depth(ctx->vpm, 9); /* the default cert verification path in openssl */       
+    }
+    X509_VERIFY_PARAM_set_depth(ctx->vpm, 9); /* the default cert verification path in openssl */
     X509_STORE_set1_param(ctx->xst, ctx->vpm);
-    
+
 #else  /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
-    ctx->xst->depth = 9; /* the default cert verification path in openssl */    
+    ctx->xst->depth = 9; /* the default cert verification path in openssl */
 #endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
 
-    return(0);    
+    return(0);
 }
 
 static void
@@ -711,7 +711,7 @@ xmlSecOpenSSLX509StoreFinalize(xmlSecKeyDataStorePtr store) {
 
     ctx = xmlSecOpenSSLX509StoreGetCtx(store);
     xmlSecAssert(ctx != NULL);
-    
+
 
     if(ctx->xst != NULL) {
         X509_STORE_free(ctx->xst);
@@ -739,16 +739,16 @@ xmlSecOpenSSLX509StoreFinalize(xmlSecKeyDataStorePtr store) {
  *****************************************************************************/
 static int
 xmlSecOpenSSLX509VerifyCRL(X509_STORE* xst, X509_CRL *crl ) {
-    X509_STORE_CTX xsc; 
+    X509_STORE_CTX xsc;
     X509_OBJECT xobj;
     EVP_PKEY *pkey;
-    int ret;  
+    int ret;
 
     xmlSecAssert2(xst != NULL, -1);
     xmlSecAssert2(crl != NULL, -1);
-    
+
     X509_STORE_CTX_init(&xsc, xst, NULL, NULL);
-    ret = X509_STORE_get_by_subject(&xsc, X509_LU_X509, 
+    ret = X509_STORE_get_by_subject(&xsc, X509_LU_X509,
                                     X509_CRL_get_issuer(crl), &xobj);
     if(ret <= 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -769,7 +769,7 @@ xmlSecOpenSSLX509VerifyCRL(X509_STORE* xst, X509_CRL *crl ) {
         return(-1);
     }
     ret = X509_CRL_verify(crl, pkey);
-    EVP_PKEY_free(pkey);    
+    EVP_PKEY_free(pkey);
     if(ret != 1) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -777,11 +777,11 @@ xmlSecOpenSSLX509VerifyCRL(X509_STORE* xst, X509_CRL *crl ) {
                     XMLSEC_ERRORS_R_CRYPTO_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
     }
-    X509_STORE_CTX_cleanup (&xsc);  
+    X509_STORE_CTX_cleanup (&xsc);
     return((ret == 1) ? 1 : 0);
 }
 
-static X509*            
+static X509*
 xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
                         xmlChar *issuerName, xmlChar *issuerSerial,
                         xmlChar *ski) {
@@ -789,7 +789,7 @@ xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
     int i;
 
     xmlSecAssert2(certs != NULL, NULL);
-    
+
     /* todo: may be this is not the fastest way to search certs */
     if(subjectName != NULL) {
         X509_NAME *nm;
@@ -801,9 +801,9 @@ xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
                         NULL,
                         "xmlSecOpenSSLX509NameRead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "subject=%s", 
+                        "subject=%s",
                         xmlSecErrorsSafeString(subjectName));
-            return(NULL);    
+            return(NULL);
         }
 
         for(i = 0; i < sk_X509_num(certs); ++i) {
@@ -812,7 +812,7 @@ xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
             if(xmlSecOpenSSLX509NamesCompare(nm, subj) == 0) {
                 X509_NAME_free(nm);
                 return(cert);
-            }       
+            }
         }
         X509_NAME_free(nm);
     } else if((issuerName != NULL) && (issuerSerial != NULL)) {
@@ -827,11 +827,11 @@ xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
                         NULL,
                         "xmlSecOpenSSLX509NameRead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "issuer=%s", 
+                        "issuer=%s",
                         xmlSecErrorsSafeString(issuerName));
-            return(NULL);    
+            return(NULL);
         }
-                
+
         bn = BN_new();
         if(bn == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -840,7 +840,7 @@ xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
                         XMLSEC_ERRORS_R_CRYPTO_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             X509_NAME_free(nm);
-            return(NULL);    
+            return(NULL);
         }
         if(BN_dec2bn(&bn, (char*)issuerSerial) == 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -850,9 +850,9 @@ xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
                         XMLSEC_ERRORS_NO_MESSAGE);
             BN_free(bn);
             X509_NAME_free(nm);
-            return(NULL);    
+            return(NULL);
         }
-        
+
         serial = BN_to_ASN1_INTEGER(bn, NULL);
         if(serial == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -862,22 +862,22 @@ xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
                         XMLSEC_ERRORS_NO_MESSAGE);
             BN_free(bn);
             X509_NAME_free(nm);
-            return(NULL);    
+            return(NULL);
         }
-        BN_free(bn); 
+        BN_free(bn);
 
 
         for(i = 0; i < sk_X509_num(certs); ++i) {
             cert = sk_X509_value(certs, i);
             if(ASN1_INTEGER_cmp(X509_get_serialNumber(cert), serial) != 0) {
                 continue;
-            } 
+            }
             issuer = X509_get_issuer_name(cert);
             if(xmlSecOpenSSLX509NamesCompare(nm, issuer) == 0) {
                 ASN1_INTEGER_free(serial);
                 X509_NAME_free(nm);
                 return(cert);
-            }       
+            }
         }
 
         X509_NAME_free(nm);
@@ -887,7 +887,7 @@ xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
         int index;
         X509_EXTENSION *ext;
         ASN1_OCTET_STRING *keyId;
-        
+
         /* our usual trick with base64 decode */
         len = xmlSecBase64Decode(ski, (xmlSecByte*)ski, xmlStrlen(ski));
         if(len < 0) {
@@ -895,23 +895,23 @@ xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
                         NULL,
                         "xmlSecBase64Decode",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                        "ski=%s", 
+                        "ski=%s",
                         xmlSecErrorsSafeString(ski));
-            return(NULL);       
+            return(NULL);
         }
         for(i = 0; i < sk_X509_num(certs); ++i) {
             cert = sk_X509_value(certs, i);
-            index = X509_get_ext_by_NID(cert, NID_subject_key_identifier, -1); 
+            index = X509_get_ext_by_NID(cert, NID_subject_key_identifier, -1);
             if((index >= 0)  && (ext = X509_get_ext(cert, index))) {
                 keyId = X509V3_EXT_d2i(ext);
-                if((keyId != NULL) && (keyId->length == len) && 
+                if((keyId != NULL) && (keyId->length == len) &&
                                     (memcmp(keyId->data, ski, len) == 0)) {
                     M_ASN1_OCTET_STRING_free(keyId);
                     return(cert);
                 }
                 M_ASN1_OCTET_STRING_free(keyId);
             }
-        }       
+        }
     }
 
     return(NULL);
@@ -924,10 +924,10 @@ xmlSecOpenSSLX509FindNextChainCert(STACK_OF(X509) *chain, X509 *cert) {
 
     xmlSecAssert2(chain != NULL, NULL);
     xmlSecAssert2(cert != NULL, NULL);
-    
+
     certSubjHash = X509_subject_name_hash(cert);
     for(i = 0; i < sk_X509_num(chain); ++i) {
-        if((sk_X509_value(chain, i) != cert) && 
+        if((sk_X509_value(chain, i) != cert) &&
            (X509_issuer_name_hash(sk_X509_value(chain, i)) == certSubjHash)) {
 
             return(sk_X509_value(chain, i));
@@ -942,24 +942,24 @@ xmlSecOpenSSLX509VerifyCertAgainstCrls(STACK_OF(X509_CRL) *crls, X509* cert) {
     X509_CRL *crl = NULL;
     X509_REVOKED *revoked;
     int i, n;
-    int ret;  
+    int ret;
 
     xmlSecAssert2(crls != NULL, -1);
     xmlSecAssert2(cert != NULL, -1);
-    
+
     /*
      * Try to retrieve a CRL corresponding to the issuer of
-     * the current certificate 
-     */    
+     * the current certificate
+     */
     n = sk_X509_CRL_num(crls);
     for(i = 0; i < n; i++) {
         crl = sk_X509_CRL_value(crls, i);
         if(crl == NULL) {
             continue;
         }
-        
+
         issuer = X509_CRL_get_issuer(crl);
-        if(xmlSecOpenSSLX509NamesCompare(X509_CRL_get_issuer(crl), issuer) == 0) { 
+        if(xmlSecOpenSSLX509NamesCompare(X509_CRL_get_issuer(crl), issuer) == 0) {
             break;
         }
     }
@@ -968,16 +968,16 @@ xmlSecOpenSSLX509VerifyCertAgainstCrls(STACK_OF(X509_CRL) *crls, X509* cert) {
         return(1);
     }
 
-    /* 
-     * Check date of CRL to make sure it's not expired 
+    /*
+     * Check date of CRL to make sure it's not expired
      */
     ret = X509_cmp_current_time(X509_CRL_get_nextUpdate(crl));
     if (ret == 0) {
         /* crl expired */
         return(1);
     }
-    
-    /* 
+
+    /*
      * Check if the current certificate is revoked by this CRL
      */
     n = sk_X509_REVOKED_num(X509_CRL_get_REVOKED(crl));
@@ -992,7 +992,7 @@ xmlSecOpenSSLX509VerifyCertAgainstCrls(STACK_OF(X509_CRL) *crls, X509* cert) {
             return(0);
         }
     }
-    return(1);    
+    return(1);
 }
 
 static X509_NAME *
@@ -1004,7 +1004,7 @@ xmlSecOpenSSLX509NameRead(xmlSecByte *str, int len) {
     int type = MBSTRING_ASC;
 
     xmlSecAssert2(str != NULL, NULL);
-    
+
     nm = X509_NAME_new();
     if(nm == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1014,14 +1014,14 @@ xmlSecOpenSSLX509NameRead(xmlSecByte *str, int len) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     while(len > 0) {
         /* skip spaces after comma or semicolon */
         while((len > 0) && isspace(*str)) {
             ++str; --len;
         }
 
-        nameLen = xmlSecOpenSSLX509NameStringRead(&str, &len, name, sizeof(name), '=', 0);      
+        nameLen = xmlSecOpenSSLX509NameStringRead(&str, &len, name, sizeof(name), '=', 0);
         if(nameLen < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -1036,8 +1036,8 @@ xmlSecOpenSSLX509NameRead(xmlSecByte *str, int len) {
             ++str; --len;
             if((*str) == '\"') {
                 ++str; --len;
-                valueLen = xmlSecOpenSSLX509NameStringRead(&str, &len, 
-                                        value, sizeof(value), '"', 1);  
+                valueLen = xmlSecOpenSSLX509NameStringRead(&str, &len,
+                                        value, sizeof(value), '"', 1);
                 if(valueLen < 0) {
                     xmlSecError(XMLSEC_ERRORS_HERE,
                                 NULL,
@@ -1047,7 +1047,7 @@ xmlSecOpenSSLX509NameRead(xmlSecByte *str, int len) {
                     X509_NAME_free(nm);
                     return(NULL);
                 }
-                
+
                 /* skip quote */
                 if((len <= 0) || ((*str) != '\"')) {
                     xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1089,8 +1089,8 @@ xmlSecOpenSSLX509NameRead(xmlSecByte *str, int len) {
                 X509_NAME_free(nm);
                 return(NULL);
             } else {
-                valueLen = xmlSecOpenSSLX509NameStringRead(&str, &len, 
-                                        value, sizeof(value), ',', 1);  
+                valueLen = xmlSecOpenSSLX509NameStringRead(&str, &len,
+                                        value, sizeof(value), ',', 1);
                 if(valueLen < 0) {
                     xmlSecError(XMLSEC_ERRORS_HERE,
                                 NULL,
@@ -1101,39 +1101,39 @@ xmlSecOpenSSLX509NameRead(xmlSecByte *str, int len) {
                     return(NULL);
                 }
                 type = MBSTRING_ASC;
-            }                   
+            }
         } else {
             valueLen = 0;
         }
         value[valueLen] = '\0';
         if(len > 0) {
             ++str; --len;
-        }       
+        }
         X509_NAME_add_entry_by_txt(nm, (char*)name, type, value, valueLen, -1, 0);
     }
-    
+
     return(nm);
 }
 
-static int 
-xmlSecOpenSSLX509NameStringRead(xmlSecByte **str, int *strLen, 
+static int
+xmlSecOpenSSLX509NameStringRead(xmlSecByte **str, int *strLen,
                         xmlSecByte *res, int resLen,
                         xmlSecByte delim, int ingoreTrailingSpaces) {
-    xmlSecByte *p, *q, *nonSpace; 
+    xmlSecByte *p, *q, *nonSpace;
 
     xmlSecAssert2(str != NULL, -1);
     xmlSecAssert2(strLen != NULL, -1);
     xmlSecAssert2(res != NULL, -1);
-    
+
     p = (*str);
     nonSpace = q = res;
-    while(((p - (*str)) < (*strLen)) && ((*p) != delim) && ((q - res) < resLen)) { 
+    while(((p - (*str)) < (*strLen)) && ((*p) != delim) && ((q - res) < resLen)) {
         if((*p) != '\\') {
-            if(ingoreTrailingSpaces && !isspace(*p)) nonSpace = q;      
+            if(ingoreTrailingSpaces && !isspace(*p)) nonSpace = q;
             *(q++) = *(p++);
         } else {
             ++p;
-            nonSpace = q;    
+            nonSpace = q;
             if(xmlSecIsHex((*p))) {
                 if((p - (*str) + 1) >= (*strLen)) {
                     xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1154,9 +1154,9 @@ xmlSecOpenSSLX509NameStringRead(xmlSecByte **str, int *strLen,
                                 "escaped symbol missed");
                     return(-1);
                 }
-                *(q++) = *(p++); 
+                *(q++) = *(p++);
             }
-        }           
+        }
     }
     if(((p - (*str)) < (*strLen)) && ((*p) != delim)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1178,26 +1178,26 @@ int xmlSecOpenSSLX509_NAME_cmp(const X509_NAME * a, const X509_NAME * b) {
 
     xmlSecAssert2(a != NULL, -1);
     xmlSecAssert2(b != NULL, 1);
-        
+
     if (sk_X509_NAME_ENTRY_num(a->entries) != sk_X509_NAME_ENTRY_num(b->entries)) {
         return sk_X509_NAME_ENTRY_num(a->entries) - sk_X509_NAME_ENTRY_num(b->entries);
     }
-        
+
     for (i=sk_X509_NAME_ENTRY_num(a->entries)-1; i>=0; i--) {
         na=sk_X509_NAME_ENTRY_value(a->entries,i);
         nb=sk_X509_NAME_ENTRY_value(b->entries,i);
-        
+
         ret = xmlSecOpenSSLX509_NAME_ENTRY_cmp(&na, &nb);
         if(ret != 0) {
             return(ret);
         }
-    }   
+    }
 
     return(0);
 }
 
 
-/** 
+/**
  * xmlSecOpenSSLX509NamesCompare:
  *
  * We have to sort X509_NAME entries to get correct results.
@@ -1208,10 +1208,10 @@ xmlSecOpenSSLX509NamesCompare(X509_NAME *a, X509_NAME *b) {
     X509_NAME *a1 = NULL;
     X509_NAME *b1 = NULL;
     int ret;
-    
-    xmlSecAssert2(a != NULL, -1);    
-    xmlSecAssert2(b != NULL, 1);    
-    
+
+    xmlSecAssert2(a != NULL, -1);
+    xmlSecAssert2(b != NULL, 1);
+
     a1 = X509_NAME_dup(a);
     if(a1 == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1230,7 +1230,7 @@ xmlSecOpenSSLX509NamesCompare(X509_NAME *a, X509_NAME *b) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(1);
     }
-        
+
     /* sort both */
     sk_X509_NAME_ENTRY_set_cmp_func(a1->entries, xmlSecOpenSSLX509_NAME_ENTRY_cmp);
     sk_X509_NAME_ENTRY_sort(a1->entries);
@@ -1246,29 +1246,29 @@ xmlSecOpenSSLX509NamesCompare(X509_NAME *a, X509_NAME *b) {
     return(ret);
 }
 
-static int 
+static int
 xmlSecOpenSSLX509_NAME_ENTRY_cmp(const X509_NAME_ENTRY * const *a, const X509_NAME_ENTRY * const *b) {
     int ret;
-    
+
     xmlSecAssert2(a != NULL, -1);
     xmlSecAssert2(b != NULL, 1);
     xmlSecAssert2((*a) != NULL, -1);
     xmlSecAssert2((*b) != NULL, 1);
 
-    /* first compare values */    
+    /* first compare values */
     if(((*a)->value == NULL) && ((*b)->value != NULL)) {
         return(-1);
     } else if(((*a)->value != NULL) && ((*b)->value == NULL)) {
         return(1);
     } else if(((*a)->value == NULL) && ((*b)->value == NULL)) {
         return(0);
-    }   
-    
+    }
+
     ret = (*a)->value->length - (*b)->value->length;
     if(ret != 0) {
         return(ret);
     }
-                
+
     ret = memcmp((*a)->value->data, (*b)->value->data, (*a)->value->length);
     if(ret != 0) {
         return(ret);
diff --git a/src/parser.c b/src/parser.c
index 399b160..fdb99c5 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * XML Parser transform and utility functions.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -29,34 +29,34 @@
  * Internal parser
  *
  *****************************************************************************/
-typedef struct _xmlSecParserCtx                                 xmlSecParserCtx, 
+typedef struct _xmlSecParserCtx                                 xmlSecParserCtx,
                                                                 *xmlSecParserCtxPtr;
 struct _xmlSecParserCtx {
     xmlParserCtxtPtr    parserCtx;
-};          
+};
 
 /**************************************************************************
  *
- * XML Parser transform 
+ * XML Parser transform
  *
  * xmlSecParserCtx is located after xmlSecTransform
- * 
+ *
  ***************************************************************************/
 #define xmlSecParserSize        \
-    (sizeof(xmlSecTransform) + sizeof(xmlSecParserCtx)) 
+    (sizeof(xmlSecTransform) + sizeof(xmlSecParserCtx))
 #define xmlSecParserGetCtx(transform) \
     ((xmlSecTransformCheckSize((transform), xmlSecParserSize)) ? \
         ((xmlSecParserCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform))) : \
-        (xmlSecParserCtxPtr)NULL)           
+        (xmlSecParserCtxPtr)NULL)
 
 static int              xmlSecParserInitialize                  (xmlSecTransformPtr transform);
 static void             xmlSecParserFinalize                    (xmlSecTransformPtr transform);
-static int              xmlSecParserPushBin                     (xmlSecTransformPtr transform, 
+static int              xmlSecParserPushBin                     (xmlSecTransformPtr transform,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
                                                                  int final,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int              xmlSecParserPopXml                      (xmlSecTransformPtr transform, 
+static int              xmlSecParserPopXml                      (xmlSecTransformPtr transform,
                                                                  xmlSecNodeSetPtr* nodes,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
@@ -68,7 +68,7 @@ static xmlSecTransformKlass xmlSecParserKlass = {
     BAD_CAST "xml-parser",                      /* const xmlChar* name; */
     NULL,                                       /* const xmlChar* href; */
     xmlSecTransformUsageDSigTransform,          /* xmlSecTransformUsage usage; */
-    
+
     xmlSecParserInitialize,                     /* xmlSecTransformInitializeMethod initialize; */
     xmlSecParserFinalize,                       /* xmlSecTransformFinalizeMethod finalize; */
     NULL,                                       /* xmlSecTransformNodeReadMethod readNode; */
@@ -94,21 +94,21 @@ static xmlSecTransformKlass xmlSecParserKlass = {
  *
  * Returns: XML parser transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformXmlParserGetKlass(void) {
     return(&xmlSecParserKlass);
 }
 
-static int 
-xmlSecParserInitialize(xmlSecTransformPtr transform) {    
+static int
+xmlSecParserInitialize(xmlSecTransformPtr transform) {
     xmlSecParserCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXmlParserId), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecParserSize), -1);
 
     ctx = xmlSecParserGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     /* initialize context */
     memset(ctx, 0, sizeof(xmlSecParserCtx));
     return(0);
@@ -123,19 +123,19 @@ xmlSecParserFinalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecParserGetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     if(ctx->parserCtx != NULL) {
         xmlFreeParserCtxt(ctx->parserCtx);
     }
     memset(ctx, 0, sizeof(xmlSecParserCtx));
 }
 
-static int 
+static int
 xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
                                 xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
     xmlSecParserCtxPtr ctx;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXmlParserId), -1);
     xmlSecAssert2(transformCtx != NULL, -1);
 
@@ -145,7 +145,7 @@ xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
     /* check/update current transform status */
     if(transform->status == xmlSecTransformStatusNone) {
         xmlSecAssert2(ctx->parserCtx == NULL, -1);
-        
+
         ctx->parserCtx = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
         if(ctx->parserCtx == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -157,14 +157,14 @@ xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
         }
 
         /* required for c14n! */
-        ctx->parserCtx->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; 
+        ctx->parserCtx->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
         ctx->parserCtx->replaceEntities = 1;
 
         transform->status = xmlSecTransformStatusWorking;
     } else if(transform->status == xmlSecTransformStatusFinished) {
         return(0);
     } else if(transform->status != xmlSecTransformStatusWorking) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -173,7 +173,7 @@ xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
     }
     xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1);
     xmlSecAssert2(ctx->parserCtx != NULL, -1);
-    
+
     /* push data to the input buffer */
     if((data != NULL) && (dataSize > 0)) {
         ret = xmlParseChunk(ctx->parserCtx, (const char*)data, dataSize, 0);
@@ -184,9 +184,9 @@ xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
                         XMLSEC_ERRORS_R_XML_FAILED,
                         "size=%d", dataSize);
             return(-1);
-        }       
-    }    
-    
+        }
+    }
+
     /* finish parsing and push to next in the chain */
     if(final != 0) {
         ret = xmlParseChunk(ctx->parserCtx, NULL, 0, 1);
@@ -197,10 +197,10 @@ xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
                         XMLSEC_ERRORS_R_XML_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
+        }
 
         /* todo: check that document is well formed? */
-        transform->outNodes = xmlSecNodeSetCreate(ctx->parserCtx->myDoc, 
+        transform->outNodes = xmlSecNodeSetCreate(ctx->parserCtx->myDoc,
                                                   NULL, xmlSecNodeSetTree);
         if(transform->outNodes == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -214,7 +214,7 @@ xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
         }
         xmlSecNodeSetDocDestroy(transform->outNodes); /* this node set "owns" the doc pointer */
         ctx->parserCtx->myDoc = NULL;
-        
+
         /* push result to the next transform (if exist) */
         if(transform->next != NULL) {
             ret = xmlSecTransformPushXml(transform->next, transform->outNodes, transformCtx);
@@ -226,15 +226,15 @@ xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-        }        
-        
+        }
+
         transform->status = xmlSecTransformStatusFinished;
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
                                xmlSecTransformCtxPtr transformCtx) {
     xmlSecParserCtxPtr ctx;
@@ -243,9 +243,9 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
     xmlParserCtxtPtr ctxt;
     xmlDocPtr doc;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXmlParserId), -1);
-    xmlSecAssert2(nodes != NULL, -1);    
+    xmlSecAssert2(nodes != NULL, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
 
     ctx = xmlSecParserGetCtx(transform);
@@ -263,7 +263,7 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
         (*nodes) = NULL;
         return(0);
     default:
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -271,7 +271,7 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
         return(-1);
     }
     xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1);
-    
+
     /* prepare parser context */
     if(transform->prev == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -281,7 +281,7 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
                     "prev transform is null");
         return(-1);
     }
-    
+
     buf = xmlSecTransformCreateInputBuffer(transform->prev, transformCtx);
     if(buf == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -291,7 +291,7 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ctxt = xmlNewParserCtxt();
     if (ctxt == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -302,7 +302,7 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
         xmlFreeParserInputBuffer(buf);
         return(-1);
     }
-    
+
     input = xmlNewIOInputStream(ctxt, buf, XML_CHAR_ENCODING_NONE);
     if(input == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -314,7 +314,7 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
         xmlFreeParserInputBuffer(buf);
         return(-1);
     }
-    
+
     ret = inputPush(ctxt, input);
     if(input == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -328,7 +328,7 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
     }
 
     /* required for c14n! */
-    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; 
+    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
     ctxt->replaceEntities = 1;
 
     /* finaly do the parsing */
@@ -346,11 +346,11 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
         xmlFreeParserCtxt(ctxt);
         return(-1);
     }
-    
+
     /* remember the result and free parsing context */
     doc = ctxt->myDoc;
     ctxt->myDoc = NULL;
-    xmlFreeParserCtxt(ctxt);    
+    xmlFreeParserCtxt(ctxt);
 
     /* return result to the caller */
     (*nodes) = xmlSecNodeSetCreate(doc, NULL, xmlSecNodeSetTree);
@@ -362,7 +362,7 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlFreeDoc(doc);
         return(-1);
-    }   
+    }
     xmlSecNodeSetDocDestroy((*nodes)); /* this node set "owns" the doc pointer */
     transform->status = xmlSecTransformStatusFinished;
     return(0);
@@ -374,7 +374,7 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
  *
  *************************************************************************/
 typedef struct _xmlSecExtMemoryParserCtx {
-    const xmlSecByte    *prefix; 
+    const xmlSecByte    *prefix;
     xmlSecSize                  prefixSize;
     const xmlSecByte    *buffer;
     xmlSecSize                  bufferSize;
@@ -382,11 +382,11 @@ typedef struct _xmlSecExtMemoryParserCtx {
     xmlSecSize                  postfixSize;
 } xmlSecExtMemoryParserCtx, *xmlSecExtMemoryParserCtxPtr;
 
-/** 
+/**
  * xmlSecParseFile:
  * @filename:           the filename.
  *
- * Loads XML Doc from file @filename. We need a special version because of 
+ * Loads XML Doc from file @filename. We need a special version because of
  * c14n issue. The code is copied from xmlSAXParseFileWithData() function.
  *
  * Returns: pointer to the loaded XML document or NULL if an error occurs.
@@ -396,7 +396,7 @@ xmlSecParseFile(const char *filename) {
     xmlDocPtr ret;
     xmlParserCtxtPtr ctxt;
     char *directory = NULL;
-    
+
     xmlSecAssert2(filename != NULL, NULL);
 
     xmlInitParser();
@@ -405,28 +405,28 @@ xmlSecParseFile(const char *filename) {
         return(NULL);
     }
 
-    /* todo: set directories from current doc? */    
+    /* todo: set directories from current doc? */
     if ((ctxt->directory == NULL) && (directory == NULL))
         directory = xmlParserGetDirectory(filename);
     if ((ctxt->directory == NULL) && (directory != NULL))
         ctxt->directory = (char *) xmlStrdup((xmlChar *) directory);
 
     /* required for c14n! */
-    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; 
+    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
     ctxt->replaceEntities = 1;
-    
+
     xmlParseDocument(ctxt);
 
-    if(ctxt->wellFormed) { 
+    if(ctxt->wellFormed) {
         ret = ctxt->myDoc;
     } else {
        ret = NULL;
        xmlFreeDoc(ctxt->myDoc);
        ctxt->myDoc = NULL;
     }
-    xmlFreeParserCtxt(ctxt);    
+    xmlFreeParserCtxt(ctxt);
     return(ret);
-    
+
 }
 
 /**
@@ -438,18 +438,18 @@ xmlSecParseFile(const char *filename) {
  * @postfix:            the third part of the input.
  * @postfixSize:        the size of the third part of the input.
  *
- * Loads XML Doc from 3 chunks of memory: @prefix, @buffer and @postfix. 
+ * Loads XML Doc from 3 chunks of memory: @prefix, @buffer and @postfix.
  *
  * Returns: pointer to the loaded XML document or NULL if an error occurs.
  */
 xmlDocPtr
 xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize,
-                     const xmlSecByte *buffer, xmlSecSize bufferSize, 
+                     const xmlSecByte *buffer, xmlSecSize bufferSize,
                      const xmlSecByte *postfix, xmlSecSize postfixSize) {
     xmlParserCtxtPtr ctxt = NULL;
     xmlDocPtr doc = NULL;
     int ret;
-    
+
     /* create context */
     ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
     if(ctxt == NULL) {
@@ -462,7 +462,7 @@ xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize,
     }
 
     /* required for c14n! */
-    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; 
+    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
     ctxt->replaceEntities = 1;
 
     /* prefix */
@@ -476,7 +476,7 @@ xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize,
                         "prefixSize=%d", prefixSize);
             goto done;
         }
-    }   
+    }
 
     /* buffer */
     if((buffer != NULL) && (bufferSize > 0)) {
@@ -489,7 +489,7 @@ xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize,
                         "bufferSize=%d", bufferSize);
             goto done;
         }
-    }   
+    }
 
     /* postfix */
     if((postfix != NULL) && (postfixSize > 0)) {
@@ -502,7 +502,7 @@ xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize,
                         "postfixSize=%d", postfixSize);
             goto done;
         }
-    }   
+    }
 
     /* finishing */
     ret = xmlParseChunk(ctxt, NULL, 0, 1);
@@ -513,7 +513,7 @@ xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize,
                     XMLSEC_ERRORS_R_XML_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         goto done;
-    }   
+    }
     doc = ctxt->myDoc;
 
 done:
@@ -530,7 +530,7 @@ done:
  * @size:               the input buffer size.
  * @recovery:           the flag.
  *
- * Loads XML Doc from memory. We need a special version because of 
+ * Loads XML Doc from memory. We need a special version because of
  * c14n issue. The code is copied from xmlSAXParseMemory() function.
  *
  * Returns: pointer to the loaded XML document or NULL if an error occurs.
@@ -541,7 +541,7 @@ xmlSecParseMemory(const xmlSecByte *buffer, xmlSecSize size, int recovery) {
     xmlParserCtxtPtr ctxt;
 
     xmlSecAssert2(buffer != NULL, NULL);
-    
+
     ctxt = xmlCreateMemoryParserCtxt((char*)buffer, size);
     if (ctxt == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -553,19 +553,19 @@ xmlSecParseMemory(const xmlSecByte *buffer, xmlSecSize size, int recovery) {
     }
 
     /* required for c14n! */
-    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; 
+    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
     ctxt->replaceEntities = 1;
 
     xmlParseDocument(ctxt);
 
     if((ctxt->wellFormed) || recovery) {
-        ret = ctxt->myDoc; 
+        ret = ctxt->myDoc;
     } else {
        ret = NULL;
        xmlFreeDoc(ctxt->myDoc);
        ctxt->myDoc = NULL;
     }
-    xmlFreeParserCtxt(ctxt);    
+    xmlFreeParserCtxt(ctxt);
     return(ret);
 }
 
diff --git a/src/skeleton/app.c b/src/skeleton/app.c
index c279882..15ba3cf 100644
--- a/src/skeleton/app.c
+++ b/src/skeleton/app.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -23,9 +23,9 @@
 /**
  * xmlSecSkeletonAppInit:
  * @config:             the path to Skeleton configuration (unused).
- * 
+ *
  * General crypto engine initialization. This function is used
- * by XMLSec command line utility and called before 
+ * by XMLSec command line utility and called before
  * @xmlSecInit function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -38,9 +38,9 @@ xmlSecSkeletonAppInit(const char* config ATTRIBUTE_UNUSED) {
 
 /**
  * xmlSecSkeletonAppShutdown:
- * 
+ *
  * General crypto engine shutdown. This function is used
- * by XMLSec command line utility and called after 
+ * by XMLSec command line utility and called after
  * @xmlSecShutdown function.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -48,7 +48,7 @@ xmlSecSkeletonAppInit(const char* config ATTRIBUTE_UNUSED) {
 int
 xmlSecSkeletonAppShutdown(void) {
     /* TODO: shutdown Skeleton crypto engine */
-    
+
     return(0);
 }
 
@@ -71,7 +71,7 @@ xmlSecSkeletonAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
                         void* pwdCallbackCtx) {
     xmlSecAssert2(filename != NULL, NULL);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
-    
+
     /* TODO: load key */
     xmlSecError(XMLSEC_ERRORS_HERE,
                 NULL,
@@ -119,16 +119,16 @@ xmlSecSkeletonAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlS
  *
  * Reads the certificate from $ filename and adds it to key
  * (not implemented yet).
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
-xmlSecSkeletonAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, 
+int
+xmlSecSkeletonAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
                           xmlSecKeyDataFormat format) {
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
-    
+
     /* TODO */
     xmlSecError(XMLSEC_ERRORS_HERE,
                 NULL,
@@ -146,16 +146,16 @@ xmlSecSkeletonAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
  * @format:             the certificate file format.
  *
  * Reads the certificate from memory buffer and adds it to key.
- * 
+ *
  * Returns: 0 on success or a negative value otherwise.
  */
-int             
-xmlSecSkeletonAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize, 
+int
+xmlSecSkeletonAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
                                 xmlSecKeyDataFormat format) {
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
-    
+
     /* TODO */
     xmlSecError(XMLSEC_ERRORS_HERE,
                 NULL,
@@ -180,10 +180,10 @@ xmlSecSkeletonAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
-xmlSecSkeletonAppPkcs12Load(const char *filename, 
+xmlSecKeyPtr
+xmlSecSkeletonAppPkcs12Load(const char *filename,
                           const char *pwd ATTRIBUTE_UNUSED,
-                          void* pwdCallback ATTRIBUTE_UNUSED, 
+                          void* pwdCallback ATTRIBUTE_UNUSED,
                           void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
     xmlSecAssert2(filename != NULL, NULL);
 
@@ -193,7 +193,7 @@ xmlSecSkeletonAppPkcs12Load(const char *filename,
                 "xmlSecSkeletonAppPkcs12Load",
                 XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
                 XMLSEC_ERRORS_NO_MESSAGE);
-    return(NULL); 
+    return(NULL);
 }
 
 /**
@@ -210,9 +210,9 @@ xmlSecSkeletonAppPkcs12Load(const char *filename,
  *
  * Returns: pointer to the key or NULL if an error occurs.
  */
-xmlSecKeyPtr    
+xmlSecKeyPtr
 xmlSecSkeletonAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, const char *pwd,
-                       void *pwdCallback ATTRIBUTE_UNUSED, 
+                       void *pwdCallback ATTRIBUTE_UNUSED,
                        void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
     xmlSecAssert2(data != NULL, NULL);
 
@@ -222,7 +222,7 @@ xmlSecSkeletonAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, c
                 "xmlSecSkeletonAppPkcs12Load",
                 XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
                 XMLSEC_ERRORS_NO_MESSAGE);
-    return(NULL); 
+    return(NULL);
 }
 
 
@@ -234,15 +234,15 @@ xmlSecSkeletonAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, c
  * @format:             the certificate file format.
  * @type:               the flag that indicates is the certificate in @filename
  *                      trusted or not.
- * 
+ *
  * Reads cert from @filename and adds to the list of trusted or known
  * untrusted certs in @store (not implemented yet).
  *
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecSkeletonAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename, 
-                                xmlSecKeyDataFormat format, 
+xmlSecSkeletonAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
+                                xmlSecKeyDataFormat format,
                                 xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
@@ -271,8 +271,8 @@ xmlSecSkeletonAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecSkeletonAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data, 
-                             xmlSecSize dataSize, xmlSecKeyDataFormat format, 
+xmlSecSkeletonAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
+                             xmlSecSize dataSize, xmlSecKeyDataFormat format,
                              xmlSecKeyDataType type) {
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
@@ -297,18 +297,18 @@ xmlSecSkeletonAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte
  * and a default Skeleton crypto key data stores.
  *
  * Returns: 0 on success or a negative value otherwise.
- */ 
+ */
 int
 xmlSecSkeletonAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
-    
-    /* TODO: if Skeleton crypto engine has another default 
+
+    /* TODO: if Skeleton crypto engine has another default
      * keys storage then use it!
      */
 
-    /* create simple keys store if needed */        
+    /* create simple keys store if needed */
     if(xmlSecKeysMngrGetKeysStore(mngr) == NULL) {
         xmlSecKeyStorePtr keysStore;
 
@@ -321,7 +321,7 @@ xmlSecSkeletonAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         "xmlSecSimpleKeysStoreId");
             return(-1);
         }
-        
+
         ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -330,20 +330,20 @@ xmlSecSkeletonAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecKeyStoreDestroy(keysStore);
-            return(-1);        
+            return(-1);
         }
     }
 
-    ret = xmlSecSkeletonKeysMngrInit(mngr);    
+    ret = xmlSecSkeletonKeysMngrInit(mngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecSkeletonKeysMngrInit",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1); 
+        return(-1);
     }
-    
+
     mngr->getKey = xmlSecKeysMngrGetKey;
     return(0);
 }
@@ -355,21 +355,21 @@ xmlSecSkeletonAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
  *
  * Adds @key to the keys manager @mngr created with #xmlSecSkeletonAppDefaultKeysMngrInit
  * function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecSkeletonAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
 
-    /* TODO: if Skeleton crypto engine has another default 
+    /* TODO: if Skeleton crypto engine has another default
      * keys storage then use it!
      */
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -379,7 +379,7 @@ xmlSecSkeletonAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr ke
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecSimpleKeysStoreAdoptKey(store, key);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -389,7 +389,7 @@ xmlSecSkeletonAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr ke
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -398,23 +398,23 @@ xmlSecSkeletonAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr ke
  * @mngr:               the pointer to keys manager.
  * @uri:                the uri.
  *
- * Loads XML keys file from @uri to the keys manager @mngr created 
+ * Loads XML keys file from @uri to the keys manager @mngr created
  * with #xmlSecSkeletonAppDefaultKeysMngrInit function.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecSkeletonAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(uri != NULL, -1);
 
-    /* TODO: if Skeleton crypto engine has another default 
+    /* TODO: if Skeleton crypto engine has another default
      * keys storage then use it!
      */
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -424,7 +424,7 @@ xmlSecSkeletonAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecSimpleKeysStoreLoad(store, uri, mngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -434,7 +434,7 @@ xmlSecSkeletonAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
                     "uri=%s", xmlSecErrorsSafeString(uri));
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -445,21 +445,21 @@ xmlSecSkeletonAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
  * @type:               the type of keys to save (public/private/symmetric).
  *
  * Saves keys from @mngr to  XML keys file.
- *  
+ *
  * Returns: 0 on success or a negative value otherwise.
- */ 
-int 
+ */
+int
 xmlSecSkeletonAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename, xmlSecKeyDataType type) {
     xmlSecKeyStorePtr store;
     int ret;
-    
+
     xmlSecAssert2(mngr != NULL, -1);
     xmlSecAssert2(filename != NULL, -1);
 
-    /* TODO: if Skeleton crypto engine has another default 
+    /* TODO: if Skeleton crypto engine has another default
      * keys storage then use it!
      */
-    
+
     store = xmlSecKeysMngrGetKeysStore(mngr);
     if(store == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -469,18 +469,18 @@ xmlSecSkeletonAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filenam
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecSimpleKeysStoreSave(store, filename, type);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecSimpleKeysStoreSave",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "filename=%s", 
+                    "filename=%s",
                     xmlSecErrorsSafeString(filename));
         return(-1);
     }
-    
+
     return(0);
 }
 
diff --git a/src/skeleton/crypto.c b/src/skeleton/crypto.c
index fb3ef9c..c911113 100644
--- a/src/skeleton/crypto.c
+++ b/src/skeleton/crypto.c
@@ -1,9 +1,9 @@
-/** 
+/**
  * XMLSec library
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -34,7 +34,7 @@ static xmlSecCryptoDLFunctionsPtr gXmlSecSkeletonFunctions = NULL;
 xmlSecCryptoDLFunctionsPtr
 xmlSecCryptoGetFunctions_skeleton(void) {
     static xmlSecCryptoDLFunctions functions;
-    
+
     if(gXmlSecSkeletonFunctions != NULL) {
         return(gXmlSecSkeletonFunctions);
     }
@@ -42,7 +42,7 @@ xmlSecCryptoGetFunctions_skeleton(void) {
     memset(&functions, 0, sizeof(functions));
     gXmlSecSkeletonFunctions = &functions;
 
-    /**  
+    /**
      * Crypto Init/shutdown
      */
     gXmlSecSkeletonFunctions->cryptoInit                = xmlSecSkeletonInit;
@@ -52,25 +52,25 @@ xmlSecCryptoGetFunctions_skeleton(void) {
     /**
      * Key data ids
      */
-#ifndef XMLSEC_NO_AES    
+#ifndef XMLSEC_NO_AES
     gXmlSecSkeletonFunctions->keyDataAesGetKlass        = xmlSecSkeletonKeyDataAesGetKlass;
 #endif /* XMLSEC_NO_AES */
 
-#ifndef XMLSEC_NO_DES    
+#ifndef XMLSEC_NO_DES
     gXmlSecSkeletonFunctions->keyDataDesGetKlass        = xmlSecSkeletonKeyDataDesGetKlass;
 #endif /* XMLSEC_NO_DES */
 
 #ifndef XMLSEC_NO_DSA
     gXmlSecSkeletonFunctions->keyDataDsaGetKlass        = xmlSecSkeletonKeyDataDsaGetKlass;
-#endif /* XMLSEC_NO_DSA */    
+#endif /* XMLSEC_NO_DSA */
 
 #ifndef XMLSEC_NO_GOST
     gXmlSecSkeletonFunctions->keyDataGost2001GetKlass   = xmlSecSkeletonKeyDataGost2001GetKlass;
-#endif /* XMLSEC_NO_GOST */    
+#endif /* XMLSEC_NO_GOST */
 
-#ifndef XMLSEC_NO_HMAC  
+#ifndef XMLSEC_NO_HMAC
     gXmlSecSkeletonFunctions->keyDataHmacGetKlass       = xmlSecSkeletonKeyDataHmacGetKlass;
-#endif /* XMLSEC_NO_HMAC */    
+#endif /* XMLSEC_NO_HMAC */
 
 #ifndef XMLSEC_NO_RSA
     gXmlSecSkeletonFunctions->keyDataRsaGetKlass        = xmlSecSkeletonKeyDataRsaGetKlass;
@@ -91,7 +91,7 @@ xmlSecCryptoGetFunctions_skeleton(void) {
     /**
      * Crypto transforms ids
      */
-#ifndef XMLSEC_NO_AES    
+#ifndef XMLSEC_NO_AES
     gXmlSecSkeletonFunctions->transformAes128CbcGetKlass        = xmlSecSkeletonTransformAes128CbcGetKlass;
     gXmlSecSkeletonFunctions->transformAes192CbcGetKlass        = xmlSecSkeletonTransformAes192CbcGetKlass;
     gXmlSecSkeletonFunctions->transformAes256CbcGetKlass        = xmlSecSkeletonTransformAes256CbcGetKlass;
@@ -100,7 +100,7 @@ xmlSecCryptoGetFunctions_skeleton(void) {
     gXmlSecSkeletonFunctions->transformKWAes256GetKlass         = xmlSecSkeletonTransformKWAes256GetKlass;
 #endif /* XMLSEC_NO_AES */
 
-#ifndef XMLSEC_NO_DES    
+#ifndef XMLSEC_NO_DES
     gXmlSecSkeletonFunctions->transformDes3CbcGetKlass          = xmlSecSkeletonTransformDes3CbcGetKlass;
     gXmlSecSkeletonFunctions->transformKWDes3GetKlass           = xmlSecSkeletonTransformKWDes3GetKlass;
 #endif /* XMLSEC_NO_DES */
@@ -129,17 +129,17 @@ xmlSecCryptoGetFunctions_skeleton(void) {
     gXmlSecSkeletonFunctions->transformRsaOaepGetKlass          = xmlSecSkeletonTransformRsaOaepGetKlass;
 #endif /* XMLSEC_NO_RSA */
 
-#ifndef XMLSEC_NO_SHA1    
+#ifndef XMLSEC_NO_SHA1
     gXmlSecSkeletonFunctions->transformSha1GetKlass             = xmlSecSkeletonTransformSha1GetKlass;
 #endif /* XMLSEC_NO_SHA1 */
 
-#ifndef XMLSEC_NO_GOST    
+#ifndef XMLSEC_NO_GOST
     gXmlSecSkeletonFunctions->transformGostR3411_94GetKlass             = xmlSecSkeletonTransformGostR3411_94GetKlass;
 #endif /* XMLSEC_NO_GOST */
 
     /**
      * High level routines form xmlsec command line utility
-     */ 
+     */
     gXmlSecSkeletonFunctions->cryptoAppInit                     = xmlSecSkeletonAppInit;
     gXmlSecSkeletonFunctions->cryptoAppShutdown                 = xmlSecSkeletonAppShutdown;
     gXmlSecSkeletonFunctions->cryptoAppDefaultKeysMngrInit      = xmlSecSkeletonAppDefaultKeysMngrInit;
@@ -149,13 +149,13 @@ xmlSecCryptoGetFunctions_skeleton(void) {
 #ifndef XMLSEC_NO_X509
     gXmlSecSkeletonFunctions->cryptoAppKeysMngrCertLoad         = xmlSecSkeletonAppKeysMngrCertLoad;
     gXmlSecSkeletonFunctions->cryptoAppKeysMngrCertLoadMemory   = xmlSecSkeletonAppKeysMngrCertLoadMemory;
-    gXmlSecSkeletonFunctions->cryptoAppPkcs12Load               = xmlSecSkeletonAppPkcs12Load; 
-    gXmlSecSkeletonFunctions->cryptoAppPkcs12LoadMemory         = xmlSecSkeletonAppPkcs12LoadMemory; 
+    gXmlSecSkeletonFunctions->cryptoAppPkcs12Load               = xmlSecSkeletonAppPkcs12Load;
+    gXmlSecSkeletonFunctions->cryptoAppPkcs12LoadMemory         = xmlSecSkeletonAppPkcs12LoadMemory;
     gXmlSecSkeletonFunctions->cryptoAppKeyCertLoad              = xmlSecSkeletonAppKeyCertLoad;
     gXmlSecSkeletonFunctions->cryptoAppKeyCertLoadMemory        = xmlSecSkeletonAppKeyCertLoadMemory;
 #endif /* XMLSEC_NO_X509 */
-    gXmlSecSkeletonFunctions->cryptoAppKeyLoad                  = xmlSecSkeletonAppKeyLoad; 
-    gXmlSecSkeletonFunctions->cryptoAppKeyLoadMemory            = xmlSecSkeletonAppKeyLoadMemory; 
+    gXmlSecSkeletonFunctions->cryptoAppKeyLoad                  = xmlSecSkeletonAppKeyLoad;
+    gXmlSecSkeletonFunctions->cryptoAppKeyLoadMemory            = xmlSecSkeletonAppKeyLoadMemory;
     gXmlSecSkeletonFunctions->cryptoAppDefaultPwdCallback       = (void*)xmlSecSkeletonAppGetDefaultPwdCallback();
 
     return(gXmlSecSkeletonFunctions);
@@ -164,12 +164,12 @@ xmlSecCryptoGetFunctions_skeleton(void) {
 
 /**
  * xmlSecSkeletonInit:
- * 
- * XMLSec library specific crypto engine initialization. 
+ *
+ * XMLSec library specific crypto engine initialization.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecSkeletonInit (void)  {
     /* Check loaded xmlsec library version */
     if(xmlSecCheckVersionExact() != 1) {
@@ -197,12 +197,12 @@ xmlSecSkeletonInit (void)  {
 
 /**
  * xmlSecSkeletonShutdown:
- * 
- * XMLSec library specific crypto engine shutdown. 
+ *
+ * XMLSec library specific crypto engine shutdown.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecSkeletonShutdown(void) {
     /* TODO: if necessary, do additional shutdown here */
     return(0);
diff --git a/src/skeleton/globals.h b/src/skeleton/globals.h
index 272a27b..770b6db 100644
--- a/src/skeleton/globals.h
+++ b/src/skeleton/globals.h
@@ -5,14 +5,14 @@
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #ifndef __XMLSEC_GLOBALS_H__
 #define __XMLSEC_GLOBALS_H__
 
 /**
- * Use autoconf defines if present. 
+ * Use autoconf defines if present.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/src/soap.c b/src/soap.c
index 95303ac..3757e1a 100644
--- a/src/soap.c
+++ b/src/soap.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Simple SOAP messages parsing/creation.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -14,7 +14,7 @@
 
 #include <stdlib.h>
 #include <string.h>
- 
+
 #include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
@@ -30,8 +30,8 @@
 /**
  * xmlSecSoap11CreateEnvelope:
  * @doc:        the parent doc (might be NULL).
- * 
- * Creates a new SOAP Envelope node. Caller is responsible for 
+ *
+ * Creates a new SOAP Envelope node. Caller is responsible for
  * adding the returned node to the XML document.
  *
  * XML Schema (http://schemas.xmlsoap.org/soap/envelope/):
@@ -41,7 +41,7 @@
  *         <xs:sequence>
  *             <xs:element ref="tns:Header" minOccurs="0"/>
  *             <xs:element ref="tns:Body" minOccurs="1"/>
- *             <xs:any namespace="##other" minOccurs="0" 
+ *             <xs:any namespace="##other" minOccurs="0"
  *                 maxOccurs="unbounded" processContents="lax"/>
  *         </xs:sequence>
  *         <xs:anyAttribute namespace="##other" processContents="lax"/>
@@ -50,12 +50,12 @@
  * Returns: pointer to newly created <soap:Envelope> node or NULL
  * if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap11CreateEnvelope(xmlDocPtr doc) {
     xmlNodePtr envNode;
     xmlNodePtr bodyNode;
     xmlNsPtr ns;
-    
+
     /* create Envelope node */
     envNode = xmlNewDocNode(doc, NULL, xmlSecNodeEnvelope, NULL);
     if(envNode == NULL) {
@@ -65,9 +65,9 @@ xmlSecSoap11CreateEnvelope(xmlDocPtr doc) {
                     XMLSEC_ERRORS_R_XML_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeEnvelope));
-        return(NULL);               
+        return(NULL);
     }
-    
+
     ns = xmlNewNs(envNode, xmlSecSoap11Ns, NULL) ;
     if(ns == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -77,11 +77,11 @@ xmlSecSoap11CreateEnvelope(xmlDocPtr doc) {
                     "ns=%s",
                     xmlSecErrorsSafeString(xmlSecSoap11Ns));
         xmlFreeNode(envNode);
-        return(NULL);                   
+        return(NULL);
     }
     xmlSetNs(envNode, ns);
-    
-    /* add required Body node */    
+
+    /* add required Body node */
     bodyNode = xmlSecAddChild(envNode, xmlSecNodeBody, xmlSecSoap11Ns);
     if(bodyNode == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -91,16 +91,16 @@ xmlSecSoap11CreateEnvelope(xmlDocPtr doc) {
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeBody));
         xmlFreeNode(envNode);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     return(envNode);
 }
 
 /**
  * xmlSecSoap11EnsureHeader:
  * @envNode:    the pointer to <soap:Envelope> node.
- * 
+ *
  * Gets the pointer to <soap:Header> node (if necessary, the node
  * is created).
  *
@@ -109,7 +109,7 @@ xmlSecSoap11CreateEnvelope(xmlDocPtr doc) {
  *     <xs:element name="Header" type="tns:Header"/>
  *     <xs:complexType name="Header">
  *         <xs:sequence>
- *             <xs:any namespace="##other" minOccurs="0" 
+ *             <xs:any namespace="##other" minOccurs="0"
  *                 maxOccurs="unbounded" processContents="lax"/>
  *         </xs:sequence>
  *         <xs:anyAttribute namespace="##other" processContents="lax"/>
@@ -117,11 +117,11 @@ xmlSecSoap11CreateEnvelope(xmlDocPtr doc) {
  *
  * Returns: pointer to <soap:Header> node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap11EnsureHeader(xmlNodePtr envNode) {
     xmlNodePtr hdrNode;
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(envNode != NULL, NULL);
 
     /* try to find Header node first */
@@ -137,9 +137,9 @@ xmlSecSoap11EnsureHeader(xmlNodePtr envNode) {
                     xmlSecErrorsSafeString(xmlSecNodeBody),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
-    
+
     /* finally add Header node before body */
     hdrNode = xmlSecAddPrevSibling(cur, xmlSecNodeHeader, xmlSecSoap11Ns);
     if(hdrNode == NULL) {
@@ -150,7 +150,7 @@ xmlSecSoap11EnsureHeader(xmlNodePtr envNode) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(hdrNode);
 }
 
@@ -158,7 +158,7 @@ xmlSecSoap11EnsureHeader(xmlNodePtr envNode) {
  * xmlSecSoap11AddBodyEntry:
  * @envNode:            the pointer to <soap:Envelope> node.
  * @entryNode:          the pointer to body entry node.
- * 
+ *
  * Adds a new entry to <soap:Body> node.
  *
  * Returns: pointer to the added entry (@contentNode) or NULL if an error occurs.
@@ -177,7 +177,7 @@ xmlSecSoap11AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
                     "xmlSecSoap11GetBody",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);                   
+        return(NULL);
     }
 
     return(xmlSecAddChildNode(bodyNode, entryNode));
@@ -186,7 +186,7 @@ xmlSecSoap11AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
 /**
  * xmlSecSoap11AddFaultEntry:
  * @envNode:            the pointer to <soap:Envelope> node.
- * @faultCodeHref:      the fault code QName href (must be known in th context of 
+ * @faultCodeHref:      the fault code QName href (must be known in th context of
  *                      <soap:Body> node).
  * @faultCodeLocalPart: the fault code QName LocalPart.
  * @faultString:        the human readable explanation of the fault.
@@ -208,17 +208,17 @@ xmlSecSoap11AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
  *     </xs:complexType>
  *     <xs:complexType name="detail">
  *         <xs:sequence>
- *             <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" 
+ *             <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded"
  *                 processContents="lax"/>
  *         </xs:sequence>
  *         <xs:anyAttribute namespace="##any" processContents="lax"/>
  *     </xs:complexType>
- * 
+ *
  * Returns: pointer to the added entry or NULL if an error occurs.
  */
 xmlNodePtr
-xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref, 
-                          const xmlChar* faultCodeLocalPart, 
+xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
+                          const xmlChar* faultCodeLocalPart,
                           const xmlChar* faultString, const xmlChar* faultActor) {
     xmlNodePtr bodyNode;
     xmlNodePtr faultNode;
@@ -237,9 +237,9 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
                     "xmlSecSoap11GetBody",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     /* check that we don't have Fault node already */
     faultNode = xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap11Ns);
     if(faultNode != NULL) {
@@ -248,9 +248,9 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
                     xmlSecErrorsSafeString(xmlSecNodeBody),
                     XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
-    
+
     /* add Fault node */
     faultNode = xmlSecAddChild(bodyNode, xmlSecNodeFault, xmlSecSoap11Ns);
     if(faultNode == NULL) {
@@ -260,9 +260,9 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeFault));
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     /* add faultcode node */
     cur = xmlSecAddChild(faultNode, xmlSecNodeFaultCode, xmlSecSoap11Ns);
     if(cur == NULL) {
@@ -274,9 +274,9 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
                     xmlSecErrorsSafeString(xmlSecNodeFaultCode));
         xmlUnlinkNode(faultNode);
         xmlFreeNode(faultNode);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     /* create qname for fault code */
     qname = xmlSecGetQName(cur, faultCodeHref, faultCodeLocalPart);
     if(qname == NULL) {
@@ -288,9 +288,9 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
                     xmlSecErrorsSafeString(cur->name));
         xmlUnlinkNode(faultNode);
         xmlFreeNode(faultNode);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     /* set faultcode value */
     xmlNodeSetContent(cur, qname);
     xmlFree(qname);
@@ -306,12 +306,12 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
                     xmlSecErrorsSafeString(xmlSecNodeFaultString));
         xmlUnlinkNode(faultNode);
         xmlFreeNode(faultNode);
-        return(NULL);                   
+        return(NULL);
     }
 
     /* set faultstring node */
     xmlNodeSetContent(cur, faultString);
-    
+
     if(faultActor != NULL) {
         /* add faultactor node */
         cur = xmlSecAddChild(faultNode, xmlSecNodeFaultActor, xmlSecSoap11Ns);
@@ -324,13 +324,13 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
                         xmlSecErrorsSafeString(xmlSecNodeFaultActor));
             xmlUnlinkNode(faultNode);
             xmlFreeNode(faultNode);
-            return(NULL);                       
+            return(NULL);
         }
-    
+
         /* set faultactor node */
         xmlNodeSetContent(cur, faultActor);
     }
-    
+
     return(faultNode);
 }
 
@@ -343,12 +343,12 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
  * Returns: 1 if @envNode has a valid <soap:Envelope> element, 0 if it is
  * not valid or a negative value if an error occurs.
  */
-int 
+int
 xmlSecSoap11CheckEnvelope(xmlNodePtr envNode) {
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(envNode != NULL, -1);
-    
+
     /* verify envNode itself */
     if(!xmlSecCheckNodeName(envNode, xmlSecNodeEnvelope, xmlSecSoap11Ns)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -356,7 +356,7 @@ xmlSecSoap11CheckEnvelope(xmlNodePtr envNode) {
                     xmlSecErrorsSafeString(xmlSecNodeEnvelope),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(0);      
+        return(0);
     }
 
     /* optional Header node first */
@@ -372,24 +372,24 @@ xmlSecSoap11CheckEnvelope(xmlNodePtr envNode) {
                     xmlSecErrorsSafeString(xmlSecNodeBody),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(0);      
+        return(0);
     }
-    
+
     return(1);
 }
 
 /**
  * xmlSecSoap11GetHeader:
  * @envNode:    the pointer to <soap:Envelope> node.
- * 
+ *
  * Gets pointer to the <soap:Header> node.
  *
  * Returns: pointer to <soap:Header> node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap11GetHeader(xmlNodePtr envNode) {
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(envNode != NULL, NULL);
 
     /* optional Header node is first */
@@ -404,15 +404,15 @@ xmlSecSoap11GetHeader(xmlNodePtr envNode) {
 /**
  * xmlSecSoap11GetBody:
  * @envNode:    the pointer to <soap:Envelope> node.
- * 
+ *
  * Gets pointer to the <soap:Body> node.
  *
  * Returns: pointer to <soap:Body> node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap11GetBody(xmlNodePtr envNode) {
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(envNode != NULL, NULL);
 
     /* optional Header node first */
@@ -428,7 +428,7 @@ xmlSecSoap11GetBody(xmlNodePtr envNode) {
                     xmlSecErrorsSafeString(xmlSecNodeBody),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
 
     return(cur);
@@ -442,12 +442,12 @@ xmlSecSoap11GetBody(xmlNodePtr envNode) {
  *
  * Returns: the number of body entries.
  */
-xmlSecSize 
+xmlSecSize
 xmlSecSoap11GetBodyEntriesNumber(xmlNodePtr envNode) {
     xmlSecSize number = 0;
     xmlNodePtr bodyNode;
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(envNode != NULL, 0);
 
     /* get Body node */
@@ -466,7 +466,7 @@ xmlSecSoap11GetBodyEntriesNumber(xmlNodePtr envNode) {
         number++;
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     return(number);
 }
 
@@ -474,16 +474,16 @@ xmlSecSoap11GetBodyEntriesNumber(xmlNodePtr envNode) {
  * xmlSecSoap11GetBodyEntry:
  * @envNode:    the pointer to <soap:Envelope> node.
  * @pos:        the body entry number.
- * 
+ *
  * Gets the body entry number @pos.
  *
  * Returns: pointer to body entry node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap11GetBodyEntry(xmlNodePtr envNode, xmlSecSize pos) {
     xmlNodePtr bodyNode;
     xmlNodePtr cur;
- 
+
     xmlSecAssert2(envNode != NULL, NULL);
 
     /* get Body node */
@@ -494,7 +494,7 @@ xmlSecSoap11GetBodyEntry(xmlNodePtr envNode, xmlSecSize pos) {
                     "xmlSecSoap11GetBody",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);                   
+        return(NULL);
     }
 
     cur = xmlSecGetNextElementNode(bodyNode->children);
@@ -509,12 +509,12 @@ xmlSecSoap11GetBodyEntry(xmlNodePtr envNode, xmlSecSize pos) {
 /**
  * xmlSecSoap11GetFaultEntry:
  * @envNode:    the pointer to <soap:Envelope> node.
- * 
+ *
  * Gets the Fault entry (if any).
  *
  * Returns: pointer to Fault entry or NULL if it does not exist.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap11GetFaultEntry(xmlNodePtr envNode) {
     xmlNodePtr bodyNode;
 
@@ -528,19 +528,19 @@ xmlSecSoap11GetFaultEntry(xmlNodePtr envNode) {
                     "xmlSecSoap11GetBody",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);                   
+        return(NULL);
     }
 
     return(xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap11Ns));
 }
-                                                                 
+
 
 /***********************************************************************
  *
  * SOAP 1.2
  *
  **********************************************************************/
-static const xmlSecQName2IntegerInfo gXmlSecSoap12FaultCodeInfo[] = 
+static const xmlSecQName2IntegerInfo gXmlSecSoap12FaultCodeInfo[] =
 {
     { xmlSecSoap12Ns, xmlSecSoapFaultCodeVersionMismatch,
       xmlSecSoap12FaultCodeVersionMismatch },
@@ -558,12 +558,12 @@ static const xmlSecQName2IntegerInfo gXmlSecSoap12FaultCodeInfo[] =
 /**
  * xmlSecSoap12CreateEnvelope:
  * @doc:        the parent doc (might be NULL).
- * 
- * Creates a new SOAP 1.2 Envelope node. Caller is responsible for 
+ *
+ * Creates a new SOAP 1.2 Envelope node. Caller is responsible for
  * adding the returned node to the XML document.
  *
  * XML Schema (http://www.w3.org/2003/05/soap-envelope):
- * 
+ *
  *     <xs:element name="Envelope" type="tns:Envelope"/>
  *     <xs:complexType name="Envelope">
  *         <xs:sequence>
@@ -576,12 +576,12 @@ static const xmlSecQName2IntegerInfo gXmlSecSoap12FaultCodeInfo[] =
  * Returns: pointer to newly created <soap:Envelope> node or NULL
  * if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap12CreateEnvelope(xmlDocPtr doc) {
     xmlNodePtr envNode;
     xmlNodePtr bodyNode;
     xmlNsPtr ns;
-    
+
     /* create Envelope node */
     envNode = xmlNewDocNode(doc, NULL, xmlSecNodeEnvelope, NULL);
     if(envNode == NULL) {
@@ -591,9 +591,9 @@ xmlSecSoap12CreateEnvelope(xmlDocPtr doc) {
                     XMLSEC_ERRORS_R_XML_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeEnvelope));
-        return(NULL);               
+        return(NULL);
     }
-    
+
     ns = xmlNewNs(envNode, xmlSecSoap12Ns, NULL) ;
     if(ns == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -603,11 +603,11 @@ xmlSecSoap12CreateEnvelope(xmlDocPtr doc) {
                     "ns=%s",
                     xmlSecErrorsSafeString(xmlSecSoap12Ns));
         xmlFreeNode(envNode);
-        return(NULL);                   
+        return(NULL);
     }
     xmlSetNs(envNode, ns);
-    
-    /* add required Body node */    
+
+    /* add required Body node */
     bodyNode = xmlSecAddChild(envNode, xmlSecNodeBody, xmlSecSoap12Ns);
     if(bodyNode == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -617,16 +617,16 @@ xmlSecSoap12CreateEnvelope(xmlDocPtr doc) {
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeBody));
         xmlFreeNode(envNode);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     return(envNode);
 }
 
 /**
  * xmlSecSoap12EnsureHeader:
  * @envNode:    the pointer to <soap:Envelope> node.
- * 
+ *
  * Gets the pointer to <soap:Header> node (if necessary, the node
  * is created).
  *
@@ -635,7 +635,7 @@ xmlSecSoap12CreateEnvelope(xmlDocPtr doc) {
  *     <xs:element name="Header" type="tns:Header"/>
  *     <xs:complexType name="Header">
  *         <xs:sequence>
- *             <xs:any namespace="##any" processContents="lax" 
+ *             <xs:any namespace="##any" processContents="lax"
  *                     minOccurs="0" maxOccurs="unbounded"/>
  *         </xs:sequence>
  *         <xs:anyAttribute namespace="##other" processContents="lax"/>
@@ -643,11 +643,11 @@ xmlSecSoap12CreateEnvelope(xmlDocPtr doc) {
  *
  * Returns: pointer to <soap:Header> node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap12EnsureHeader(xmlNodePtr envNode) {
     xmlNodePtr hdrNode;
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(envNode != NULL, NULL);
 
     /* try to find Header node first */
@@ -663,9 +663,9 @@ xmlSecSoap12EnsureHeader(xmlNodePtr envNode) {
                     xmlSecErrorsSafeString(xmlSecNodeBody),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
-    
+
     /* finally add Header node before body */
     hdrNode = xmlSecAddPrevSibling(cur, xmlSecNodeHeader, xmlSecSoap12Ns);
     if(hdrNode == NULL) {
@@ -676,7 +676,7 @@ xmlSecSoap12EnsureHeader(xmlNodePtr envNode) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     return(hdrNode);
 }
 
@@ -684,7 +684,7 @@ xmlSecSoap12EnsureHeader(xmlNodePtr envNode) {
  * xmlSecSoap12AddBodyEntry:
  * @envNode:            the pointer to <soap:Envelope> node.
  * @entryNode:          the pointer to body entry node.
- * 
+ *
  * Adds a new entry to <soap:Body> node.
  *
  * XML Schema (http://www.w3.org/2003/05/soap-envelope):
@@ -692,7 +692,7 @@ xmlSecSoap12EnsureHeader(xmlNodePtr envNode) {
  *     <xs:element name="Body" type="tns:Body"/>
  *     <xs:complexType name="Body">
  *         <xs:sequence>
- *             <xs:any namespace="##any" processContents="lax" 
+ *             <xs:any namespace="##any" processContents="lax"
  *                     minOccurs="0" maxOccurs="unbounded"/>
  *         </xs:sequence>
  *         <xs:anyAttribute namespace="##other" processContents="lax"/>
@@ -714,7 +714,7 @@ xmlSecSoap12AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
                     "xmlSecSoap12GetBody",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);                   
+        return(NULL);
     }
 
     return(xmlSecAddChildNode(bodyNode, entryNode));
@@ -726,9 +726,9 @@ xmlSecSoap12AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
  * @faultCode:          the fault code.
  * @faultReasonText:    the human readable explanation of the fault.
  * @faultReasonLang:    the language (xml:lang) for @faultReason string.
- * @faultNodeURI:       the more preciese information about fault source 
+ * @faultNodeURI:       the more preciese information about fault source
  *                      (might be NULL).
- * @faultRole:          the role the node was operating in at the point 
+ * @faultRole:          the role the node was operating in at the point
  *                      the fault occurred (might be NULL).
  *
  * Adds <soap:Fault> entry to the @envNode. Note that only one <soap:Fault>
@@ -746,21 +746,21 @@ xmlSecSoap12AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
  *             <xs:element name="Detail" type="tns:detail" minOccurs="0"/>
  *         </xs:sequence>
  *     </xs:complexType>
- *     
+ *
  *     <xs:complexType name="faultcode">
  *         <xs:sequence>
  *             <xs:element name="Value" type="tns:faultcodeEnum"/>
  *             <xs:element name="Subcode" type="tns:subcode" minOccurs="0"/>
  *         </xs:sequence>
  *     </xs:complexType>
- *     
+ *
  *     <xs:complexType name="faultreason">
  *         <xs:sequence>
- *             <xs:element name="Text" type="tns:reasontext" 
+ *             <xs:element name="Text" type="tns:reasontext"
  *                         minOccurs="1" maxOccurs="unbounded"/>
  *         </xs:sequence>
  *     </xs:complexType>
- *     
+ *
  *     <xs:complexType name="reasontext">
  *         <xs:simpleContent>
  *             <xs:extension base="xs:string">
@@ -768,7 +768,7 @@ xmlSecSoap12AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
  *             </xs:extension>
  *         </xs:simpleContent>
  *     </xs:complexType>
- *     
+ *
  *     <xs:simpleType name="faultcodeEnum">
  *         <xs:restriction base="xs:QName">
  *             <xs:enumeration value="tns:DataEncodingUnknown"/>
@@ -778,22 +778,22 @@ xmlSecSoap12AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
  *             <xs:enumeration value="tns:VersionMismatch"/>
  *         </xs:restriction>
  *     </xs:simpleType>
- *     
+ *
  *     <xs:complexType name="subcode">
  *         <xs:sequence>
  *             <xs:element name="Value" type="xs:QName"/>
  *             <xs:element name="Subcode" type="tns:subcode" minOccurs="0"/>
  *         </xs:sequence>
  *     </xs:complexType>
- *     
+ *
  *     <xs:complexType name="detail">
  *         <xs:sequence>
- *             <xs:any namespace="##any" processContents="lax" 
+ *             <xs:any namespace="##any" processContents="lax"
  *                 minOccurs="0" maxOccurs="unbounded"/>
  *         </xs:sequence>
  *         <xs:anyAttribute namespace="##other" processContents="lax"/>
  *     </xs:complexType>
- *     
+ *
  * Returns: pointer to the added entry or NULL if an error occurs.
  */
 xmlNodePtr
@@ -818,9 +818,9 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
                     "xmlSecSoap12GetBody",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     /* check that we don't have Fault node already */
     faultNode = xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap12Ns);
     if(faultNode != NULL) {
@@ -829,9 +829,9 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
                     xmlSecErrorsSafeString(xmlSecNodeBody),
                     XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
-    
+
     /* add Fault node */
     faultNode = xmlSecAddChild(bodyNode, xmlSecNodeFault, xmlSecSoap12Ns);
     if(faultNode == NULL) {
@@ -841,9 +841,9 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeFault));
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     /* add Code node */
     cur = xmlSecAddChild(faultNode, xmlSecNodeCode, xmlSecSoap12Ns);
     if(cur == NULL) {
@@ -855,9 +855,9 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
                     xmlSecErrorsSafeString(xmlSecNodeCode));
         xmlUnlinkNode(faultNode);
         xmlFreeNode(faultNode);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     /* write the fault code in Value child */
     ret = xmlSecQName2IntegerNodeWrite(gXmlSecSoap12FaultCodeInfo, cur,
                                        xmlSecNodeValue, xmlSecSoap12Ns,
@@ -871,7 +871,7 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
                     faultCode);
         xmlUnlinkNode(faultNode);
         xmlFreeNode(faultNode);
-        return(NULL);   
+        return(NULL);
     }
 
     /* add Reason node */
@@ -885,9 +885,9 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
                     xmlSecErrorsSafeString(xmlSecNodeReason));
         xmlUnlinkNode(faultNode);
         xmlFreeNode(faultNode);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     /* Add Reason/Text node */
     if(xmlSecSoap12AddFaultReasonText(faultNode, faultReasonText, faultReasonLang) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -898,7 +898,7 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
                     xmlSecErrorsSafeString(faultReasonText));
         xmlUnlinkNode(faultNode);
         xmlFreeNode(faultNode);
-        return(NULL);                   
+        return(NULL);
     }
 
     if(faultNodeURI != NULL) {
@@ -913,7 +913,7 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
                         xmlSecErrorsSafeString(xmlSecNodeNode));
             xmlUnlinkNode(faultNode);
             xmlFreeNode(faultNode);
-            return(NULL);                       
+            return(NULL);
         }
         xmlNodeSetContent(cur, faultNodeURI);
     }
@@ -930,11 +930,11 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
                         xmlSecErrorsSafeString(xmlSecNodeRole));
             xmlUnlinkNode(faultNode);
             xmlFreeNode(faultNode);
-            return(NULL);                       
+            return(NULL);
         }
         xmlNodeSetContent(cur, faultRole);
     }
-    
+
     return(faultNode);
 }
 
@@ -949,7 +949,7 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
  * Returns: a pointer to the newly created <Subcode> node or NULL if an error
  * occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap12AddFaultSubcode(xmlNodePtr faultNode, const xmlChar* subCodeHref, const xmlChar* subCodeName) {
     xmlNodePtr cur, subcodeNode, valueNode;
     xmlChar* qname;
@@ -992,7 +992,7 @@ xmlSecSoap12AddFaultSubcode(xmlNodePtr faultNode, const xmlChar* subCodeHref, co
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeSubcode));
-        return(NULL);                   
+        return(NULL);
     }
 
     /* add Value node */
@@ -1006,7 +1006,7 @@ xmlSecSoap12AddFaultSubcode(xmlNodePtr faultNode, const xmlChar* subCodeHref, co
                     xmlSecErrorsSafeString(xmlSecNodeValue));
         xmlUnlinkNode(subcodeNode);
         xmlFreeNode(subcodeNode);
-        return(NULL);                   
+        return(NULL);
     }
 
     /* create qname for fault code */
@@ -1020,7 +1020,7 @@ xmlSecSoap12AddFaultSubcode(xmlNodePtr faultNode, const xmlChar* subCodeHref, co
                     xmlSecErrorsSafeString(cur->name));
         xmlUnlinkNode(subcodeNode);
         xmlFreeNode(subcodeNode);
-        return(NULL);                   
+        return(NULL);
     }
 
     /* set result qname in Value node */
@@ -1043,8 +1043,8 @@ xmlSecSoap12AddFaultSubcode(xmlNodePtr faultNode, const xmlChar* subCodeHref, co
  * Returns: a pointer to the newly created <Text> node or NULL if an error
  * occurs.
  */
-xmlNodePtr 
-xmlSecSoap12AddFaultReasonText(xmlNodePtr faultNode, const xmlChar* faultReasonText, 
+xmlNodePtr
+xmlSecSoap12AddFaultReasonText(xmlNodePtr faultNode, const xmlChar* faultReasonText,
                                const xmlChar* faultReasonLang) {
     xmlNodePtr reasonNode;
     xmlNodePtr textNode;
@@ -1062,7 +1062,7 @@ xmlSecSoap12AddFaultReasonText(xmlNodePtr faultNode, const xmlChar* faultReasonT
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeReason));
-        return(NULL);                   
+        return(NULL);
     }
 
     /* add Text node */
@@ -1074,7 +1074,7 @@ xmlSecSoap12AddFaultReasonText(xmlNodePtr faultNode, const xmlChar* faultReasonT
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeText));
-        return(NULL);                   
+        return(NULL);
     }
     xmlNodeSetContent(textNode, faultReasonText);
     xmlNodeSetLang(textNode, faultReasonLang);
@@ -1086,13 +1086,13 @@ xmlSecSoap12AddFaultReasonText(xmlNodePtr faultNode, const xmlChar* faultReasonT
  * xmlSecSoap12AddFaultDetailEntry:
  * @faultNode:          the pointer to <Fault> node.
  * @detailEntryNode:    the pointer to detail entry node.
- * 
+ *
  * Adds a new child to the Detail child element of @faultNode.
  *
- * Returns: pointer to the added child (@detailEntryNode) or NULL if an error 
+ * Returns: pointer to the added child (@detailEntryNode) or NULL if an error
  * occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap12AddFaultDetailEntry(xmlNodePtr faultNode, xmlNodePtr detailEntryNode) {
     xmlNodePtr detailNode;
 
@@ -1110,10 +1110,10 @@ xmlSecSoap12AddFaultDetailEntry(xmlNodePtr faultNode, xmlNodePtr detailEntryNode
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeDetail));
-            return(NULL);                       
+            return(NULL);
         }
     }
-    
+
     return(xmlSecAddChildNode(detailNode, detailEntryNode));
 }
 
@@ -1126,12 +1126,12 @@ xmlSecSoap12AddFaultDetailEntry(xmlNodePtr faultNode, xmlNodePtr detailEntryNode
  * Returns: 1 if @envNode has a valid <soap:Envelope> element, 0 if it is
  * not valid or a negative value if an error occurs.
  */
-int 
+int
 xmlSecSoap12CheckEnvelope(xmlNodePtr envNode) {
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(envNode != NULL, -1);
-    
+
     /* verify envNode itself */
     if(!xmlSecCheckNodeName(envNode, xmlSecNodeEnvelope, xmlSecSoap12Ns)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1139,7 +1139,7 @@ xmlSecSoap12CheckEnvelope(xmlNodePtr envNode) {
                     xmlSecErrorsSafeString(xmlSecNodeEnvelope),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(0);      
+        return(0);
     }
 
     /* optional Header node first */
@@ -1155,24 +1155,24 @@ xmlSecSoap12CheckEnvelope(xmlNodePtr envNode) {
                     xmlSecErrorsSafeString(xmlSecNodeBody),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(0);      
+        return(0);
     }
-    
+
     return(1);
 }
 
 /**
  * xmlSecSoap12GetHeader:
  * @envNode:    the pointer to <soap:Envelope> node.
- * 
+ *
  * Gets pointer to the <soap:Header> node.
  *
  * Returns: pointer to <soap:Header> node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap12GetHeader(xmlNodePtr envNode) {
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(envNode != NULL, NULL);
 
     /* optional Header node is first */
@@ -1187,15 +1187,15 @@ xmlSecSoap12GetHeader(xmlNodePtr envNode) {
 /**
  * xmlSecSoap12GetBody:
  * @envNode:    the pointer to <soap:Envelope> node.
- * 
+ *
  * Gets pointer to the <soap:Body> node.
  *
  * Returns: pointer to <soap:Body> node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap12GetBody(xmlNodePtr envNode) {
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(envNode != NULL, NULL);
 
     /* optional Header node first */
@@ -1211,7 +1211,7 @@ xmlSecSoap12GetBody(xmlNodePtr envNode) {
                     xmlSecErrorsSafeString(xmlSecNodeBody),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
 
     return(cur);
@@ -1225,12 +1225,12 @@ xmlSecSoap12GetBody(xmlNodePtr envNode) {
  *
  * Returns: the number of body entries.
  */
-xmlSecSize 
+xmlSecSize
 xmlSecSoap12GetBodyEntriesNumber(xmlNodePtr envNode) {
     xmlSecSize number = 0;
     xmlNodePtr bodyNode;
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(envNode != NULL, 0);
 
     /* get Body node */
@@ -1249,7 +1249,7 @@ xmlSecSoap12GetBodyEntriesNumber(xmlNodePtr envNode) {
         number++;
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     return(number);
 }
 
@@ -1257,16 +1257,16 @@ xmlSecSoap12GetBodyEntriesNumber(xmlNodePtr envNode) {
  * xmlSecSoap12GetBodyEntry:
  * @envNode:    the pointer to <soap:Envelope> node.
  * @pos:        the body entry number.
- * 
+ *
  * Gets the body entry number @pos.
  *
  * Returns: pointer to body entry node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap12GetBodyEntry(xmlNodePtr envNode, xmlSecSize pos) {
     xmlNodePtr bodyNode;
     xmlNodePtr cur;
- 
+
     xmlSecAssert2(envNode != NULL, NULL);
 
     /* get Body node */
@@ -1277,7 +1277,7 @@ xmlSecSoap12GetBodyEntry(xmlNodePtr envNode, xmlSecSize pos) {
                     "xmlSecSoap12GetBody",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);                   
+        return(NULL);
     }
 
     cur = xmlSecGetNextElementNode(bodyNode->children);
@@ -1292,12 +1292,12 @@ xmlSecSoap12GetBodyEntry(xmlNodePtr envNode, xmlSecSize pos) {
 /**
  * xmlSecSoap12GetFaultEntry:
  * @envNode:    the pointer to <soap:Envelope> node.
- * 
+ *
  * Gets the Fault entry (if any).
  *
  * Returns: pointer to Fault entry or NULL if it does not exist.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecSoap12GetFaultEntry(xmlNodePtr envNode) {
     xmlNodePtr bodyNode;
 
@@ -1311,12 +1311,12 @@ xmlSecSoap12GetFaultEntry(xmlNodePtr envNode) {
                     "xmlSecSoap12GetBody",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);                   
+        return(NULL);
     }
 
     return(xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap12Ns));
 }
-                                                                 
+
 #endif /* XMLSEC_NO_SOAP */
 
 
diff --git a/src/strings.c b/src/strings.c
index 8de89b0..86e76ab 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * All the string constants.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
diff --git a/src/templates.c b/src/templates.c
index d368907..2270db6 100644
--- a/src/templates.c
+++ b/src/templates.c
@@ -1,18 +1,18 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Creating signature and encryption templates.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
 
 #include <stdlib.h>
 #include <string.h>
- 
+
 #include <libxml/tree.h>
 
 #include <xmlsec/xmlsec.h>
@@ -24,14 +24,14 @@
 #include <xmlsec/errors.h>
 
 
-static xmlNodePtr       xmlSecTmplAddReference          (xmlNodePtr parentNode, 
+static xmlNodePtr       xmlSecTmplAddReference          (xmlNodePtr parentNode,
                                                          xmlSecTransformId digestMethodId,
-                                                         const xmlChar *id, 
-                                                         const xmlChar *uri, 
+                                                         const xmlChar *id,
+                                                         const xmlChar *uri,
                                                          const xmlChar *type);
-static int              xmlSecTmplPrepareEncData        (xmlNodePtr parentNode, 
+static int              xmlSecTmplPrepareEncData        (xmlNodePtr parentNode,
                                                          xmlSecTransformId encMethodId);
-static int              xmlSecTmplNodeWriteNsList       (xmlNodePtr parentNode, 
+static int              xmlSecTmplNodeWriteNsList       (xmlNodePtr parentNode,
                                                          const xmlChar** namespaces);
 /**************************************************************************
  *
@@ -40,21 +40,21 @@ static int              xmlSecTmplNodeWriteNsList       (xmlNodePtr parentNode,
  **************************************************************************/
 /**
  * xmlSecTmplSignatureCreate:
- * @doc:                the pointer to signature document or NULL; in the 
+ * @doc:                the pointer to signature document or NULL; in the
  *                      second case, application must later call @xmlSetTreeDoc
- *                      to ensure that all the children nodes have correct 
+ *                      to ensure that all the children nodes have correct
  *                      pointer to XML document.
  * @c14nMethodId:       the signature canonicalization method.
  * @signMethodId:       the signature  method.
  * @id:                 the node id (may be NULL).
  *
- * Creates new <dsig:Signature/> node with the mandatory <dsig:SignedInfo/>, 
- * <dsig:CanonicalizationMethod/>, <dsig:SignatureMethod/> and 
- * <dsig:SignatureValue/> children and sub-children. 
+ * Creates new <dsig:Signature/> node with the mandatory <dsig:SignedInfo/>,
+ * <dsig:CanonicalizationMethod/>, <dsig:SignatureMethod/> and
+ * <dsig:SignatureValue/> children and sub-children.
  * The application is responsible for inserting the returned node
- * in the XML document. 
+ * in the XML document.
  *
- * Returns: the pointer to newly created <dsig:Signature/> node or NULL if an 
+ * Returns: the pointer to newly created <dsig:Signature/> node or NULL if an
  * error occurs.
  */
 xmlNodePtr
@@ -65,14 +65,14 @@ xmlSecTmplSignatureCreate(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
 
 /**
  * xmlSecTmplSignatureCreateNsPref:
- * @doc:                the pointer to signature document or NULL; in the 
+ * @doc:                the pointer to signature document or NULL; in the
  *                      second case, application must later call @xmlSetTreeDoc
- *                      to ensure that all the children nodes have correct 
+ *                      to ensure that all the children nodes have correct
  *                      pointer to XML document.
  * @c14nMethodId:       the signature canonicalization method.
  * @signMethodId:       the signature  method.
  * @id:                 the node id (may be NULL).
- * @nsPrefix:   the namespace prefix for the signature element (e.g. "dsig"), or NULL 
+ * @nsPrefix:   the namespace prefix for the signature element (e.g. "dsig"), or NULL
  *
  * Creates new <dsig:Signature/> node with the mandatory
  * <dsig:SignedInfo/>, <dsig:CanonicalizationMethod/>,
@@ -83,7 +83,7 @@ xmlSecTmplSignatureCreate(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
  * appropriate child nodes.  The application is responsible for
  * inserting the returned node in the XML document.
  *
- * Returns: the pointer to newly created <dsig:Signature/> node or NULL if an 
+ * Returns: the pointer to newly created <dsig:Signature/> node or NULL if an
  * error occurs.
  */
 xmlNodePtr
@@ -94,12 +94,12 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
     xmlNodePtr signedInfoNode;
     xmlNodePtr cur;
     xmlNsPtr ns;
-    
+
     xmlSecAssert2(c14nMethodId != NULL, NULL);
     xmlSecAssert2(c14nMethodId->href != NULL, NULL);
     xmlSecAssert2(signMethodId != NULL, NULL);
     xmlSecAssert2(signMethodId->href != NULL, NULL);
-    
+
     /* create Signature node itself */
     signNode = xmlNewDocNode(doc, NULL, xmlSecNodeSignature, NULL);
     if(signNode == NULL) {
@@ -109,9 +109,9 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
                     XMLSEC_ERRORS_R_XML_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeSignature));
-        return(NULL);               
+        return(NULL);
     }
-    
+
     ns = xmlNewNs(signNode, xmlSecDSigNs, nsPrefix);
     if(ns == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -121,15 +121,15 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
                     "ns=%s",
                     xmlSecErrorsSafeString(xmlSecDSigNs));
         xmlFreeNode(signNode);
-        return(NULL);                   
+        return(NULL);
     }
     xmlSetNs(signNode, ns);
-    
+
     if(id != NULL) {
         xmlSetProp(signNode, BAD_CAST "Id", id);
     }
 
-    /* add SignedInfo node */    
+    /* add SignedInfo node */
     signedInfoNode = xmlSecAddChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs);
     if(signedInfoNode == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -139,10 +139,10 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeSignedInfo));
         xmlFreeNode(signNode);
-        return(NULL);                   
+        return(NULL);
     }
 
-    /* add SignatureValue node */    
+    /* add SignatureValue node */
     cur = xmlSecAddChild(signNode, xmlSecNodeSignatureValue, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -152,7 +152,7 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeSignatureValue));
         xmlFreeNode(signNode);
-        return(NULL);                   
+        return(NULL);
     }
 
     /* add CanonicaizationMethod node to SignedInfo */
@@ -165,7 +165,7 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeCanonicalizationMethod));
         xmlFreeNode(signNode);
-        return(NULL);                   
+        return(NULL);
     }
     if(xmlSetProp(cur, xmlSecAttrAlgorithm, c14nMethodId->href) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -176,7 +176,7 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
                     xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
                     xmlSecErrorsSafeString(c14nMethodId->href));
         xmlFreeNode(signNode);
-        return(NULL);                   
+        return(NULL);
     }
 
     /* add SignatureMethod node to SignedInfo */
@@ -189,7 +189,7 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeSignatureMethod));
         xmlFreeNode(signNode);
-        return(NULL);                   
+        return(NULL);
     }
     if(xmlSetProp(cur, xmlSecAttrAlgorithm, signMethodId->href) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -200,9 +200,9 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
                     xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
                     xmlSecErrorsSafeString(signMethodId->href));
         xmlFreeNode(signNode);
-        return(NULL);                   
+        return(NULL);
     }
-        
+
     return(signNode);
 }
 
@@ -211,22 +211,22 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
  * @signNode:           the  pointer to <dsig:Signature/> node.
  * @id:                 the node id (may be NULL).
  *
- * Adds (if necessary) <dsig:KeyInfo/> node to the <dsig:Signature/> 
- * node @signNode. 
+ * Adds (if necessary) <dsig:KeyInfo/> node to the <dsig:Signature/>
+ * node @signNode.
  *
- * Returns: the pointer to newly created <dsig:KeyInfo/> node or NULL if an 
+ * Returns: the pointer to newly created <dsig:KeyInfo/> node or NULL if an
  * error occurs.
  */
 xmlNodePtr
 xmlSecTmplSignatureEnsureKeyInfo(xmlNodePtr signNode, const xmlChar *id) {
     xmlNodePtr res;
-    
+
     xmlSecAssert2(signNode != NULL, NULL);
 
     res = xmlSecFindChild(signNode, xmlSecNodeKeyInfo, xmlSecDSigNs);
     if(res == NULL) {
         xmlNodePtr signValueNode;
-    
+
         signValueNode = xmlSecFindChild(signNode, xmlSecNodeSignatureValue, xmlSecDSigNs);
         if(signValueNode == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -234,7 +234,7 @@ xmlSecTmplSignatureEnsureKeyInfo(xmlNodePtr signNode, const xmlChar *id) {
                         xmlSecErrorsSafeString(xmlSecNodeSignatureValue),
                         XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);       
+            return(NULL);
         }
 
         res = xmlSecAddNextSibling(signValueNode, xmlSecNodeKeyInfo, xmlSecDSigNs);
@@ -245,14 +245,14 @@ xmlSecTmplSignatureEnsureKeyInfo(xmlNodePtr signNode, const xmlChar *id) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
-            return(NULL);                       
+            return(NULL);
         }
     }
     if(id != NULL) {
         xmlSetProp(res, xmlSecAttrId, id);
     }
-    return(res);        
-}         
+    return(res);
+}
 
 /**
  * xmlSecTmplSignatureAddReference:
@@ -262,18 +262,18 @@ xmlSecTmplSignatureEnsureKeyInfo(xmlNodePtr signNode, const xmlChar *id) {
  * @uri:                the reference node uri (may be NULL).
  * @type:               the reference node type (may be NULL).
  *
- * Adds <dsig:Reference/> node with given URI (@uri), Id (@id) and 
+ * Adds <dsig:Reference/> node with given URI (@uri), Id (@id) and
  * Type (@type) attributes and the required children <dsig:DigestMethod/> and
- * <dsig:DigestValue/> to the <dsig:SignedInfo/> child of @signNode. 
+ * <dsig:DigestValue/> to the <dsig:SignedInfo/> child of @signNode.
  *
- * Returns: the pointer to newly created <dsig:Reference/> node or NULL 
+ * Returns: the pointer to newly created <dsig:Reference/> node or NULL
  * if an error occurs.
  */
-xmlNodePtr      
+xmlNodePtr
 xmlSecTmplSignatureAddReference(xmlNodePtr signNode, xmlSecTransformId digestMethodId,
                     const xmlChar *id, const xmlChar *uri, const xmlChar *type) {
     xmlNodePtr signedInfoNode;
-    
+
     xmlSecAssert2(signNode != NULL, NULL);
     xmlSecAssert2(digestMethodId != NULL, NULL);
     xmlSecAssert2(digestMethodId->href != NULL, NULL);
@@ -285,18 +285,18 @@ xmlSecTmplSignatureAddReference(xmlNodePtr signNode, xmlSecTransformId digestMet
                     xmlSecErrorsSafeString(xmlSecNodeSignedInfo),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
-    
+
     return(xmlSecTmplAddReference(signedInfoNode, digestMethodId, id, uri, type));
 }
 
-static xmlNodePtr 
+static xmlNodePtr
 xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId,
-                    const xmlChar *id, const xmlChar *uri, const xmlChar *type) {    
+                    const xmlChar *id, const xmlChar *uri, const xmlChar *type) {
     xmlNodePtr res;
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(parentNode != NULL, NULL);
     xmlSecAssert2(digestMethodId != NULL, NULL);
     xmlSecAssert2(digestMethodId->href != NULL, NULL);
@@ -324,7 +324,7 @@ xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId,
         xmlSetProp(res, xmlSecAttrURI, uri);
     }
 
-    /* add DigestMethod node and set algorithm */    
+    /* add DigestMethod node and set algorithm */
     cur = xmlSecAddChild(res, xmlSecNodeDigestMethod, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -335,7 +335,7 @@ xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId,
                     xmlSecErrorsSafeString(xmlSecNodeDigestMethod));
         xmlUnlinkNode(res);
         xmlFreeNode(res);
-        return(NULL);                   
+        return(NULL);
     }
     if(xmlSetProp(cur, xmlSecAttrAlgorithm, digestMethodId->href) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -347,10 +347,10 @@ xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId,
                     xmlSecErrorsSafeString(digestMethodId->href));
         xmlUnlinkNode(res);
         xmlFreeNode(res);
-        return(NULL);                   
+        return(NULL);
     }
 
-    /* add DigestValue node */    
+    /* add DigestValue node */
     cur = xmlSecAddChild(res, xmlSecNodeDigestValue, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -361,10 +361,10 @@ xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId,
                     xmlSecErrorsSafeString(xmlSecNodeDigestValue));
         xmlUnlinkNode(res);
         xmlFreeNode(res);
-        return(NULL);                   
+        return(NULL);
     }
-    
-    return(res);    
+
+    return(res);
 }
 
 /**
@@ -374,18 +374,18 @@ xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId,
  * @mimeType:           the object mime type (may be NULL).
  * @encoding:           the object encoding (may be NULL).
  *
- * Adds <dsig:Object/> node to the <dsig:Signature/> node @signNode. 
+ * Adds <dsig:Object/> node to the <dsig:Signature/> node @signNode.
  *
- * Returns: the pointer to newly created <dsig:Object/> node or NULL 
+ * Returns: the pointer to newly created <dsig:Object/> node or NULL
  * if an error occurs.
  */
 xmlNodePtr
-xmlSecTmplSignatureAddObject(xmlNodePtr signNode, const xmlChar *id, 
+xmlSecTmplSignatureAddObject(xmlNodePtr signNode, const xmlChar *id,
                          const xmlChar *mimeType, const xmlChar *encoding) {
     xmlNodePtr res;
 
     xmlSecAssert2(signNode != NULL, NULL);
-    
+
     res = xmlSecAddChild(signNode, xmlSecNodeObject, xmlSecDSigNs);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -394,7 +394,7 @@ xmlSecTmplSignatureAddObject(xmlNodePtr signNode, const xmlChar *id,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeObject));
-        return(NULL);                   
+        return(NULL);
     }
     if(id != NULL) {
         xmlSetProp(res, xmlSecAttrId, id);
@@ -405,10 +405,10 @@ xmlSecTmplSignatureAddObject(xmlNodePtr signNode, const xmlChar *id,
     if(encoding != NULL) {
         xmlSetProp(res, xmlSecAttrEncoding, encoding);
     }
-    return(res);        
+    return(res);
 }
 
-/** 
+/**
  * xmlSecTmplSignatureGetSignMethodNode:
  * @signNode:           the pointer to <dsig:Signature /> node.
  *
@@ -416,12 +416,12 @@ xmlSecTmplSignatureAddObject(xmlNodePtr signNode, const xmlChar *id,
  *
  * Returns: pointer to <dsig:SignatureMethod /> node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecTmplSignatureGetSignMethodNode(xmlNodePtr signNode) {
     xmlNodePtr signedInfoNode;
-    
+
     xmlSecAssert2(signNode != NULL, NULL);
-    
+
     signedInfoNode = xmlSecFindChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs);
     if(signedInfoNode == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -429,12 +429,12 @@ xmlSecTmplSignatureGetSignMethodNode(xmlNodePtr signNode) {
                     xmlSecErrorsSafeString(xmlSecNodeSignedInfo),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
     return(xmlSecFindChild(signedInfoNode, xmlSecNodeSignatureMethod, xmlSecDSigNs));
 }
 
-/** 
+/**
  * xmlSecTmplSignatureGetC14NMethodNode:
  * @signNode:           the pointer to <dsig:Signature /> node.
  *
@@ -442,12 +442,12 @@ xmlSecTmplSignatureGetSignMethodNode(xmlNodePtr signNode) {
  *
  * Returns: pointer to <dsig:CanonicalizationMethod /> node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecTmplSignatureGetC14NMethodNode(xmlNodePtr signNode) {
     xmlNodePtr signedInfoNode;
-    
+
     xmlSecAssert2(signNode != NULL, NULL);
-    
+
     signedInfoNode = xmlSecFindChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs);
     if(signedInfoNode == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -455,7 +455,7 @@ xmlSecTmplSignatureGetC14NMethodNode(xmlNodePtr signNode) {
                     xmlSecErrorsSafeString(xmlSecNodeSignedInfo),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
     return(xmlSecFindChild(signedInfoNode, xmlSecNodeCanonicalizationMethod, xmlSecDSigNs));
 }
@@ -466,15 +466,15 @@ xmlSecTmplSignatureGetC14NMethodNode(xmlNodePtr signNode) {
  * @transformId:                the transform method id.
  *
  * Adds <dsig:Transform/> node to the <dsig:Reference/> node @referenceNode.
- * 
- * Returns: the pointer to newly created <dsig:Transform/> node or NULL if an 
+ *
+ * Returns: the pointer to newly created <dsig:Transform/> node or NULL if an
  * error occurs.
  */
 xmlNodePtr
 xmlSecTmplReferenceAddTransform(xmlNodePtr referenceNode, xmlSecTransformId transformId) {
     xmlNodePtr transformsNode;
     xmlNodePtr res;
-    
+
     xmlSecAssert2(referenceNode != NULL, NULL);
     xmlSecAssert2(transformId != NULL, NULL);
     xmlSecAssert2(transformId->href != NULL, NULL);
@@ -483,13 +483,13 @@ xmlSecTmplReferenceAddTransform(xmlNodePtr referenceNode, xmlSecTransformId tran
     transformsNode = xmlSecFindChild(referenceNode, xmlSecNodeTransforms, xmlSecDSigNs);
     if(transformsNode == NULL) {
         xmlNodePtr tmp;
-        
+
         tmp = xmlSecGetNextElementNode(referenceNode->children);
         if(tmp == NULL) {
             transformsNode = xmlSecAddChild(referenceNode, xmlSecNodeTransforms, xmlSecDSigNs);
         } else {
             transformsNode = xmlSecAddPrevSibling(tmp, xmlSecNodeTransforms, xmlSecDSigNs);
-        }   
+        }
         if(transformsNode == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -497,7 +497,7 @@ xmlSecTmplReferenceAddTransform(xmlNodePtr referenceNode, xmlSecTransformId tran
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeTransforms));
-            return(NULL);                       
+            return(NULL);
         }
     }
 
@@ -509,7 +509,7 @@ xmlSecTmplReferenceAddTransform(xmlNodePtr referenceNode, xmlSecTransformId tran
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeTransform));
-        return(NULL);                   
+        return(NULL);
     }
 
     if(xmlSetProp(res, xmlSecAttrAlgorithm, transformId->href) == NULL) {
@@ -522,10 +522,10 @@ xmlSecTmplReferenceAddTransform(xmlNodePtr referenceNode, xmlSecTransformId tran
                     xmlSecErrorsSafeString(transformId->href));
         xmlUnlinkNode(res);
         xmlFreeNode(res);
-        return(NULL);                   
+        return(NULL);
     }
 
-    return(res);    
+    return(res);
 }
 
 /**
@@ -536,10 +536,10 @@ xmlSecTmplReferenceAddTransform(xmlNodePtr referenceNode, xmlSecTransformId tran
  *
  * Adds <dsig:SignatureProperties/> node to the <dsig:Object/> node @objectNode.
  *
- * Returns: the pointer to newly created <dsig:SignatureProperties/> node or NULL 
+ * Returns: the pointer to newly created <dsig:SignatureProperties/> node or NULL
  * if an error occurs.
  */
-xmlNodePtr              
+xmlNodePtr
 xmlSecTmplObjectAddSignProperties(xmlNodePtr objectNode, const xmlChar *id, const xmlChar *target) {
     xmlNodePtr res;
 
@@ -553,7 +553,7 @@ xmlSecTmplObjectAddSignProperties(xmlNodePtr objectNode, const xmlChar *id, cons
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeSignatureProperties));
-        return(NULL);                   
+        return(NULL);
     }
     if(id != NULL) {
         xmlSetProp(res, xmlSecAttrId, id);
@@ -571,7 +571,7 @@ xmlSecTmplObjectAddSignProperties(xmlNodePtr objectNode, const xmlChar *id, cons
  *
  * Adds <dsig:Manifest/> node to the <dsig:Object/> node @objectNode.
  *
- * Returns: the pointer to newly created <dsig:Manifest/> node or NULL 
+ * Returns: the pointer to newly created <dsig:Manifest/> node or NULL
  * if an error occurs.
  */
 xmlNodePtr
@@ -588,7 +588,7 @@ xmlSecTmplObjectAddManifest(xmlNodePtr objectNode,  const xmlChar *id) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeManifest));
-        return(NULL);                   
+        return(NULL);
     }
     if(id != NULL) {
         xmlSetProp(res, xmlSecAttrId, id);
@@ -604,14 +604,14 @@ xmlSecTmplObjectAddManifest(xmlNodePtr objectNode,  const xmlChar *id) {
  * @uri:                the reference node uri (may be NULL).
  * @type:               the reference node type (may be NULL).
  *
- * Adds <dsig:Reference/> node with specified URI (@uri), Id (@id) and 
+ * Adds <dsig:Reference/> node with specified URI (@uri), Id (@id) and
  * Type (@type) attributes and the required children <dsig:DigestMethod/> and
  * <dsig:DigestValue/> to the <dsig:Manifest/> node @manifestNode.
  *
- * Returns: the pointer to newly created <dsig:Reference/> node or NULL 
+ * Returns: the pointer to newly created <dsig:Reference/> node or NULL
  * if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecTmplManifestAddReference(xmlNodePtr manifestNode, xmlSecTransformId digestMethodId,
                               const xmlChar *id, const xmlChar *uri, const xmlChar *type) {
     return(xmlSecTmplAddReference(manifestNode, digestMethodId, id, uri, type));
@@ -622,10 +622,10 @@ xmlSecTmplManifestAddReference(xmlNodePtr manifestNode, xmlSecTransformId digest
  * <enc:EncryptedData/> node
  *
  **************************************************************************/
-/** 
+/**
  * xmlSecTmplEncDataCreate:
  * @doc:                the pointer to signature document or NULL; in the later
- *                      case, application must later call @xmlSetTreeDoc to ensure 
+ *                      case, application must later call @xmlSetTreeDoc to ensure
  *                      that all the children nodes have correct pointer to XML document.
  * @encMethodId:        the encryption method (may be NULL).
  * @id:                 the Id attribute (optional).
@@ -633,18 +633,18 @@ xmlSecTmplManifestAddReference(xmlNodePtr manifestNode, xmlSecTransformId digest
  * @mimeType:           the MimeType attribute (optional)
  * @encoding:           the Encoding attribute (optional)
  *
- * Creates new <enc:EncryptedData /> node for encryption template. 
+ * Creates new <enc:EncryptedData /> node for encryption template.
  *
- * Returns: the pointer newly created  <enc:EncryptedData/> node or NULL 
+ * Returns: the pointer newly created  <enc:EncryptedData/> node or NULL
  * if an error occurs.
  */
-xmlNodePtr              
+xmlNodePtr
 xmlSecTmplEncDataCreate(xmlDocPtr doc, xmlSecTransformId encMethodId,
                             const xmlChar *id, const xmlChar *type,
                             const xmlChar *mimeType, const xmlChar *encoding) {
     xmlNodePtr encNode;
     xmlNsPtr ns;
-    
+
     encNode = xmlNewDocNode(doc, NULL, xmlSecNodeEncryptedData, NULL);
     if(encNode == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -653,9 +653,9 @@ xmlSecTmplEncDataCreate(xmlDocPtr doc, xmlSecTransformId encMethodId,
                     XMLSEC_ERRORS_R_XML_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeEncryptedData));
-        return(NULL);           
+        return(NULL);
     }
-    
+
     ns = xmlNewNs(encNode, xmlSecEncNs, NULL);
     if(ns == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -664,10 +664,10 @@ xmlSecTmplEncDataCreate(xmlDocPtr doc, xmlSecTransformId encMethodId,
                     XMLSEC_ERRORS_R_XML_FAILED,
                     "ns=%s",
                     xmlSecErrorsSafeString(xmlSecEncNs));
-        return(NULL);                   
+        return(NULL);
     }
     xmlSetNs(encNode, ns);
-    
+
     if(id != NULL) {
         xmlSetProp(encNode, xmlSecAttrId, id);
     }
@@ -680,7 +680,7 @@ xmlSecTmplEncDataCreate(xmlDocPtr doc, xmlSecTransformId encMethodId,
     if(encoding != NULL) {
         xmlSetProp(encNode, xmlSecAttrEncoding, encoding);
     }
-    
+
     if(xmlSecTmplPrepareEncData(encNode, encMethodId) < 0) {
         xmlFreeNode(encNode);
         return(NULL);
@@ -688,13 +688,13 @@ xmlSecTmplEncDataCreate(xmlDocPtr doc, xmlSecTransformId encMethodId,
     return(encNode);
 }
 
-static int  
+static int
 xmlSecTmplPrepareEncData(xmlNodePtr parentNode, xmlSecTransformId encMethodId) {
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(parentNode != NULL, -1);
     xmlSecAssert2((encMethodId == NULL) || (encMethodId->href != NULL), -1);
-    
+
     /* add EncryptionMethod node if requested */
     if(encMethodId != NULL) {
         cur = xmlSecAddChild(parentNode, xmlSecNodeEncryptionMethod, xmlSecEncNs);
@@ -705,7 +705,7 @@ xmlSecTmplPrepareEncData(xmlNodePtr parentNode, xmlSecTransformId encMethodId) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeEncryptionMethod));
-            return(-1);         
+            return(-1);
         }
         if(xmlSetProp(cur, xmlSecAttrAlgorithm, encMethodId->href) == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -715,10 +715,10 @@ xmlSecTmplPrepareEncData(xmlNodePtr parentNode, xmlSecTransformId encMethodId) {
                         "name=%s,value=%s",
                         xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
                         xmlSecErrorsSafeString(encMethodId->href));
-            return(-1);         
-        }       
+            return(-1);
+        }
     }
-        
+
     /* and CipherData node */
     cur = xmlSecAddChild(parentNode, xmlSecNodeCipherData, xmlSecEncNs);
     if(cur == NULL) {
@@ -728,33 +728,33 @@ xmlSecTmplPrepareEncData(xmlNodePtr parentNode, xmlSecTransformId encMethodId) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeCipherData));
-        return(-1);                     
+        return(-1);
     }
-    
+
     return(0);
 }
 
 
-/** 
+/**
  * xmlSecTmplEncDataEnsureKeyInfo:
  * @encNode:            the pointer to <enc:EncryptedData/> node.
  * @id:                 the Id attrbibute (optional).
  *
  * Adds <dsig:KeyInfo/> to the  <enc:EncryptedData/> node @encNode.
  *
- * Returns: the pointer to newly created <dsig:KeyInfo/> node or 
+ * Returns: the pointer to newly created <dsig:KeyInfo/> node or
  * NULL if an error occurs.
  */
 xmlNodePtr
 xmlSecTmplEncDataEnsureKeyInfo(xmlNodePtr encNode, const xmlChar* id) {
     xmlNodePtr res;
-    
+
     xmlSecAssert2(encNode != NULL, NULL);
 
     res = xmlSecFindChild(encNode, xmlSecNodeKeyInfo, xmlSecDSigNs);
     if(res == NULL) {
         xmlNodePtr cipherDataNode;
-    
+
         cipherDataNode = xmlSecFindChild(encNode, xmlSecNodeCipherData, xmlSecEncNs);
         if(cipherDataNode == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -762,7 +762,7 @@ xmlSecTmplEncDataEnsureKeyInfo(xmlNodePtr encNode, const xmlChar* id) {
                         xmlSecErrorsSafeString(xmlSecNodeCipherData),
                         XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(NULL);       
+            return(NULL);
         }
 
         res = xmlSecAddPrevSibling(cipherDataNode, xmlSecNodeKeyInfo, xmlSecDSigNs);
@@ -773,24 +773,24 @@ xmlSecTmplEncDataEnsureKeyInfo(xmlNodePtr encNode, const xmlChar* id) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
-            return(NULL);                       
+            return(NULL);
         }
     }
     if(id != NULL) {
         xmlSetProp(res, xmlSecAttrId, id);
     }
-    return(res);        
+    return(res);
 }
 
-/** 
+/**
  * xmlSecTmplEncDataEnsureEncProperties:
  * @encNode:            the pointer to <enc:EncryptedData/> node.
  * @id:                 the Id attribute (optional).
  *
- * Adds <enc:EncryptionProperties/> node to the <enc:EncryptedData/> 
+ * Adds <enc:EncryptionProperties/> node to the <enc:EncryptedData/>
  * node @encNode.
  *
- * Returns: the pointer to newly created <enc:EncryptionProperties/> node or 
+ * Returns: the pointer to newly created <enc:EncryptionProperties/> node or
  * NULL if an error occurs.
  */
 xmlNodePtr
@@ -809,35 +809,35 @@ xmlSecTmplEncDataEnsureEncProperties(xmlNodePtr encNode, const xmlChar *id) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeEncryptionProperties));
-            return(NULL);                       
+            return(NULL);
         }
     }
 
     if(id != NULL) {
         xmlSetProp(res, xmlSecAttrId, id);
     }
-    
+
     return(res);
 }
 
-/** 
+/**
  * xmlSecTmplEncDataAddEncProperty:
  * @encNode:            the pointer to <enc:EncryptedData/> node.
  * @id:                 the Id attribute (optional).
  * @target:             the Target attribute (optional).
  *
- * Adds <enc:EncryptionProperty/> node (and the parent 
- * <enc:EncryptionProperties/> node if required) to the 
+ * Adds <enc:EncryptionProperty/> node (and the parent
+ * <enc:EncryptionProperties/> node if required) to the
  * <enc:EncryptedData/> node @encNode.
  *
- * Returns: the pointer to newly created <enc:EncryptionProperty/> node or 
+ * Returns: the pointer to newly created <enc:EncryptionProperty/> node or
  * NULL if an error occurs.
  */
-xmlNodePtr      
+xmlNodePtr
 xmlSecTmplEncDataAddEncProperty(xmlNodePtr encNode, const xmlChar *id, const xmlChar *target) {
     xmlNodePtr encProps;
     xmlNodePtr res;
-        
+
     xmlSecAssert2(encNode != NULL, NULL);
 
     encProps = xmlSecTmplEncDataEnsureEncProperties(encNode, NULL);
@@ -847,7 +847,7 @@ xmlSecTmplEncDataAddEncProperty(xmlNodePtr encNode, const xmlChar *id, const xml
                     "xmlSecTmplEncDataEnsureEncProperties",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
 
     res = xmlSecAddChild(encProps, xmlSecNodeEncryptionProperty, xmlSecEncNs);
@@ -858,7 +858,7 @@ xmlSecTmplEncDataAddEncProperty(xmlNodePtr encNode, const xmlChar *id, const xml
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeEncryptionProperty));
-        return(NULL);   
+        return(NULL);
     }
     if(id != NULL) {
         xmlSetProp(res, xmlSecAttrId, id);
@@ -866,24 +866,24 @@ xmlSecTmplEncDataAddEncProperty(xmlNodePtr encNode, const xmlChar *id, const xml
     if(target != NULL) {
         xmlSetProp(res, xmlSecAttrTarget, target);
     }
-    
+
     return(res);
 }
 
-/** 
+/**
  * xmlSecTmplEncDataEnsureCipherValue:
  * @encNode:            the pointer to <enc:EncryptedData/> node.
  *
  * Adds <enc:CipherValue/> to the <enc:EncryptedData/> node @encNode.
  *
- * Returns: the pointer to newly created <enc:CipherValue/> node or 
+ * Returns: the pointer to newly created <enc:CipherValue/> node or
  * NULL if an error occurs.
  */
 xmlNodePtr
 xmlSecTmplEncDataEnsureCipherValue(xmlNodePtr encNode) {
     xmlNodePtr cipherDataNode;
     xmlNodePtr res, tmp;
-        
+
     xmlSecAssert2(encNode != NULL, NULL);
 
     cipherDataNode = xmlSecFindChild(encNode, xmlSecNodeCipherData, xmlSecEncNs);
@@ -893,7 +893,7 @@ xmlSecTmplEncDataEnsureCipherValue(xmlNodePtr encNode) {
                     xmlSecErrorsSafeString(xmlSecNodeCipherData),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
 
     /* check that we don;t have CipherReference node */
@@ -904,7 +904,7 @@ xmlSecTmplEncDataEnsureCipherValue(xmlNodePtr encNode) {
                     xmlSecErrorsSafeString(xmlSecNodeCipherReference),
                     XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
 
     res = xmlSecFindChild(cipherDataNode, xmlSecNodeCipherValue, xmlSecEncNs);
@@ -917,14 +917,14 @@ xmlSecTmplEncDataEnsureCipherValue(xmlNodePtr encNode) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeCipherValue));
-            return(NULL);                       
+            return(NULL);
         }
     }
-        
+
     return(res);
 }
 
-/** 
+/**
  * xmlSecTmplEncDataEnsureCipherReference:
  * @encNode:            the pointer to <enc:EncryptedData/> node.
  * @uri:                the URI attribute (may be NULL).
@@ -932,14 +932,14 @@ xmlSecTmplEncDataEnsureCipherValue(xmlNodePtr encNode) {
  * Adds <enc:CipherReference/> node with specified URI attribute @uri
  * to the <enc:EncryptedData/> node @encNode.
  *
- * Returns: the pointer to newly created <enc:CipherReference/> node or 
+ * Returns: the pointer to newly created <enc:CipherReference/> node or
  * NULL if an error occurs.
  */
 xmlNodePtr
 xmlSecTmplEncDataEnsureCipherReference(xmlNodePtr encNode, const xmlChar *uri) {
     xmlNodePtr cipherDataNode;
     xmlNodePtr res, tmp;
-        
+
     xmlSecAssert2(encNode != NULL, NULL);
 
     cipherDataNode = xmlSecFindChild(encNode, xmlSecNodeCipherData, xmlSecEncNs);
@@ -949,7 +949,7 @@ xmlSecTmplEncDataEnsureCipherReference(xmlNodePtr encNode, const xmlChar *uri) {
                     xmlSecErrorsSafeString(xmlSecNodeCipherData),
                     XMLSEC_ERRORS_R_NODE_NOT_FOUND,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
 
     /* check that we don;t have CipherValue node */
@@ -960,7 +960,7 @@ xmlSecTmplEncDataEnsureCipherReference(xmlNodePtr encNode, const xmlChar *uri) {
                     xmlSecErrorsSafeString(xmlSecNodeCipherValue),
                     XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
 
     res = xmlSecFindChild(cipherDataNode, xmlSecNodeCipherReference, xmlSecEncNs);
@@ -973,18 +973,18 @@ xmlSecTmplEncDataEnsureCipherReference(xmlNodePtr encNode, const xmlChar *uri) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeCipherReference));
-            return(NULL);                       
+            return(NULL);
         }
     }
-    
+
     if(uri != NULL) {
         xmlSetProp(res, xmlSecAttrURI, uri);
     }
-    
+
     return(res);
 }
 
-/** 
+/**
  * xmlSecTmplEncDataGetEncMethodNode:
  * @encNode:            the pointer to <enc:EcnryptedData /> node.
  *
@@ -992,14 +992,14 @@ xmlSecTmplEncDataEnsureCipherReference(xmlNodePtr encNode, const xmlChar *uri) {
  *
  * Returns: pointer to <enc:EncryptionMethod /> node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecTmplEncDataGetEncMethodNode(xmlNodePtr encNode) {
     xmlSecAssert2(encNode != NULL, NULL);
 
     return(xmlSecFindChild(encNode, xmlSecNodeEncryptionMethod, xmlSecEncNs));
 }
 
-/** 
+/**
  * xmlSecTmplCipherReferenceAddTransform:
  * @cipherReferenceNode:        the pointer to <enc:CipherReference/> node.
  * @transformId:                the transform id.
@@ -1008,18 +1008,18 @@ xmlSecTmplEncDataGetEncMethodNode(xmlNodePtr encNode) {
  * with specified transform methods @transform to the <enc:CipherReference/>
  * child node of the <enc:EncryptedData/> node @encNode.
  *
- * Returns: the pointer to newly created <dsig:Transform/> node or 
+ * Returns: the pointer to newly created <dsig:Transform/> node or
  * NULL if an error occurs.
  */
 xmlNodePtr
-xmlSecTmplCipherReferenceAddTransform(xmlNodePtr cipherReferenceNode, 
+xmlSecTmplCipherReferenceAddTransform(xmlNodePtr cipherReferenceNode,
                                   xmlSecTransformId transformId) {
     xmlNodePtr transformsNode;
     xmlNodePtr res;
 
     xmlSecAssert2(cipherReferenceNode != NULL, NULL);
-    xmlSecAssert2(transformId != NULL, NULL);    
-    xmlSecAssert2(transformId->href != NULL, NULL);    
+    xmlSecAssert2(transformId != NULL, NULL);
+    xmlSecAssert2(transformId->href != NULL, NULL);
 
     transformsNode = xmlSecFindChild(cipherReferenceNode, xmlSecNodeTransforms, xmlSecEncNs);
     if(transformsNode == NULL) {
@@ -1031,10 +1031,10 @@ xmlSecTmplCipherReferenceAddTransform(xmlNodePtr cipherReferenceNode,
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeTransforms));
-            return(NULL);       
+            return(NULL);
         }
     }
-    
+
     res = xmlSecAddChild(transformsNode,  xmlSecNodeTransform, xmlSecDSigNs);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1043,9 +1043,9 @@ xmlSecTmplCipherReferenceAddTransform(xmlNodePtr cipherReferenceNode,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeTransform));
-        return(NULL);   
+        return(NULL);
     }
-    
+
     if(xmlSetProp(res, xmlSecAttrAlgorithm, transformId->href) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1056,9 +1056,9 @@ xmlSecTmplCipherReferenceAddTransform(xmlNodePtr cipherReferenceNode,
                     xmlSecErrorsSafeString(transformId->href));
         xmlUnlinkNode(res);
         xmlFreeNode(res);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     return(res);
 }
 
@@ -1067,16 +1067,16 @@ xmlSecTmplCipherReferenceAddTransform(xmlNodePtr cipherReferenceNode,
  *
  * <enc:EncryptedKey> node
  *
- **********************************************************************/ 
+ **********************************************************************/
 
-/** 
+/**
  * xmlSecTmplReferenceListAddDataReference:
  * @encNode:                    the pointer to <enc:EncryptedKey/> node.
  * @uri:                        uri to reference (optional)
  *
  * Adds <enc:DataReference/> and the parent <enc:ReferenceList/> node (if needed).
  *
- * Returns: the pointer to newly created <enc:DataReference/> node or 
+ * Returns: the pointer to newly created <enc:DataReference/> node or
  * NULL if an error occurs.
  */
 xmlNodePtr
@@ -1084,7 +1084,7 @@ xmlSecTmplReferenceListAddDataReference(xmlNodePtr encNode, const xmlChar *uri)
     xmlNodePtr refListNode, res;
 
     xmlSecAssert2(encNode != NULL, NULL);
-    
+
     refListNode = xmlSecFindChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs);
     if(refListNode == NULL) {
         refListNode = xmlSecAddChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs);
@@ -1095,10 +1095,10 @@ xmlSecTmplReferenceListAddDataReference(xmlNodePtr encNode, const xmlChar *uri)
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeReferenceList));
-            return(NULL);       
+            return(NULL);
         }
     }
-    
+
     res = xmlSecAddChild(refListNode,  xmlSecNodeDataReference, xmlSecEncNs);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1107,9 +1107,9 @@ xmlSecTmplReferenceListAddDataReference(xmlNodePtr encNode, const xmlChar *uri)
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDataReference));
-        return(NULL);   
+        return(NULL);
     }
- 
+
     if(uri != NULL) {
         if(xmlSetProp(res, xmlSecAttrURI, uri) == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1121,21 +1121,21 @@ xmlSecTmplReferenceListAddDataReference(xmlNodePtr encNode, const xmlChar *uri)
                         xmlSecErrorsSafeString(uri));
             xmlUnlinkNode(res);
             xmlFreeNode(res);
-            return(NULL);                       
+            return(NULL);
         }
     }
 
     return(res);
 }
 
-/** 
+/**
  * xmlSecTmplReferenceListAddKeyReference:
  * @encNode:                    the pointer to <enc:EncryptedKey/> node.
  * @uri:                        uri to reference (optional)
  *
  * Adds <enc:KeyReference/> and the parent <enc:ReferenceList/> node (if needed).
  *
- * Returns: the pointer to newly created <enc:KeyReference/> node or 
+ * Returns: the pointer to newly created <enc:KeyReference/> node or
  * NULL if an error occurs.
  */
 xmlNodePtr
@@ -1143,7 +1143,7 @@ xmlSecTmplReferenceListAddKeyReference(xmlNodePtr encNode, const xmlChar *uri) {
     xmlNodePtr refListNode, res;
 
     xmlSecAssert2(encNode != NULL, NULL);
-    
+
     refListNode = xmlSecFindChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs);
     if(refListNode == NULL) {
         refListNode = xmlSecAddChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs);
@@ -1154,10 +1154,10 @@ xmlSecTmplReferenceListAddKeyReference(xmlNodePtr encNode, const xmlChar *uri) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeReferenceList));
-            return(NULL);       
+            return(NULL);
         }
     }
-    
+
     res = xmlSecAddChild(refListNode,  xmlSecNodeKeyReference, xmlSecEncNs);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1166,9 +1166,9 @@ xmlSecTmplReferenceListAddKeyReference(xmlNodePtr encNode, const xmlChar *uri) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeKeyReference));
-        return(NULL);   
+        return(NULL);
     }
- 
+
     if(uri != NULL) {
         if(xmlSetProp(res, xmlSecAttrURI, uri) == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1180,7 +1180,7 @@ xmlSecTmplReferenceListAddKeyReference(xmlNodePtr encNode, const xmlChar *uri) {
                         xmlSecErrorsSafeString(uri));
             xmlUnlinkNode(res);
             xmlFreeNode(res);
-            return(NULL);                       
+            return(NULL);
         }
     }
 
@@ -1197,20 +1197,20 @@ xmlSecTmplReferenceListAddKeyReference(xmlNodePtr encNode, const xmlChar *uri) {
 /**
  * xmlSecTmplKeyInfoAddKeyName:
  * @keyInfoNode:        the pointer to <dsig:KeyInfo/> node.
- * @name:               the key name (optional).        
+ * @name:               the key name (optional).
  *
  * Adds <dsig:KeyName/> node to the <dsig:KeyInfo/> node @keyInfoNode.
  *
  * Returns: the pointer to the newly created <dsig:KeyName/> node or
  * NULL if an error occurs.
  */
-xmlNodePtr      
+xmlNodePtr
 xmlSecTmplKeyInfoAddKeyName(xmlNodePtr keyInfoNode, const xmlChar* name) {
     xmlNodePtr res;
 
     xmlSecAssert2(keyInfoNode != NULL, NULL);
-        
-    res = xmlSecAddChild(keyInfoNode, xmlSecNodeKeyName, xmlSecDSigNs); 
+
+    res = xmlSecAddChild(keyInfoNode, xmlSecNodeKeyName, xmlSecDSigNs);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1218,7 +1218,7 @@ xmlSecTmplKeyInfoAddKeyName(xmlNodePtr keyInfoNode, const xmlChar* name) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeKeyName));
-        return(NULL);   
+        return(NULL);
     }
     if(name != NULL) {
         xmlSecNodeEncodeAndSetContent(res, name);
@@ -1240,8 +1240,8 @@ xmlSecTmplKeyInfoAddKeyValue(xmlNodePtr keyInfoNode) {
     xmlNodePtr res;
 
     xmlSecAssert2(keyInfoNode != NULL, NULL);
-        
-    res = xmlSecAddChild(keyInfoNode, xmlSecNodeKeyValue, xmlSecDSigNs); 
+
+    res = xmlSecAddChild(keyInfoNode, xmlSecNodeKeyValue, xmlSecDSigNs);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1249,9 +1249,9 @@ xmlSecTmplKeyInfoAddKeyValue(xmlNodePtr keyInfoNode) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeKeyValue));
-        return(NULL);   
+        return(NULL);
     }
-    
+
     return(res);
 }
 
@@ -1269,8 +1269,8 @@ xmlSecTmplKeyInfoAddX509Data(xmlNodePtr keyInfoNode) {
     xmlNodePtr res;
 
     xmlSecAssert2(keyInfoNode != NULL, NULL);
-        
-    res = xmlSecAddChild(keyInfoNode, xmlSecNodeX509Data, xmlSecDSigNs); 
+
+    res = xmlSecAddChild(keyInfoNode, xmlSecNodeX509Data, xmlSecDSigNs);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1278,9 +1278,9 @@ xmlSecTmplKeyInfoAddX509Data(xmlNodePtr keyInfoNode) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeX509Data));
-        return(NULL);   
+        return(NULL);
     }
-    
+
     return(res);
 }
 
@@ -1301,8 +1301,8 @@ xmlSecTmplKeyInfoAddRetrievalMethod(xmlNodePtr keyInfoNode, const xmlChar *uri,
     xmlNodePtr res;
 
     xmlSecAssert2(keyInfoNode != NULL, NULL);
-        
-    res = xmlSecAddChild(keyInfoNode, xmlSecNodeRetrievalMethod, xmlSecDSigNs); 
+
+    res = xmlSecAddChild(keyInfoNode, xmlSecNodeRetrievalMethod, xmlSecDSigNs);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1310,9 +1310,9 @@ xmlSecTmplKeyInfoAddRetrievalMethod(xmlNodePtr keyInfoNode, const xmlChar *uri,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRetrievalMethod));
-        return(NULL);   
+        return(NULL);
     }
-    
+
     if(uri != NULL) {
         xmlSetProp(res, xmlSecAttrURI, uri);
     }
@@ -1326,7 +1326,7 @@ xmlSecTmplKeyInfoAddRetrievalMethod(xmlNodePtr keyInfoNode, const xmlChar *uri,
  * xmlSecTmplRetrievalMethodAddTransform:
  * @retrMethodNode:     the pointer to <dsig:RetrievalMethod/> node.
  * @transformId:        the transform id.
- * 
+ *
  * Adds <dsig:Transform/> node (and the parent <dsig:Transforms/> node
  * if required) to the <dsig:RetrievalMethod/> node @retrMethod.
  *
@@ -1339,8 +1339,8 @@ xmlSecTmplRetrievalMethodAddTransform(xmlNodePtr retrMethodNode, xmlSecTransform
     xmlNodePtr res;
 
     xmlSecAssert2(retrMethodNode != NULL, NULL);
-    xmlSecAssert2(transformId != NULL, NULL);    
-    xmlSecAssert2(transformId->href != NULL, NULL);    
+    xmlSecAssert2(transformId != NULL, NULL);
+    xmlSecAssert2(transformId->href != NULL, NULL);
 
     transformsNode = xmlSecFindChild(retrMethodNode, xmlSecNodeTransforms, xmlSecDSigNs);
     if(transformsNode == NULL) {
@@ -1352,10 +1352,10 @@ xmlSecTmplRetrievalMethodAddTransform(xmlNodePtr retrMethodNode, xmlSecTransform
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeTransforms));
-            return(NULL);       
+            return(NULL);
         }
     }
-    
+
     res = xmlSecAddChild(transformsNode,  xmlSecNodeTransform, xmlSecDSigNs);
     if(res == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1364,9 +1364,9 @@ xmlSecTmplRetrievalMethodAddTransform(xmlNodePtr retrMethodNode, xmlSecTransform
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeTransform));
-        return(NULL);   
+        return(NULL);
     }
-    
+
     if(xmlSetProp(res, xmlSecAttrAlgorithm, transformId->href) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1377,9 +1377,9 @@ xmlSecTmplRetrievalMethodAddTransform(xmlNodePtr retrMethodNode, xmlSecTransform
                     xmlSecErrorsSafeString(transformId->href));
         xmlUnlinkNode(res);
         xmlFreeNode(res);
-        return(NULL);                   
+        return(NULL);
     }
-    
+
     return(res);
 }
 
@@ -1389,16 +1389,16 @@ xmlSecTmplRetrievalMethodAddTransform(xmlNodePtr retrMethodNode, xmlSecTransform
  * @keyInfoNode:        the pointer to <dsig:KeyInfo/> node.
  * @encMethodId:        the encryption method (optional).
  * @id:                 the Id attribute (optional).
- * @type:               the Type attribute (optional). 
- * @recipient:          the Recipient attribute (optional). 
+ * @type:               the Type attribute (optional).
+ * @recipient:          the Recipient attribute (optional).
  *
- * Adds <enc:EncryptedKey/> node with given attributes to 
+ * Adds <enc:EncryptedKey/> node with given attributes to
  * the <dsig:KeyInfo/> node @keyInfoNode.
  *
  * Returns: the pointer to the newly created <enc:EncryptedKey/> node or
  * NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecTmplKeyInfoAddEncryptedKey(xmlNodePtr keyInfoNode, xmlSecTransformId encMethodId,
                          const xmlChar* id, const xmlChar* type, const xmlChar* recipient) {
     xmlNodePtr encKeyNode;
@@ -1406,17 +1406,17 @@ xmlSecTmplKeyInfoAddEncryptedKey(xmlNodePtr keyInfoNode, xmlSecTransformId encMe
     xmlSecAssert2(keyInfoNode != NULL, NULL);
 
     /* we allow multiple encrypted key elements */
-    encKeyNode = xmlSecAddChild(keyInfoNode, xmlSecNodeEncryptedKey, xmlSecEncNs); 
+    encKeyNode = xmlSecAddChild(keyInfoNode, xmlSecNodeEncryptedKey, xmlSecEncNs);
     if(encKeyNode == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeEncryptedKey));
-        return(NULL);   
+        return(NULL);
     }
-    
+
     if(id != NULL) {
         xmlSetProp(encKeyNode, xmlSecAttrId, id);
     }
@@ -1430,27 +1430,27 @@ xmlSecTmplKeyInfoAddEncryptedKey(xmlNodePtr keyInfoNode, xmlSecTransformId encMe
     if(xmlSecTmplPrepareEncData(encKeyNode, encMethodId) < 0) {
         xmlUnlinkNode(encKeyNode);
         xmlFreeNode(encKeyNode);
-        return(NULL);                   
-    }    
-    return(encKeyNode);    
+        return(NULL);
+    }
+    return(encKeyNode);
 }
 
 /***********************************************************************
  *
  * <dsig:X509Data> node
  *
- **********************************************************************/ 
+ **********************************************************************/
 /**
  * xmlSecTmplX509DataAddIssuerSerial:
  * @x509DataNode:       the pointer to <dsig:X509Data/> node.
- * 
+ *
  * Adds <dsig:X509IssuerSerial/> node to the given <dsig:X509Data/> node.
  *
  * Returns: the pointer to the newly created <dsig:X509IssuerSerial/> node or
  * NULL if an error occurs.
  */
 
-xmlNodePtr 
+xmlNodePtr
 xmlSecTmplX509DataAddIssuerSerial(xmlNodePtr x509DataNode) {
     xmlNodePtr cur;
 
@@ -1465,25 +1465,25 @@ xmlSecTmplX509DataAddIssuerSerial(xmlNodePtr x509DataNode) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509IssuerSerial, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial));
         return(NULL);
-    }    
-    
+    }
+
     return (cur);
 }
 
 /**
  * xmlSecTmplX509IssuerSerialAddIssuerName:
  * @x509IssuerSerialNode:       the pointer to <dsig:X509IssuerSerial/> node.
- * @issuerName:         the issuer name (optional).     
+ * @issuerName:         the issuer name (optional).
  *
  * Adds <dsig:X509IssuerName/> node to the <dsig:X509IssuerSerial/> node @x509IssuerSerialNode.
  *
@@ -1493,9 +1493,9 @@ xmlSecTmplX509DataAddIssuerSerial(xmlNodePtr x509DataNode) {
 xmlNodePtr
 xmlSecTmplX509IssuerSerialAddIssuerName(xmlNodePtr x509IssuerSerialNode, const xmlChar* issuerName) {
         xmlNodePtr res;
-        
+
         xmlSecAssert2(x509IssuerSerialNode != NULL, NULL);
-        
+
   if(xmlSecFindChild(x509IssuerSerialNode, xmlSecNodeX509IssuerName,
                                 xmlSecDSigNs) != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1514,7 +1514,7 @@ xmlSecTmplX509IssuerSerialAddIssuerName(xmlNodePtr x509IssuerSerialNode, const x
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
-        return(NULL);   
+        return(NULL);
     }
 
                 if (issuerName != NULL) {
@@ -1526,7 +1526,7 @@ xmlSecTmplX509IssuerSerialAddIssuerName(xmlNodePtr x509IssuerSerialNode, const x
 /**
  * xmlSecTmplX509IssuerSerialAddSerialNumber:
  * @x509IssuerSerialNode:       the pointer to <dsig:X509IssuerSerial/> node.
- * @serial:             the serial number (optional).   
+ * @serial:             the serial number (optional).
  *
  * Adds <dsig:X509SerialNumber/> node to the <dsig:X509IssuerSerial/> node @x509IssuerSerialNode.
  *
@@ -1557,7 +1557,7 @@ xmlSecTmplX509IssuerSerialAddSerialNumber(xmlNodePtr x509IssuerSerialNode, const
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                                 "node=%s",
                                 xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
-                return(NULL);   
+                return(NULL);
         }
 
         if (serial != NULL) {
@@ -1569,14 +1569,14 @@ xmlSecTmplX509IssuerSerialAddSerialNumber(xmlNodePtr x509IssuerSerialNode, const
 /**
  * xmlSecTmplX509DataAddSubjectName:
  * @x509DataNode:       the pointer to <dsig:X509Data/> node.
- * 
+ *
  * Adds <dsig:X509SubjectName/> node to the given <dsig:X509Data/> node.
  *
  * Returns: the pointer to the newly created <dsig:X509SubjectName/> node or
  * NULL if an error occurs.
  */
 
-xmlNodePtr 
+xmlNodePtr
 xmlSecTmplX509DataAddSubjectName(xmlNodePtr x509DataNode) {
     xmlNodePtr cur;
 
@@ -1591,32 +1591,32 @@ xmlSecTmplX509DataAddSubjectName(xmlNodePtr x509DataNode) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509SubjectName, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeX509SubjectName));
         return(NULL);
-    }    
-    
+    }
+
     return (cur);
 }
 
 /**
  * xmlSecTmplX509DataAddSKI:
  * @x509DataNode:       the pointer to <dsig:X509Data/> node.
- * 
+ *
  * Adds <dsig:X509SKI/> node to the given <dsig:X509Data/> node.
  *
  * Returns: the pointer to the newly created <dsig:X509SKI/> node or
  * NULL if an error occurs.
  */
 
-xmlNodePtr 
+xmlNodePtr
 xmlSecTmplX509DataAddSKI(xmlNodePtr x509DataNode) {
     xmlNodePtr cur;
 
@@ -1631,18 +1631,18 @@ xmlSecTmplX509DataAddSKI(xmlNodePtr x509DataNode) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509SKI, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeX509SKI));
         return(NULL);
-    }    
-    
+    }
+
     return (cur);
 }
 
@@ -1650,14 +1650,14 @@ xmlSecTmplX509DataAddSKI(xmlNodePtr x509DataNode) {
 /**
  * xmlSecTmplX509DataAddCertificate:
  * @x509DataNode:       the pointer to <dsig:X509Data/> node.
- * 
+ *
  * Adds <dsig:X509Certificate/> node to the given <dsig:X509Data/> node.
  *
  * Returns: the pointer to the newly created <dsig:X509Certificate/> node or
  * NULL if an error occurs.
  */
 
-xmlNodePtr 
+xmlNodePtr
 xmlSecTmplX509DataAddCertificate(xmlNodePtr x509DataNode) {
     xmlNodePtr cur;
 
@@ -1672,32 +1672,32 @@ xmlSecTmplX509DataAddCertificate(xmlNodePtr x509DataNode) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509Certificate, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
         return(NULL);
-    }    
-    
+    }
+
     return (cur);
 }
 
 /**
  * xmlSecTmplX509DataAddCRL:
  * @x509DataNode:       the pointer to <dsig:X509Data/> node.
- * 
+ *
  * Adds <dsig:X509CRL/> node to the given <dsig:X509Data/> node.
  *
  * Returns: the pointer to the newly created <dsig:X509CRL/> node or
  * NULL if an error occurs.
  */
 
-xmlNodePtr 
+xmlNodePtr
 xmlSecTmplX509DataAddCRL(xmlNodePtr x509DataNode) {
     xmlNodePtr cur;
 
@@ -1712,18 +1712,18 @@ xmlSecTmplX509DataAddCRL(xmlNodePtr x509DataNode) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509CRL, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeX509CRL));
         return(NULL);
-    }    
-    
+    }
+
     return (cur);
 }
 
@@ -1738,7 +1738,7 @@ xmlSecTmplX509DataAddCRL(xmlNodePtr x509DataNode) {
  * @transformNode:      the pointer to <dsig:Transform/> node
  * @bitsLen:            the required length in bits
  *
- * Creates <dsig:HMACOutputLength/> child for the HMAC transform 
+ * Creates <dsig:HMACOutputLength/> child for the HMAC transform
  * node @node.
  *
  * Returns: 0 on success and a negatie value otherwise.
@@ -1760,18 +1760,18 @@ xmlSecTmplTransformAddHmacOutputLength(xmlNodePtr transformNode, xmlSecSize bits
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     cur = xmlSecAddChild(transformNode, xmlSecNodeHMACOutputLength, xmlSecDSigNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeHMACOutputLength));
         return(-1);
-    }    
-    
+    }
+
     sprintf(buf, "%u", bitsLen);
     xmlNodeSetContent(cur, BAD_CAST buf);
     return(0);
@@ -1782,13 +1782,13 @@ xmlSecTmplTransformAddHmacOutputLength(xmlNodePtr transformNode, xmlSecSize bits
  * @transformNode:      the pointer to <dsig:Transform/> node.
  * @buf:                the OAEP param buffer.
  * @size:               the OAEP param buffer size.
- * 
+ *
  * Creates <enc:OAEPParam/> child node in the @node.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int     
-xmlSecTmplTransformAddRsaOaepParam(xmlNodePtr transformNode, 
+int
+xmlSecTmplTransformAddRsaOaepParam(xmlNodePtr transformNode,
                         const xmlSecByte *buf, xmlSecSize size) {
     xmlNodePtr oaepParamNode;
     xmlChar *base64;
@@ -1804,7 +1804,7 @@ xmlSecTmplTransformAddRsaOaepParam(xmlNodePtr transformNode,
                     xmlSecErrorsSafeString(xmlSecNodeRsaOAEPparams),
                     XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);    
+        return(-1);
     }
 
     oaepParamNode = xmlSecAddChild(transformNode, xmlSecNodeRsaOAEPparams, xmlSecEncNs);
@@ -1813,11 +1813,11 @@ xmlSecTmplTransformAddRsaOaepParam(xmlNodePtr transformNode,
                     NULL,
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeRsaOAEPparams));
-        return(-1);    
+        return(-1);
     }
-    
+
     base64 = xmlSecBase64Encode(buf, size, 0);
     if(base64 == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1825,9 +1825,9 @@ xmlSecTmplTransformAddRsaOaepParam(xmlNodePtr transformNode,
                     "xmlSecBase64Encode",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", size);
-        return(-1);    
+        return(-1);
     }
-    
+
     xmlNodeSetContent(oaepParamNode, base64);
     xmlFree(base64);
     return(0);
@@ -1837,7 +1837,7 @@ xmlSecTmplTransformAddRsaOaepParam(xmlNodePtr transformNode,
  * xmlSecTmplTransformAddXsltStylesheet:
  * @transformNode:      the pointer to <dsig:Transform/> node.
  * @xslt:               the XSLT transform exspression.
- * 
+ *
  * Writes the XSLT transform expression to the @node.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -1846,10 +1846,10 @@ int
 xmlSecTmplTransformAddXsltStylesheet(xmlNodePtr transformNode, const xmlChar *xslt) {
     xmlDocPtr xsltDoc;
     int ret;
-        
-    xmlSecAssert2(transformNode != NULL, -1);    
-    xmlSecAssert2(xslt != NULL, -1);    
-    
+
+    xmlSecAssert2(transformNode != NULL, -1);
+    xmlSecAssert2(xslt != NULL, -1);
+
     xsltDoc = xmlParseMemory((const char*)xslt, xmlStrlen(xslt));
     if(xsltDoc == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1859,7 +1859,7 @@ xmlSecTmplTransformAddXsltStylesheet(xmlNodePtr transformNode, const xmlChar *xs
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecReplaceContent(transformNode, xmlDocGetRootElement(xsltDoc));
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1870,7 +1870,7 @@ xmlSecTmplTransformAddXsltStylesheet(xmlNodePtr transformNode, const xmlChar *xs
         xmlFreeDoc(xsltDoc);
         return(-1);
     }
-    
+
     xmlFreeDoc(xsltDoc);
     return(0);
 }
@@ -1878,7 +1878,7 @@ xmlSecTmplTransformAddXsltStylesheet(xmlNodePtr transformNode, const xmlChar *xs
 /**
  * xmlSecTmplTransformAddC14NInclNamespaces:
  * @transformNode:      the pointer to <dsig:Transform/> node.
- * @prefixList:         the white space delimited  list of namespace prefixes, 
+ * @prefixList:         the white space delimited  list of namespace prefixes,
  *                      where "#default" indicates the default namespace
  *                      (optional).
  *
@@ -1886,36 +1886,36 @@ xmlSecTmplTransformAddXsltStylesheet(xmlNodePtr transformNode, const xmlChar *xs
  *
  * Returns: 0 if success or a negative value otherwise.
  */
-int             
-xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode, 
+int
+xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode,
                                          const xmlChar *prefixList) {
     xmlNodePtr cur;
 
-    xmlSecAssert2(transformNode != NULL, -1);    
+    xmlSecAssert2(transformNode != NULL, -1);
     xmlSecAssert2(prefixList != NULL, -1);
 
     cur = xmlSecFindChild(transformNode, xmlSecNodeInclusiveNamespaces, xmlSecNsExcC14N);
     if(cur != NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     xmlSecErrorsSafeString(xmlSecNodeInclusiveNamespaces),
                     XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     cur = xmlSecAddChild(transformNode, xmlSecNodeInclusiveNamespaces, xmlSecNsExcC14N);
     if(cur == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecNodeGetName(transformNode)),
                     "xmlSecAddChild",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeInclusiveNamespaces));
         return(-1);
-    }    
-    
-    xmlSetProp(cur, xmlSecAttrPrefixList, prefixList);    
+    }
+
+    xmlSetProp(cur, xmlSecAttrPrefixList, prefixList);
     return(0);
 }
 
@@ -1926,19 +1926,19 @@ xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode,
  * @nsList:             the NULL terminated list of namespace prefix/href pairs
  *                      (optional).
  *
- * Writes XPath transform infromation to the <dsig:Transform/> node 
+ * Writes XPath transform infromation to the <dsig:Transform/> node
  * @node.
  *
  * Returns: 0 for success or a negative value otherwise.
  */
-int     
+int
 xmlSecTmplTransformAddXPath(xmlNodePtr transformNode, const xmlChar *expression,
                          const xmlChar **nsList) {
     xmlNodePtr xpathNode;
-    
+
     xmlSecAssert2(transformNode != NULL, -1);
     xmlSecAssert2(expression != NULL, -1);
-    
+
     xpathNode = xmlSecFindChild(transformNode, xmlSecNodeXPath, xmlSecDSigNs);
     if(xpathNode != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1946,7 +1946,7 @@ xmlSecTmplTransformAddXPath(xmlNodePtr transformNode, const xmlChar *expression,
                     xmlSecErrorsSafeString(xmlSecNodeXPath),
                     XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);    
+        return(-1);
     }
 
     xpathNode = xmlSecAddChild(transformNode, xmlSecNodeXPath, xmlSecDSigNs);
@@ -1957,9 +1957,9 @@ xmlSecTmplTransformAddXPath(xmlNodePtr transformNode, const xmlChar *expression,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeXPath));
-        return(-1);    
+        return(-1);
     }
-    
+
     xmlSecNodeEncodeAndSetContent(xpathNode, expression);
     return((nsList != NULL) ? xmlSecTmplNodeWriteNsList(xpathNode, nsList) : 0);
 }
@@ -1972,7 +1972,7 @@ xmlSecTmplTransformAddXPath(xmlNodePtr transformNode, const xmlChar *expression,
  * @nsList:             the NULL terminated list of namespace prefix/href pairs.
  *                      (optional).
  *
- * Writes XPath2 transform infromation to the <dsig:Transform/> node 
+ * Writes XPath2 transform infromation to the <dsig:Transform/> node
  * @node.
  *
  * Returns: 0 for success or a negative value otherwise.
@@ -1994,10 +1994,10 @@ xmlSecTmplTransformAddXPath2(xmlNodePtr transformNode, const xmlChar* type,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeXPath));
-        return(-1);    
+        return(-1);
     }
     xmlSetProp(xpathNode, xmlSecAttrFilter, type);
-    
+
     xmlSecNodeEncodeAndSetContent(xpathNode, expression);
     return((nsList != NULL) ? xmlSecTmplNodeWriteNsList(xpathNode, nsList) : 0);
 }
@@ -2009,12 +2009,12 @@ xmlSecTmplTransformAddXPath2(xmlNodePtr transformNode, const xmlChar* type,
  * @nsList:             the NULL terminated list of namespace prefix/href pairs.
  *                      (optional).
  *
- * Writes XPoniter transform infromation to the <dsig:Transform/> node 
+ * Writes XPoniter transform infromation to the <dsig:Transform/> node
  * @node.
  *
  * Returns: 0 for success or a negative value otherwise.
  */
-int     
+int
 xmlSecTmplTransformAddXPointer(xmlNodePtr transformNode, const xmlChar *expression,
                          const xmlChar **nsList) {
     xmlNodePtr xpointerNode;
@@ -2029,7 +2029,7 @@ xmlSecTmplTransformAddXPointer(xmlNodePtr transformNode, const xmlChar *expressi
                     xmlSecErrorsSafeString(xmlSecNodeXPointer),
                     XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);    
+        return(-1);
     }
 
     xpointerNode = xmlSecAddChild(transformNode, xmlSecNodeXPointer, xmlSecXPointerNs);
@@ -2040,15 +2040,15 @@ xmlSecTmplTransformAddXPointer(xmlNodePtr transformNode, const xmlChar *expressi
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeXPointer));
-        return(-1);    
+        return(-1);
     }
-    
-    
+
+
     xmlSecNodeEncodeAndSetContent(xpointerNode, expression);
     return((nsList != NULL) ? xmlSecTmplNodeWriteNsList(xpointerNode, nsList) : 0);
 }
 
-static int 
+static int
 xmlSecTmplNodeWriteNsList(xmlNodePtr parentNode, const xmlChar** nsList) {
     xmlNsPtr ns;
     const xmlChar *prefix;
@@ -2057,7 +2057,7 @@ xmlSecTmplNodeWriteNsList(xmlNodePtr parentNode, const xmlChar** nsList) {
 
     xmlSecAssert2(parentNode != NULL, -1);
     xmlSecAssert2(nsList != NULL, -1);
-        
+
     ptr = nsList;
     while((*ptr) != NULL) {
         if(xmlStrEqual(BAD_CAST "#default", (*ptr))) {
@@ -2081,7 +2081,7 @@ xmlSecTmplNodeWriteNsList(xmlNodePtr parentNode, const xmlChar** nsList) {
                         NULL,
                         "xmlNewNs",
                         XMLSEC_ERRORS_R_XML_FAILED,
-                        "href=%s;prefix=%s", 
+                        "href=%s;prefix=%s",
                         xmlSecErrorsSafeString(href),
                         xmlSecErrorsSafeString(prefix));
             return(-1);
diff --git a/src/transforms.c b/src/transforms.c
index 56372a8..e8e0050 100644
--- a/src/transforms.c
+++ b/src/transforms.c
@@ -1,41 +1,41 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * The Transforms Element (http://www.w3.org/TR/xmldsig-core/#sec-Transforms)
- * 
- * The optional Transforms element contains an ordered list of Transform 
- * elements; these describe how the signer obtained the data object that 
+ *
+ * The optional Transforms element contains an ordered list of Transform
+ * elements; these describe how the signer obtained the data object that
  * was digested.
  *
  * Schema Definition:
- * 
+ *
  *  <element name="Transforms" type="ds:TransformsType"/>
  *  <complexType name="TransformsType">
  *    <sequence>
- *      <element ref="ds:Transform" maxOccurs="unbounded"/> 
+ *      <element ref="ds:Transform" maxOccurs="unbounded"/>
  *    </sequence>
  *   </complexType>
  *
  *  <element name="Transform" type="ds:TransformType"/>
  *  <complexType name="TransformType" mixed="true">
- *    <choice minOccurs="0" maxOccurs="unbounded"> 
+ *    <choice minOccurs="0" maxOccurs="unbounded">
  *      <any namespace="##other" processContents="lax"/>
  *      <!-- (1,1) elements from (0,unbounded) namespaces -->
- *      <element name="XPath" type="string"/> 
+ *      <element name="XPath" type="string"/>
  *    </choice>
- *    <attribute name="Algorithm" type="anyURI" use="required"/> 
+ *    <attribute name="Algorithm" type="anyURI" use="required"/>
  *  </complexType>
- *    
+ *
  * DTD:
- *    
+ *
  *  <!ELEMENT Transforms (Transform+)>
  *  <!ELEMENT Transform (#PCDATA|XPath %Transform.ANY;)* >
  *  <!ATTLIST Transform Algorithm    CDATA    #REQUIRED >
  *  <!ELEMENT XPath (#PCDATA) >
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 
@@ -69,11 +69,11 @@
 static xmlSecPtrList xmlSecAllTransformIds;
 
 
-/** 
+/**
  * xmlSecTransformIdsGet:
  *
  * Gets global registered transform klasses list.
- * 
+ *
  * Returns: the pointer to list of all registered transform klasses.
  */
 xmlSecPtrListPtr
@@ -81,18 +81,18 @@ xmlSecTransformIdsGet(void) {
     return(&xmlSecAllTransformIds);
 }
 
-/** 
+/**
  * xmlSecTransformIdsInit:
  *
- * Initializes the transform klasses. This function is called from the 
+ * Initializes the transform klasses. This function is called from the
  * #xmlSecInit function and the application should not call it directly.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformIdsInit(void) {
     int ret;
-    
+
     ret = xmlSecPtrListInitialize(xmlSecTransformIdsGet(), xmlSecTransformIdListId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -102,7 +102,7 @@ xmlSecTransformIdsInit(void) {
                     "xmlSecTransformIdListId");
         return(-1);
     }
-    
+
     ret = xmlSecTransformIdsRegisterDefault();
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -112,14 +112,14 @@ xmlSecTransformIdsInit(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
 /**
  * xmlSecTransformIdsShutdown:
- * 
- * Shuts down the keys data klasses. This function is called from the 
+ *
+ * Shuts down the keys data klasses. This function is called from the
  * #xmlSecShutdown function and the application should not call it directly.
  */
 void
@@ -127,7 +127,7 @@ xmlSecTransformIdsShutdown(void) {
     xmlSecPtrListFinalize(xmlSecTransformIdsGet());
 }
 
-/** 
+/**
  * xmlSecTransformIdsRegister:
  * @id:                 the transform klass.
  *
@@ -135,12 +135,12 @@ xmlSecTransformIdsShutdown(void) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformIdsRegister(xmlSecTransformId id) {
     int ret;
-        
+
     xmlSecAssert2(id != xmlSecTransformIdUnknown, -1);
-    
+
     ret = xmlSecPtrListAdd(xmlSecTransformIdsGet(), (xmlSecPtr)id);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -151,8 +151,8 @@ xmlSecTransformIdsRegister(xmlSecTransformId id) {
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
         return(-1);
     }
-    
-    return(0);    
+
+    return(0);
 }
 
 /**
@@ -163,12 +163,12 @@ xmlSecTransformIdsRegister(xmlSecTransformId id) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformBase64Id) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformBase64Id)));
@@ -178,7 +178,7 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformEnvelopedId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformEnvelopedId)));
@@ -189,7 +189,7 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformInclC14NId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NId)));
@@ -198,7 +198,7 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformInclC14NWithCommentsId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NWithCommentsId)));
@@ -207,7 +207,7 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformInclC14N11Id) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14N11Id)));
@@ -216,7 +216,7 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformInclC14N11WithCommentsId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14N11WithCommentsId)));
@@ -225,7 +225,7 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformExclC14NId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformExclC14NId)));
@@ -234,7 +234,7 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformExclC14NWithCommentsId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformExclC14NWithCommentsId)));
@@ -244,7 +244,7 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformXPathId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPathId)));
@@ -254,7 +254,7 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformXPath2Id) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPath2Id)));
@@ -264,7 +264,7 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformXPointerId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPointerId)));
@@ -275,14 +275,14 @@ xmlSecTransformIdsRegisterDefault(void) {
     if(xmlSecTransformIdsRegister(xmlSecTransformXsltId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformIdsRegister",           
+                    "xmlSecTransformIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXsltId)));
         return(-1);
     }
-#endif /* XMLSEC_NO_XSLT */    
-    
+#endif /* XMLSEC_NO_XSLT */
+
     return(0);
 }
 
@@ -301,7 +301,7 @@ xmlSecTransformIdsRegisterDefault(void) {
  * Returns: 1 if @uri matches @type, 0 if not or a negative value
  * if an error occurs.
  */
-int 
+int
 xmlSecTransformUriTypeCheck(xmlSecTransformUriType type, const xmlChar* uri) {
     xmlSecTransformUriType uriType = 0;
 
@@ -313,7 +313,7 @@ xmlSecTransformUriTypeCheck(xmlSecTransformUriType type, const xmlChar* uri) {
         uriType = xmlSecTransformUriTypeLocal;
     } else {
         uriType = xmlSecTransformUriTypeRemote;
-    }    
+    }
     return(((uriType & type) != 0) ? 1 : 0);
 }
 
@@ -327,17 +327,17 @@ xmlSecTransformUriTypeCheck(xmlSecTransformUriType type, const xmlChar* uri) {
  * xmlSecTransformCtxCreate:
  *
  * Creates transforms chain processing context.
- * The caller is responsible for destroying returend object by calling 
+ * The caller is responsible for destroying returend object by calling
  * #xmlSecTransformCtxDestroy function.
  *
  * Returns: pointer to newly allocated context object or NULL if an error
  * occurs.
  */
-xmlSecTransformCtxPtr 
+xmlSecTransformCtxPtr
 xmlSecTransformCtxCreate(void) {
     xmlSecTransformCtxPtr ctx;
     int ret;
-    
+
     /* Allocate a new xmlSecTransform and fill the fields. */
     ctx = (xmlSecTransformCtxPtr)xmlMalloc(sizeof(xmlSecTransformCtx));
     if(ctx == NULL) {
@@ -345,10 +345,10 @@ xmlSecTransformCtxCreate(void) {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "size=%d", sizeof(xmlSecTransformCtx)); 
+                    "size=%d", sizeof(xmlSecTransformCtx));
         return(NULL);
     }
-    
+
     ret = xmlSecTransformCtxInitialize(ctx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -359,7 +359,7 @@ xmlSecTransformCtxCreate(void) {
         xmlSecTransformCtxDestroy(ctx);
         return(NULL);
     }
-    
+
     return(ctx);
 }
 
@@ -372,7 +372,7 @@ xmlSecTransformCtxCreate(void) {
 void
 xmlSecTransformCtxDestroy(xmlSecTransformCtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
-    
+
     xmlSecTransformCtxFinalize(ctx);
     xmlFree(ctx);
 }
@@ -382,21 +382,21 @@ xmlSecTransformCtxDestroy(xmlSecTransformCtxPtr ctx) {
  * @ctx:                the pointer to transforms chain processing context.
  *
  * Initializes transforms chain processing context.
- * The caller is responsible for cleaing up returend object by calling 
+ * The caller is responsible for cleaing up returend object by calling
  * #xmlSecTransformCtxFinalize function.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformCtxInitialize(xmlSecTransformCtxPtr ctx) {
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecTransformCtx));
 
     ret = xmlSecPtrListInitialize(&(ctx->enabledTransforms), xmlSecTransformIdListId);
-    if(ret < 0) { 
+    if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecPtrListInitialize",
@@ -415,10 +415,10 @@ xmlSecTransformCtxInitialize(xmlSecTransformCtxPtr ctx) {
  *
  * Cleans up @ctx object initialized with #xmlSecTransformCtxInitialize function.
  */
-void 
+void
 xmlSecTransformCtxFinalize(xmlSecTransformCtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
-    
+
     xmlSecTransformCtxReset(ctx);
     xmlSecPtrListFinalize(&(ctx->enabledTransforms));
     memset(ctx, 0, sizeof(xmlSecTransformCtx));
@@ -430,15 +430,15 @@ xmlSecTransformCtxFinalize(xmlSecTransformCtxPtr ctx) {
  *
  * Resets transfroms context for new processing.
  */
-void 
+void
 xmlSecTransformCtxReset(xmlSecTransformCtxPtr ctx) {
-    xmlSecTransformPtr transform, tmp;    
-    
+    xmlSecTransformPtr transform, tmp;
+
     xmlSecAssert(ctx != NULL);
 
     ctx->result = NULL;
     ctx->status = xmlSecTransformStatusNone;
-    
+
     /* destroy uri */
     if(ctx->uri != NULL) {
         xmlFree(ctx->uri);
@@ -448,7 +448,7 @@ xmlSecTransformCtxReset(xmlSecTransformCtxPtr ctx) {
         xmlFree(ctx->xptrExpr);
         ctx->xptrExpr = NULL;
     }
-    
+
     /* destroy transforms chain */
     for(transform = ctx->first; transform != NULL; transform = tmp) {
         tmp = transform->next;
@@ -458,7 +458,7 @@ xmlSecTransformCtxReset(xmlSecTransformCtxPtr ctx) {
 }
 
 /**
- * xmlSecTransformCtxCopyUserPref: 
+ * xmlSecTransformCtxCopyUserPref:
  * @dst:                the pointer to destination transforms chain processing context.
  * @src:                the pointer to source transforms chain processing context.
  *
@@ -466,21 +466,21 @@ xmlSecTransformCtxReset(xmlSecTransformCtxPtr ctx) {
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecTransformCtxCopyUserPref(xmlSecTransformCtxPtr dst, xmlSecTransformCtxPtr src) {
     int ret;
-    
+
     xmlSecAssert2(dst != NULL, -1);
     xmlSecAssert2(src != NULL, -1);
-    
-    dst->userData        = src->userData;  
-    dst->flags           = src->flags;  
-    dst->flags2          = src->flags2;  
+
+    dst->userData        = src->userData;
+    dst->flags           = src->flags;
+    dst->flags2          = src->flags2;
     dst->enabledUris     = src->enabledUris;
     dst->preExecCallback = src->preExecCallback;
-    
+
     ret = xmlSecPtrListCopy(&(dst->enabledTransforms), &(src->enabledTransforms));
-    if(ret < 0) { 
+    if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecPtrListCopy",
@@ -488,25 +488,25 @@ xmlSecTransformCtxCopyUserPref(xmlSecTransformCtxPtr dst, xmlSecTransformCtxPtr
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
 /**
- * xmlSecTransformCtxAppend: 
+ * xmlSecTransformCtxAppend:
  * @ctx:                the pointer to transforms chain processing context.
  * @transform:          the pointer to new transform.
  *
- * Connects the @transform to the end of the chain of transforms in the @ctx 
+ * Connects the @transform to the end of the chain of transforms in the @ctx
  * (see #xmlSecTransformConnect function for details).
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecTransformCtxAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transform) {
     int ret;
-    
-    xmlSecAssert2(ctx != NULL, -1);    
+
+    xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1);
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
 
@@ -515,7 +515,7 @@ xmlSecTransformCtxAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transform
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "xmlSecTransformConnect",           
+                        "xmlSecTransformConnect",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "name=%s",
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
@@ -531,19 +531,19 @@ xmlSecTransformCtxAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transform
 }
 
 /**
- * xmlSecTransformCtxPrepend: 
+ * xmlSecTransformCtxPrepend:
  * @ctx:                the pointer to transforms chain processing context.
  * @transform:          the pointer to new transform.
  *
- * Connects the @transform to the beggining of the chain of transforms in the @ctx 
+ * Connects the @transform to the beggining of the chain of transforms in the @ctx
  * (see #xmlSecTransformConnect function for details).
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecTransformCtxPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transform) {
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1);
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
@@ -553,7 +553,7 @@ xmlSecTransformCtxPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transfor
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "xmlSecTransformConnect",           
+                        "xmlSecTransformConnect",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "name=%s",
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
@@ -569,20 +569,20 @@ xmlSecTransformCtxPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transfor
 }
 
 /**
- * xmlSecTransformCtxCreateAndAppend: 
+ * xmlSecTransformCtxCreateAndAppend:
  * @ctx:                the pointer to transforms chain processing context.
  * @id:                 the new transform klass.
  *
- * Creaeates new transform and connects it to the end of the chain of 
+ * Creaeates new transform and connects it to the end of the chain of
  * transforms in the @ctx (see #xmlSecTransformConnect function for details).
  *
  * Returns: pointer to newly created transform or NULL if an error occurs.
  */
-xmlSecTransformPtr 
+xmlSecTransformPtr
 xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformId id) {
     xmlSecTransformPtr transform;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, NULL);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, NULL);
     xmlSecAssert2(id != xmlSecTransformIdUnknown, NULL);
@@ -591,7 +591,7 @@ xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformId i
     if(!xmlSecTransformIsValid(transform)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCreate",                
+                    "xmlSecTransformCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
@@ -602,7 +602,7 @@ xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformId i
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCtxAppend",     
+                    "xmlSecTransformCtxAppend",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
@@ -614,20 +614,20 @@ xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformId i
 }
 
 /**
- * xmlSecTransformCtxCreateAndPrepend: 
+ * xmlSecTransformCtxCreateAndPrepend:
  * @ctx:                the pointer to transforms chain processing context.
  * @id:                 the new transform klass.
  *
- * Creaeates new transform and connects it to the end of the chain of 
+ * Creaeates new transform and connects it to the end of the chain of
  * transforms in the @ctx (see #xmlSecTransformConnect function for details).
  *
  * Returns: pointer to newly created transform or NULL if an error occurs.
  */
-xmlSecTransformPtr 
+xmlSecTransformPtr
 xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformId id) {
     xmlSecTransformPtr transform;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, NULL);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, NULL);
     xmlSecAssert2(id != xmlSecTransformIdUnknown, NULL);
@@ -636,7 +636,7 @@ xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformId
     if(!xmlSecTransformIsValid(transform)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCreate",                
+                    "xmlSecTransformCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
@@ -647,7 +647,7 @@ xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformId
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCtxPrepend",            
+                    "xmlSecTransformCtxPrepend",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
@@ -659,26 +659,26 @@ xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformId
 }
 
 /**
- * xmlSecTransformCtxNodeRead: 
+ * xmlSecTransformCtxNodeRead:
  * @ctx:                the pointer to transforms chain processing context.
  * @node:               the pointer to transform's node.
  * @usage:              the transform's usage (signature, encryption, etc.).
  *
- * Reads the transform from the @node and appends it to the current chain 
+ * Reads the transform from the @node and appends it to the current chain
  * of transforms in @ctx.
  *
  * Returns: pointer to newly created transform or NULL if an error occurs.
  */
 xmlSecTransformPtr
-xmlSecTransformCtxNodeRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node, 
+xmlSecTransformCtxNodeRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node,
                            xmlSecTransformUsage usage) {
     xmlSecTransformPtr transform;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, NULL);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, NULL);
     xmlSecAssert2(node != NULL, NULL);
-    
+
     transform = xmlSecTransformNodeRead(node, usage, ctx);
     if(transform == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -686,46 +686,46 @@ xmlSecTransformCtxNodeRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node,
                     "xmlSecTransformNodeRead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
-                    xmlSecErrorsSafeString(xmlSecNodeGetName(node))); 
+                    xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
         return(NULL);
     }
-    
+
     ret = xmlSecTransformCtxAppend(ctx, transform);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCtxAppend",     
+                    "xmlSecTransformCtxAppend",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
         xmlSecTransformDestroy(transform);
         return(NULL);
     }
-    
+
     return(transform);
 }
 
 /**
- * xmlSecTransformCtxNodesListRead: 
+ * xmlSecTransformCtxNodesListRead:
  * @ctx:                the pointer to transforms chain processing context.
  * @node:               the pointer to <dsig:Transform/> nodes parent node.
  * @usage:              the transform's usage (signature, encryption, etc.).
  *
- * Reads transforms from the <dsig:Transform/> children of the @node and 
+ * Reads transforms from the <dsig:Transform/> children of the @node and
  * appends them to the current transforms chain in @ctx object.
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecTransformCtxNodesListRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node, xmlSecTransformUsage usage) {
     xmlSecTransformPtr transform;
     xmlNodePtr cur;
     int ret;
-        
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     cur = xmlSecGetNextElementNode(node->children);
     while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeTransform, xmlSecDSigNs)) {
         transform = xmlSecTransformNodeRead(cur, usage, ctx);
@@ -738,8 +738,8 @@ xmlSecTransformCtxNodesListRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node, xmlS
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
             return(-1);
         }
-        
-        ret = xmlSecTransformCtxAppend(ctx, transform); 
+
+        ret = xmlSecTransformCtxAppend(ctx, transform);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -749,7 +749,7 @@ xmlSecTransformCtxNodesListRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node, xmlS
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
             xmlSecTransformDestroy(transform);
             return(-1);
-        }       
+        }
         cur = xmlSecGetNextElementNode(cur->next);
     }
 
@@ -760,44 +760,44 @@ xmlSecTransformCtxNodesListRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node, xmlS
                     XMLSEC_ERRORS_R_UNEXPECTED_NODE,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
     return(0);
 }
 
 /**
- * xmlSecTransformCtxSetUri: 
+ * xmlSecTransformCtxSetUri:
  * @ctx:                the pointer to transforms chain processing context.
  * @uri:                the URI.
- * @hereNode:           the pointer to "here" node required by some 
+ * @hereNode:           the pointer to "here" node required by some
  *                      XML transforms (may be NULL).
  *
  * Parses uri and adds xpointer transforms if required.
  *
  * The following examples demonstrate what the URI attribute identifies and
- * how it is dereferenced 
+ * how it is dereferenced
  * (http://www.w3.org/TR/xmldsig-core/#sec-ReferenceProcessingModel):
  *
  * - URI="http://example.com/bar.xml";
- * identifies the octets that represent the external resource 
- * 'http://example.com/bar.xml', that is probably an XML document given 
- * its file extension. 
+ * identifies the octets that represent the external resource
+ * 'http://example.com/bar.xml', that is probably an XML document given
+ * its file extension.
  *
  * - URI="http://example.com/bar.xml#chapter1";
- * identifies the element with ID attribute value 'chapter1' of the 
- * external XML resource 'http://example.com/bar.xml', provided as an 
- * octet stream. Again, for the sake of interoperability, the element 
- * identified as 'chapter1' should be obtained using an XPath transform 
- * rather than a URI fragment (barename XPointer resolution in external 
- * resources is not REQUIRED in this specification). 
+ * identifies the element with ID attribute value 'chapter1' of the
+ * external XML resource 'http://example.com/bar.xml', provided as an
+ * octet stream. Again, for the sake of interoperability, the element
+ * identified as 'chapter1' should be obtained using an XPath transform
+ * rather than a URI fragment (barename XPointer resolution in external
+ * resources is not REQUIRED in this specification).
  *
  * - URI=""
- * identifies the node-set (minus any comment nodes) of the XML resource 
- * containing the signature 
+ * identifies the node-set (minus any comment nodes) of the XML resource
+ * containing the signature
  *
  * - URI="#chapter1"
- * identifies a node-set containing the element with ID attribute value 
- * 'chapter1' of the XML resource containing the signature. XML Signature 
- * (and its applications) modify this node-set to include the element plus 
+ * identifies a node-set containing the element with ID attribute value
+ * 'chapter1' of the XML resource containing the signature. XML Signature
+ * (and its applications) modify this node-set to include the element plus
  * all descendents including namespaces and attributes -- but not comments.
  *
  * Returns: 0 on success or a negative value otherwise.
@@ -809,7 +809,7 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
     xmlChar* buf = NULL;
     int useVisa3DHack = 0;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->uri == NULL, -1);
     xmlSecAssert2(ctx->xptrExpr == NULL, -1);
@@ -822,12 +822,12 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_URI_TYPE,
-                    "uri=%s", 
+                    "uri=%s",
                     xmlSecErrorsSafeString(uri));
         return(-1);
     }
 
-    /* is it an empty uri? */    
+    /* is it an empty uri? */
     if((uri == NULL) || (xmlStrlen(uri) == 0)) {
         return(0);
     }
@@ -841,7 +841,7 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_STRDUP_FAILED,
-                        "size=%d", xmlStrlen(uri)); 
+                        "size=%d", xmlStrlen(uri));
             return(-1);
         }
         /* we are done */
@@ -853,20 +853,20 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_STRDUP_FAILED,
-                        "size=%d", xmlStrlen(uri)); 
+                        "size=%d", xmlStrlen(uri));
             return(-1);
         }
         /* we are done */
-        return(0);      
+        return(0);
     }
-    
+
     ctx->uri = xmlStrndup(uri, xptr - uri);
     if(ctx->uri == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_STRDUP_FAILED,
-                    "size=%d", xptr - uri); 
+                    "size=%d", xptr - uri);
         return(-1);
     }
 
@@ -876,7 +876,7 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_STRDUP_FAILED,
-                    "size=%d", xmlStrlen(xptr)); 
+                    "size=%d", xmlStrlen(xptr));
         return(-1);
     }
 
@@ -892,8 +892,8 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
     } else {
         static const char tmpl[] = "xpointer(id(\'%s\'))";
         xmlSecSize size;
-        
-        /* we need to add "xpointer(id('..')) because otherwise we have 
+
+        /* we need to add "xpointer(id('..')) because otherwise we have
          * problems with numeric ("111" and so on) and other "strange" ids */
         size = xmlStrlen(BAD_CAST tmpl) + xmlStrlen(xptr) + 2;
         buf = (xmlChar*)xmlMalloc(size * sizeof(xmlChar));
@@ -903,33 +903,33 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
                         NULL,
                         XMLSEC_ERRORS_R_MALLOC_FAILED,
                         "size=%d", size);
-            return(-1);     
+            return(-1);
         }
         sprintf((char*)buf, tmpl, xptr + 1);
         xptr = buf;
         nodeSetType = xmlSecNodeSetTreeWithoutComments;
     }
 
-    if(useVisa3DHack == 0) {    
+    if(useVisa3DHack == 0) {
         xmlSecTransformPtr transform;
-        
+
         /* we need to create XPonter transform to execute expr */
         transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformXPointerId);
         if(!xmlSecTransformIsValid(transform)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "xmlSecTransformCtxCreateAndPrepend", 
+                        "xmlSecTransformCtxCreateAndPrepend",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "transform=%s",
                         xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPointerId)));
             return(-1);
         }
-    
+
         ret = xmlSecTransformXPointerSetExpr(transform, xptr, nodeSetType, hereNode);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "xmlSecTransformXPointerSetExpr",  
+                        "xmlSecTransformXPointerSetExpr",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "name=%s",
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
@@ -940,29 +940,29 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
         }
     } else {
         /* Visa3D protocol doesn't follow XML/XPointer/XMLDSig specs
-         * and allows invalid XPointer expressions (e.g. "#12345") in 
-         * the URI attribute. 
-         * Since we couldn't evaluate such expressions thru XPath/XPointer 
+         * and allows invalid XPointer expressions (e.g. "#12345") in
+         * the URI attribute.
+         * Since we couldn't evaluate such expressions thru XPath/XPointer
          * engine, we need to have this hack here
          */
         xmlSecTransformPtr transform;
-        
+
         transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformVisa3DHackId);
         if(!xmlSecTransformIsValid(transform)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "xmlSecTransformCtxCreateAndPrepend", 
+                        "xmlSecTransformCtxCreateAndPrepend",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "transform=%s",
                         xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformVisa3DHackId)));
             return(-1);
         }
-    
+
         ret = xmlSecTransformVisa3DHackSetID(transform, xptr);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "xmlSecTransformVisa3DHackSetID",  
+                        "xmlSecTransformVisa3DHackSetID",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "name=%s",
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
@@ -975,12 +975,12 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
     if(buf != NULL) {
         xmlFree(buf);
     }
-    
+
     return(0);
 }
 
 /**
- * xmlSecTransformCtxPrepare: 
+ * xmlSecTransformCtxPrepare:
  * @ctx:                the pointer to transforms chain processing context.
  * @inputDataType:      the expected input type.
  *
@@ -988,22 +988,22 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecTransformCtxPrepare(xmlSecTransformCtxPtr ctx, xmlSecTransformDataType inputDataType) {
     xmlSecTransformDataType firstType;
     xmlSecTransformPtr transform;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->result == NULL, -1);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1);
-    
+
     /* add binary buffer to store result */
     transform = xmlSecTransformCtxCreateAndAppend(ctx, xmlSecTransformMemBufId);
     if(!xmlSecTransformIsValid(transform)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCreate",                
+                    "xmlSecTransformCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
@@ -1013,17 +1013,17 @@ xmlSecTransformCtxPrepare(xmlSecTransformCtxPtr ctx, xmlSecTransformDataType inp
     if(ctx->result == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformMemBufGetBuffer",  
+                    "xmlSecTransformMemBufGetBuffer",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
         return(-1);
-    }    
+    }
 
     firstType = xmlSecTransformGetDataType(ctx->first, xmlSecTransformModePush, ctx);
     if(((firstType & xmlSecTransformDataTypeBin) == 0) &&
        ((inputDataType & xmlSecTransformDataTypeBin) != 0)) {
-        
+
         /* need to add parser transform */
         transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformXmlParserId);
         if(transform == NULL) {
@@ -1058,19 +1058,19 @@ xmlSecTransformCtxPrepare(xmlSecTransformCtxPtr ctx, xmlSecTransformDataType inp
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "ctx->preExecCallback", 
+                        "ctx->preExecCallback",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
+        }
     }
 
-    ctx->status = xmlSecTransformStatusWorking;    
+    ctx->status = xmlSecTransformStatusWorking;
     return(0);
 }
 
 /**
- * xmlSecTransformCtxBinaryExecute: 
+ * xmlSecTransformCtxBinaryExecute:
  * @ctx:                the pointer to transforms chain processing context.
  * @data:               the input binary data buffer.
  * @dataSize:           the input data size.
@@ -1080,10 +1080,10 @@ xmlSecTransformCtxPrepare(xmlSecTransformCtxPtr ctx, xmlSecTransformDataType inp
  * Returns: 0 on success or a negative value otherwise.
  */
 int
-xmlSecTransformCtxBinaryExecute(xmlSecTransformCtxPtr ctx, 
+xmlSecTransformCtxBinaryExecute(xmlSecTransformCtxPtr ctx,
                                 const xmlSecByte* data, xmlSecSize dataSize) {
     int ret;
-        
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->result == NULL, -1);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1);
@@ -1092,33 +1092,33 @@ xmlSecTransformCtxBinaryExecute(xmlSecTransformCtxPtr ctx,
 
     /* we should not have uri stored in ctx */
     xmlSecAssert2(ctx->uri == NULL, -1);
-    
+
     ret = xmlSecTransformCtxPrepare(ctx, xmlSecTransformDataTypeBin);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCtxPrepare", 
+                    "xmlSecTransformCtxPrepare",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "type=bin");
         return(-1);
-    }   
-    
+    }
+
     ret = xmlSecTransformPushBin(ctx->first, data, dataSize, 1, ctx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCtxPushBin", 
+                    "xmlSecTransformCtxPushBin",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "dataSize=%d", dataSize);
         return(-1);
     }
 
     ctx->status = xmlSecTransformStatusFinished;
-    return(0);    
+    return(0);
 }
 
 /**
- * xmlSecTransformCtxUriExecute: 
+ * xmlSecTransformCtxUriExecute:
  * @ctx:                the pointer to transforms chain processing context.
  * @uri:                the URI.
  *
@@ -1126,18 +1126,18 @@ xmlSecTransformCtxBinaryExecute(xmlSecTransformCtxPtr ctx,
  *
  * Returns: 0 on success or a negative value otherwise.
  */
-int 
+int
 xmlSecTransformCtxUriExecute(xmlSecTransformCtxPtr ctx, const xmlChar* uri) {
     xmlSecTransformPtr uriTransform;
     int ret;
-        
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1);
     xmlSecAssert2(uri != NULL, -1);
 
     /* we should not execute transform for a different uri */
     xmlSecAssert2((ctx->uri == NULL) || (uri == ctx->uri) || xmlStrEqual(uri, ctx->uri), -1);
-    
+
     uriTransform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformInputURIId);
     if(uriTransform == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1148,7 +1148,7 @@ xmlSecTransformCtxUriExecute(xmlSecTransformCtxPtr ctx, const xmlChar* uri) {
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInputURIId)));
         return(-1);
     }
-    
+
     ret = xmlSecTransformInputURIOpen(uriTransform, uri);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1165,16 +1165,16 @@ xmlSecTransformCtxUriExecute(xmlSecTransformCtxPtr ctx, const xmlChar* uri) {
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCtxPrepare", 
+                    "xmlSecTransformCtxPrepare",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "type=bin");
         return(-1);
-    }   
-    
-    /* Now we have a choice: we either can push from first transform or pop 
+    }
+
+    /* Now we have a choice: we either can push from first transform or pop
      * from last. Our C14N transforms prefers push, so push data!
      */
-    ret = xmlSecTransformPump(uriTransform, uriTransform->next, ctx);     
+    ret = xmlSecTransformPump(uriTransform, uriTransform->next, ctx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1184,13 +1184,13 @@ xmlSecTransformCtxUriExecute(xmlSecTransformCtxPtr ctx, const xmlChar* uri) {
                     xmlSecErrorsSafeString(uri));
         return(-1);
     }
-     
+
     ctx->status = xmlSecTransformStatusFinished;
     return(0);
 }
 
 /**
- * xmlSecTransformCtxXmlExecute: 
+ * xmlSecTransformCtxXmlExecute:
  * @ctx:                the pointer to transforms chain processing context.
  * @nodes:              the input node set.
  *
@@ -1201,23 +1201,23 @@ xmlSecTransformCtxUriExecute(xmlSecTransformCtxPtr ctx, const xmlChar* uri) {
 int
 xmlSecTransformCtxXmlExecute(xmlSecTransformCtxPtr ctx, xmlSecNodeSetPtr nodes) {
     int ret;
-        
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->result == NULL, -1);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1);
     xmlSecAssert2(nodes != NULL, -1);
-    
-    xmlSecAssert2((ctx->uri == NULL) || (xmlStrlen(ctx->uri) == 0), -1); 
+
+    xmlSecAssert2((ctx->uri == NULL) || (xmlStrlen(ctx->uri) == 0), -1);
 
     ret = xmlSecTransformCtxPrepare(ctx, xmlSecTransformDataTypeXml);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCtxPrepare", 
+                    "xmlSecTransformCtxPrepare",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "type=xml");
         return(-1);
-    }   
+    }
 
     /* it's better to do push than pop because all XML transform
      * just don't care and c14n likes push more than pop */
@@ -1225,7 +1225,7 @@ xmlSecTransformCtxXmlExecute(xmlSecTransformCtxPtr ctx, xmlSecNodeSetPtr nodes)
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformPushXml", 
+                    "xmlSecTransformPushXml",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformGetName(ctx->first)));
@@ -1237,7 +1237,7 @@ xmlSecTransformCtxXmlExecute(xmlSecTransformCtxPtr ctx, xmlSecNodeSetPtr nodes)
 }
 
 /**
- * xmlSecTransformCtxExecute: 
+ * xmlSecTransformCtxExecute:
  * @ctx:                the pointer to transforms chain processing context.
  * @doc:                the pointer to input document.
  *
@@ -1248,34 +1248,34 @@ xmlSecTransformCtxXmlExecute(xmlSecTransformCtxPtr ctx, xmlSecNodeSetPtr nodes)
 int
 xmlSecTransformCtxExecute(xmlSecTransformCtxPtr ctx, xmlDocPtr doc) {
     int ret;
-        
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->result == NULL, -1);
     xmlSecAssert2(ctx->status == xmlSecTransformStatusNone, -1);
     xmlSecAssert2(doc != NULL, -1);
-    
+
     if((ctx->uri == NULL) || (xmlStrlen(ctx->uri) == 0)) {
         xmlSecNodeSetPtr nodes;
-        
+
         if((ctx->xptrExpr != NULL) && (xmlStrlen(ctx->xptrExpr) > 0)){
             /* our xpointer transform takes care of providing correct nodes set */
             nodes = xmlSecNodeSetCreate(doc, NULL, xmlSecNodeSetNormal);
             if(nodes == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
                             NULL,
-                            "xmlSecNodeSetCreate", 
+                            "xmlSecNodeSetCreate",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-        
+
         } else {
             /* we do not want to have comments for empty URI */
             nodes = xmlSecNodeSetGetChildren(doc, NULL, 0, 0);
             if(nodes == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
                             NULL,
-                            "xmlSecNodeSetGetChildren", 
+                            "xmlSecNodeSetGetChildren",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
@@ -1285,7 +1285,7 @@ xmlSecTransformCtxExecute(xmlSecTransformCtxPtr ctx, xmlDocPtr doc) {
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "xmlSecTransformCtxXmlExecute", 
+                        "xmlSecTransformCtxXmlExecute",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecNodeSetDestroy(nodes);
@@ -1298,13 +1298,13 @@ xmlSecTransformCtxExecute(xmlSecTransformCtxPtr ctx, xmlDocPtr doc) {
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
-                        "xmlSecTransformCtxUriExecute", 
+                        "xmlSecTransformCtxUriExecute",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-    } 
-    
+    }
+
     return(0);
 }
 
@@ -1312,17 +1312,17 @@ xmlSecTransformCtxExecute(xmlSecTransformCtxPtr ctx, xmlDocPtr doc) {
  * xmlSecTransformCtxDebugDump:
  * @ctx:                the pointer to transforms chain processing context.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints transforms context debug information to @output.
  */
-void 
+void
 xmlSecTransformCtxDebugDump(xmlSecTransformCtxPtr ctx, FILE* output) {
-    xmlSecTransformPtr transform;    
-    
+    xmlSecTransformPtr transform;
+
     xmlSecAssert(ctx != NULL);
     xmlSecAssert(output != NULL);
 
-    fprintf(output, "== TRANSFORMS CTX (status=%d)\n", ctx->status);    
+    fprintf(output, "== TRANSFORMS CTX (status=%d)\n", ctx->status);
 
     fprintf(output, "== flags: 0x%08x\n", ctx->flags);
     fprintf(output, "== flags2: 0x%08x\n", ctx->flags2);
@@ -1332,11 +1332,11 @@ xmlSecTransformCtxDebugDump(xmlSecTransformCtxPtr ctx, FILE* output) {
     } else {
         fprintf(output, "== enabled transforms: all\n");
     }
-    
-    fprintf(output, "=== uri: %s\n", 
-            (ctx->uri != NULL) ? ctx->uri : BAD_CAST "NULL");    
-    fprintf(output, "=== uri xpointer expr: %s\n", 
-            (ctx->xptrExpr != NULL) ? ctx->xptrExpr : BAD_CAST "NULL");    
+
+    fprintf(output, "=== uri: %s\n",
+            (ctx->uri != NULL) ? ctx->uri : BAD_CAST "NULL");
+    fprintf(output, "=== uri xpointer expr: %s\n",
+            (ctx->xptrExpr != NULL) ? ctx->xptrExpr : BAD_CAST "NULL");
     for(transform = ctx->first; transform != NULL; transform = transform->next) {
         xmlSecTransformDebugDump(transform, output);
     }
@@ -1346,16 +1346,16 @@ xmlSecTransformCtxDebugDump(xmlSecTransformCtxPtr ctx, FILE* output) {
  * xmlSecTransformCtxDebugXmlDump:
  * @ctx:                the pointer to transforms chain processing context.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints transforms context debug information to @output in XML format.
  */
-void 
+void
 xmlSecTransformCtxDebugXmlDump(xmlSecTransformCtxPtr ctx, FILE* output) {
-    xmlSecTransformPtr transform;    
-    
+    xmlSecTransformPtr transform;
+
     xmlSecAssert(ctx != NULL);
     xmlSecAssert(output != NULL);
- 
+
     fprintf(output, "<TransformCtx status=\"%d\">\n", ctx->status);
 
     fprintf(output, "<Flags>%08x</Flags>\n", ctx->flags);
@@ -1372,7 +1372,7 @@ xmlSecTransformCtxDebugXmlDump(xmlSecTransformCtxPtr ctx, FILE* output) {
     fprintf(output, "<Uri>");
     xmlSecPrintXmlString(output, ctx->uri);
     fprintf(output, "</Uri>\n");
-    
+
     fprintf(output, "<UriXPointer>");
     xmlSecPrintXmlString(output, ctx->xptrExpr);
     fprintf(output, "</UriXPointer>\n");
@@ -1380,7 +1380,7 @@ xmlSecTransformCtxDebugXmlDump(xmlSecTransformCtxPtr ctx, FILE* output) {
     for(transform = ctx->first; transform != NULL; transform = transform->next) {
         xmlSecTransformDebugXmlDump(transform, output);
     }
-    fprintf(output, "</TransformCtx>\n");    
+    fprintf(output, "</TransformCtx>\n");
 }
 
 /**************************************************************************
@@ -1396,17 +1396,17 @@ xmlSecTransformCtxDebugXmlDump(xmlSecTransformCtxPtr ctx, FILE* output) {
  * destroying returned tansform using #xmlSecTransformDestroy function.
  *
  * Returns: pointer to newly created transform or NULL if an error occurs.
- */ 
-xmlSecTransformPtr      
+ */
+xmlSecTransformPtr
 xmlSecTransformCreate(xmlSecTransformId id) {
     xmlSecTransformPtr transform;
     int ret;
-    
+
     xmlSecAssert2(id != NULL, NULL);
     xmlSecAssert2(id->klassSize >= sizeof(xmlSecTransformKlass), NULL);
     xmlSecAssert2(id->objSize >= sizeof(xmlSecTransform), NULL);
     xmlSecAssert2(id->name != NULL, NULL);
-        
+
     /* Allocate a new xmlSecTransform and fill the fields. */
     transform = (xmlSecTransformPtr)xmlMalloc(id->objSize);
     if(transform == NULL) {
@@ -1414,12 +1414,12 @@ xmlSecTransformCreate(xmlSecTransformId id) {
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "size=%d", id->objSize); 
+                    "size=%d", id->objSize);
         return(NULL);
     }
-    memset(transform, 0, id->objSize);    
+    memset(transform, 0, id->objSize);
     transform->id = id;
-    
+
     if(id->initialize != NULL) {
         ret = (id->initialize)(transform);
         if(ret < 0) {
@@ -1441,7 +1441,7 @@ xmlSecTransformCreate(xmlSecTransformId id) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", 0);
         xmlSecTransformDestroy(transform);
-        return(NULL);   
+        return(NULL);
     }
 
     ret = xmlSecBufferInitialize(&(transform->outBuf), 0);
@@ -1452,9 +1452,9 @@ xmlSecTransformCreate(xmlSecTransformId id) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "size=%d", 0);
         xmlSecTransformDestroy(transform);
-        return(NULL);   
+        return(NULL);
     }
-    
+
     return(transform);
 }
 
@@ -1468,7 +1468,7 @@ void
 xmlSecTransformDestroy(xmlSecTransformPtr transform) {
     xmlSecAssert(xmlSecTransformIsValid(transform));
     xmlSecAssert(transform->id->objSize > 0);
-    
+
     /* first need to remove ourselves from chain */
     xmlSecTransformRemove(transform);
 
@@ -1477,19 +1477,19 @@ xmlSecTransformDestroy(xmlSecTransformPtr transform) {
 
     /* we never destroy input nodes, output nodes
      * are destroyed if and only if they are different
-     * from input nodes 
+     * from input nodes
      */
     if((transform->outNodes != NULL) && (transform->outNodes != transform->inNodes)) {
         xmlSecNodeSetDestroy(transform->outNodes);
     }
-    if(transform->id->finalize != NULL) { 
+    if(transform->id->finalize != NULL) {
         (transform->id->finalize)(transform);
     }
     memset(transform, 0, transform->id->objSize);
     xmlFree(transform);
 }
 
-/** 
+/**
  * xmlSecTransformNodeRead:
  * @node:               the pointer to the transform's node.
  * @usage:              the transform usage (signature, encryption, ...).
@@ -1525,19 +1525,19 @@ xmlSecTransformNodeRead(xmlNodePtr node, xmlSecTransformUsage usage, xmlSecTrans
                     XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
-        return(NULL);           
+        return(NULL);
     }
-    
-    id = xmlSecTransformIdListFindByHref(xmlSecTransformIdsGet(), href, usage);    
+
+    id = xmlSecTransformIdListFindByHref(xmlSecTransformIdsGet(), href, usage);
     if(id == xmlSecTransformIdUnknown) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecTransformIdListFindByHref",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
-                    "href=%s", 
+                    "href=%s",
                     xmlSecErrorsSafeString(href));
         xmlFree(href);
-        return(NULL);           
+        return(NULL);
     }
 
     /* check with enabled transforms list */
@@ -1552,17 +1552,17 @@ xmlSecTransformNodeRead(xmlNodePtr node, xmlSecTransformUsage usage, xmlSecTrans
         xmlFree(href);
         return(NULL);
     }
-        
+
     transform = xmlSecTransformCreate(id);
     if(!xmlSecTransformIsValid(transform)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecTransformCreate",                
+                    "xmlSecTransformCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
         xmlFree(href);
-        return(NULL);           
+        return(NULL);
     }
 
     if(transform->id->readNode != NULL) {
@@ -1576,13 +1576,13 @@ xmlSecTransformNodeRead(xmlNodePtr node, xmlSecTransformUsage usage, xmlSecTrans
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
             xmlSecTransformDestroy(transform);
             xmlFree(href);
-            return(NULL);               
+            return(NULL);
         }
     }
 
-    /* finally remember the transform node */    
+    /* finally remember the transform node */
     transform->hereNode = node;
-    xmlFree(href);   
+    xmlFree(href);
     return(transform);
 }
 
@@ -1597,22 +1597,22 @@ xmlSecTransformNodeRead(xmlNodePtr node, xmlSecTransformUsage usage, xmlSecTrans
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformPump(xmlSecTransformPtr left, xmlSecTransformPtr right, xmlSecTransformCtxPtr transformCtx) {
     xmlSecTransformDataType leftType;
     xmlSecTransformDataType rightType;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformIsValid(left), -1);
     xmlSecAssert2(xmlSecTransformIsValid(right), -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-    
+
     leftType = xmlSecTransformGetDataType(left, xmlSecTransformModePop, transformCtx);
     rightType = xmlSecTransformGetDataType(right, xmlSecTransformModePush, transformCtx);
 
-    if(((leftType & xmlSecTransformDataTypeXml) != 0) && 
+    if(((leftType & xmlSecTransformDataTypeXml) != 0) &&
        ((rightType & xmlSecTransformDataTypeXml) != 0)) {
-       
+
        xmlSecNodeSetPtr nodes = NULL;
 
        ret = xmlSecTransformPopXml(left, &nodes, transformCtx);
@@ -1634,12 +1634,12 @@ xmlSecTransformPump(xmlSecTransformPtr left, xmlSecTransformPtr right, xmlSecTra
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
        }
-    }  else if(((leftType & xmlSecTransformDataTypeBin) != 0) && 
-               ((rightType & xmlSecTransformDataTypeBin) != 0)) {       
+    }  else if(((leftType & xmlSecTransformDataTypeBin) != 0) &&
+               ((rightType & xmlSecTransformDataTypeBin) != 0)) {
         xmlSecByte buf[XMLSEC_TRANSFORM_BINARY_CHUNK];
         xmlSecSize bufSize;
         int final;
-        
+
         do {
             ret = xmlSecTransformPopBin(left, buf, sizeof(buf), &bufSize, transformCtx);
             if(ret < 0) {
@@ -1675,7 +1675,7 @@ xmlSecTransformPump(xmlSecTransformPtr left, xmlSecTransformPtr right, xmlSecTra
 /**
  * xmlSecTransformSetKey:
  * @transform:          the pointer to transform.
- * @key:                the pointer to key. 
+ * @key:                the pointer to key.
  *
  * Sets the transform's key.
  *
@@ -1685,7 +1685,7 @@ int
 xmlSecTransformSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(key != NULL, -1);
-        
+
     if(transform->id->setKey != NULL) {
         return((transform->id->setKey)(transform, key));
     }
@@ -1695,7 +1695,7 @@ xmlSecTransformSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
 /**
  * xmlSecTransformSetKeyReq:
  * @transform:          the pointer to transform.
- * @keyReq:             the pointer to keys requirements object. 
+ * @keyReq:             the pointer to keys requirements object.
  *
  * Sets the key requirements for @transform in the @keyReq.
  *
@@ -1705,12 +1705,12 @@ int
 xmlSecTransformSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) {
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(keyReq != NULL, -1);
-        
+
     keyReq->keyId       = xmlSecKeyDataIdUnknown;
     keyReq->keyType     = xmlSecKeyDataTypeUnknown;
     keyReq->keyUsage    = xmlSecKeyUsageAny;
     keyReq->keyBitsSize = 0;
-        
+
     if(transform->id->setKeyReq != NULL) {
         return((transform->id->setKeyReq)(transform, keyReq));
     }
@@ -1730,7 +1730,7 @@ xmlSecTransformSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformVerify(xmlSecTransformPtr transform, const xmlSecByte* data,
                     xmlSecSize dataSize, xmlSecTransformCtxPtr transformCtx) {
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
@@ -1751,16 +1751,16 @@ xmlSecTransformVerify(xmlSecTransformPtr transform, const xmlSecByte* data,
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform, xmlNodePtr node,
                                  xmlSecTransformCtxPtr transformCtx) {
     xmlSecBuffer buffer;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-    
+
     ret = xmlSecBufferInitialize(&buffer, 0);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1770,7 +1770,7 @@ xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform, xmlNodePtr node,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecBufferBase64NodeContentRead(&buffer, node);
     if((ret < 0) || (xmlSecBufferGetData(&buffer) == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1781,7 +1781,7 @@ xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform, xmlNodePtr node,
         xmlSecBufferFinalize(&buffer);
         return(-1);
     }
-    
+
     ret = xmlSecTransformVerify(transform, xmlSecBufferGetData(&buffer),
                                 xmlSecBufferGetSize(&buffer), transformCtx);
     if(ret < 0) {
@@ -1804,18 +1804,18 @@ xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform, xmlNodePtr node,
  * @mode:               the data mode (push or pop).
  * @transformCtx:       the transform's chaing processing context.
  *
- * Gets transform input (@mode is "push") or output (@mode is "pop") data 
+ * Gets transform input (@mode is "push") or output (@mode is "pop") data
  * type (binary or XML).
  *
  * Returns: the transform's data type for the @mode operation.
  */
-xmlSecTransformDataType 
-xmlSecTransformGetDataType(xmlSecTransformPtr transform, xmlSecTransformMode mode, 
+xmlSecTransformDataType
+xmlSecTransformGetDataType(xmlSecTransformPtr transform, xmlSecTransformMode mode,
                     xmlSecTransformCtxPtr transformCtx) {
     xmlSecAssert2(xmlSecTransformIsValid(transform), xmlSecTransformDataTypeUnknown);
     xmlSecAssert2(transform->id->getDataType != NULL, xmlSecTransformDataTypeUnknown);
-    
-    return((transform->id->getDataType)(transform, mode, transformCtx));    
+
+    return((transform->id->getDataType)(transform, mode, transformCtx));
 }
 
 /**
@@ -1828,17 +1828,17 @@ xmlSecTransformGetDataType(xmlSecTransformPtr transform, xmlSecTransformMode mod
  * @transformCtx:       the pointer to transform context object.
  *
  * Process binary @data and pushes results to next transform.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
                     xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(transform->id->pushBin != NULL, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-    
-    return((transform->id->pushBin)(transform, data, dataSize, final, transformCtx));    
+
+    return((transform->id->pushBin)(transform, data, dataSize, final, transformCtx));
 }
 
 /**
@@ -1849,13 +1849,13 @@ xmlSecTransformPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
  * @dataSize:           the pointer to returned data size.
  * @transformCtx:       the pointer to transform context object.
  *
- * Pops data from previous transform in the chain, processes data and 
- * returns result in the @data buffer. The size of returned data is 
+ * Pops data from previous transform in the chain, processes data and
+ * returns result in the @data buffer. The size of returned data is
  * placed in the @dataSize.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
                     xmlSecSize maxDataSize, xmlSecSize* dataSize, xmlSecTransformCtxPtr transformCtx) {
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
@@ -1864,7 +1864,7 @@ xmlSecTransformPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
     xmlSecAssert2(dataSize != NULL, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
 
-    return((transform->id->popBin)(transform, data, maxDataSize, dataSize, transformCtx));    
+    return((transform->id->popBin)(transform, data, maxDataSize, dataSize, transformCtx));
 }
 
 /**
@@ -1877,14 +1877,14 @@ xmlSecTransformPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
                     xmlSecTransformCtxPtr transformCtx) {
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(transform->id->pushXml != NULL, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
 
-    return((transform->id->pushXml)(transform, nodes, transformCtx));    
+    return((transform->id->pushXml)(transform, nodes, transformCtx));
 }
 
 /**
@@ -1893,19 +1893,19 @@ xmlSecTransformPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
  * @nodes:              the pointer to store popinter to result nodes.
  * @transformCtx:       the pointer to transform context object.
  *
- * Pops data from previous transform in the chain, processes the data and 
+ * Pops data from previous transform in the chain, processes the data and
  * returns result in @nodes.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
                     xmlSecTransformCtxPtr transformCtx) {
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(transform->id->popXml != NULL, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
 
-    return((transform->id->popXml)(transform, nodes, transformCtx));    
+    return((transform->id->popXml)(transform, nodes, transformCtx));
 }
 
 /**
@@ -1918,7 +1918,7 @@ xmlSecTransformPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(transform->id->execute != NULL, -1);
@@ -1934,11 +1934,11 @@ xmlSecTransformExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
  *
  * Prints transform's debug information to @output.
  */
-void 
+void
 xmlSecTransformDebugDump(xmlSecTransformPtr transform, FILE* output) {
     xmlSecAssert(xmlSecTransformIsValid(transform));
     xmlSecAssert(output != NULL);
-    
+
     fprintf(output, "=== Transform: %s (href=%s)\n",
                 xmlSecErrorsSafeString(transform->id->name),
                 xmlSecErrorsSafeString(transform->id->href));
@@ -1951,7 +1951,7 @@ xmlSecTransformDebugDump(xmlSecTransformPtr transform, FILE* output) {
  *
  * Prints transform's debug information to @output in XML format.
  */
-void 
+void
 xmlSecTransformDebugXmlDump(xmlSecTransformPtr transform, FILE* output) {
     xmlSecAssert(xmlSecTransformIsValid(transform));
     xmlSecAssert(output != NULL);
@@ -1967,41 +1967,41 @@ xmlSecTransformDebugXmlDump(xmlSecTransformPtr transform, FILE* output) {
  *
  * Operations on transforms chain
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * xmlSecTransformConnect:
  * @left:               the pointer to left (prev) transform.
  * @right:              the pointer to right (next) transform.
  * @transformCtx:       the transform's chaing processing context.
  *
- * If the data object is a node-set and the next transform requires octets, 
- * the signature application MUST attempt to convert the node-set to an octet 
- * stream using Canonical XML [XML-C14N].  
+ * If the data object is a node-set and the next transform requires octets,
+ * the signature application MUST attempt to convert the node-set to an octet
+ * stream using Canonical XML [XML-C14N].
  *
  * The story is different if the right transform is base64 decode
  * (http://www.w3.org/TR/xmldsig-core/#sec-Base-64):
  *
- * This transform requires an octet stream for input. If an XPath node-set 
- * (or sufficiently functional alternative) is given as input, then it is 
- * converted to an octet stream by performing operations logically equivalent 
- * to 1) applying an XPath transform with expression self::text(), then 2) 
- * taking the string-value of the node-set. Thus, if an XML element is 
- * identified by a barename XPointer in the Reference URI, and its content 
- * consists solely of base64 encoded character data, then this transform 
- * automatically strips away the start and end tags of the identified element 
- * and any of its descendant elements as well as any descendant comments and 
+ * This transform requires an octet stream for input. If an XPath node-set
+ * (or sufficiently functional alternative) is given as input, then it is
+ * converted to an octet stream by performing operations logically equivalent
+ * to 1) applying an XPath transform with expression self::text(), then 2)
+ * taking the string-value of the node-set. Thus, if an XML element is
+ * identified by a barename XPointer in the Reference URI, and its content
+ * consists solely of base64 encoded character data, then this transform
+ * automatically strips away the start and end tags of the identified element
+ * and any of its descendant elements as well as any descendant comments and
  * processing instructions. The output of this transform is an octet stream.
  *
- * Returns: 0 on success or a negative value if an error occurs. 
+ * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
-xmlSecTransformConnect(xmlSecTransformPtr left, xmlSecTransformPtr right, 
+int
+xmlSecTransformConnect(xmlSecTransformPtr left, xmlSecTransformPtr right,
                        xmlSecTransformCtxPtr transformCtx) {
     xmlSecTransformDataType leftType;
     xmlSecTransformDataType rightType;
     xmlSecTransformId middleId;
     xmlSecTransformPtr middle;
-        
+
     xmlSecAssert2(xmlSecTransformIsValid(left), -1);
     xmlSecAssert2(xmlSecTransformIsValid(right), -1);
     xmlSecAssert2(transformCtx != NULL, -1);
@@ -2009,25 +2009,25 @@ xmlSecTransformConnect(xmlSecTransformPtr left, xmlSecTransformPtr right,
     leftType = xmlSecTransformGetDataType(left, xmlSecTransformModePop, transformCtx);
     rightType = xmlSecTransformGetDataType(right, xmlSecTransformModePush, transformCtx);
 
-    /* happy case first: nothing need to be done */    
-    if((((leftType & xmlSecTransformDataTypeBin) != 0) && 
-        ((rightType & xmlSecTransformDataTypeBin) != 0)) || 
-       (((leftType & xmlSecTransformDataTypeXml) != 0) && 
+    /* happy case first: nothing need to be done */
+    if((((leftType & xmlSecTransformDataTypeBin) != 0) &&
+        ((rightType & xmlSecTransformDataTypeBin) != 0)) ||
+       (((leftType & xmlSecTransformDataTypeXml) != 0) &&
         ((rightType & xmlSecTransformDataTypeXml) != 0))) {
-        
+
         left->next = right;
         right->prev = left;
         return(0);
-    } 
-    
-    if(((leftType & xmlSecTransformDataTypeBin) != 0) && 
+    }
+
+    if(((leftType & xmlSecTransformDataTypeBin) != 0) &&
         ((rightType & xmlSecTransformDataTypeXml) != 0)) {
-            
+
         /* need to insert parser */
         middleId = xmlSecTransformXmlParserId;
-    } else if(((leftType & xmlSecTransformDataTypeXml) != 0) && 
+    } else if(((leftType & xmlSecTransformDataTypeXml) != 0) &&
         ((rightType & xmlSecTransformDataTypeBin) != 0)) {
-        
+
         /* need to insert c14n or special pre-base64 transform */
         if(xmlSecTransformCheckId(right, xmlSecTransformBase64Id)) {
             middleId = xmlSecTransformRemoveXmlTagsC14NId;
@@ -2039,11 +2039,11 @@ xmlSecTransformConnect(xmlSecTransformPtr left, xmlSecTransformPtr right,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
                     xmlSecErrorsSafeString(xmlSecTransformGetName(right)),
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
-                    "leftType=%d;rightType=%d", 
+                    "leftType=%d;rightType=%d",
                     leftType, rightType);
-        return(-1);     
+        return(-1);
     }
-    
+
     /* insert transform */
     middle = xmlSecTransformCreate(middleId);
     if(middle == NULL) {
@@ -2054,7 +2054,7 @@ xmlSecTransformConnect(xmlSecTransformPtr left, xmlSecTransformPtr right,
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformKlassGetName(middleId)));
         return(-1);
-    }   
+    }
     left->next = middle;
     middle->prev = left;
     middle->next = right;
@@ -2066,7 +2066,7 @@ xmlSecTransformConnect(xmlSecTransformPtr left, xmlSecTransformPtr right,
  * xmlSecTransformRemove:
  * @transform: the pointer to #xmlSecTransform structure.
  *
- * Removes @transform from the chain. 
+ * Removes @transform from the chain.
  */
 void
 xmlSecTransformRemove(xmlSecTransformPtr transform) {
@@ -2086,24 +2086,24 @@ xmlSecTransformRemove(xmlSecTransformPtr transform) {
  *
  * Default callbacks, most of the transforms can use them
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * xmlSecTransformDefaultGetDataType:
  * @transform:          the pointer to transform.
  * @mode:               the data mode (push or pop).
  * @transformCtx:       the transform's chaing processing context.
  *
- * Gets transform input (@mode is "push") or output (@mode is "pop") data 
+ * Gets transform input (@mode is "push") or output (@mode is "pop") data
  * type (binary or XML) by analyzing available pushBin/popBin/pushXml/popXml
  * methods.
  *
  * Returns: the transform's data type for the @mode operation.
  */
-xmlSecTransformDataType 
+xmlSecTransformDataType
 xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform, xmlSecTransformMode mode,
                                   xmlSecTransformCtxPtr transformCtx) {
     xmlSecTransformDataType type = xmlSecTransformDataTypeUnknown;
-    
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), xmlSecTransformDataTypeUnknown);
     xmlSecAssert2(transformCtx != NULL, xmlSecTransformDataTypeUnknown);
 
@@ -2112,18 +2112,18 @@ xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform, xmlSecTransformM
         case xmlSecTransformModePush:
             if(transform->id->pushBin != NULL) {
                 type |= xmlSecTransformDataTypeBin;
-            } 
+            }
             if(transform->id->pushXml != NULL) {
                 type |= xmlSecTransformDataTypeXml;
-            } 
+            }
             break;
         case xmlSecTransformModePop:
             if(transform->id->popBin != NULL) {
                 type |= xmlSecTransformDataTypeBin;
-            } 
+            }
             if(transform->id->popXml != NULL) {
                 type |= xmlSecTransformDataTypeXml;
-            } 
+            }
             break;
         default:
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2133,7 +2133,7 @@ xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform, xmlSecTransformM
                         "mode=%d", mode);
             return(xmlSecTransformDataTypeUnknown);
     }
-    
+
     return(type);
 }
 
@@ -2146,34 +2146,34 @@ xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform, xmlSecTransformM
  *                      data chunk.
  * @transformCtx:       the pointer to transform context object.
  *
- * Process binary @data by calling transform's execute method and pushes 
+ * Process binary @data by calling transform's execute method and pushes
  * results to next transform.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
                         xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
     xmlSecSize inSize = 0;
     xmlSecSize outSize = 0;
     int finalData = 0;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-    
+
     do {
-        /* append data to input buffer */    
+        /* append data to input buffer */
         if(dataSize > 0) {
             xmlSecSize chunkSize;
-            
+
             xmlSecAssert2(data != NULL, -1);
 
             chunkSize = dataSize;
             if(chunkSize > XMLSEC_TRANSFORM_BINARY_CHUNK) {
                 chunkSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
             }
-            
+
             ret = xmlSecBufferAppend(&(transform->inBuf), data, chunkSize);
             if(ret < 0) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2182,7 +2182,7 @@ xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* da
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             "size=%d", chunkSize);
                 return(-1);
-            }   
+            }
 
             dataSize -= chunkSize;
             data += chunkSize;
@@ -2215,7 +2215,7 @@ xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* da
             finalData = 0;
         }
         if((transform->next != NULL) && ((outSize > 0) || (finalData != 0))) {
-            ret = xmlSecTransformPushBin(transform->next, 
+            ret = xmlSecTransformPushBin(transform->next,
                             xmlSecBufferGetData(&(transform->outBuf)),
                             outSize,
                             finalData,
@@ -2229,7 +2229,7 @@ xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* da
                 return(-1);
             }
         }
-        
+
         /* remove data anyway */
         if(outSize > 0) {
             ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize);
@@ -2243,7 +2243,7 @@ xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* da
             }
         }
     } while((dataSize > 0) || (outSize > 0));
-    
+
     return(0);
 }
 
@@ -2256,12 +2256,12 @@ xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* da
  * @transformCtx:       the pointer to transform context object.
  *
  * Pops data from previous transform in the chain, processes data by calling
- * transform's execute method and returns result in the @data buffer. The 
+ * transform's execute method and returns result in the @data buffer. The
  * size of returned data is placed in the @dataSize.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
                             xmlSecSize maxDataSize, xmlSecSize* dataSize, xmlSecTransformCtxPtr transformCtx) {
     xmlSecSize outSize;
@@ -2275,7 +2275,7 @@ xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
 
     while((xmlSecBufferGetSize(&(transform->outBuf)) == 0) && (final == 0)) {
         /* read data from previous transform if exist */
-        if(transform->prev != NULL) {    
+        if(transform->prev != NULL) {
             xmlSecSize inSize, chunkSize;
 
             inSize = xmlSecBufferGetSize(&(transform->inBuf));
@@ -2290,10 +2290,10 @@ xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             "size=%d", inSize + chunkSize);
                 return(-1);
-            }   
+            }
 
             /* get data from previous transform */
-            ret = xmlSecTransformPopBin(transform->prev, 
+            ret = xmlSecTransformPopBin(transform->prev,
                             xmlSecBufferGetData(&(transform->inBuf)) + inSize,
                             chunkSize, &chunkSize, transformCtx);
             if(ret < 0) {
@@ -2304,7 +2304,7 @@ xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 return(-1);
             }
-        
+
             /* adjust our size if needed */
             if(chunkSize > 0) {
                 ret = xmlSecBufferSetSize(&(transform->inBuf), inSize + chunkSize);
@@ -2322,7 +2322,7 @@ xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
             }
         } else {
             final = 1; /* no previous transform, we are "permanently final" */
-        }       
+        }
 
         /* execute our transform */
         ret = xmlSecTransformExecute(transform, final, transformCtx);
@@ -2335,20 +2335,20 @@ xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
             return(-1);
         }
     }
-    
+
     /* copy result (if any) */
-    outSize = xmlSecBufferGetSize(&(transform->outBuf)); 
+    outSize = xmlSecBufferGetSize(&(transform->outBuf));
     if(outSize > maxDataSize) {
         outSize = maxDataSize;
     }
-    
+
     /* we don't want to put too much */
     if(outSize > XMLSEC_TRANSFORM_BINARY_CHUNK) {
         outSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
     }
     if(outSize > 0) {
         xmlSecAssert2(xmlSecBufferGetData(&(transform->outBuf)), -1);
-        
+
         memcpy(data, xmlSecBufferGetData(&(transform->outBuf)), outSize);
 
         ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize);
@@ -2359,9 +2359,9 @@ xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", outSize);
             return(-1);
-        }       
+        }
     }
-    
+
     /* set the result size */
     (*dataSize) = outSize;
     return(0);
@@ -2373,13 +2373,13 @@ xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
  * @nodes:              the input nodes.
  * @transformCtx:       the pointer to transform context object.
  *
- * Processes @nodes by calling transform's execute method and pushes 
+ * Processes @nodes by calling transform's execute method and pushes
  * result to the next transform in the chain.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
-xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes, 
+int
+xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
                             xmlSecTransformCtxPtr transformCtx) {
     int ret;
 
@@ -2411,7 +2411,7 @@ xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nod
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-    }        
+    }
     return(0);
 }
 
@@ -2421,21 +2421,21 @@ xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nod
  * @nodes:              the pointer to store popinter to result nodes.
  * @transformCtx:       the pointer to transform context object.
  *
- * Pops data from previous transform in the chain, processes the data 
+ * Pops data from previous transform in the chain, processes the data
  * by calling transform's execute method and returns result in @nodes.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
-xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes, 
+int
+xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
                             xmlSecTransformCtxPtr transformCtx) {
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
     xmlSecAssert2(transform->inNodes == NULL, -1);
     xmlSecAssert2(transform->outNodes == NULL, -1);
     xmlSecAssert2(transformCtx != NULL, -1);
-    
+
     /* pop result from the prev transform (if exist) */
     if(transform->prev != NULL) {
         ret = xmlSecTransformPopXml(transform->prev, &(transform->inNodes), transformCtx);
@@ -2447,7 +2447,7 @@ xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nod
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-    }        
+    }
 
     /* execute our transform */
     ret = xmlSecTransformExecute(transform, 1, transformCtx);
@@ -2464,7 +2464,7 @@ xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nod
     if(nodes != NULL) {
         (*nodes) = transform->outNodes;
     }
-    
+
     return(0);
 }
 
@@ -2483,12 +2483,12 @@ static xmlSecPtrListKlass xmlSecTransformIdListKlass = {
 
 /**
  * xmlSecTransformIdListGetKlass:
- * 
+ *
  * The transform id list klass.
  *
  * Returns: pointer to the transform id list klass.
  */
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecTransformIdListGetKlass(void) {
     return(&xmlSecTransformIdListKlass);
 }
@@ -2503,13 +2503,13 @@ xmlSecTransformIdListGetKlass(void) {
  * Returns: 1 if @dataId is found in the @list, 0 if not and a negative
  * value if an error occurs.
  */
-int 
+int
 xmlSecTransformIdListFind(xmlSecPtrListPtr list, xmlSecTransformId transformId) {
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecTransformIdListId), -1);
     xmlSecAssert2(transformId != NULL, -1);
-    
+
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         if((xmlSecTransformId)xmlSecPtrListGetItem(list, i) == transformId) {
@@ -2519,7 +2519,7 @@ xmlSecTransformIdListFind(xmlSecPtrListPtr list, xmlSecTransformId transformId)
     return(0);
 }
 
-/** 
+/**
  * xmlSecTransformIdListFindByHref:
  * @list:               the pointer to transform ids list.
  * @href:               the desired transform klass href.
@@ -2528,30 +2528,30 @@ xmlSecTransformIdListFind(xmlSecPtrListPtr list, xmlSecTransformId transformId)
  * Lookups data klass in the list with given @href and @usage in @list.
  *
  * Returns: transform klass is found and NULL otherwise.
- */ 
-xmlSecTransformId       
+ */
+xmlSecTransformId
 xmlSecTransformIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href,
                             xmlSecTransformUsage usage) {
     xmlSecTransformId transformId;
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecTransformIdListId), xmlSecTransformIdUnknown);
     xmlSecAssert2(href != NULL, xmlSecTransformIdUnknown);
-    
+
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
         xmlSecAssert2(transformId != xmlSecTransformIdUnknown, xmlSecTransformIdUnknown);
 
-        if(((usage & transformId->usage) != 0) && (transformId->href != NULL) && 
+        if(((usage & transformId->usage) != 0) && (transformId->href != NULL) &&
            xmlStrEqual(href, transformId->href)) {
-           return(transformId);    
+           return(transformId);
         }
     }
     return(xmlSecTransformIdUnknown);
 }
 
-/** 
+/**
  * xmlSecTransformIdListFindByName:
  * @list:               the pointer to transform ids list.
  * @name:               the desired transform klass name.
@@ -2560,13 +2560,13 @@ xmlSecTransformIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href,
  * Lookups data klass in the list with given @name and @usage in @list.
  *
  * Returns: transform klass is found and NULL otherwise.
- */ 
-xmlSecTransformId       
-xmlSecTransformIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name, 
+ */
+xmlSecTransformId
+xmlSecTransformIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name,
                             xmlSecTransformUsage usage) {
     xmlSecTransformId transformId;
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecTransformIdListId), xmlSecTransformIdUnknown);
     xmlSecAssert2(name != NULL, xmlSecTransformIdUnknown);
 
@@ -2577,25 +2577,25 @@ xmlSecTransformIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name,
 
         if(((usage & transformId->usage) != 0) && (transformId->name != NULL) &&
            xmlStrEqual(name, BAD_CAST transformId->name)) {
-           
-           return(transformId);    
+
+           return(transformId);
         }
     }
     return(xmlSecTransformIdUnknown);
 }
 
-/** 
+/**
  * xmlSecTransformIdListDebugDump:
  * @list:               the pointer to transform ids list.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints binary transform debug information to @output.
  */
-void 
+void
 xmlSecTransformIdListDebugDump(xmlSecPtrListPtr list, FILE* output) {
     xmlSecTransformId transformId;
     xmlSecSize i, size;
-    
+
     xmlSecAssert(xmlSecPtrListCheckId(list, xmlSecTransformIdListId));
     xmlSecAssert(output != NULL);
 
@@ -2604,24 +2604,24 @@ xmlSecTransformIdListDebugDump(xmlSecPtrListPtr list, FILE* output) {
         transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
         xmlSecAssert(transformId != NULL);
         xmlSecAssert(transformId->name != NULL);
-            
+
         if(i > 0) {
             fprintf(output, ",\"%s\"", transformId->name);
         } else {
             fprintf(output, "\"%s\"", transformId->name);
-        }           
+        }
     }
     fprintf(output, "\n");
 }
 
-/** 
+/**
  * xmlSecTransformIdListDebugXmlDump:
  * @list:               the pointer to transform ids list.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints binary transform debug information to @output in XML format.
  */
-void 
+void
 xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
     xmlSecTransformId transformId;
     xmlSecSize i, size;
@@ -2635,7 +2635,7 @@ xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
         transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
         xmlSecAssert(transformId != NULL);
         xmlSecAssert(transformId->name != NULL);
-            
+
         fprintf(output, "<TransformId name=\"");
         xmlSecPrintXmlString(output, transformId->name);
         fprintf(output, "\" />");
@@ -2647,7 +2647,7 @@ xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
  *
  * IO buffers for transforms
  *
- ************************************************************************/ 
+ ************************************************************************/
 typedef struct _xmlSecTransformIOBuffer                 xmlSecTransformIOBuffer,
                                                         *xmlSecTransformIOBufferPtr;
 typedef enum {
@@ -2667,10 +2667,10 @@ static xmlSecTransformIOBufferPtr xmlSecTransformIOBufferCreate (xmlSecTransform
 static void     xmlSecTransformIOBufferDestroy                  (xmlSecTransformIOBufferPtr buffer);
 static int      xmlSecTransformIOBufferRead                     (xmlSecTransformIOBufferPtr buffer,
                                                                  xmlSecByte *buf,
-                                                                 xmlSecSize size);              
+                                                                 xmlSecSize size);
 static int      xmlSecTransformIOBufferWrite                    (xmlSecTransformIOBufferPtr buffer,
                                                                  const xmlSecByte *buf,
-                                                                 xmlSecSize size);              
+                                                                 xmlSecSize size);
 static int      xmlSecTransformIOBufferClose                    (xmlSecTransformIOBufferPtr buffer);
 
 
@@ -2683,15 +2683,15 @@ static int      xmlSecTransformIOBufferClose                    (xmlSecTransform
  *
  * Returns: pointer to new output buffer or NULL if an error occurs.
  */
-xmlOutputBufferPtr 
+xmlOutputBufferPtr
 xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform, xmlSecTransformCtxPtr transformCtx) {
-    xmlSecTransformIOBufferPtr buffer; 
+    xmlSecTransformIOBufferPtr buffer;
     xmlSecTransformDataType type;
     xmlOutputBufferPtr output;
-    
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), NULL);
     xmlSecAssert2(transformCtx != NULL, NULL);
-    
+
     /* check that we have binary push method for this transform */
     type = xmlSecTransformDefaultGetDataType(transform, xmlSecTransformModePush, transformCtx);
     if((type & xmlSecTransformDataTypeBin) == 0) {
@@ -2702,7 +2702,7 @@ xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform, xmlSecTransformC
                     "push binary data not supported");
         return(NULL);
     }
-    
+
     buffer = xmlSecTransformIOBufferCreate(xmlSecTransformIOBufferModeWrite, transform, transformCtx);
     if(buffer == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2712,11 +2712,11 @@ xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform, xmlSecTransformC
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     output = xmlOutputBufferCreateIO((xmlOutputWriteCallback)xmlSecTransformIOBufferWrite,
                                      (xmlOutputCloseCallback)xmlSecTransformIOBufferClose,
                                      buffer,
-                                     NULL); 
+                                     NULL);
     if(output == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -2726,7 +2726,7 @@ xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform, xmlSecTransformC
         xmlSecTransformIOBufferDestroy(buffer);
         return(NULL);
     }
-    
+
     return(output);
 }
 
@@ -2739,12 +2739,12 @@ xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform, xmlSecTransformC
  *
  * Returns: pointer to new input buffer or NULL if an error occurs.
  */
-xmlParserInputBufferPtr 
+xmlParserInputBufferPtr
 xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform, xmlSecTransformCtxPtr transformCtx) {
-    xmlSecTransformIOBufferPtr buffer;    
+    xmlSecTransformIOBufferPtr buffer;
     xmlSecTransformDataType type;
     xmlParserInputBufferPtr input;
-    
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), NULL);
     xmlSecAssert2(transformCtx != NULL, NULL);
 
@@ -2757,7 +2757,7 @@ xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform, xmlSecTransformCt
                     XMLSEC_ERRORS_R_INVALID_TRANSFORM,
                     "pop binary data not supported");
         return(NULL);
-    }    
+    }
 
     buffer = xmlSecTransformIOBufferCreate(xmlSecTransformIOBufferModeRead, transform, transformCtx);
     if(buffer == NULL) {
@@ -2768,11 +2768,11 @@ xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform, xmlSecTransformCt
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     input = xmlParserInputBufferCreateIO((xmlInputReadCallback)xmlSecTransformIOBufferRead,
                                      (xmlInputCloseCallback)xmlSecTransformIOBufferClose,
                                      buffer,
-                                     XML_CHAR_ENCODING_NONE); 
+                                     XML_CHAR_ENCODING_NONE);
     if(input == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -2782,37 +2782,37 @@ xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform, xmlSecTransformCt
         xmlSecTransformIOBufferDestroy(buffer);
         return(NULL);
     }
-    
+
     return(input);
 }
 
-static xmlSecTransformIOBufferPtr 
+static xmlSecTransformIOBufferPtr
 xmlSecTransformIOBufferCreate(xmlSecTransformIOBufferMode mode, xmlSecTransformPtr transform,
                               xmlSecTransformCtxPtr transformCtx) {
     xmlSecTransformIOBufferPtr buffer;
-    
+
     xmlSecAssert2(xmlSecTransformIsValid(transform), NULL);
     xmlSecAssert2(transformCtx != NULL, NULL);
-    
+
     buffer = (xmlSecTransformIOBufferPtr)xmlMalloc(sizeof(xmlSecTransformIOBuffer));
     if(buffer == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "size=%d", sizeof(xmlSecTransformIOBuffer)); 
+                    "size=%d", sizeof(xmlSecTransformIOBuffer));
         return(NULL);
     }
     memset(buffer, 0, sizeof(xmlSecTransformIOBuffer));
-    
+
     buffer->mode = mode;
     buffer->transform = transform;
     buffer->transformCtx = transformCtx;
-    
+
     return(buffer);
 }
 
-static void 
+static void
 xmlSecTransformIOBufferDestroy(xmlSecTransformIOBufferPtr buffer) {
     xmlSecAssert(buffer != NULL);
 
@@ -2820,17 +2820,17 @@ xmlSecTransformIOBufferDestroy(xmlSecTransformIOBufferPtr buffer) {
     xmlFree(buffer);
 }
 
-static int 
-xmlSecTransformIOBufferRead(xmlSecTransformIOBufferPtr buffer, 
+static int
+xmlSecTransformIOBufferRead(xmlSecTransformIOBufferPtr buffer,
                             xmlSecByte *buf, xmlSecSize size) {
     int ret;
-    
+
     xmlSecAssert2(buffer != NULL, -1);
     xmlSecAssert2(buffer->mode == xmlSecTransformIOBufferModeRead, -1);
     xmlSecAssert2(xmlSecTransformIsValid(buffer->transform), -1);
     xmlSecAssert2(buffer->transformCtx != NULL, -1);
     xmlSecAssert2(buf != NULL, -1);
-    
+
     ret = xmlSecTransformPopBin(buffer->transform, buf, size, &size, buffer->transformCtx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2843,11 +2843,11 @@ xmlSecTransformIOBufferRead(xmlSecTransformIOBufferPtr buffer,
     return(size);
 }
 
-static int 
-xmlSecTransformIOBufferWrite(xmlSecTransformIOBufferPtr buffer, 
+static int
+xmlSecTransformIOBufferWrite(xmlSecTransformIOBufferPtr buffer,
                             const xmlSecByte *buf, xmlSecSize size) {
     int ret;
-    
+
     xmlSecAssert2(buffer != NULL, -1);
     xmlSecAssert2(buffer->mode == xmlSecTransformIOBufferModeWrite, -1);
     xmlSecAssert2(xmlSecTransformIsValid(buffer->transform), -1);
@@ -2866,14 +2866,14 @@ xmlSecTransformIOBufferWrite(xmlSecTransformIOBufferPtr buffer,
     return(size);
 }
 
-static int 
+static int
 xmlSecTransformIOBufferClose(xmlSecTransformIOBufferPtr buffer) {
     int ret;
-    
+
     xmlSecAssert2(buffer != NULL, -1);
     xmlSecAssert2(xmlSecTransformIsValid(buffer->transform), -1);
     xmlSecAssert2(buffer->transformCtx != NULL, -1);
-    
+
     /* need to flush write buffer before destroing */
     if(buffer->mode == xmlSecTransformIOBufferModeWrite) {
         ret = xmlSecTransformPushBin(buffer->transform, NULL, 0, 1, buffer->transformCtx);
@@ -2886,7 +2886,7 @@ xmlSecTransformIOBufferClose(xmlSecTransformIOBufferPtr buffer) {
             return(-1);
         }
     }
-    
+
     xmlSecTransformIOBufferDestroy(buffer);
     return(0);
 }
diff --git a/src/x509.c b/src/x509.c
index 679c35e..028030e 100644
--- a/src/x509.c
+++ b/src/x509.c
@@ -1,21 +1,21 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
 
 #ifndef XMLSEC_NO_X509
- 
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
 #include <libxml/tree.h>
-#include <libxml/parser.h> 
+#include <libxml/parser.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -50,7 +50,7 @@ xmlSecX509DataGetNodeContent (xmlNodePtr node, int deleteChildren,
     xmlSecAssert2(keyInfoCtx != NULL, -1);
 
     /* determine the current node content */
-    cur = xmlSecGetNextElementNode(node->children); 
+    cur = xmlSecGetNextElementNode(node->children);
     while(cur != NULL) {
         deleteCurNode = 0;
         if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
diff --git a/src/xkms.c b/src/xkms.c
index ed0adc6..1046b8e 100644
--- a/src/xkms.c
+++ b/src/xkms.c
@@ -1,24 +1,24 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * "XML Key Management Specification v 2.0" implementation
  *  http://www.w3.org/TR/xkms2/
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
 
 #ifndef XMLSEC_NO_XKMS
- 
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
 #include <libxml/tree.h>
-#include <libxml/parser.h> 
+#include <libxml/parser.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -47,15 +47,15 @@ static int      xmlSecXkmsServerCtxWriteSoap12FatalError        (xmlSecXkmsServe
 
 static int      xmlSecXkmsServerCtxRequestAbstractTypeNodeRead  (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr* node);
-static int      xmlSecXkmsServerCtxSignatureNodeRead            (xmlSecXkmsServerCtxPtr ctx, 
+static int      xmlSecXkmsServerCtxSignatureNodeRead            (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
-static int      xmlSecXkmsServerCtxMessageExtensionNodesRead    (xmlSecXkmsServerCtxPtr ctx, 
+static int      xmlSecXkmsServerCtxMessageExtensionNodesRead    (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr* node);
-static int      xmlSecXkmsServerCtxOpaqueClientDataNodeRead     (xmlSecXkmsServerCtxPtr ctx, 
+static int      xmlSecXkmsServerCtxOpaqueClientDataNodeRead     (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
-static int      xmlSecXkmsServerCtxPendingNotificationNodeRead  (xmlSecXkmsServerCtxPtr ctx, 
+static int      xmlSecXkmsServerCtxPendingNotificationNodeRead  (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
-static int      xmlSecXkmsServerCtxRespondWithNodesRead         (xmlSecXkmsServerCtxPtr ctx, 
+static int      xmlSecXkmsServerCtxRespondWithNodesRead         (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr* node);
 static int      xmlSecXkmsServerCtxPendingRequestNodeRead       (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr* node);
@@ -69,16 +69,16 @@ static int      xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsSer
 static int      xmlSecXkmsServerCtxKeyInfoNodeWrite             (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node,
                                                                  xmlSecKeyPtr key);
-static int      xmlSecXkmsServerCtxUseKeyWithNodesRead          (xmlSecXkmsServerCtxPtr ctx, 
+static int      xmlSecXkmsServerCtxUseKeyWithNodesRead          (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr* node);
-static int      xmlSecXkmsServerCtxUseKeyWithNodesWrite         (xmlSecXkmsServerCtxPtr ctx, 
+static int      xmlSecXkmsServerCtxUseKeyWithNodesWrite         (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node,
                                                                  xmlSecKeyPtr key);
 static int      xmlSecXkmsServerCtxTimeInstantNodeRead          (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
-static int      xmlSecXkmsServerCtxResultTypeNodeWrite          (xmlSecXkmsServerCtxPtr ctx, 
+static int      xmlSecXkmsServerCtxResultTypeNodeWrite          (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
-static int      xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(xmlSecXkmsServerCtxPtr ctx, 
+static int      xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
 static int      xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node,
@@ -87,65 +87,65 @@ static int      xmlSecXkmsServerCtxKeyBindingNodeWrite          (xmlSecXkmsServe
                                                                  xmlNodePtr node,
                                                                  xmlSecKeyPtr key);
 static int      xmlSecXkmsServerCtxValidityIntervalNodeWrite    (xmlSecXkmsServerCtxPtr ctx,
-                                                                 xmlNodePtr node, 
+                                                                 xmlNodePtr node,
                                                                  xmlSecKeyPtr key);
 static int      xmlSecXkmsServerCtxKeyBindingStatusNodeWrite    (xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node,
                                                                  xmlSecKeyPtr key);
 
 
-static const xmlSecQName2IntegerInfo gXmlSecXkmsResultMajorInfo[] = 
+static const xmlSecQName2IntegerInfo gXmlSecXkmsResultMajorInfo[] =
 {
   { xmlSecXkmsNs, xmlSecResultMajorCodeSuccess,
     xmlSecXkmsResultMajorSuccess },
   { xmlSecXkmsNs, xmlSecResultMajorCodeVersionMismatch,
     xmlSecXkmsResultMajorVersionMismatch },
-  { xmlSecXkmsNs, xmlSecResultMajorCodeSender, 
+  { xmlSecXkmsNs, xmlSecResultMajorCodeSender,
     xmlSecXkmsResultMajorSender },
   { xmlSecXkmsNs, xmlSecResultMajorCodeReceiver,
     xmlSecXkmsResultMajorReceiver },
-  { xmlSecXkmsNs, xmlSecResultMajorCodeRepresent,     
+  { xmlSecXkmsNs, xmlSecResultMajorCodeRepresent,
     xmlSecXkmsResultMajorRepresent },
-  { xmlSecXkmsNs, xmlSecResultMajorCodePending, 
+  { xmlSecXkmsNs, xmlSecResultMajorCodePending,
     xmlSecXkmsResultMajorPending, },
   { NULL , NULL, 0 }    /* MUST be last in the list */
 };
 
-static const xmlSecQName2IntegerInfo gXmlSecXkmsMinorErrorInfo[] = 
+static const xmlSecQName2IntegerInfo gXmlSecXkmsMinorErrorInfo[] =
 {
   { xmlSecXkmsNs, xmlSecResultMinorCodeNoMatch,
     xmlSecXkmsResultMinorNoMatch },
-  { xmlSecXkmsNs, xmlSecResultMinorCodeTooManyResponses, 
+  { xmlSecXkmsNs, xmlSecResultMinorCodeTooManyResponses,
     xmlSecXkmsResultMinorTooManyResponses },
   { xmlSecXkmsNs, xmlSecResultMinorCodeIncomplete,
     xmlSecXkmsResultMinorIncomplete },
-  { xmlSecXkmsNs, xmlSecResultMinorCodeFailure, 
+  { xmlSecXkmsNs, xmlSecResultMinorCodeFailure,
     xmlSecXkmsResultMinorFailure },
-  { xmlSecXkmsNs, xmlSecResultMinorCodeRefused, 
+  { xmlSecXkmsNs, xmlSecResultMinorCodeRefused,
     xmlSecXkmsResultMinorRefused },
-  { xmlSecXkmsNs, xmlSecResultMinorCodeNoAuthentication, 
+  { xmlSecXkmsNs, xmlSecResultMinorCodeNoAuthentication,
     xmlSecXkmsResultMinorNoAuthentication },
-  { xmlSecXkmsNs, xmlSecResultMinorCodeMessageNotSupported, 
+  { xmlSecXkmsNs, xmlSecResultMinorCodeMessageNotSupported,
     xmlSecXkmsResultMinorMessageNotSupported },
-  { xmlSecXkmsNs, xmlSecResultMinorCodeUnknownResponseId, 
+  { xmlSecXkmsNs, xmlSecResultMinorCodeUnknownResponseId,
     xmlSecXkmsResultMinorUnknownResponseId },
-  { xmlSecXkmsNs, xmlSecResultMinorCodeNotSynchronous, 
+  { xmlSecXkmsNs, xmlSecResultMinorCodeNotSynchronous,
     xmlSecXkmsResultMinorSynchronous },
   { NULL, NULL, 0 }     /* MUST be last in the list */
 };
 
-static const xmlSecQName2IntegerInfo gXmlSecXkmsKeyBindingStatusInfo[] = 
+static const xmlSecQName2IntegerInfo gXmlSecXkmsKeyBindingStatusInfo[] =
 {
-  { xmlSecXkmsNs, xmlSecKeyBindingStatusValid, 
+  { xmlSecXkmsNs, xmlSecKeyBindingStatusValid,
     xmlSecXkmsKeyBindingStatusValid },
   { xmlSecXkmsNs, xmlSecKeyBindingStatusInvalid,
     xmlSecXkmsKeyBindingStatusInvalid },
-  { xmlSecXkmsNs, xmlSecKeyBindingStatusIndeterminate, 
+  { xmlSecXkmsNs, xmlSecKeyBindingStatusIndeterminate,
     xmlSecXkmsKeyBindingStatusIndeterminate },
   { NULL, NULL, 0 }     /* MUST be last in the list */
 };
 
-static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyUsageInfo[] = 
+static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyUsageInfo[] =
 {
   { xmlSecXkmsNs, xmlSecKeyUsageEncryption,
     xmlSecKeyUsageEncrypt | xmlSecKeyUsageDecrypt },
@@ -156,7 +156,7 @@ static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyUsageInfo[] =
   { NULL, NULL, 0 }     /* MUST be last in the list */
 };
 
-static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyBindingReasonInfo[] = 
+static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyBindingReasonInfo[] =
 {
     { xmlSecXkmsNs, xmlSecKeyBindingReasonIssuerTrust,
       XMLSEC_XKMS_KEY_BINDING_REASON_MASK_ISSUER_TRAST },
@@ -169,7 +169,7 @@ static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyBindingReasonInfo[] =
     { NULL, NULL, 0 }   /* MUST be last in the list */
 };
 
-static const xmlSecQName2BitMaskInfo gXmlSecXkmsResponseMechanismInfo[] = 
+static const xmlSecQName2BitMaskInfo gXmlSecXkmsResponseMechanismInfo[] =
 {
     { xmlSecXkmsNs, xmlSecResponseMechanismRepresent,
       XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT },
@@ -180,14 +180,14 @@ static const xmlSecQName2BitMaskInfo gXmlSecXkmsResponseMechanismInfo[] =
     { NULL, NULL, 0 }   /* MUST be last in the list */
 };
 
-static const xmlSecQName2IntegerInfo gXmlSecXkmsFormatInfo[] = 
+static const xmlSecQName2IntegerInfo gXmlSecXkmsFormatInfo[] =
 {
-  { NULL, xmlSecXkmsFormatStrPlain, 
+  { NULL, xmlSecXkmsFormatStrPlain,
     xmlSecXkmsServerFormatPlain },
 #ifndef XMLSEC_NO_SOAP
   { NULL, xmlSecXkmsFormatStrSoap11,
     xmlSecXkmsServerFormatSoap11 },
-  { NULL, xmlSecXkmsFormatStrSoap12, 
+  { NULL, xmlSecXkmsFormatStrSoap12,
     xmlSecXkmsServerFormatSoap12 },
 #endif /* XMLSEC_NO_SOAP */
   { NULL, NULL, 0 }     /* MUST be last in the list */
@@ -196,19 +196,19 @@ static const xmlSecQName2IntegerInfo gXmlSecXkmsFormatInfo[] =
 /**
  * xmlSecXkmsServerFormatFromString:
  * @str         the string.
- *  
+ *
  * Gets xmlSecXkmsServerFormat from string @str.
- * 
+ *
  * Returns: corresponding format or xmlSecXkmsServerFormatUnknown
  * if format could not be recognized.
- */ 
-xmlSecXkmsServerFormat 
+ */
+xmlSecXkmsServerFormat
 xmlSecXkmsServerFormatFromString(const xmlChar* str) {
     int res;
     int ret;
 
     xmlSecAssert2(str != NULL, xmlSecXkmsServerFormatUnknown);
-    
+
     ret = xmlSecQName2IntegerGetInteger(gXmlSecXkmsFormatInfo, NULL, str, &res);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -216,7 +216,7 @@ xmlSecXkmsServerFormatFromString(const xmlChar* str) {
                     "xmlSecQName2IntegerGetInteger",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(xmlSecXkmsServerFormatUnknown);   
+        return(xmlSecXkmsServerFormatUnknown);
     }
 
     return((xmlSecXkmsServerFormat)res);
@@ -230,10 +230,10 @@ xmlSecXkmsServerFormatFromString(const xmlChar* str) {
  *
  * Returns: string corresponding to @format or NULL if an error occurs.
  */
-const xmlChar* 
+const xmlChar*
 xmlSecXkmsServerFormatToString (xmlSecXkmsServerFormat format) {
     xmlSecQName2IntegerInfoConstPtr info;
-    
+
     xmlSecAssert2(format != xmlSecXkmsServerFormatUnknown, NULL);
 
     info = xmlSecQName2IntegerGetInfo(gXmlSecXkmsFormatInfo, format);
@@ -253,28 +253,28 @@ xmlSecXkmsServerFormatToString (xmlSecXkmsServerFormat format) {
  * @keysMngr:   the pointer to keys manager.
  *
  * Creates XKMS request server side processing context.
- * The caller is responsible for destroying returend object by calling 
+ * The caller is responsible for destroying returend object by calling
  * #xmlSecXkmsServerCtxDestroy function.
  *
  * Returns: pointer to newly allocated context object or NULL if an error
  * occurs.
  */
-xmlSecXkmsServerCtxPtr  
+xmlSecXkmsServerCtxPtr
 xmlSecXkmsServerCtxCreate(xmlSecKeysMngrPtr keysMngr) {
     xmlSecXkmsServerCtxPtr ctx;
     int ret;
-    
+
     ctx = (xmlSecXkmsServerCtxPtr) xmlMalloc(sizeof(xmlSecXkmsServerCtx));
     if(ctx == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecXkmsServerCtx)=%d", 
+                    "sizeof(xmlSecXkmsServerCtx)=%d",
                     sizeof(xmlSecXkmsServerCtx));
         return(NULL);
     }
-    
+
     ret = xmlSecXkmsServerCtxInitialize(ctx, keysMngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -283,9 +283,9 @@ xmlSecXkmsServerCtxCreate(xmlSecKeysMngrPtr keysMngr) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecXkmsServerCtxDestroy(ctx);
-        return(NULL);   
+        return(NULL);
     }
-    return(ctx);    
+    return(ctx);
 }
 
 /**
@@ -294,10 +294,10 @@ xmlSecXkmsServerCtxCreate(xmlSecKeysMngrPtr keysMngr) {
  *
  * Destroy context object created with #xmlSecXkmsServerCtxCreate function.
  */
-void  
+void
 xmlSecXkmsServerCtxDestroy(xmlSecXkmsServerCtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
-    
+
     xmlSecXkmsServerCtxFinalize(ctx);
     xmlFree(ctx);
 }
@@ -308,17 +308,17 @@ xmlSecXkmsServerCtxDestroy(xmlSecXkmsServerCtxPtr ctx) {
  * @keysMngr:   the pointer to keys manager.
  *
  * Initializes XKMS element processing context.
- * The caller is responsible for cleaing up returend object by calling 
+ * The caller is responsible for cleaing up returend object by calling
  * #xmlSecXkmsServerCtxFinalize function.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keysMngr) {
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     memset(ctx, 0, sizeof(xmlSecXkmsServerCtx));
 
     ctx->resultMajor    = xmlSecXkmsResultMajorSuccess;
@@ -334,10 +334,10 @@ xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keys
                     "xmlSecKeyInfoCtxInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
     ctx->keyInfoReadCtx.mode = xmlSecKeyInfoModeRead;
-    
+
     ret = xmlSecKeyInfoCtxInitialize(&(ctx->keyInfoWriteCtx), keysMngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -345,13 +345,13 @@ xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keys
                     "xmlSecKeyInfoCtxInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
     ctx->keyInfoWriteCtx.mode = xmlSecKeyInfoModeWrite;
 
     /* enabled RespondWith */
     ret = xmlSecPtrListInitialize(&(ctx->enabledRespondWithIds), xmlSecXkmsRespondWithIdListId);
-    if(ret < 0) { 
+    if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecPtrListInitialize",
@@ -362,7 +362,7 @@ xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keys
 
     /* enabled ServerRequest */
     ret = xmlSecPtrListInitialize(&(ctx->enabledServerRequestIds), xmlSecXkmsServerRequestIdListId);
-    if(ret < 0) { 
+    if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecPtrListInitialize",
@@ -381,7 +381,7 @@ xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keys
                     "xmlSecPtrListInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
 
     /* initialize RespondWith list */
@@ -392,7 +392,7 @@ xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keys
                     "xmlSecPtrListInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
 
     return(0);
@@ -404,12 +404,12 @@ xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keys
  *
  * Cleans up @ctx object.
  */
-void 
+void
 xmlSecXkmsServerCtxFinalize(xmlSecXkmsServerCtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
 
     xmlSecXkmsServerCtxReset(ctx);
-    
+
     if(ctx->expectedService != NULL) {
         xmlFree(ctx->expectedService);
     }
@@ -432,10 +432,10 @@ xmlSecXkmsServerCtxFinalize(xmlSecXkmsServerCtxPtr ctx) {
  *
  * Resets @ctx object, user settings are not touched.
  */
-void 
+void
 xmlSecXkmsServerCtxReset(xmlSecXkmsServerCtxPtr ctx) {
     xmlSecAssert(ctx != NULL);
-    
+
     ctx->resultMajor = xmlSecXkmsResultMajorSuccess;
     ctx->resultMinor = xmlSecXkmsResultMinorNone;
     xmlSecKeyInfoCtxReset(&(ctx->keyInfoReadCtx));
@@ -443,12 +443,12 @@ xmlSecXkmsServerCtxReset(xmlSecXkmsServerCtxPtr ctx) {
     xmlSecPtrListEmpty(&(ctx->keys));
     xmlSecPtrListEmpty(&(ctx->respWithList));
 
-    ctx->requestNode            = NULL;    
-    ctx->opaqueClientDataNode   = NULL;    
+    ctx->requestNode            = NULL;
+    ctx->opaqueClientDataNode   = NULL;
     ctx->firtsMsgExtNode        = NULL;
     ctx->keyInfoNode            = NULL;
     ctx->requestId              = xmlSecXkmsServerRequestIdUnknown;
-    
+
     if(ctx->id != NULL) {
         xmlFree(ctx->id); ctx->id = NULL;
     }
@@ -462,18 +462,18 @@ xmlSecXkmsServerCtxReset(xmlSecXkmsServerCtxPtr ctx) {
         xmlFree(ctx->originalRequestId); ctx->originalRequestId = NULL;
     }
     if(ctx->pendingNotificationMechanism != NULL) {
-        xmlFree(ctx->pendingNotificationMechanism); 
+        xmlFree(ctx->pendingNotificationMechanism);
         ctx->pendingNotificationMechanism = NULL;
     }
     if(ctx->pendingNotificationIdentifier != NULL) {
-        xmlFree(ctx->pendingNotificationIdentifier); 
+        xmlFree(ctx->pendingNotificationIdentifier);
         ctx->pendingNotificationIdentifier = NULL;
     }
     if(ctx->compoundRequestContexts != NULL) {
         xmlSecPtrListDestroy(ctx->compoundRequestContexts);
         ctx->compoundRequestContexts = NULL;
     }
-    
+
     ctx->responseLimit          = XMLSEC_XKMS_NO_RESPONSE_LIMIT;
     ctx->responseMechanismMask  = 0;
 }
@@ -482,15 +482,15 @@ xmlSecXkmsServerCtxReset(xmlSecXkmsServerCtxPtr ctx) {
  * xmlSecXkmsServerCtxCopyUserPref:
  * @dst:        the pointer to destination context.
  * @src:        the pointer to source context.
- * 
+ *
  * Copies user preference from @src context to @dst.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecXkmsServerCtxCopyUserPref(xmlSecXkmsServerCtxPtr dst, xmlSecXkmsServerCtxPtr src) {
     int ret;
-    
+
     xmlSecAssert2(dst != NULL, -1);
     xmlSecAssert2(src != NULL, -1);
 
@@ -517,7 +517,7 @@ xmlSecXkmsServerCtxCopyUserPref(xmlSecXkmsServerCtxPtr dst, xmlSecXkmsServerCtxP
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     if(src->expectedService != NULL) {
         dst->expectedService = xmlStrdup(src->expectedService);
         if(dst->expectedService == NULL) {
@@ -545,7 +545,7 @@ xmlSecXkmsServerCtxCopyUserPref(xmlSecXkmsServerCtxPtr dst, xmlSecXkmsServerCtxP
 
 
     ret = xmlSecPtrListCopy(&(dst->enabledRespondWithIds), &(src->enabledRespondWithIds));
-    if(ret < 0) { 
+    if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecPtrListCopy",
@@ -555,7 +555,7 @@ xmlSecXkmsServerCtxCopyUserPref(xmlSecXkmsServerCtxPtr dst, xmlSecXkmsServerCtxP
     }
 
     ret = xmlSecPtrListCopy(&(dst->enabledServerRequestIds), &(src->enabledServerRequestIds));
-    if(ret < 0) { 
+    if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecPtrListCopy",
@@ -565,23 +565,23 @@ xmlSecXkmsServerCtxCopyUserPref(xmlSecXkmsServerCtxPtr dst, xmlSecXkmsServerCtxP
     }
 
     return(0);
-} 
+}
 
-/** 
- * xmlSecXkmsServerCtxProcess: 
+/**
+ * xmlSecXkmsServerCtxProcess:
  * @ctx:        the pointer to XKMS processing context.
  * @node:       the pointer to request node.
  * @format:     the request/response format.
  * @doc:        the pointer to response parent XML document (might be NULL).
- * 
- * Reads XKMS request from @node and creates response to a newly created node. 
+ *
+ * Reads XKMS request from @node and creates response to a newly created node.
  * Caller is responsible for adding the returned node to the XML document.
  *
  * Returns: pointer to newly created XKMS response node or NULL
  * if an error occurs.
  */
-xmlNodePtr 
-xmlSecXkmsServerCtxProcess(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, 
+xmlNodePtr
+xmlSecXkmsServerCtxProcess(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,
                               xmlSecXkmsServerFormat format, xmlDocPtr doc) {
     int ret;
 
@@ -600,8 +600,8 @@ xmlSecXkmsServerCtxProcess(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,
                     xmlSecErrorsSafeString(node->name));
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
         goto done;
-    }    
-        
+    }
+
     ret = xmlSecXkmsServerCtxRequestRead(ctx, ctx->requestNode);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -612,7 +612,7 @@ xmlSecXkmsServerCtxProcess(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,
                     xmlSecErrorsSafeString(ctx->requestNode->name));
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
         goto done;
-    }    
+    }
 
     ret = xmlSecXkmsServerRequestExecute(ctx->requestId, ctx);
     if(ret < 0) {
@@ -627,11 +627,11 @@ xmlSecXkmsServerCtxProcess(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,
     }
 
 done:
-    /* always try to write response back */    
+    /* always try to write response back */
     if(ctx->requestId != NULL) {
         xmlNodePtr respNode;
         xmlNodePtr wrappedRespNode;
-        
+
         respNode = xmlSecXkmsServerCtxResponseWrite(ctx, doc);
         if(respNode == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -641,9 +641,9 @@ done:
                         "ctx->requestNode=%s",
                         xmlSecErrorsSafeString(ctx->requestNode->name));
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
-            goto error;    
+            goto error;
         }
-    
+
 
         wrappedRespNode = xmlSecXkmsServerCtxResponseWrap(ctx, respNode, format, doc);
         if(wrappedRespNode == NULL) {
@@ -655,19 +655,19 @@ done:
                         xmlSecErrorsSafeString(ctx->requestNode->name));
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
             xmlFreeNode(respNode);
-            goto error;    
+            goto error;
         }
 
         return(wrappedRespNode);
     }
-    
+
 error:
     /* last attempt: create fatatl error response */
     return(xmlSecXkmsServerCtxFatalErrorResponseCreate(ctx, format, doc));
 }
 
-/** 
- * xmlSecXkmsServerCtxRequestRead: 
+/**
+ * xmlSecXkmsServerCtxRequestRead:
  * @ctx:        the pointer to XKMS processing context.
  * @node:       the pointer to request node.
  *
@@ -675,10 +675,10 @@ error:
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecXkmsServerCtxRequestRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->requestId == NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -712,16 +712,16 @@ xmlSecXkmsServerCtxRequestRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
         return(-1);
     }
-        
+
     return(0);
 }
 
-/** 
- * xmlSecXkmsServerCtxResponseWrite: 
+/**
+ * xmlSecXkmsServerCtxResponseWrite:
  * @ctx:        the pointer to XKMS processing context.
  * @doc:        the pointer to response parent XML document (might be NULL).
  *
- * Writes XKMS response from context to a newly created node. Caller is 
+ * Writes XKMS response from context to a newly created node. Caller is
  * responsible for adding the returned node to the XML document.
  *
  * Returns: pointer to newly created XKMS response node or NULL
@@ -730,7 +730,7 @@ xmlSecXkmsServerCtxRequestRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
 xmlNodePtr
 xmlSecXkmsServerCtxResponseWrite(xmlSecXkmsServerCtxPtr ctx, xmlDocPtr doc) {
     xmlNodePtr respNode;
-    
+
     xmlSecAssert2(ctx != NULL, NULL);
     xmlSecAssert2(ctx->requestId != NULL, NULL);
 
@@ -746,7 +746,7 @@ xmlSecXkmsServerCtxResponseWrite(xmlSecXkmsServerCtxPtr ctx, xmlDocPtr doc) {
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
         return(NULL);
     }
-    
+
     return(respNode);
 }
 
@@ -755,18 +755,18 @@ xmlSecXkmsServerCtxResponseWrite(xmlSecXkmsServerCtxPtr ctx, xmlDocPtr doc) {
  * @ctx:        the pointer to XKMS processing context.
  * @node:       the pointer to request node.
  * @format:     the request/response format.
- * 
+ *
  * Removes SOAP or other envelope from XKMS request.
  *
- * Returns: pointer to "real" XKMS request node or NULL if an error occurs. 
+ * Returns: pointer to "real" XKMS request node or NULL if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,  xmlSecXkmsServerFormat format) {
     xmlNodePtr result = NULL;
-        
+
     xmlSecAssert2(ctx != NULL, NULL);
     xmlSecAssert2(node != NULL, NULL);
-    
+
     switch(format) {
     case xmlSecXkmsServerFormatPlain:
         result = node;
@@ -782,8 +782,8 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,  x
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
             return(NULL);
-        }   
-        
+        }
+
         /* check that Body has exactly one entry */
         if(xmlSecSoap11GetBodyEntriesNumber(node) != 1) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -794,7 +794,7 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,  x
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
             return(NULL);
         }
-        
+
         /* this one enntry is our xkms request */
         result = xmlSecSoap11GetBodyEntry(node, 0);
         if(result == NULL) {
@@ -806,7 +806,7 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,  x
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
             return(NULL);
         }
-        
+
         break;
     case xmlSecXkmsServerFormatSoap12:
         /* verify that it is actually soap Envelope node */
@@ -818,8 +818,8 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,  x
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
             return(NULL);
-        }   
-        
+        }
+
         /* check that Body has exactly one entry */
         if(xmlSecSoap12GetBodyEntriesNumber(node) != 1) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -830,7 +830,7 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,  x
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
             return(NULL);
         }
-        
+
         /* this one enntry is our xkms request */
         result = xmlSecSoap12GetBodyEntry(node, 0);
         if(result == NULL) {
@@ -842,7 +842,7 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,  x
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
             return(NULL);
         }
-        
+
         break;
 #endif /* XMLSEC_NO_SOAP */
     default:
@@ -855,12 +855,12 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,  x
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
         return(NULL);
     }
-    
+
     return(result);
 }
 
-/** 
- * xmlSecXkmsServerCtxResponseWrap: 
+/**
+ * xmlSecXkmsServerCtxResponseWrap:
  * @ctx:        the pointer to XKMS processing context.
  * @node:       the pointer to response node.
  * @format:     the request/response format.
@@ -872,13 +872,13 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,  x
  * Returns: pointer to newly created response envelope node or NULL
  * if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecXkmsServerCtxResponseWrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecXkmsServerFormat format, xmlDocPtr doc) {
     xmlNodePtr result = NULL;
-    
+
     xmlSecAssert2(ctx != NULL, NULL);
     xmlSecAssert2(node != NULL, NULL);
-    
+
     switch(format) {
     case xmlSecXkmsServerFormatPlain:
         result = node; /* do nothing */
@@ -895,7 +895,7 @@ xmlSecXkmsServerCtxResponseWrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xml
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
             return(NULL);
         }
-        
+
         if(xmlSecSoap11AddBodyEntry(result, node) == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -917,7 +917,7 @@ xmlSecXkmsServerCtxResponseWrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xml
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
             return(NULL);
         }
-        
+
         if(xmlSecSoap12AddBodyEntry(result, node) == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -939,33 +939,33 @@ xmlSecXkmsServerCtxResponseWrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xml
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
         return(NULL);
     }
-    
+
     return(result);
 }
 
-/** 
- * xmlSecXkmsServerCtxFatalErrorResponseCreate: 
+/**
+ * xmlSecXkmsServerCtxFatalErrorResponseCreate:
  * @ctx:        the pointer to XKMS processing context.
  * @format:     the request/response format.
  * @doc:        the pointer to response parent XML document (might be NULL).
  *
- * Creates a "fatal error" SOAP or other envelope respons. Caller is 
+ * Creates a "fatal error" SOAP or other envelope respons. Caller is
  * responsible for adding the returned node to the XML document.
  *
  * Returns: pointer to newly created fatal error response (it might be NULL).
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXkmsServerFormat format, xmlDocPtr doc) {
     xmlNodePtr result = NULL;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, NULL);
 
     /* make sure that we have an error */
     if(ctx->resultMajor == xmlSecXkmsResultMajorSuccess) {
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
     }
-    
+
     switch(format) {
     case xmlSecXkmsServerFormatPlain:
         /* try to create fatal error response with XKMS Status request */
@@ -991,7 +991,7 @@ xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXk
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
             return(NULL);
         }
-        
+
         ret = xmlSecXkmsServerCtxWriteSoap11FatalError(ctx, result);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1003,7 +1003,7 @@ xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXk
             xmlFreeNode(result);
             return(NULL);
         }
-                
+
         break;
     case xmlSecXkmsServerFormatSoap12:
         result = xmlSecSoap12CreateEnvelope(doc);
@@ -1016,7 +1016,7 @@ xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXk
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
             return(NULL);
         }
-        
+
         ret = xmlSecXkmsServerCtxWriteSoap12FatalError(ctx, result);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1028,7 +1028,7 @@ xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXk
             xmlFreeNode(result);
             return(NULL);
         }
-                
+
         break;
 #endif /* XMLSEC_NO_SOAP */
     default:
@@ -1041,18 +1041,18 @@ xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXk
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
         return(NULL);
     }
-    
+
     return(result);
 }
 
 #ifndef XMLSEC_NO_SOAP
-static int 
+static int
 xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr envNode) {
     const xmlChar* faultCodeHref = NULL;
     const xmlChar* faultCodeLocalPart = NULL;
     xmlChar* faultString = NULL;
     int len;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(envNode != NULL, -1);
 
@@ -1071,7 +1071,7 @@ xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
             return(-1);
         }
-    } else if((ctx->resultMajor == xmlSecXkmsResultMajorSender) && 
+    } else if((ctx->resultMajor == xmlSecXkmsResultMajorSender) &&
               (ctx->requestId == NULL)) {
         /* we understood the request but were not able to parse input message */
         faultCodeHref = xmlSecSoap11Ns;
@@ -1090,7 +1090,7 @@ xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
             return(-1);
         }
         xmlSecStrPrintf(faultString, len , xmlSecXkmsSoapFaultReasonMessageInvalid,
-                        xmlSecErrorsSafeString(ctx->requestNode->name));        
+                        xmlSecErrorsSafeString(ctx->requestNode->name));
     } else if((ctx->resultMajor == xmlSecXkmsResultMajorReceiver) &&
               (ctx->requestId == NULL)) {
         /* we understood the request but were not able to process it */
@@ -1111,7 +1111,7 @@ xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
         faultCodeHref = xmlSecSoap11Ns;
         faultCodeLocalPart = xmlSecSoapFaultCodeClient;
 
-        len = xmlStrlen(BAD_CAST xmlSecErrorsSafeString(ctx->requestNode->name)) + 
+        len = xmlStrlen(BAD_CAST xmlSecErrorsSafeString(ctx->requestNode->name)) +
               xmlStrlen(xmlSecXkmsSoapFaultReasonMessageNotSupported) + 1;
         faultString = xmlMalloc(len + 1);
         if(faultString == NULL) {
@@ -1140,7 +1140,7 @@ xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
             return(-1);
         }
     }
-    
+
     if(xmlSecSoap11AddFaultEntry(envNode, faultCodeHref, faultCodeLocalPart, faultString, NULL) == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1148,15 +1148,15 @@ xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
-        xmlFree(faultString);    
+        xmlFree(faultString);
         return(-1);
     }
 
-    xmlFree(faultString);    
+    xmlFree(faultString);
     return(0);
 }
 
-static int 
+static int
 xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr envNode) {
     xmlSecSoap12FaultCode faultCode = xmlSecSoap12FaultCodeUnknown;
     const xmlChar* faultSubCodeHref = NULL;
@@ -1164,7 +1164,7 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
     xmlChar* faultReason = NULL;
     int len;
     xmlNodePtr faultNode;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(envNode != NULL, -1);
 
@@ -1182,7 +1182,7 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
             xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
             return(-1);
         }
-    } else if((ctx->resultMajor == xmlSecXkmsResultMajorSender) && 
+    } else if((ctx->resultMajor == xmlSecXkmsResultMajorSender) &&
               (ctx->requestId == NULL)) {
         /* we understood the request but were not able to parse input message */
         faultCode = xmlSecSoap12FaultCodeSender;
@@ -1202,7 +1202,7 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
             return(-1);
         }
         xmlSecStrPrintf(faultReason, len , xmlSecXkmsSoapFaultReasonMessageInvalid,
-                        xmlSecErrorsSafeString(ctx->requestNode->name));        
+                        xmlSecErrorsSafeString(ctx->requestNode->name));
     } else if((ctx->resultMajor == xmlSecXkmsResultMajorReceiver) &&
               (ctx->requestId == NULL)) {
         /* we understood the request but were not able to process it */
@@ -1223,7 +1223,7 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
         faultSubCodeHref = xmlSecXkmsNs;
         faultSubCodeLocalPart = xmlSecXkmsSoapSubcodeValueBadMessage;
 
-        len = xmlStrlen(BAD_CAST xmlSecErrorsSafeString(ctx->requestNode->name)) + 
+        len = xmlStrlen(BAD_CAST xmlSecErrorsSafeString(ctx->requestNode->name)) +
               xmlStrlen(xmlSecXkmsSoapFaultReasonMessageNotSupported) + 1;
         faultReason = xmlMalloc(len + 1);
         if(faultReason == NULL) {
@@ -1253,8 +1253,8 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
     }
     xmlSecAssert2(faultCode != xmlSecSoap12FaultCodeUnknown, -1);
     xmlSecAssert2(faultReason != NULL, -1);
-    
-    faultNode = xmlSecSoap12AddFaultEntry(envNode, faultCode, faultReason, 
+
+    faultNode = xmlSecSoap12AddFaultEntry(envNode, faultCode, faultReason,
                                     xmlSecXkmsSoapFaultReasonLang, NULL, NULL);
     if(faultNode == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1263,10 +1263,10 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
-        xmlFree(faultReason);    
+        xmlFree(faultReason);
         return(-1);
     }
-    xmlFree(faultReason);    
+    xmlFree(faultReason);
 
     if((faultSubCodeHref != NULL) && (faultSubCodeLocalPart != NULL)) {
         /* make sure that we have subcode (xkms) namespace declared */
@@ -1297,28 +1297,28 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
 #endif /* XMLSEC_NO_SOAP */
 
 
-/** 
- * xmlSecXkmsServerCtxSetResult: 
+/**
+ * xmlSecXkmsServerCtxSetResult:
  * @ctx:         the pointer to XKMS processing context.
  * @resultMajor: the major result code.
  * @resultMinor: the minor result code.
- * 
+ *
  * Sets the major/minor result code in the context if no other result is already
  * reported.
  */
-void 
-xmlSecXkmsServerCtxSetResult(xmlSecXkmsServerCtxPtr ctx, xmlSecXkmsResultMajor resultMajor, 
+void
+xmlSecXkmsServerCtxSetResult(xmlSecXkmsServerCtxPtr ctx, xmlSecXkmsResultMajor resultMajor,
                              xmlSecXkmsResultMinor resultMinor) {
     xmlSecAssert(ctx != NULL);
-    
-    if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) && 
+
+    if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) &&
        (resultMinor != xmlSecXkmsResultMajorSuccess)) {
         ctx->resultMajor = resultMajor;
         ctx->resultMinor = resultMinor;
-    } else if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) && 
+    } else if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) &&
        (ctx->resultMinor == xmlSecXkmsResultMinorNone)) {
         xmlSecAssert(resultMajor == xmlSecXkmsResultMajorSuccess);
-        
+
         ctx->resultMinor = resultMinor;
     }
 }
@@ -1331,45 +1331,45 @@ xmlSecXkmsServerCtxSetResult(xmlSecXkmsServerCtxPtr ctx, xmlSecXkmsResultMajor r
  *
  * Prints the debug information about @ctx to @output.
  */
-void 
+void
 xmlSecXkmsServerCtxDebugDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
     xmlSecAssert(ctx != NULL);
     xmlSecAssert(output != NULL);
-    
+
     fprintf(output, "= XKMS SERVER CONTEXT: %s\n",
-            (ctx->requestId != xmlSecXkmsServerRequestIdUnknown && 
-             xmlSecXkmsServerRequestKlassGetName(ctx->requestId)) ? 
+            (ctx->requestId != xmlSecXkmsServerRequestIdUnknown &&
+             xmlSecXkmsServerRequestKlassGetName(ctx->requestId)) ?
                 xmlSecXkmsServerRequestKlassGetName(ctx->requestId) :
                 BAD_CAST "NULL");
 
-    xmlSecQName2IntegerDebugDump(gXmlSecXkmsResultMajorInfo, 
-                ctx->resultMajor, BAD_CAST "resultMajor", output);    
-    xmlSecQName2IntegerDebugDump(gXmlSecXkmsMinorErrorInfo, 
-                ctx->resultMinor, BAD_CAST "resultMinor", output);    
+    xmlSecQName2IntegerDebugDump(gXmlSecXkmsResultMajorInfo,
+                ctx->resultMajor, BAD_CAST "resultMajor", output);
+    xmlSecQName2IntegerDebugDump(gXmlSecXkmsMinorErrorInfo,
+                ctx->resultMinor, BAD_CAST "resultMinor", output);
 
-    fprintf(output, "== id: %s\n", 
+    fprintf(output, "== id: %s\n",
                 (ctx->id) ? ctx->id : BAD_CAST "");
-    fprintf(output, "== service: %s\n", 
+    fprintf(output, "== service: %s\n",
                 (ctx->service) ? ctx->service : BAD_CAST "");
-    fprintf(output, "== nonce: %s\n", 
+    fprintf(output, "== nonce: %s\n",
                 (ctx->nonce) ? ctx->nonce : BAD_CAST "");
-    fprintf(output, "== originalRequestId: %s\n", 
+    fprintf(output, "== originalRequestId: %s\n",
                 (ctx->originalRequestId) ? ctx->originalRequestId : BAD_CAST "");
-    fprintf(output, "== pendingNotificationMechanism: %s\n", 
-                (ctx->pendingNotificationMechanism) ? 
-                    ctx->pendingNotificationMechanism : 
+    fprintf(output, "== pendingNotificationMechanism: %s\n",
+                (ctx->pendingNotificationMechanism) ?
+                    ctx->pendingNotificationMechanism :
                     BAD_CAST "");
-    fprintf(output, "== pendingNotificationIdentifier: %s\n", 
-                (ctx->pendingNotificationIdentifier) ? 
-                    ctx->pendingNotificationIdentifier : 
+    fprintf(output, "== pendingNotificationIdentifier: %s\n",
+                (ctx->pendingNotificationIdentifier) ?
+                    ctx->pendingNotificationIdentifier :
                     BAD_CAST "");
     if(ctx->responseLimit != XMLSEC_XKMS_NO_RESPONSE_LIMIT) {
         fprintf(output, "== ResponseLimit: %d\n", ctx->responseLimit);
     }
-    xmlSecQName2BitMaskDebugDump(gXmlSecXkmsResponseMechanismInfo, 
-                ctx->responseMechanismMask, BAD_CAST "responseMechanism", output);    
+    xmlSecQName2BitMaskDebugDump(gXmlSecXkmsResponseMechanismInfo,
+                ctx->responseMechanismMask, BAD_CAST "responseMechanism", output);
 
-    if(ctx->expectedService != NULL) {    
+    if(ctx->expectedService != NULL) {
         fprintf(output, "== expected service: %s\n", ctx->expectedService);
     }
     fprintf(output, "== flags: 0x%08x\n", ctx->flags);
@@ -1377,7 +1377,7 @@ xmlSecXkmsServerCtxDebugDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
 
     fprintf(output, "== Key Info Read Ctx:\n");
     xmlSecKeyInfoCtxDebugDump(&(ctx->keyInfoReadCtx), output);
-    
+
     fprintf(output, "== Key Info Write Ctx:\n");
     xmlSecKeyInfoCtxDebugDump(&(ctx->keyInfoWriteCtx), output);
 
@@ -1400,7 +1400,7 @@ xmlSecXkmsServerCtxDebugDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
 
     fprintf(output, "== Keys:\n");
     xmlSecPtrListDebugDump(&(ctx->keys), output);
-    
+
     if(ctx->compoundRequestContexts != NULL) {
         fprintf(output, "== Compound Request:\n");
         xmlSecPtrListDebugDump(ctx->compoundRequestContexts, output);
@@ -1414,23 +1414,23 @@ xmlSecXkmsServerCtxDebugDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
  *
  * Prints the debug information about @ctx to @output in XML format.
  */
-void 
+void
 xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
     xmlSecAssert(ctx != NULL);
     xmlSecAssert(output != NULL);
 
     fprintf(output, "<XkmsServerRequestContext name=\"");
-    xmlSecPrintXmlString(output, 
+    xmlSecPrintXmlString(output,
             (ctx->requestId != xmlSecXkmsServerRequestIdUnknown) ?
                 xmlSecXkmsServerRequestKlassGetName(ctx->requestId) :
                 BAD_CAST "NULL"
     );
     fprintf(output, "\">\n");
 
-    xmlSecQName2IntegerDebugXmlDump(gXmlSecXkmsResultMajorInfo, 
-                ctx->resultMajor, BAD_CAST "MajorError", output);    
-    xmlSecQName2IntegerDebugXmlDump(gXmlSecXkmsMinorErrorInfo, 
-                ctx->resultMinor, BAD_CAST "MinorError", output);    
+    xmlSecQName2IntegerDebugXmlDump(gXmlSecXkmsResultMajorInfo,
+                ctx->resultMajor, BAD_CAST "MajorError", output);
+    xmlSecQName2IntegerDebugXmlDump(gXmlSecXkmsMinorErrorInfo,
+                ctx->resultMinor, BAD_CAST "MinorError", output);
 
     fprintf(output, "<Id>");
     xmlSecPrintXmlString(output, ctx->id);
@@ -1447,7 +1447,7 @@ xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
     fprintf(output, "<OriginalRequestId>");
     xmlSecPrintXmlString(output, ctx->originalRequestId);
     fprintf(output, "</OriginalRequestId>\n");
-    
+
     fprintf(output, "<PendingNotificationMechanism>");
     xmlSecPrintXmlString(output, ctx->pendingNotificationMechanism);
     fprintf(output, "</PendingNotificationMechanism>\n");
@@ -1459,14 +1459,14 @@ xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
     if(ctx->responseLimit != XMLSEC_XKMS_NO_RESPONSE_LIMIT) {
         fprintf(output, "<ResponseLimit>%d</ResponseLimit>\n", ctx->responseLimit);
     }
-    xmlSecQName2BitMaskDebugXmlDump(gXmlSecXkmsResponseMechanismInfo, 
-                ctx->responseMechanismMask, BAD_CAST "ResponseMechanism", output);    
+    xmlSecQName2BitMaskDebugXmlDump(gXmlSecXkmsResponseMechanismInfo,
+                ctx->responseMechanismMask, BAD_CAST "ResponseMechanism", output);
 
 
     fprintf(output, "<ExpectedService>");
     xmlSecPrintXmlString(output, ctx->expectedService);
     fprintf(output, "</ExpectedService>\n");
-    
+
     fprintf(output, "<Flags>%08x</Flags>\n", ctx->flags);
     fprintf(output, "<Flags2>%08x</Flags2>\n", ctx->flags2);
 
@@ -1519,7 +1519,7 @@ xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
  *      (<xkms:OpaqueClientData>
  *          <xkms:OpaqueData>?
  *      )?
- *  
+ *
  *  <xkms:RequestAbstractType Id Service Nonce? OriginalRequestId? ResponseLimit?>
  *      <ds:Signature>?
  *      <xkms:MessageExtension>*
@@ -1537,13 +1537,13 @@ xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
  *      <complexContent>
  *         <extension base="xkms:MessageAbstractType">
  *            <sequence>
- *              <element ref="xkms:ResponseMechanism" minOccurs="0" 
+ *              <element ref="xkms:ResponseMechanism" minOccurs="0"
  *                     maxOccurs="unbounded"/>
- *               <element ref="xkms:RespondWith" minOccurs="0" 
+ *               <element ref="xkms:RespondWith" minOccurs="0"
  *                     maxOccurs="unbounded"/>
  *               <element ref="xkms:PendingNotification" minOccurs="0"/>
  *            </sequence>
- *            <attribute name="OriginalRequestId" type="anyURI" 
+ *            <attribute name="OriginalRequestId" type="anyURI"
  *                  use="optional"/>
  *            <attribute name="ResponseLimit" type="integer" use="optional"/>
  *         </extension>
@@ -1555,7 +1555,7 @@ xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
  *   <complexType name="MessageAbstractType" abstract="true">
  *      <sequence>
  *         <element ref="ds:Signature" minOccurs="0"/>
- *         <element ref="xkms:MessageExtension" minOccurs="0" 
+ *         <element ref="xkms:MessageExtension" minOccurs="0"
  *               maxOccurs="unbounded"/>
  *         <element ref="xkms:OpaqueClientData" minOccurs="0"/>
  *      </sequence>
@@ -1565,7 +1565,7 @@ xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
  *   </complexType>
  *   <!-- /MessageAbstractType -->
  */
-static int 
+static int
 xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* node) {
     xmlNodePtr cur;
     xmlChar* tmp;
@@ -1574,7 +1574,7 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2((*node) != NULL, -1);
-    
+
     cur = (*node);
     xmlSecAssert2(cur != NULL, -1);
 
@@ -1591,7 +1591,7 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
                     xmlSecErrorsSafeString(cur->name));
         return(-1);
     }
-    
+
     /* required Service attribute */
     xmlSecAssert2(ctx->service == NULL, -1);
     ctx->service = xmlGetProp(cur, xmlSecAttrService);
@@ -1605,7 +1605,7 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
                     xmlSecErrorsSafeString(cur->name));
         return(-1);
     }
-    
+
     /* check service */
     if((ctx->expectedService != NULL) && (!xmlStrEqual(ctx->expectedService, ctx->service))) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1634,9 +1634,9 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
         xmlFree(tmp);
     }
 
-    /* now read children */   
+    /* now read children */
     cur = xmlSecGetNextElementNode(cur->children);
-    
+
     /* first node is optional <dsig:Signature/> node */
     if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeSignature, xmlSecDSigNs)) {
         ret = xmlSecXkmsServerCtxSignatureNodeRead(ctx, cur);
@@ -1650,7 +1650,7 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
         }
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     /* next is zero or more <xkms:MessageExtension/> nodes */
     ret = xmlSecXkmsServerCtxMessageExtensionNodesRead(ctx, &cur);
     if(ret < 0) {
@@ -1661,7 +1661,7 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     /* next is optional <xkms:OpaqueClientData/> node */
     if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeOpaqueClientData, xmlSecXkmsNs)) {
         ret = xmlSecXkmsServerCtxOpaqueClientDataNodeRead(ctx, cur);
@@ -1677,9 +1677,9 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
     }
 
     /* next is zero or more <xkms:ResponseMechanism/> nodes */
-    ret = xmlSecQName2BitMaskNodesRead(gXmlSecXkmsResponseMechanismInfo, &cur, 
+    ret = xmlSecQName2BitMaskNodesRead(gXmlSecXkmsResponseMechanismInfo, &cur,
                         xmlSecNodeResponseMechanism, xmlSecXkmsNs,
-                        ((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM) != 0) ? 1 : 0, 
+                        ((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM) != 0) ? 1 : 0,
                         &ctx->responseMechanismMask);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1690,7 +1690,7 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
                     xmlSecErrorsSafeString(xmlSecNodeResponseMechanism));
         return(-1);
     }
-    
+
     /* next is zero or more <xkms:RespondWith/> nodes */
     ret = xmlSecXkmsServerCtxRespondWithNodesRead(ctx, &cur);
     if(ret < 0) {
@@ -1704,7 +1704,7 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
 
     /* next is optional <xkms:PendingNotification/> node */
     if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodePendingNotification, xmlSecXkmsNs)) {
-        ret = xmlSecXkmsServerCtxPendingNotificationNodeRead(ctx, cur);    
+        ret = xmlSecXkmsServerCtxPendingNotificationNodeRead(ctx, cur);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -1716,20 +1716,20 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
         cur = xmlSecGetNextElementNode(cur->next);
     }
 
-    (*node) = cur;    
+    (*node) = cur;
     return(0);
 }
 
-static int 
+static int
 xmlSecXkmsServerCtxSignatureNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     /* todo: verify signature and make sure that correct data was signed */
     return(0);
 }
 
-/** 
+/**
  *   <!-- MessageExtension -->
  *   <element name="MessageExtension" type="xkms:MessageExtensionAbstractType"
  *         abstract="true"/>
@@ -1752,11 +1752,11 @@ xmlSecXkmsServerCtxMessageExtensionNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNode
         cur = xmlSecGetNextElementNode(cur->next);
     }
 
-    (*node) = cur;    
+    (*node) = cur;
     return(0);
 }
 
-static int 
+static int
 xmlSecXkmsServerCtxOpaqueClientDataNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->opaqueClientDataNode == NULL, -1);
@@ -1782,10 +1782,10 @@ xmlSecXkmsServerCtxRespondWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr*
         if(xmlSecPtrListGetSize(&(ctx->enabledRespondWithIds)) > 0) {
             id = xmlSecXkmsRespondWithIdListFindByNodeValue(&(ctx->enabledRespondWithIds), cur);
         } else {
-            id = xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecXkmsRespondWithIdsGet(), cur);        
+            id = xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecXkmsRespondWithIdsGet(), cur);
         }
 
-        if(id != xmlSecXkmsRespondWithIdUnknown) {      
+        if(id != xmlSecXkmsRespondWithIdUnknown) {
             ret = xmlSecXkmsRespondWithNodeRead(id, ctx, cur);
             if(ret < 0) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1797,7 +1797,7 @@ xmlSecXkmsServerCtxRespondWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr*
             }
         } else if((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH) != 0) {
             xmlChar* content ;
-            
+
             content = xmlNodeGetContent(cur);
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -1813,12 +1813,12 @@ xmlSecXkmsServerCtxRespondWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr*
         }
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
-    (*node) = cur;    
+
+    (*node) = cur;
     return(0);
 }
 
-/** 
+/**
  * XML Schema:
  *   <!-- PendingNotification -->
  *   <element name="PendingNotification" type="xkms:PendingNotificationType"/>
@@ -1828,7 +1828,7 @@ xmlSecXkmsServerCtxRespondWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr*
  *   </complexType>
  *   <!-- /PendingNotification -->
  */
-static int 
+static int
 xmlSecXkmsServerCtxPendingNotificationNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -1858,7 +1858,7 @@ xmlSecXkmsServerCtxPendingNotificationNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
                     xmlSecErrorsSafeString(node->name));
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1872,11 +1872,11 @@ xmlSecXkmsServerCtxPendingNotificationNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
  *      <xkms:ResponseMechanism>*
  *      <xkms:RespondWith>*
  *      <xkms:PendingNotification Mechanism Identifier>?
- *  
+ *
  * XML Schema:
  *
- *   <!-- PendingRequest -->  
- *   <element name="PendingRequest" type="xkms:PendingRequestType"/>   
+ *   <!-- PendingRequest -->
+ *   <element name="PendingRequest" type="xkms:PendingRequestType"/>
  *   <complexType name="PendingRequestType">
  *       <complexContent>
  *           <extension base="xkms:RequestAbstractType">
@@ -1884,15 +1884,15 @@ xmlSecXkmsServerCtxPendingNotificationNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
  *            </extension>
  *       </complexContent>
  *    </complexType>
- *    <!-- /PendingRequest --> * 
+ *    <!-- /PendingRequest --> *
  */
-static int 
+static int
 xmlSecXkmsServerCtxPendingRequestNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* node) {
     int ret;
 
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     /* first read "parent" type */
     ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, node);
     if(ret < 0) {
@@ -1914,9 +1914,9 @@ xmlSecXkmsServerCtxPendingRequestNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
  *      <xkms:KeyUsage>?
  *      <xkms:KeyUsage>?
  *      <xkms:KeyUsage>?
- *      <xkms:UseKeyWith Application Identifier>*    
+ *      <xkms:UseKeyWith Application Identifier>*
  *      <xkms:TimeInstant Time>?
- *  
+ *
  * XML Schema:
  *   <!-- QueryKeyBinding -->
  *   <element name="QueryKeyBinding" type="xkms:QueryKeyBindingType"/>
@@ -1931,14 +1931,14 @@ xmlSecXkmsServerCtxPendingRequestNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
  *   </complexType>
  *   <!-- /QueryKeyBinding -->
  */
-static int 
+static int
 xmlSecXkmsServerCtxQueryKeyBindingNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     /* first read "parent" type */
     cur = node;
     ret = xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(ctx, &cur);
@@ -1974,7 +1974,7 @@ xmlSecXkmsServerCtxQueryKeyBindingNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePt
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
@@ -1992,38 +1992,38 @@ xmlSecXkmsServerCtxQueryKeyBindingNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePt
  *       <sequence>
  *          <element ref="ds:KeyInfo" minOccurs="0"/>
  *          <element ref="xkms:KeyUsage" minOccurs="0" maxOccurs="3"/>
- *          <element ref="xkms:UseKeyWith" minOccurs="0" 
+ *          <element ref="xkms:UseKeyWith" minOccurs="0"
  *                   maxOccurs="unbounded"/>
  *       </sequence>
  *       <attribute name="Id" type="ID" use="optional"/>
  *    </complexType>
  *    <!-- /KeyBindingAbstractType-->
  */
-static int 
+static int
 xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* node) {
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2((*node) != NULL, -1);
-    
+
     cur = (*node);
     xmlSecAssert2(cur != NULL, -1);
-    
+
     /* we don't care about Id attribute in this node */
     cur = xmlSecGetNextElementNode(cur->children);
-    
+
     /* first node is optional <dsig:KeyInfo/> node. for now we only remember pointer */
     xmlSecAssert2(ctx->keyInfoNode == NULL, -1);
     if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {
         ctx->keyInfoNode = cur;
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     /* next is zero or more <xkms:KeyUsage/> nodes */
     ret = xmlSecQName2BitMaskNodesRead(gXmlSecXkmsKeyUsageInfo, &cur,
-                    xmlSecNodeKeyUsage, xmlSecXkmsNs, 
+                    xmlSecNodeKeyUsage, xmlSecXkmsNs,
                     ((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE) != 0) ? 1 : 0,
                     &(ctx->keyInfoReadCtx.keyReq.keyUsage));
     if(ret < 0) {
@@ -2035,7 +2035,7 @@ xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xm
                     xmlSecErrorsSafeString(xmlSecNodeKeyUsage));
         return(-1);
     }
-    
+
     /* next is zero or more <xkms:UseKeyWith/> nodes */
     ret = xmlSecXkmsServerCtxUseKeyWithNodesRead(ctx, &cur);
     if(ret < 0) {
@@ -2051,7 +2051,7 @@ xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xm
     return(0);
 }
 
-static int 
+static int
 xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) {
     xmlNodePtr cur;
     int ret;
@@ -2068,7 +2068,7 @@ xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, x
                     "xmlSecGenerateAndAddID",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     /* <dsig:KeyInfo/> node */
@@ -2080,7 +2080,7 @@ xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, x
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
-        return(-1);     
+        return(-1);
     }
 
     ret = xmlSecXkmsServerCtxKeyInfoNodeWrite(ctx, cur, key);
@@ -2090,12 +2090,12 @@ xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, x
                     "xmlSecXkmsServerCtxKeyInfoNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     /* next is <xkms:KeyUsage/> node */
     ret = xmlSecQName2BitMaskNodesWrite(gXmlSecXkmsKeyUsageInfo, node,
-                    xmlSecNodeKeyUsage, xmlSecXkmsNs, 
+                    xmlSecNodeKeyUsage, xmlSecXkmsNs,
                     key->usage);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2117,11 +2117,11 @@ xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, x
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecXkmsServerCtxKeyInfoNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) {
     int ret;
 
@@ -2137,7 +2137,7 @@ xmlSecXkmsServerCtxKeyInfoNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,
                     "xmlSecXkmsRespondWithIdListWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     ret = xmlSecKeyInfoNodeWrite(node, key, &(ctx->keyInfoWriteCtx));
@@ -2147,7 +2147,7 @@ xmlSecXkmsServerCtxKeyInfoNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,
                     "xmlSecKeyInfoNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     return(0);
@@ -2172,7 +2172,7 @@ xmlSecXkmsServerCtxUseKeyWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* n
     xmlChar* application;
     xmlChar* identifier;
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
@@ -2205,7 +2205,7 @@ xmlSecXkmsServerCtxUseKeyWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* n
             xmlFree(application);
             return(-1);
         }
-        
+
         keyUseWith = xmlSecKeyUseWithCreate(application, identifier);
         if(keyUseWith == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2219,7 +2219,7 @@ xmlSecXkmsServerCtxUseKeyWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* n
         }
         xmlFree(application);
         xmlFree(identifier);
-        
+
         ret = xmlSecPtrListAdd(list, keyUseWith);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2230,15 +2230,15 @@ xmlSecXkmsServerCtxUseKeyWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* n
             xmlSecKeyUseWithDestroy(keyUseWith);
             return(-1);
         }
-        
+
         cur = xmlSecGetNextElementNode(cur->next);
     }
 
-    (*node) = cur;    
+    (*node) = cur;
     return(0);
 }
 
-static int 
+static int
 xmlSecXkmsServerCtxUseKeyWithNodesWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) {
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -2249,7 +2249,7 @@ xmlSecXkmsServerCtxUseKeyWithNodesWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr n
 }
 
 
-static int 
+static int
 xmlSecXkmsServerCtxTimeInstantNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -2284,10 +2284,10 @@ xmlSecXkmsServerCtxTimeInstantNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
  *    </complexType>
  *    <!-- /ResultType -->
  */
-static int 
+static int
 xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     int ret;
-    
+
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
@@ -2299,12 +2299,12 @@ xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
                     "xmlSecGenerateAndAddID",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     /* todo: generate nonce? */
 
-    /* set Service atribute (required) */   
+    /* set Service atribute (required) */
     if((ctx->service == NULL) || (xmlSetProp(node, xmlSecAttrService, ctx->service) == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -2313,11 +2313,11 @@ xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
                     "name=%s,value=%s",
                     xmlSecErrorsSafeString(xmlSecAttrService),
                     xmlSecErrorsSafeString(ctx->service));
-        return(-1);     
+        return(-1);
     }
-    
 
-    /* set RequestId atribute (optional) */   
+
+    /* set RequestId atribute (optional) */
     if((ctx->id != NULL) && (xmlSetProp(node, xmlSecAttrRequestId, ctx->id) == NULL)) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -2326,11 +2326,11 @@ xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
                     "name=%s,value=%s",
                     xmlSecErrorsSafeString(xmlSecAttrRequestId),
                     xmlSecErrorsSafeString(ctx->id));
-        return(-1);     
+        return(-1);
     }
-    
-    
-    /* set major code (required) */ 
+
+
+    /* set major code (required) */
     ret = xmlSecQName2IntegerAttributeWrite(gXmlSecXkmsResultMajorInfo, node,
                                              xmlSecAttrResultMajor, ctx->resultMajor);
     if(ret < 0) {
@@ -2341,10 +2341,10 @@ xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
                     "name=%s,value=%d",
                     xmlSecErrorsSafeString(xmlSecAttrResultMajor),
                     ctx->resultMajor);
-        return(-1);     
+        return(-1);
     }
 
-    /* set minor code (optional) */ 
+    /* set minor code (optional) */
     if(ctx->resultMinor != xmlSecXkmsResultMinorNone) {
         ret = xmlSecQName2IntegerAttributeWrite(gXmlSecXkmsMinorErrorInfo, node,
                                              xmlSecAttrResultMinor, ctx->resultMinor);
@@ -2356,16 +2356,16 @@ xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
                         "name=%s,value=%d",
                         xmlSecErrorsSafeString(xmlSecAttrResultMinor),
                         ctx->resultMinor);
-            return(-1); 
+            return(-1);
         }
     }
 
     /* todo: create signature template */
-    
+
     /* todo: create message extension nodes? */
 
-    /* <xkms:OpaqueClientData/>: An XKMS service SHOULD return the value of 
-     * the <OpaqueClientData> element unmodified in a request in a response 
+    /* <xkms:OpaqueClientData/>: An XKMS service SHOULD return the value of
+     * the <OpaqueClientData> element unmodified in a request in a response
      * with status code Succes */
     if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) && (ctx->opaqueClientDataNode != NULL)) {
         xmlNodePtr copyNode;
@@ -2379,8 +2379,8 @@ xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
                         "name=%s",
                         xmlSecErrorsSafeString(ctx->opaqueClientDataNode->name));
             return(-1);
-        }       
-        
+        }
+
         if(xmlSecAddChildNode(node, copyNode) == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -2399,50 +2399,50 @@ xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
                     "xmlSecXkmsServerCtxRequestSignatureValueNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     return(0);
 }
 
-/** 
- * A service SHOULD include the <RequestSignatureValue> element in a response 
- * if the following conditions are satisfied and MUST NOT include the value 
+/**
+ * A service SHOULD include the <RequestSignatureValue> element in a response
+ * if the following conditions are satisfied and MUST NOT include the value
  * otherwise:
  *
  *
  *  - The <ds:Signature> element was present in the corresponding request
- *  - The service successfully verified the <ds:Signature> element in the 
+ *  - The service successfully verified the <ds:Signature> element in the
  *  corresponding request, and
  *  - The ResponseMechanism RequestSignatureValue was specified.
- *    
+ *
  */
-static int 
+static int
 xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     /* todo: check all conditions for RequestSignatureValue */
     if((ctx->responseMechanismMask & XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE) == 0) {
         /* The ResponseMechanism RequestSignatureValue was not specified. */
         return(0);
     }
-    
+
     /* todo: write RequestSignatureValue */
     return(0);
 }
 
 
-/** 
- *  
+/**
+ *
  *  <xkms:UnverifiedKeyBindingType Id?>
  *      <ds:KeyInfo>?
  *      <xkms:KeyUsage>?
  *      <xkms:KeyUsage>?
  *      <xkms:KeyUsage>?
- *      <xkms:UseKeyWith Application Identifier>*    
+ *      <xkms:UseKeyWith Application Identifier>*
  *      <xkms:ValidityInterval NotBefore NotOnOrAfter>?
- *  
+ *
  * XML Schema:
  *
  *    <!-- UnverifiedKeyBinding -->
@@ -2458,7 +2458,7 @@ xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(xmlSecXkmsServerCtxPtr ctx, xm
  *    </complexType>
  *    <!-- /UnverifiedKeyBinding -->
  */
-static int 
+static int
 xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) {
     int ret;
 
@@ -2467,47 +2467,47 @@ xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, xml
     xmlSecAssert2(node != NULL, -1);
 
     /* first write "parent" type */
-    ret = xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(ctx, node, key);    
+    ret = xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(ctx, node, key);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     /* <xkms:ValidityInterval/> node */
-    ret = xmlSecXkmsServerCtxValidityIntervalNodeWrite(ctx, node, key);    
+    ret = xmlSecXkmsServerCtxValidityIntervalNodeWrite(ctx, node, key);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecXkmsServerCtxValidityIntervalNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecXkmsServerCtxValidityIntervalNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) {
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(key != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     /* todo: write key validity interval */
     return(0);
 }
 
-/** 
+/**
  *  <xkms:KeyBinding Id?>
  *      <ds:KeyInfo>?
  *      <xkms:KeyUsage>?
  *      <xkms:KeyUsage>?
  *      <xkms:KeyUsage>?
- *      <xkms:UseKeyWith Application Identifier>*    
+ *      <xkms:UseKeyWith Application Identifier>*
  *      <xkms:ValidityInterval NotBefore NotOnOrAfter>?
  *      <xkms:Status StatusValue>
  *          (<xkms:ValidReason>?
@@ -2516,13 +2516,13 @@ xmlSecXkmsServerCtxValidityIntervalNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNode
  *           )*
  *
  * XML Schema:
- * 
- *    <!-- KeyBinding -->   
- *    <element name="KeyBinding" type="xkms:KeyBindingType"/>   
- *    <complexType name="KeyBindingType">      
- *        <complexContent>         
- *            <extension base="xkms:UnverifiedKeyBindingType">            
- *                <sequence>               
+ *
+ *    <!-- KeyBinding -->
+ *    <element name="KeyBinding" type="xkms:KeyBindingType"/>
+ *    <complexType name="KeyBindingType">
+ *        <complexContent>
+ *            <extension base="xkms:UnverifiedKeyBindingType">
+ *                <sequence>
  *                    <element ref="xkms:Status"/>
  *                </sequence>
  *            </extension>
@@ -2530,7 +2530,7 @@ xmlSecXkmsServerCtxValidityIntervalNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNode
  *    </complexType>
  *    <!-- /KeyBinding -->
  */
-static int 
+static int
 xmlSecXkmsServerCtxKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) {
     int ret;
 
@@ -2539,25 +2539,25 @@ xmlSecXkmsServerCtxKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
     xmlSecAssert2(node != NULL, -1);
 
     /* first write "parent" type */
-    ret = xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(ctx, node, key);    
+    ret = xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(ctx, node, key);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     /* <xkms:Status/> node */
-    ret = xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(ctx, node, key);    
+    ret = xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(ctx, node, key);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlSecXkmsServerCtxKeyBindingStatusNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     return(0);
@@ -2569,21 +2569,21 @@ xmlSecXkmsServerCtxKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
  *       <xkms:IndeterminateReason>?
  *       <xkms:InvalidReason>?
  *      )*
- * 
+ *
  * XML Schema:
  *
- *    <!-- Status -->   
+ *    <!-- Status -->
  *    <element name="Status" type="xkms:StatusType"/>
  *    <complexType name="StatusType">
  *       <sequence>
- *          <element ref="xkms:ValidReason" minOccurs="0" 
+ *          <element ref="xkms:ValidReason" minOccurs="0"
  *                maxOccurs="unbounded"/>
- *          <element ref="xkms:IndeterminateReason" minOccurs="0" 
+ *          <element ref="xkms:IndeterminateReason" minOccurs="0"
  *                maxOccurs="unbounded"/>
- *          <element ref="xkms:InvalidReason" minOccurs="0" 
+ *          <element ref="xkms:InvalidReason" minOccurs="0"
  *                maxOccurs="unbounded"/>
  *       </sequence>
- *       <attribute name="StatusValue" type="xkms:KeyBindingStatus" 
+ *       <attribute name="StatusValue" type="xkms:KeyBindingStatus"
  *             use="required"/>
  *    </complexType>
  *    <simpleType name="KeyBindingStatus">
@@ -2595,7 +2595,7 @@ xmlSecXkmsServerCtxKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
  *    </simpleType>
  *    <!-- /Status -->
  */
-static int 
+static int
 xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xmlSecKeyPtr key) {
     xmlNodePtr cur;
     int ret;
@@ -2612,11 +2612,11 @@ xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNode
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeStatus));
-        return(-1);     
+        return(-1);
     }
 
     /* if we are here then the key was validated */
-    ret = xmlSecQName2IntegerAttributeWrite(gXmlSecXkmsKeyBindingStatusInfo, cur, 
+    ret = xmlSecQName2IntegerAttributeWrite(gXmlSecXkmsKeyBindingStatusInfo, cur,
                     xmlSecAttrStatusValue, xmlSecXkmsKeyBindingStatusValid);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2625,9 +2625,9 @@ xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNode
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecAttrStatusValue));
-        return(-1);     
+        return(-1);
     }
-    
+
     /* todo: write the reasons */
     return(0);
 }
@@ -2636,7 +2636,7 @@ xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNode
  *
  * xmlSecXkmsServerCtx list
  *
- ************************************************************************/ 
+ ************************************************************************/
 static xmlSecPtrListKlass xmlSecXkmsServerCtxPtrListKlass = {
     BAD_CAST "xkms-server-ctx-list",
     NULL,                                                               /* xmlSecPtrDuplicateItemMethod duplicateItem; */
@@ -2645,7 +2645,7 @@ static xmlSecPtrListKlass xmlSecXkmsServerCtxPtrListKlass = {
     (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerCtxDebugXmlDump,      /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
 };
 
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecXkmsServerCtxPtrListGetKlass(void) {
     return(&xmlSecXkmsServerCtxPtrListKlass);
 }
@@ -2659,11 +2659,11 @@ xmlSecXkmsServerCtxPtrListGetKlass(void) {
 static xmlSecPtrList xmlSecAllXkmsRespondWithIds;
 
 
-/** 
+/**
  * xmlSecXkmsRespondWithIdsGet:
  *
  * Gets global registered RespondWith klasses list.
- * 
+ *
  * Returns: the pointer to list of all registered RespondWith klasses.
  */
 xmlSecPtrListPtr
@@ -2671,18 +2671,18 @@ xmlSecXkmsRespondWithIdsGet(void) {
     return(&xmlSecAllXkmsRespondWithIds);
 }
 
-/** 
+/**
  * xmlSecXkmsRespondWithIdsInit:
  *
- * Initializes the RespondWith klasses. This function is called from the 
+ * Initializes the RespondWith klasses. This function is called from the
  * #xmlSecInit function and the application should not call it directly.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecXkmsRespondWithIdsInit(void) {
     int ret;
-    
+
     ret = xmlSecPtrListInitialize(xmlSecXkmsRespondWithIdsGet(), xmlSecXkmsRespondWithIdListId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2692,7 +2692,7 @@ xmlSecXkmsRespondWithIdsInit(void) {
                     "xmlSecXkmsRespondWithIdListId");
         return(-1);
     }
-    
+
     ret = xmlSecXkmsRespondWithIdsRegisterDefault();
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2702,14 +2702,14 @@ xmlSecXkmsRespondWithIdsInit(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
 /**
  * xmlSecXkmsRespondWithIdsShutdown:
- * 
- * Shuts down the keys data klasses. This function is called from the 
+ *
+ * Shuts down the keys data klasses. This function is called from the
  * #xmlSecShutdown function and the application should not call it directly.
  */
 void
@@ -2717,7 +2717,7 @@ xmlSecXkmsRespondWithIdsShutdown(void) {
     xmlSecPtrListFinalize(xmlSecXkmsRespondWithIdsGet());
 }
 
-/** 
+/**
  * xmlSecXkmsRespondWithIdsRegister:
  * @id:         the RespondWith klass.
  *
@@ -2725,12 +2725,12 @@ xmlSecXkmsRespondWithIdsShutdown(void) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithId id) {
     int ret;
-        
+
     xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1);
-    
+
     ret = xmlSecPtrListAdd(xmlSecXkmsRespondWithIdsGet(), (xmlSecPtr)id);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2741,8 +2741,8 @@ xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithId id) {
                     xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)));
         return(-1);
     }
-    
-    return(0);    
+
+    return(0);
 }
 
 /**
@@ -2753,12 +2753,12 @@ xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithId id) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecXkmsRespondWithIdsRegisterDefault(void) {
     if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithKeyNameId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsRespondWithIdsRegister",     
+                    "xmlSecXkmsRespondWithIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithKeyNameId)));
@@ -2768,7 +2768,7 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
     if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithKeyValueId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsRespondWithIdsRegister",     
+                    "xmlSecXkmsRespondWithIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithKeyValueId)));
@@ -2778,7 +2778,7 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
     if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithPrivateKeyId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsRespondWithIdsRegister",     
+                    "xmlSecXkmsRespondWithIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithPrivateKeyId)));
@@ -2788,7 +2788,7 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
     if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithRetrievalMethodId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsRespondWithIdsRegister",     
+                    "xmlSecXkmsRespondWithIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithRetrievalMethodId)));
@@ -2798,7 +2798,7 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
     if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithX509CertId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsRespondWithIdsRegister",     
+                    "xmlSecXkmsRespondWithIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509CertId)));
@@ -2808,7 +2808,7 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
     if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithX509ChainId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsRespondWithIdsRegister",     
+                    "xmlSecXkmsRespondWithIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509ChainId)));
@@ -2818,7 +2818,7 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
     if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithX509CRLId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsRespondWithIdsRegister",     
+                    "xmlSecXkmsRespondWithIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509CRLId)));
@@ -2830,7 +2830,7 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
     if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithPGPId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsRespondWithIdsRegister",     
+                    "xmlSecXkmsRespondWithIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithPGPId)));
@@ -2840,7 +2840,7 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
     if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithSPKIId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsRespondWithIdsRegister",     
+                    "xmlSecXkmsRespondWithIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithSPKIId)));
@@ -2855,7 +2855,7 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
  *
  * XKMS RespondWith Klass
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * xmlSecXkmsRespondWithNodeRead:
  * @id:         the RespondWith class.
@@ -2866,7 +2866,7 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int  
+int
 xmlSecXkmsRespondWithNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
                               xmlNodePtr node) {
     xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1);
@@ -2889,7 +2889,7 @@ xmlSecXkmsRespondWithNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecXkmsRespondWithNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
                              xmlNodePtr node) {
     xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1);
@@ -2909,12 +2909,12 @@ xmlSecXkmsRespondWithNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPt
  *
  * Writes debug information about @id into the @output.
  */
-void 
+void
 xmlSecXkmsRespondWithDebugDump(xmlSecXkmsRespondWithId id, FILE* output) {
     xmlSecAssert(id != xmlSecXkmsRespondWithIdUnknown);
     xmlSecAssert(output != NULL);
 
-    fprintf(output, "=== RespondWith: \"%s\" (href=\"%s\")\n", 
+    fprintf(output, "=== RespondWith: \"%s\" (href=\"%s\")\n",
         xmlSecErrorsSafeString(id->valueName),
         xmlSecErrorsSafeString(id->valueNs));
 }
@@ -2926,7 +2926,7 @@ xmlSecXkmsRespondWithDebugDump(xmlSecXkmsRespondWithId id, FILE* output) {
  *
  * Writes debug information about @id into the @output in XML format.
  */
-void 
+void
 xmlSecXkmsRespondWithDebugXmlDump(xmlSecXkmsRespondWithId id, FILE* output) {
     xmlSecAssert(id != xmlSecXkmsRespondWithIdUnknown);
     xmlSecAssert(output != NULL);
@@ -2938,7 +2938,7 @@ xmlSecXkmsRespondWithDebugXmlDump(xmlSecXkmsRespondWithId id, FILE* output) {
     fprintf(output, "</RespondWith>\n");
 }
 
-int 
+int
 xmlSecXkmsRespondWithDefaultNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
                             xmlNodePtr node) {
     int ret;
@@ -2954,12 +2954,12 @@ xmlSecXkmsRespondWithDefaultNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServe
                     "xmlSecXkmsRespondWithIdListFind",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     } else if(ret > 0) {
         /* do nothing, we already have it in the list */
         return(0);
-    }    
-    
+    }
+
     ret = xmlSecPtrListAdd(&(ctx->respWithList), id);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -2967,13 +2967,13 @@ xmlSecXkmsRespondWithDefaultNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServe
                     "xmlSecPtrListAdd",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     return(0);
 }
 
-int  
+int
 xmlSecXkmsRespondWithDefaultNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
                             xmlNodePtr node) {
     xmlNodePtr cur;
@@ -2991,7 +2991,7 @@ xmlSecXkmsRespondWithDefaultNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServ
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(id->nodeName));
-        return(-1);     
+        return(-1);
     }
 
     return(0);
@@ -3001,7 +3001,7 @@ xmlSecXkmsRespondWithDefaultNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServ
  *
  * XKMS RespondWith Klass List
  *
- ************************************************************************/ 
+ ************************************************************************/
 static xmlSecPtrListKlass xmlSecXkmsRespondWithIdListKlass = {
     BAD_CAST "respond-with-ids-list",
     NULL,                                                               /* xmlSecPtrDuplicateItemMethod duplicateItem; */
@@ -3010,18 +3010,18 @@ static xmlSecPtrListKlass xmlSecXkmsRespondWithIdListKlass = {
     (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsRespondWithDebugXmlDump,    /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
 };
 
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecXkmsRespondWithIdListGetKlass(void) {
     return(&xmlSecXkmsRespondWithIdListKlass);
 }
 
-int 
+int
 xmlSecXkmsRespondWithIdListFind(xmlSecPtrListPtr list, xmlSecXkmsRespondWithId id) {
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsRespondWithIdListId), -1);
     xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1);
-    
+
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         if((xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i) == id) {
@@ -3031,7 +3031,7 @@ xmlSecXkmsRespondWithIdListFind(xmlSecPtrListPtr list, xmlSecXkmsRespondWithId i
     return(0);
 }
 
-xmlSecXkmsRespondWithId 
+xmlSecXkmsRespondWithId
 xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecPtrListPtr list, xmlNodePtr node) {
     xmlSecXkmsRespondWithId result = xmlSecXkmsRespondWithIdUnknown;
     xmlSecXkmsRespondWithId id;
@@ -3041,7 +3041,7 @@ xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecPtrListPtr list, xmlNodePtr nod
     const xmlChar* qnameHref;
     xmlNsPtr ns;
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsRespondWithIdListId), xmlSecXkmsRespondWithIdUnknown);
     xmlSecAssert2(node != NULL, xmlSecXkmsRespondWithIdUnknown);
 
@@ -3053,7 +3053,7 @@ xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecPtrListPtr list, xmlNodePtr nod
                     XMLSEC_ERRORS_R_XML_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(node->name));
-        return(xmlSecXkmsRespondWithIdUnknown);         
+        return(xmlSecXkmsRespondWithIdUnknown);
     }
 
     qnameLocalPart = (xmlChar*)xmlStrchr(content, ':');
@@ -3064,7 +3064,7 @@ xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecPtrListPtr list, xmlNodePtr nod
         qnamePrefix = NULL;
         qnameLocalPart = content;
     }
-    
+
     /* search namespace href */
     ns = xmlSearchNs(node->doc, node, qnamePrefix);
     if((ns == NULL) && (qnamePrefix != NULL)) {
@@ -3076,26 +3076,26 @@ xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecPtrListPtr list, xmlNodePtr nod
                     xmlSecErrorsSafeString(node->name),
                     xmlSecErrorsSafeString(qnamePrefix));
         xmlFree(content);
-        return(xmlSecXkmsRespondWithIdUnknown); 
+        return(xmlSecXkmsRespondWithIdUnknown);
     }
     qnameHref = (ns != NULL) ? ns->href : BAD_CAST NULL;
 
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         id = (xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i);
-        if((id !=  xmlSecXkmsRespondWithIdUnknown) && 
+        if((id !=  xmlSecXkmsRespondWithIdUnknown) &&
                 xmlStrEqual(id->valueName, qnameLocalPart) &&
                 xmlStrEqual(id->valueNs, qnameHref)) {
             result = id;
             break;
         }
     }
-    
+
     xmlFree(content);
-    return(result);    
+    return(result);
 }
 
-int 
+int
 xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPtr list, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlSecXkmsRespondWithId id;
     xmlSecSize i, size;
@@ -3124,7 +3124,7 @@ xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPtr list, xmlSecXkmsServerCtxPtr c
     return(0);
 }
 
-/******************************************************************** 
+/********************************************************************
  *
  * XML Sec Library RespondWith Ids
  *
@@ -3146,8 +3146,8 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKeyNameKlass = {
  * The respond with KeyName klass.
  *
  * Returns: respond with KeyName klass.
- */ 
-xmlSecXkmsRespondWithId 
+ */
+xmlSecXkmsRespondWithId
 xmlSecXkmsRespondWithKeyNameGetKlass(void) {
     return(&xmlSecXkmsRespondWithKeyNameKlass);
 }
@@ -3174,13 +3174,13 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKeyValueKlass = {
  * The respond with KeyValue klass.
  *
  * Returns: respond with KeyValue klass.
- */ 
-xmlSecXkmsRespondWithId 
+ */
+xmlSecXkmsRespondWithId
 xmlSecXkmsRespondWithKeyValueGetKlass(void) {
     return(&xmlSecXkmsRespondWithKeyValueKlass);
 }
 
-static  int  
+static  int
 xmlSecXkmsRespondWithKeyValueNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
                                       xmlNodePtr node) {
     int ret;
@@ -3197,10 +3197,10 @@ xmlSecXkmsRespondWithKeyValueNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServ
                     "xmlSecXkmsRespondWithDefaultNodeRead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
-    /* and now set some parameters in the ctx to look for a public or private 
+
+    /* and now set some parameters in the ctx to look for a public or private
      * key and to write a public key
      */
     ctx->keyInfoReadCtx.keyReq.keyType  |= (xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate);
@@ -3229,13 +3229,13 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithPrivateKeyKlass = {
  * The respond with PrivateKey klass.
  *
  * Returns: respond with PrivateKey klass.
- */ 
-xmlSecXkmsRespondWithId 
+ */
+xmlSecXkmsRespondWithId
 xmlSecXkmsRespondWithPrivateKeyGetKlass(void) {
     return(&xmlSecXkmsRespondWithPrivateKeyKlass);
 }
 
-static  int  
+static  int
 xmlSecXkmsRespondWithPrivateKeyNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
                                       xmlNodePtr node) {
     int ret;
@@ -3252,10 +3252,10 @@ xmlSecXkmsRespondWithPrivateKeyNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsSe
                     "xmlSecXkmsRespondWithDefaultNodeRead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
-    /* and now set some parameters in the ctx to look for a private 
+
+    /* and now set some parameters in the ctx to look for a private
      * key and to write a private key
      */
     ctx->keyInfoReadCtx.keyReq.keyType  |= xmlSecKeyDataTypePrivate;
@@ -3281,8 +3281,8 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithRetrievalMethodKlass = {
  * The respond with RetrievalMethod klass.
  *
  * Returns: respond with RetrievalMethod klass.
- */ 
-xmlSecXkmsRespondWithId 
+ */
+xmlSecXkmsRespondWithId
 xmlSecXkmsRespondWithRetrievalMethodGetKlass(void) {
     return(&xmlSecXkmsRespondWithRetrievalMethodKlass);
 }
@@ -3309,13 +3309,13 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509CertKlass = {
  * The respond with X509Cert klass.
  *
  * Returns: respond with X509Cert klass.
- */ 
-xmlSecXkmsRespondWithId 
+ */
+xmlSecXkmsRespondWithId
 xmlSecXkmsRespondWithX509CertGetKlass(void) {
     return(&xmlSecXkmsRespondWithX509CertKlass);
 }
 
-static  int  
+static  int
 xmlSecXkmsRespondWithX509CertNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
                                       xmlNodePtr node) {
     int ret;
@@ -3332,9 +3332,9 @@ xmlSecXkmsRespondWithX509CertNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServ
                     "xmlSecXkmsRespondWithDefaultNodeRead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     return(0);
 }
 
@@ -3358,13 +3358,13 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509ChainKlass = {
  * The respond with X509Chain klass.
  *
  * Returns: respond with X509Chain klass.
- */ 
-xmlSecXkmsRespondWithId 
+ */
+xmlSecXkmsRespondWithId
 xmlSecXkmsRespondWithX509ChainGetKlass(void) {
     return(&xmlSecXkmsRespondWithX509ChainKlass);
 }
 
-static  int  
+static  int
 xmlSecXkmsRespondWithX509ChainNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
                                       xmlNodePtr node) {
     int ret;
@@ -3381,9 +3381,9 @@ xmlSecXkmsRespondWithX509ChainNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsSer
                     "xmlSecXkmsRespondWithDefaultNodeRead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     return(0);
 }
 
@@ -3407,13 +3407,13 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509CRLKlass = {
  * The respond with X509CRL klass.
  *
  * Returns: respond with X509CRL klass.
- */ 
-xmlSecXkmsRespondWithId 
+ */
+xmlSecXkmsRespondWithId
 xmlSecXkmsRespondWithX509CRLGetKlass(void) {
     return(&xmlSecXkmsRespondWithX509CRLKlass);
 }
 
-static  int  
+static  int
 xmlSecXkmsRespondWithX509CRLNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
                                       xmlNodePtr node) {
     int ret;
@@ -3430,9 +3430,9 @@ xmlSecXkmsRespondWithX509CRLNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServe
                     "xmlSecXkmsRespondWithDefaultNodeRead",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     return(0);
 }
 
@@ -3453,8 +3453,8 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithPGPKlass = {
  * The respond with PGP klass.
  *
  * Returns: respond with PGP klass.
- */ 
-xmlSecXkmsRespondWithId 
+ */
+xmlSecXkmsRespondWithId
 xmlSecXkmsRespondWithPGPGetKlass(void) {
     return(&xmlSecXkmsRespondWithPGPKlass);
 }
@@ -3476,8 +3476,8 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithSPKIKlass = {
  * The respond with SPKI klass.
  *
  * Returns: respond with SPKI klass.
- */ 
-xmlSecXkmsRespondWithId 
+ */
+xmlSecXkmsRespondWithId
 xmlSecXkmsRespondWithSPKIGetKlass(void) {
     return(&xmlSecXkmsRespondWithSPKIKlass);
 }
@@ -3490,11 +3490,11 @@ xmlSecXkmsRespondWithSPKIGetKlass(void) {
 static xmlSecPtrList xmlSecAllXkmsServerRequestIds;
 
 
-/** 
+/**
  * xmlSecXkmsServerRequestIdsGet:
  *
  * Gets global registered ServerRequest klasses list.
- * 
+ *
  * Returns: the pointer to list of all registered ServerRequest klasses.
  */
 xmlSecPtrListPtr
@@ -3502,18 +3502,18 @@ xmlSecXkmsServerRequestIdsGet(void) {
     return(&xmlSecAllXkmsServerRequestIds);
 }
 
-/** 
+/**
  * xmlSecXkmsServerRequestIdsInit:
  *
- * Initializes the ServerRequest klasses. This function is called from the 
+ * Initializes the ServerRequest klasses. This function is called from the
  * #xmlSecInit function and the application should not call it directly.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecXkmsServerRequestIdsInit(void) {
     int ret;
-    
+
     ret = xmlSecPtrListInitialize(xmlSecXkmsServerRequestIdsGet(), xmlSecXkmsServerRequestIdListId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -3523,7 +3523,7 @@ xmlSecXkmsServerRequestIdsInit(void) {
                     "xmlSecXkmsServerRequestIdListId");
         return(-1);
     }
-    
+
     ret = xmlSecXkmsServerRequestIdsRegisterDefault();
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -3533,14 +3533,14 @@ xmlSecXkmsServerRequestIdsInit(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
 /**
  *  xmlSecXkmsServerRequestIdsShutdown:
- * 
- * Shuts down the keys data klasses. This function is called from the 
+ *
+ * Shuts down the keys data klasses. This function is called from the
  * #xmlSecShutdown function and the application should not call it directly.
  */
 void
@@ -3548,7 +3548,7 @@ xmlSecXkmsServerRequestIdsShutdown(void) {
     xmlSecPtrListFinalize(xmlSecXkmsServerRequestIdsGet());
 }
 
-/** 
+/**
  * xmlSecXkmsServerRequestIdsRegister:
  * @id:         the ServerRequest klass.
  *
@@ -3556,12 +3556,12 @@ xmlSecXkmsServerRequestIdsShutdown(void) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestId id) {
     int ret;
-        
+
     xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, -1);
-    
+
     ret = xmlSecPtrListAdd(xmlSecXkmsServerRequestIdsGet(), (xmlSecPtr)id);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -3572,8 +3572,8 @@ xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestId id) {
                     xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(id)));
         return(-1);
     }
-    
-    return(0);    
+
+    return(0);
 }
 
 /**
@@ -3584,12 +3584,12 @@ xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestId id) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecXkmsServerRequestIdsRegisterDefault(void) {
     if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestResultId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsServerRequestIdsRegister",           
+                    "xmlSecXkmsServerRequestIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestResultId)));
@@ -3599,7 +3599,7 @@ xmlSecXkmsServerRequestIdsRegisterDefault(void) {
     if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestStatusId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsServerRequestIdsRegister",           
+                    "xmlSecXkmsServerRequestIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestStatusId)));
@@ -3609,7 +3609,7 @@ xmlSecXkmsServerRequestIdsRegisterDefault(void) {
     if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestCompoundId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsServerRequestIdsRegister",           
+                    "xmlSecXkmsServerRequestIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestCompoundId)));
@@ -3619,7 +3619,7 @@ xmlSecXkmsServerRequestIdsRegisterDefault(void) {
     if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestLocateId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsServerRequestIdsRegister",           
+                    "xmlSecXkmsServerRequestIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestLocateId)));
@@ -3629,7 +3629,7 @@ xmlSecXkmsServerRequestIdsRegisterDefault(void) {
     if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestValidateId) < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
-                    "xmlSecXkmsServerRequestIdsRegister",           
+                    "xmlSecXkmsServerRequestIdsRegister",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "name=%s",
                     xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestValidateId)));
@@ -3644,7 +3644,7 @@ xmlSecXkmsServerRequestIdsRegisterDefault(void) {
  *
  * XKMS ServerRequest Klass
  *
- ************************************************************************/ 
+ ************************************************************************/
 /**
  * xmlSecXkmsServerRequestNodeRead:
  * @id:         the ServerRequest class.
@@ -3655,7 +3655,7 @@ xmlSecXkmsServerRequestIdsRegisterDefault(void) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int  
+int
 xmlSecXkmsServerRequestNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx,
                               xmlNodePtr node) {
     xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, -1);
@@ -3677,7 +3677,7 @@ xmlSecXkmsServerRequestNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCt
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int  
+int
 xmlSecXkmsServerRequestExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx) {
     xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, -1);
     xmlSecAssert2(ctx != NULL, -1);
@@ -3696,25 +3696,25 @@ xmlSecXkmsServerRequestExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtx
  * @doc:        the pointer to response parent XML document (might be NULL).
  * @node:       the pointer to response parent XML node (might be NULL).
  *
- * Writes XKMS response from context to a newly created node. Caller is 
+ * Writes XKMS response from context to a newly created node. Caller is
  * responsible for adding the returned node to the XML document.
  *
  * Returns: pointer to newly created XKMS response node or NULL
  * if an error occurs.
  */
-xmlNodePtr 
+xmlNodePtr
 xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx,
                                  xmlDocPtr doc, xmlNodePtr node) {
     xmlNodePtr respNode;
     int ret;
-    
+
     xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, NULL);
     xmlSecAssert2(ctx != NULL, NULL);
 
     /* create the response root node */
     if(node == NULL) {
         xmlNsPtr ns;
-        
+
         respNode = xmlNewDocNode(doc, NULL, id->resultNodeName, NULL);
         if(respNode == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -3749,7 +3749,7 @@ xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerC
             return(NULL);
         }
     }
-    
+
     if(id->writeNode != NULL) {
         ret = (id->writeNode)(id, ctx, respNode);
         if(ret < 0) {
@@ -3763,7 +3763,7 @@ xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerC
             return(NULL);
         }
     }
-    
+
     return(respNode);
 }
 
@@ -3774,7 +3774,7 @@ xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerC
  *
  * Writes debug information about @id into the @output.
  */
-void 
+void
 xmlSecXkmsServerRequestDebugDump(xmlSecXkmsServerRequestId id, FILE* output) {
     xmlSecAssert(id != xmlSecXkmsServerRequestIdUnknown);
     xmlSecAssert(output != NULL);
@@ -3789,7 +3789,7 @@ xmlSecXkmsServerRequestDebugDump(xmlSecXkmsServerRequestId id, FILE* output) {
  *
  * Writes debug information about @id into the @output in XML format.
  */
-void 
+void
 xmlSecXkmsServerRequestDebugXmlDump(xmlSecXkmsServerRequestId id, FILE* output) {
     xmlSecAssert(id != xmlSecXkmsServerRequestIdUnknown);
     xmlSecAssert(output != NULL);
@@ -3803,7 +3803,7 @@ xmlSecXkmsServerRequestDebugXmlDump(xmlSecXkmsServerRequestId id, FILE* output)
  *
  * XKMS ServerRequest Klass List
  *
- ************************************************************************/ 
+ ************************************************************************/
 static xmlSecPtrListKlass xmlSecXkmsServerRequestIdListKlass = {
     BAD_CAST "xkms-server-request-ids-list",
     NULL,                                                               /* xmlSecPtrDuplicateItemMethod duplicateItem; */
@@ -3812,18 +3812,18 @@ static xmlSecPtrListKlass xmlSecXkmsServerRequestIdListKlass = {
     (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerRequestDebugXmlDump,  /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
 };
 
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecXkmsServerRequestIdListGetKlass(void) {
     return(&xmlSecXkmsServerRequestIdListKlass);
 }
 
-int 
+int
 xmlSecXkmsServerRequestIdListFind(xmlSecPtrListPtr list, xmlSecXkmsServerRequestId id) {
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsServerRequestIdListId), -1);
     xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, -1);
-    
+
     size = xmlSecPtrListGetSize(list);
     for(i = 0; i < size; ++i) {
         if((xmlSecXkmsServerRequestId)xmlSecPtrListGetItem(list, i) == id) {
@@ -3833,11 +3833,11 @@ xmlSecXkmsServerRequestIdListFind(xmlSecPtrListPtr list, xmlSecXkmsServerRequest
     return(0);
 }
 
-xmlSecXkmsServerRequestId 
+xmlSecXkmsServerRequestId
 xmlSecXkmsServerRequestIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name) {
     xmlSecXkmsServerRequestId id;
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsServerRequestIdListId), xmlSecXkmsServerRequestIdUnknown);
     xmlSecAssert2(name != NULL, xmlSecXkmsServerRequestIdUnknown);
 
@@ -3848,14 +3848,14 @@ xmlSecXkmsServerRequestIdListFindByName(xmlSecPtrListPtr list, const xmlChar* na
             return(id);
         }
     }
-    return(xmlSecXkmsServerRequestIdUnknown);    
+    return(xmlSecXkmsServerRequestIdUnknown);
 }
 
-xmlSecXkmsServerRequestId 
+xmlSecXkmsServerRequestId
 xmlSecXkmsServerRequestIdListFindByNode(xmlSecPtrListPtr list, xmlNodePtr node) {
     xmlSecXkmsServerRequestId id;
     xmlSecSize i, size;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(list, xmlSecXkmsServerRequestIdListId), xmlSecXkmsServerRequestIdUnknown);
     xmlSecAssert2(node != NULL, xmlSecXkmsServerRequestIdUnknown);
 
@@ -3868,17 +3868,17 @@ xmlSecXkmsServerRequestIdListFindByNode(xmlSecPtrListPtr list, xmlNodePtr node)
             return(id);
         }
     }
-    return(xmlSecXkmsServerRequestIdUnknown);    
+    return(xmlSecXkmsServerRequestIdUnknown);
 }
 
-/******************************************************************** 
+/********************************************************************
  *
  * XML Sec Library ServerRequest Ids
  *
  *******************************************************************/
 
 
-/******************************************************************** 
+/********************************************************************
  *
  * Result response
  *
@@ -3907,16 +3907,16 @@ static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestResultKlass = {
  * The Result response klass.
  *
  * Returns: Result response klass.
- */ 
-xmlSecXkmsServerRequestId       
+ */
+xmlSecXkmsServerRequestId
 xmlSecXkmsServerRequestResultGetKlass(void) {
     return(&xmlSecXkmsServerRequestResultKlass);
 }
 
-static int 
+static int
 xmlSecXkmsServerRequestResultNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecXkmsServerRequestResultId, -1);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -3933,7 +3933,7 @@ xmlSecXkmsServerRequestResultNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
             return(-1);
         }
     }
-    
+
     /* first write the "parent" type */
     ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node);
     if(ret < 0) {
@@ -3942,13 +3942,13 @@ xmlSecXkmsServerRequestResultNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
                     "xmlSecXkmsServerCtxResultTypeNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
 
     return(0);
 }
 
-/******************************************************************** 
+/********************************************************************
  *
  * StatusRequest/StatusResponse
  *
@@ -3980,14 +3980,14 @@ static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestStatusKlass = {
  * The StatusRequest klass.
  *
  * Returns: StatusRequest klass.
- */ 
-xmlSecXkmsServerRequestId       
+ */
+xmlSecXkmsServerRequestId
 xmlSecXkmsServerRequestStatusGetKlass(void) {
     return(&xmlSecXkmsServerRequestStatusKlass);
 }
 
 /**
- * 
+ *
  *  <xkms:StatusRequest Id Service Nonce? OriginalRequestId? ResponseLimit? ResponseId?>
  *      <ds:Signature>?
  *      <xkms:MessageExtension>*
@@ -3997,28 +3997,28 @@ xmlSecXkmsServerRequestStatusGetKlass(void) {
  *      <xkms:ResponseMechanism>*
  *      <xkms:RespondWith>*
  *      <xkms:PendingNotification Mechanism Identifier>?
- *  
+ *
  * XML Schema:
- *    <!-- StatusRequest -->   
- *    <element name="StatusRequest" type="xkms:StatusRequestType"/>   
- *    <complexType name="StatusRequestType">      
- *        <complexContent>         
- *            <extension base="xkms:PendingRequestType"/>      
- *        </complexContent>   
- *    </complexType>   
+ *    <!-- StatusRequest -->
+ *    <element name="StatusRequest" type="xkms:StatusRequestType"/>
+ *    <complexType name="StatusRequestType">
+ *        <complexContent>
+ *            <extension base="xkms:PendingRequestType"/>
+ *        </complexContent>
+ *    </complexType>
  *    <!-- /StatusRequest -->
  */
-static int  
+static int
 xmlSecXkmsServerRequestStatusNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecXkmsServerRequestStatusId, -1);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
     cur = node;
-    
+
     /* first read "parent" type */
     ret = xmlSecXkmsServerCtxPendingRequestNodeRead(ctx, &cur);
     if(ret < 0) {
@@ -4044,7 +4044,7 @@ xmlSecXkmsServerRequestStatusNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsSe
 }
 
 /**
- * 
+ *
  *  <xkms:StatusResult Id Service Nonce? ResultMajor ResultMinor? RequestId? Success? Failure? Pending?>
  *      <ds:Signature>?
  *      <xkms:MessageExtension>*
@@ -4054,10 +4054,10 @@ xmlSecXkmsServerRequestStatusNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsSe
  *      <xkms:RequestSignatureValue>*
  *
  * XML Schema:
- * 
- *    <!-- StatusResult -->   
- *    <element name="StatusResult" type="xkms:StatusResultType"/>   
- *    <complexType name="StatusResultType">      
+ *
+ *    <!-- StatusResult -->
+ *    <element name="StatusResult" type="xkms:StatusResultType"/>
+ *    <complexType name="StatusResultType">
  *        <complexContent>
  *            <extension base="xkms:ResultType">
  *                <attribute name="Success" type="integer" use="optional"/>
@@ -4067,8 +4067,8 @@ xmlSecXkmsServerRequestStatusNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsSe
  *        </complexContent>
  *    </complexType>
  *    <!-- /StatusResult --> *
- */ 
-static int 
+ */
+static int
 xmlSecXkmsServerRequestStatusNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     int ret;
 
@@ -4084,14 +4084,14 @@ xmlSecXkmsServerRequestStatusNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
                     "xmlSecXkmsServerCtxResultTypeNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     /* todo: add optional StatusResult attributes */
     return(0);
 }
 
-/******************************************************************** 
+/********************************************************************
  *
  * CompoundRequest/CompoundResponse
  *
@@ -4102,7 +4102,7 @@ static int              xmlSecXkmsServerRequestCompoundNodeRead (xmlSecXkmsServe
 static int              xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id,
                                                                  xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
-static int              xmlSecXkmsServerRequestCompoundExecute  (xmlSecXkmsServerRequestId id, 
+static int              xmlSecXkmsServerRequestCompoundExecute  (xmlSecXkmsServerRequestId id,
                                                                  xmlSecXkmsServerCtxPtr ctx);
 
 static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestCompoundKlass = {
@@ -4125,8 +4125,8 @@ static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestCompoundKlass = {
  * The CompoundRequest klass.
  *
  * Returns: CompoundRequest klass.
- */ 
-xmlSecXkmsServerRequestId       
+ */
+xmlSecXkmsServerRequestId
 xmlSecXkmsServerRequestCompoundGetKlass(void) {
     return(&xmlSecXkmsServerRequestCompoundKlass);
 }
@@ -4149,39 +4149,39 @@ xmlSecXkmsServerRequestCompoundGetKlass(void) {
  *       <xkms:RecoverRequest>?
  *       <xkms:RevokeRequest>?
  *      )*
- *       
+ *
  * XML Schema:
  *
- *    <!-- CompoundRequest -->   
- *    <element name="CompoundRequest" type="xkms:CompoundRequestType"/>   
- *    <complexType name="CompoundRequestType">      
- *        <complexContent>         
- *            <extension base="xkms:RequestAbstractType">            
- *                <choice maxOccurs="unbounded">               
- *                    <element ref="xkms:LocateRequest"/>               
- *                    <element ref="xkms:ValidateRequest"/>               
- *                    <element ref="xkms:RegisterRequest"/>               
- *                    <element ref="xkms:ReissueRequest"/>               
- *                    <element ref="xkms:RecoverRequest"/>               
- *                    <element ref="xkms:RevokeRequest"/>            
- *                </choice>         
- *            </extension>      
- *        </complexContent>   
- *    </complexType>   
+ *    <!-- CompoundRequest -->
+ *    <element name="CompoundRequest" type="xkms:CompoundRequestType"/>
+ *    <complexType name="CompoundRequestType">
+ *        <complexContent>
+ *            <extension base="xkms:RequestAbstractType">
+ *                <choice maxOccurs="unbounded">
+ *                    <element ref="xkms:LocateRequest"/>
+ *                    <element ref="xkms:ValidateRequest"/>
+ *                    <element ref="xkms:RegisterRequest"/>
+ *                    <element ref="xkms:ReissueRequest"/>
+ *                    <element ref="xkms:RecoverRequest"/>
+ *                    <element ref="xkms:RevokeRequest"/>
+ *                </choice>
+ *            </extension>
+ *        </complexContent>
+ *    </complexType>
  *    <!-- /CompoundRequest -->
  */
-static int  
+static int
 xmlSecXkmsServerRequestCompoundNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlSecPtrListPtr serverRequestIdsList;
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecXkmsServerRequestCompoundId, -1);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
     cur = node;
-    
+
     /* first read "parent" type */
     ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, &cur);
     if(ret < 0) {
@@ -4211,11 +4211,11 @@ xmlSecXkmsServerRequestCompoundNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
     } else {
         serverRequestIdsList = xmlSecXkmsServerRequestIdsGet();
     }
-    xmlSecAssert2(serverRequestIdsList != NULL, -1); 
-    
+    xmlSecAssert2(serverRequestIdsList != NULL, -1);
+
     while(cur != NULL) {
-        xmlSecXkmsServerCtxPtr ctxChild;    
-        
+        xmlSecXkmsServerCtxPtr ctxChild;
+
         /* create a new context */
         ctxChild = xmlSecXkmsServerCtxCreate(ctx->keyInfoReadCtx.keysMngr);
         if(ctxChild == NULL) {
@@ -4253,7 +4253,7 @@ xmlSecXkmsServerRequestCompoundNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
 
         /* and now process request from current node */
         ctxChild->requestId = xmlSecXkmsServerRequestIdListFindByNode(serverRequestIdsList, cur);
-        if((ctxChild->requestId == xmlSecXkmsServerRequestIdUnknown) || 
+        if((ctxChild->requestId == xmlSecXkmsServerRequestIdUnknown) ||
            ((ctxChild->requestId->flags & XMLSEC_XKMS_SERVER_REQUEST_KLASS_ALLOWED_IN_COUMPOUND) == 0)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -4309,15 +4309,15 @@ xmlSecXkmsServerRequestCompoundNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
  *       <xkms:RevokeResult>?
  *      )*
  *
- * 
+ *
  * XML Schema:
  *
- *    <!-- CompoundResponse -->   
- *    <element name="CompoundResult" type="xkms:CompoundResultType"/>   
- *    <complexType name="CompoundResultType">      
- *        <complexContent>         
- *            <extension base="xkms:ResultType">            
- *                <choice maxOccurs="unbounded">               
+ *    <!-- CompoundResponse -->
+ *    <element name="CompoundResult" type="xkms:CompoundResultType"/>
+ *    <complexType name="CompoundResultType">
+ *        <complexContent>
+ *            <extension base="xkms:ResultType">
+ *                <choice maxOccurs="unbounded">
  *                    <element ref="xkms:LocateResult"/>
  *                    <element ref="xkms:ValidateResult"/>
  *                    <element ref="xkms:RegisterResult"/>
@@ -4329,8 +4329,8 @@ xmlSecXkmsServerRequestCompoundNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
  *        </complexContent>
  *   </complexType>
  *   <!-- /CompoundResponse -->
- */ 
-static int 
+ */
+static int
 xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     int ret;
 
@@ -4352,16 +4352,16 @@ xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
                             "xmlSecPtrListGetItem",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
-                return(-1);     
+                return(-1);
             }
-            
+
             if(ctxChild->resultMajor != xmlSecXkmsResultMajorSuccess) {
                 xmlSecXkmsServerCtxSetResult(ctx, ctxChild->resultMajor, ctxChild->resultMinor);
                 break;
             }
         }
     }
-    
+
     /* first write the "parent" type */
     ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node);
     if(ret < 0) {
@@ -4370,9 +4370,9 @@ xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
                     "xmlSecXkmsServerCtxResultTypeNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     /* write compound result */
     if(ctx->compoundRequestContexts != NULL) {
         xmlSecSize pos;
@@ -4388,9 +4388,9 @@ xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
                             "xmlSecPtrListGetItem",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
-                return(-1);     
+                return(-1);
             }
-            
+
             cur = xmlSecXkmsServerRequestNodeWrite(ctxChild->requestId, ctxChild, node->doc, node);
             if(cur == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -4401,7 +4401,7 @@ xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
                             xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId)));
                 return(-1);
             }
-            
+
             if(xmlSecAddChildNode(node, cur) == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
                             NULL,
@@ -4417,10 +4417,10 @@ xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
     return(0);
 }
 
-static int 
+static int
 xmlSecXkmsServerRequestCompoundExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx) {
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecXkmsServerRequestCompoundId, -1);
     xmlSecAssert2(ctx != NULL, -1);
 
@@ -4438,9 +4438,9 @@ xmlSecXkmsServerRequestCompoundExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsS
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
-                continue;       
+                continue;
             }
-            
+
             ret = xmlSecXkmsServerRequestExecute(ctxChild->requestId, ctxChild);
             if(ret < 0) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -4450,7 +4450,7 @@ xmlSecXkmsServerRequestCompoundExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsS
                             "request=%s",
                             xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId)));
                 xmlSecXkmsServerCtxSetResult(ctxChild, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
-                continue;       
+                continue;
             }
         }
     }
@@ -4459,7 +4459,7 @@ xmlSecXkmsServerRequestCompoundExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsS
 }
 
 
-/******************************************************************** 
+/********************************************************************
  *
  * LocateRequest/LocateResponse
  *
@@ -4470,7 +4470,7 @@ static int              xmlSecXkmsServerRequestLocateNodeRead   (xmlSecXkmsServe
 static int              xmlSecXkmsServerRequestLocateNodeWrite  (xmlSecXkmsServerRequestId id,
                                                                  xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
-static int              xmlSecXkmsServerRequestLocateExecute    (xmlSecXkmsServerRequestId id, 
+static int              xmlSecXkmsServerRequestLocateExecute    (xmlSecXkmsServerRequestId id,
                                                                  xmlSecXkmsServerCtxPtr ctx);
 
 static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestLocateKlass = {
@@ -4493,8 +4493,8 @@ static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestLocateKlass = {
  * The LocateRequest klass.
  *
  * Returns: LocateRequest klass.
- */ 
-xmlSecXkmsServerRequestId       
+ */
+xmlSecXkmsServerRequestId
 xmlSecXkmsServerRequestLocateGetKlass(void) {
     return(&xmlSecXkmsServerRequestLocateKlass);
 }
@@ -4514,7 +4514,7 @@ xmlSecXkmsServerRequestLocateGetKlass(void) {
  *          <xkms:KeyUsage>?
  *          <xkms:KeyUsage>?
  *          <xkms:KeyUsage>?
- *          <xkms:UseKeyWith Application Identifier>*    
+ *          <xkms:UseKeyWith Application Identifier>*
  *          <xkms:TimeInstant Time>?
  *
  * XML Schema:
@@ -4532,17 +4532,17 @@ xmlSecXkmsServerRequestLocateGetKlass(void) {
  *    </complexType>
  *    <!-- /LocateRequest -->
  */
-static int  
+static int
 xmlSecXkmsServerRequestLocateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecXkmsServerRequestLocateId, -1);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
     cur = node;
-    
+
     /* first read "parent" type */
     ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, &cur);
     if(ret < 0) {
@@ -4560,12 +4560,12 @@ xmlSecXkmsServerRequestLocateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsSe
                     NULL,
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeQueryKeyBinding));
         return(-1);
     }
-    
-    /* read <xkms:QueryKeyBinding/> node */    
+
+    /* read <xkms:QueryKeyBinding/> node */
     ret = xmlSecXkmsServerCtxQueryKeyBindingNodeRead(ctx, cur);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -4575,7 +4575,7 @@ xmlSecXkmsServerRequestLocateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsSe
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    cur = xmlSecGetNextElementNode(cur->next);    
+    cur = xmlSecGetNextElementNode(cur->next);
 
     /* check that there is nothing after the last node */
     if(cur != NULL) {
@@ -4603,10 +4603,10 @@ xmlSecXkmsServerRequestLocateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsSe
  *          <xkms:KeyUsage>?
  *          <xkms:KeyUsage>?
  *          <xkms:KeyUsage>?
- *          <xkms:UseKeyWith Application Identifier>*    
+ *          <xkms:UseKeyWith Application Identifier>*
  *          <xkms:ValidityInterval NotBefore NotOnOrAfter>?
  *      )*
- * 
+ *
  * XML Schema:
  *    <!-- LocateResult -->
  *    <element name="LocateResult" type="xkms:LocateResultType"/>
@@ -4614,15 +4614,15 @@ xmlSecXkmsServerRequestLocateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsSe
  *         <complexContent>
  *              <extension base="xkms:ResultType">
  *                   <sequence>
- *                       <element ref="xkms:UnverifiedKeyBinding" minOccurs="0" 
+ *                       <element ref="xkms:UnverifiedKeyBinding" minOccurs="0"
  *                                maxOccurs="unbounded"/>
  *                   </sequence>
  *              </extension>
  *         </complexContent>
  *    </complexType>
  *    <!-- /LocateResult -->
- */ 
-static int 
+ */
+static int
 xmlSecXkmsServerRequestLocateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlSecSize pos, size;
     xmlSecKeyPtr key;
@@ -4641,9 +4641,9 @@ xmlSecXkmsServerRequestLocateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
                     "xmlSecXkmsServerCtxResultTypeNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     /* write keys in <xkms:UnverifiedKeyBinding> nodes */
     size = xmlSecPtrListGetSize(&(ctx->keys));
     for(pos = 0; pos < size; ++pos) {
@@ -4651,7 +4651,7 @@ xmlSecXkmsServerRequestLocateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
         if(key == NULL) {
             continue;
         }
-            
+
         cur = xmlSecAddChild(node, xmlSecNodeUnverifiedKeyBinding, xmlSecXkmsNs);
         if(cur == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -4660,7 +4660,7 @@ xmlSecXkmsServerRequestLocateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeUnverifiedKeyBinding));
-            return(-1);         
+            return(-1);
         }
 
         ret = xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(ctx, cur, key);
@@ -4670,18 +4670,18 @@ xmlSecXkmsServerRequestLocateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
                         "xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1);         
+            return(-1);
         }
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecXkmsServerRequestLocateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx) {
     xmlSecKeyPtr key = NULL;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecXkmsServerRequestLocateId, -1);
     xmlSecAssert2(ctx != NULL, -1);
 
@@ -4690,7 +4690,7 @@ xmlSecXkmsServerRequestLocateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsSer
         /* todo: set parameters to locate but not validate the key */
         key = (ctx->keyInfoReadCtx.keysMngr->getKey)(ctx->keyInfoNode, &(ctx->keyInfoReadCtx));
     }
-    
+
     /* check that we got what we needed */
     if((key == NULL) || (!xmlSecKeyMatch(key, NULL, &(ctx->keyInfoReadCtx.keyReq)))) {
         if(key != NULL) {
@@ -4698,8 +4698,8 @@ xmlSecXkmsServerRequestLocateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsSer
         }
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorNoMatch);
         return(-1);
-    } 
-        
+    }
+
     xmlSecAssert2(key != NULL, -1);
     ret = xmlSecPtrListAdd(&(ctx->keys), key);
     if(ret < 0) {
@@ -4711,12 +4711,12 @@ xmlSecXkmsServerRequestLocateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsSer
         xmlSecKeyDestroy(key);
         return(-1);
     }
-    
+
     return(0);
 }
 
 
-/******************************************************************** 
+/********************************************************************
  *
  * ValidateRequest/ValidateResponse
  *
@@ -4727,7 +4727,7 @@ static int              xmlSecXkmsServerRequestValidateNodeRead (xmlSecXkmsServe
 static int              xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id,
                                                                  xmlSecXkmsServerCtxPtr ctx,
                                                                  xmlNodePtr node);
-static int              xmlSecXkmsServerRequestValidateExecute  (xmlSecXkmsServerRequestId id, 
+static int              xmlSecXkmsServerRequestValidateExecute  (xmlSecXkmsServerRequestId id,
                                                                  xmlSecXkmsServerCtxPtr ctx);
 
 static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestValidateKlass = {
@@ -4750,8 +4750,8 @@ static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestValidateKlass = {
  * The ValidateRequest klass.
  *
  * Returns: ValidateRequest klass.
- */ 
-xmlSecXkmsServerRequestId       
+ */
+xmlSecXkmsServerRequestId
 xmlSecXkmsServerRequestValidateGetKlass(void) {
     return(&xmlSecXkmsServerRequestValidateKlass);
 }
@@ -4771,35 +4771,35 @@ xmlSecXkmsServerRequestValidateGetKlass(void) {
  *          <xkms:KeyUsage>?
  *          <xkms:KeyUsage>?
  *          <xkms:KeyUsage>?
- *          <xkms:UseKeyWith Application Identifier>*    
+ *          <xkms:UseKeyWith Application Identifier>*
  *          <xkms:TimeInstant Time>?
- * 
+ *
  * XML Schema:
- * 
- *    <!-- ValidateRequest -->   
- *    <element name="ValidateRequest" type="xkms:ValidateRequestType"/>   
- *    <complexType name="ValidateRequestType">      
- *        <complexContent>         
+ *
+ *    <!-- ValidateRequest -->
+ *    <element name="ValidateRequest" type="xkms:ValidateRequestType"/>
+ *    <complexType name="ValidateRequestType">
+ *        <complexContent>
  *            <extension base="xkms:RequestAbstractType">
  *                <sequence>
  *                    <element ref="xkms:QueryKeyBinding"/>
  *                </sequence>
- *            </extension>                                                       
- *        </complexContent> 
+ *            </extension>
+ *        </complexContent>
  *    </complexType>
- *    <!-- /ValidateRequest -->                                                         
+ *    <!-- /ValidateRequest -->
  */
-static int  
+static int
 xmlSecXkmsServerRequestValidateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecXkmsServerRequestValidateId, -1);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
     cur = node;
-    
+
     /* first read "parent" type */
     ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, &cur);
     if(ret < 0) {
@@ -4817,12 +4817,12 @@ xmlSecXkmsServerRequestValidateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
                     NULL,
                     xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
                     XMLSEC_ERRORS_R_INVALID_NODE,
-                    "node=%s", 
+                    "node=%s",
                     xmlSecErrorsSafeString(xmlSecNodeQueryKeyBinding));
         return(-1);
     }
-    
-    /* read <xkms:QueryKeyBinding/> node */    
+
+    /* read <xkms:QueryKeyBinding/> node */
     ret = xmlSecXkmsServerCtxQueryKeyBindingNodeRead(ctx, cur);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -4832,7 +4832,7 @@ xmlSecXkmsServerRequestValidateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    cur = xmlSecGetNextElementNode(cur->next);    
+    cur = xmlSecGetNextElementNode(cur->next);
 
     /* check that there is nothing after the last node */
     if(cur != NULL) {
@@ -4860,7 +4860,7 @@ xmlSecXkmsServerRequestValidateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
  *          <xkms:KeyUsage>?
  *          <xkms:KeyUsage>?
  *          <xkms:KeyUsage>?
- *          <xkms:UseKeyWith Application Identifier>*    
+ *          <xkms:UseKeyWith Application Identifier>*
  *          <xkms:ValidityInterval NotBefore NotOnOrAfter>?
  *          <xkms:Status StatusValue>
  *              (<xkms:ValidReason>?
@@ -4868,24 +4868,24 @@ xmlSecXkmsServerRequestValidateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
  *               <xkms:InvalidReason>?
  *              )*
  *      )*
- * 
+ *
  * XML Schema:
  *
- *    <!-- ValidateResult -->   
+ *    <!-- ValidateResult -->
  *    <element name="ValidateResult" type="xkms:ValidateResultType"/>
  *    <complexType name="ValidateResultType">
  *        <complexContent>
  *            <extension base="xkms:ResultType">
  *                <sequence>
- *                    <element ref="xkms:KeyBinding" minOccurs="0" 
+ *                    <element ref="xkms:KeyBinding" minOccurs="0"
  *                                  maxOccurs="unbounded"/>
  *                </sequence>
  *            </extension>
  *        </complexContent>
  *    </complexType>
  *    <!-- /ValidateResult -->
- */ 
-static int 
+ */
+static int
 xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
     xmlSecSize pos, size;
     xmlSecKeyPtr key;
@@ -4904,9 +4904,9 @@ xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
                     "xmlSecXkmsServerCtxResultTypeNodeWrite",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
+        return(-1);
     }
-    
+
     /* write keys in <xkms:UnverifiedKeyBinding> nodes */
     size = xmlSecPtrListGetSize(&(ctx->keys));
     for(pos = 0; pos < size; ++pos) {
@@ -4914,7 +4914,7 @@ xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
         if(key == NULL) {
             continue;
         }
-            
+
         cur = xmlSecAddChild(node, xmlSecNodeUnverifiedKeyBinding, xmlSecXkmsNs);
         if(cur == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -4923,7 +4923,7 @@ xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeUnverifiedKeyBinding));
-            return(-1);         
+            return(-1);
         }
 
         ret = xmlSecXkmsServerCtxKeyBindingNodeWrite(ctx, cur, key);
@@ -4933,18 +4933,18 @@ xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
                         "xmlSecXkmsServerCtxKeyBindingNodeWrite",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1);         
+            return(-1);
         }
     }
 
     return(0);
 }
 
-static int 
+static int
 xmlSecXkmsServerRequestValidateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx) {
     xmlSecKeyPtr key = NULL;
     int ret;
-    
+
     xmlSecAssert2(id == xmlSecXkmsServerRequestValidateId, -1);
     xmlSecAssert2(ctx != NULL, -1);
 
@@ -4952,7 +4952,7 @@ xmlSecXkmsServerRequestValidateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsS
     if((ctx->keyInfoReadCtx.keysMngr != NULL) && (ctx->keyInfoReadCtx.keysMngr->getKey != NULL)) {
         key = (ctx->keyInfoReadCtx.keysMngr->getKey)(ctx->keyInfoNode, &(ctx->keyInfoReadCtx));
     }
-    
+
     /* check that we got what we needed */
     if((key == NULL) || (!xmlSecKeyMatch(key, NULL, &(ctx->keyInfoReadCtx.keyReq)))) {
         if(key != NULL) {
@@ -4960,8 +4960,8 @@ xmlSecXkmsServerRequestValidateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsS
         }
         xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorNoMatch);
         return(-1);
-    } 
-        
+    }
+
     xmlSecAssert2(key != NULL, -1);
     ret = xmlSecPtrListAdd(&(ctx->keys), key);
     if(ret < 0) {
@@ -4973,7 +4973,7 @@ xmlSecXkmsServerRequestValidateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsS
         xmlSecKeyDestroy(key);
         return(-1);
     }
-    
+
     return(0);
 }
 
diff --git a/src/xmldsig.c b/src/xmldsig.c
index b5fc54e..edd7020 100644
--- a/src/xmldsig.c
+++ b/src/xmldsig.c
@@ -1,13 +1,13 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * "XML Digital Signature" implementation
  *  http://www.w3.org/TR/xmldsig-core/
  *  http://www.w3.org/Signature/Overview.html
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -19,7 +19,7 @@
 #include <string.h>
 
 #include <libxml/tree.h>
-#include <libxml/parser.h> 
+#include <libxml/parser.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -36,15 +36,15 @@
  * xmlSecDSigCtx
  *
  *************************************************************************/
-static int      xmlSecDSigCtxProcessSignatureNode       (xmlSecDSigCtxPtr dsigCtx, 
+static int      xmlSecDSigCtxProcessSignatureNode       (xmlSecDSigCtxPtr dsigCtx,
                                                          xmlNodePtr node);
-static int      xmlSecDSigCtxProcessSignedInfoNode      (xmlSecDSigCtxPtr dsigCtx, 
+static int      xmlSecDSigCtxProcessSignedInfoNode      (xmlSecDSigCtxPtr dsigCtx,
                                                          xmlNodePtr node);
-static int      xmlSecDSigCtxProcessKeyInfoNode         (xmlSecDSigCtxPtr dsigCtx, 
+static int      xmlSecDSigCtxProcessKeyInfoNode         (xmlSecDSigCtxPtr dsigCtx,
                                                          xmlNodePtr node);
-static int      xmlSecDSigCtxProcessObjectNode          (xmlSecDSigCtxPtr dsigCtx, 
+static int      xmlSecDSigCtxProcessObjectNode          (xmlSecDSigCtxPtr dsigCtx,
                                                          xmlNodePtr node);
-static int      xmlSecDSigCtxProcessManifestNode        (xmlSecDSigCtxPtr dsigCtx, 
+static int      xmlSecDSigCtxProcessManifestNode        (xmlSecDSigCtxPtr dsigCtx,
                                                          xmlNodePtr node);
 
 /* The ID attribute in XMLDSig is 'Id' */
@@ -55,28 +55,28 @@ static const xmlChar*           xmlSecDSigIds[] = { xmlSecAttrId, NULL };
  * @keysMngr:           the pointer to keys manager.
  *
  * Creates <dsig:Signature/> element processing context.
- * The caller is responsible for destroying returend object by calling 
+ * The caller is responsible for destroying returend object by calling
  * #xmlSecDSigCtxDestroy function.
  *
  * Returns: pointer to newly allocated context object or NULL if an error
  * occurs.
  */
-xmlSecDSigCtxPtr        
+xmlSecDSigCtxPtr
 xmlSecDSigCtxCreate(xmlSecKeysMngrPtr keysMngr) {
     xmlSecDSigCtxPtr dsigCtx;
     int ret;
-    
+
     dsigCtx = (xmlSecDSigCtxPtr) xmlMalloc(sizeof(xmlSecDSigCtx));
     if(dsigCtx == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecDSigCtx)=%d", 
+                    "sizeof(xmlSecDSigCtx)=%d",
                     sizeof(xmlSecDSigCtx));
         return(NULL);
     }
-    
+
     ret = xmlSecDSigCtxInitialize(dsigCtx, keysMngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -85,9 +85,9 @@ xmlSecDSigCtxCreate(xmlSecKeysMngrPtr keysMngr) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecDSigCtxDestroy(dsigCtx);
-        return(NULL);   
+        return(NULL);
     }
-    return(dsigCtx);    
+    return(dsigCtx);
 }
 
 /**
@@ -96,10 +96,10 @@ xmlSecDSigCtxCreate(xmlSecKeysMngrPtr keysMngr) {
  *
  * Destroy context object created with #xmlSecDSigCtxCreate function.
  */
-void  
+void
 xmlSecDSigCtxDestroy(xmlSecDSigCtxPtr dsigCtx) {
     xmlSecAssert(dsigCtx != NULL);
-    
+
     xmlSecDSigCtxFinalize(dsigCtx);
     xmlFree(dsigCtx);
 }
@@ -110,17 +110,17 @@ xmlSecDSigCtxDestroy(xmlSecDSigCtxPtr dsigCtx) {
  * @keysMngr:           the pointer to keys manager.
  *
  * Initializes <dsig:Signature/> element processing context.
- * The caller is responsible for cleaing up returend object by calling 
+ * The caller is responsible for cleaing up returend object by calling
  * #xmlSecDSigCtxFinalize function.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecDSigCtxInitialize(xmlSecDSigCtxPtr dsigCtx, xmlSecKeysMngrPtr keysMngr) {
     int ret;
-    
+
     xmlSecAssert2(dsigCtx != NULL, -1);
-    
+
     memset(dsigCtx, 0, sizeof(xmlSecDSigCtx));
 
     /* initialize key info */
@@ -131,10 +131,10 @@ xmlSecDSigCtxInitialize(xmlSecDSigCtxPtr dsigCtx, xmlSecKeysMngrPtr keysMngr) {
                     "xmlSecKeyInfoCtxInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
     dsigCtx->keyInfoReadCtx.mode = xmlSecKeyInfoModeRead;
-    
+
     ret = xmlSecKeyInfoCtxInitialize(&(dsigCtx->keyInfoWriteCtx), keysMngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -142,7 +142,7 @@ xmlSecDSigCtxInitialize(xmlSecDSigCtxPtr dsigCtx, xmlSecKeysMngrPtr keysMngr) {
                     "xmlSecKeyInfoCtxInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
     dsigCtx->keyInfoWriteCtx.mode = xmlSecKeyInfoModeWrite;
     /* it's not wise to write private key :) */
@@ -156,14 +156,14 @@ xmlSecDSigCtxInitialize(xmlSecDSigCtxPtr dsigCtx, xmlSecKeysMngrPtr keysMngr) {
                     "xmlSecTransformCtxInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
 
     /* references lists from SignedInfo and Manifest elements */
-    xmlSecPtrListInitialize(&(dsigCtx->signedInfoReferences), 
+    xmlSecPtrListInitialize(&(dsigCtx->signedInfoReferences),
+                            xmlSecDSigReferenceCtxListId);
+    xmlSecPtrListInitialize(&(dsigCtx->manifestReferences),
                             xmlSecDSigReferenceCtxListId);
-    xmlSecPtrListInitialize(&(dsigCtx->manifestReferences), 
-                            xmlSecDSigReferenceCtxListId);    
 
     dsigCtx->enabledReferenceUris = xmlSecTransformUriTypeAny;
     return(0);
@@ -175,7 +175,7 @@ xmlSecDSigCtxInitialize(xmlSecDSigCtxPtr dsigCtx, xmlSecKeysMngrPtr keysMngr) {
  *
  * Cleans up @dsigCtx object initialized with #xmlSecDSigCtxInitialize function.
  */
-void 
+void
 xmlSecDSigCtxFinalize(xmlSecDSigCtxPtr dsigCtx) {
     xmlSecAssert(dsigCtx != NULL);
 
@@ -186,14 +186,14 @@ xmlSecDSigCtxFinalize(xmlSecDSigCtxPtr dsigCtx) {
     xmlSecPtrListFinalize(&(dsigCtx->manifestReferences));
 
     if(dsigCtx->enabledReferenceTransforms != NULL) {
-        xmlSecPtrListDestroy(dsigCtx->enabledReferenceTransforms);      
+        xmlSecPtrListDestroy(dsigCtx->enabledReferenceTransforms);
     }
     if(dsigCtx->signKey != NULL) {
         xmlSecKeyDestroy(dsigCtx->signKey);
     }
     if(dsigCtx->id != NULL) {
         xmlFree(dsigCtx->id);
-    }   
+    }
     memset(dsigCtx, 0, sizeof(xmlSecDSigCtx));
 }
 
@@ -206,10 +206,10 @@ xmlSecDSigCtxFinalize(xmlSecDSigCtxPtr dsigCtx) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecDSigCtxEnableReferenceTransform(xmlSecDSigCtxPtr dsigCtx, xmlSecTransformId transformId) {
     int ret;
-    
+
     xmlSecAssert2(dsigCtx != NULL, -1);
     xmlSecAssert2(dsigCtx->result == NULL, -1);
     xmlSecAssert2(transformId != xmlSecTransformIdUnknown, -1);
@@ -222,10 +222,10 @@ xmlSecDSigCtxEnableReferenceTransform(xmlSecDSigCtxPtr dsigCtx, xmlSecTransformI
                         "xmlSecPtrListCreate",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1);   
+            return(-1);
         }
-    }   
-        
+    }
+
     ret = xmlSecPtrListAdd(dsigCtx->enabledReferenceTransforms, (void*)transformId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -233,7 +233,7 @@ xmlSecDSigCtxEnableReferenceTransform(xmlSecDSigCtxPtr dsigCtx, xmlSecTransformI
                     "xmlSecPtrListAdd",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
     return(0);
 }
@@ -247,7 +247,7 @@ xmlSecDSigCtxEnableReferenceTransform(xmlSecDSigCtxPtr dsigCtx, xmlSecTransformI
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecDSigCtxEnableSignatureTransform(xmlSecDSigCtxPtr dsigCtx, xmlSecTransformId transformId) {
     xmlSecAssert2(dsigCtx != NULL, -1);
     xmlSecAssert2(dsigCtx->result == NULL, -1);
@@ -259,18 +259,18 @@ xmlSecDSigCtxEnableSignatureTransform(xmlSecDSigCtxPtr dsigCtx, xmlSecTransformI
 /**
  * xmlSecDSigCtxGetPreSignBuffer:
  * @dsigCtx:            the pointer to <dsig:Signature/> processing context.
- * 
+ *
  * Gets pointer to the buffer with serialized <dsig:SignedInfo/> element
- * just before signature claculation (valid if and only if 
+ * just before signature claculation (valid if and only if
  * #XMLSEC_DSIG_FLAGS_STORE_SIGNATURE context flag is set.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-xmlSecBufferPtr 
+xmlSecBufferPtr
 xmlSecDSigCtxGetPreSignBuffer(xmlSecDSigCtxPtr dsigCtx) {
     xmlSecAssert2(dsigCtx != NULL, NULL);
-    
-    return((dsigCtx->preSignMemBufMethod != NULL) ? 
+
+    return((dsigCtx->preSignMemBufMethod != NULL) ?
             xmlSecTransformMemBufGetBuffer(dsigCtx->preSignMemBufMethod) : NULL);
 }
 
@@ -283,10 +283,10 @@ xmlSecDSigCtxGetPreSignBuffer(xmlSecDSigCtxPtr dsigCtx) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecDSigCtxSign(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr tmpl) {
     int ret;
-    
+
     xmlSecAssert2(dsigCtx != NULL, -1);
     xmlSecAssert2(dsigCtx->result == NULL, -1);
     xmlSecAssert2(tmpl != NULL, -1);
@@ -330,27 +330,27 @@ xmlSecDSigCtxSign(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr tmpl) {
     xmlNodeSetContentLen(dsigCtx->signValueNode,
                             xmlSecBufferGetData(dsigCtx->result),
                             xmlSecBufferGetSize(dsigCtx->result));
-    
+
     /* set success status and we are done */
     dsigCtx->status = xmlSecDSigStatusSucceeded;
-    return(0);    
+    return(0);
 }
 
 /**
  * xmlSecDSigCtxVerify:
  * @dsigCtx:            the pointer to <dsig:Signature/> processing context.
  * @node:               the pointer with <dsig:Signature/> node.
- * 
+ *
  * Vaidates signature in the @node. The verification result is returned
  * in #status member of the @dsigCtx object.
  *
- * Returns: 0 on success (check #status member of @dsigCtx to get 
+ * Returns: 0 on success (check #status member of @dsigCtx to get
  * signature verification result) or a negative value if an error occurs.
  */
-int 
+int
 xmlSecDSigCtxVerify(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     int ret;
-    
+
     xmlSecAssert2(dsigCtx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(node->doc != NULL, -1);
@@ -359,7 +359,7 @@ xmlSecDSigCtxVerify(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     dsigCtx->operation  = xmlSecTransformOperationVerify;
     dsigCtx->status     = xmlSecDSigStatusUnknown;
     xmlSecAddIDs(node->doc, node, xmlSecDSigIds);
-    
+
     /* read siganture info */
     ret = xmlSecDSigCtxProcessSignatureNode(dsigCtx, node);
     if(ret < 0) {
@@ -389,7 +389,7 @@ xmlSecDSigCtxVerify(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     /* set status and we are done */
     if(dsigCtx->signMethod->status == xmlSecTransformStatusOk) {
         dsigCtx->status = xmlSecDSigStatusSucceeded;
@@ -404,47 +404,47 @@ xmlSecDSigCtxVerify(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
  *
  * The Signature  element (http://www.w3.org/TR/xmldsig-core/#sec-Signature)
  *
- * The Signature element is the root element of an XML Signature. 
- * Implementation MUST generate laxly schema valid [XML-schema] Signature 
+ * The Signature element is the root element of an XML Signature.
+ * Implementation MUST generate laxly schema valid [XML-schema] Signature
  * elements as specified by the following schema:
- * The way in which the SignedInfo element is presented to the 
- * canonicalization method is dependent on that method. The following 
+ * The way in which the SignedInfo element is presented to the
+ * canonicalization method is dependent on that method. The following
  * applies to algorithms which process XML as nodes or characters:
  *
- *  - XML based canonicalization implementations MUST be provided with 
- *  a [XPath] node-set originally formed from the document containing 
+ *  - XML based canonicalization implementations MUST be provided with
+ *  a [XPath] node-set originally formed from the document containing
  *  the SignedInfo and currently indicating the SignedInfo, its descendants,
- *  and the attribute and namespace nodes of SignedInfo and its descendant 
+ *  and the attribute and namespace nodes of SignedInfo and its descendant
  *  elements.
  *
- *  - Text based canonicalization algorithms (such as CRLF and charset 
- *  normalization) should be provided with the UTF-8 octets that represent 
- *  the well-formed SignedInfo element, from the first character to the 
- *  last character of the XML representation, inclusive. This includes 
- *  the entire text of the start and end tags of the SignedInfo element 
- *  as well as all descendant markup and character data (i.e., the text) 
- *  between those tags. Use of text based canonicalization of SignedInfo 
- *  is NOT RECOMMENDED.              
+ *  - Text based canonicalization algorithms (such as CRLF and charset
+ *  normalization) should be provided with the UTF-8 octets that represent
+ *  the well-formed SignedInfo element, from the first character to the
+ *  last character of the XML representation, inclusive. This includes
+ *  the entire text of the start and end tags of the SignedInfo element
+ *  as well as all descendant markup and character data (i.e., the text)
+ *  between those tags. Use of text based canonicalization of SignedInfo
+ *  is NOT RECOMMENDED.
  *
  *  =================================
- *  we do not support any non XML based C14N 
+ *  we do not support any non XML based C14N
  *
  * Schema Definition:
  *
  *  <element name="Signature" type="ds:SignatureType"/>
  *  <complexType name="SignatureType">
- *  <sequence> 
- *     <element ref="ds:SignedInfo"/> 
- *     <element ref="ds:SignatureValue"/> 
- *     <element ref="ds:KeyInfo" minOccurs="0"/> 
- *     <element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/> 
+ *  <sequence>
+ *     <element ref="ds:SignedInfo"/>
+ *     <element ref="ds:SignatureValue"/>
+ *     <element ref="ds:KeyInfo" minOccurs="0"/>
+ *     <element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/>
  *     </sequence> <attribute name="Id" type="ID" use="optional"/>
  *  </complexType>
- *    
+ *
  * DTD:
- *    
+ *
  *  <!ELEMENT Signature (SignedInfo, SignatureValue, KeyInfo?, Object*)  >
- *  <!ATTLIST Signature  
+ *  <!ATTLIST Signature
  *      xmlns   CDATA   #FIXED 'http://www.w3.org/2000/09/xmldsig#'
  *      Id      ID  #IMPLIED >
  *
@@ -456,7 +456,7 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     xmlNodePtr keyInfoNode = NULL;
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(dsigCtx != NULL, -1);
     xmlSecAssert2((dsigCtx->operation == xmlSecTransformOperationSign) || (dsigCtx->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1);
@@ -472,7 +472,7 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                     XMLSEC_ERRORS_R_INVALID_NODE,
                     "expected=%s",
                     xmlSecErrorsSafeString(xmlSecNodeSignature));
-        return(-1);         
+        return(-1);
     }
 
     /* read node data */
@@ -480,7 +480,7 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     dsigCtx->id = xmlGetProp(node, xmlSecAttrId);
 
     /* first node is required SignedInfo */
-    cur = xmlSecGetNextElementNode(node->children);    
+    cur = xmlSecGetNextElementNode(node->children);
     if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeSignedInfo, xmlSecDSigNs))) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -513,7 +513,7 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     } else {
         keyInfoNode = NULL;
     }
-    
+
     /* next nodes are optional Object nodes */
     while((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeObject, xmlSecDSigNs))) {
         /* read manifests from objects */
@@ -525,12 +525,12 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                             "xmlSecDSigCtxProcessObjectNode",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
-                return(-1);                 
+                return(-1);
             }
         }
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     /* if there is something left than it's an error */
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -549,14 +549,14 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                     "xmlSecDSigCtxProcessSignedInfoNode",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
-    }                           
+        return(-1);
+    }
     /* references processing might change the status */
     if(dsigCtx->status != xmlSecDSigStatusUnknown) {
         return(0);
     }
-    
-    /* as the result, we should have sign and c14n methods set */    
+
+    /* as the result, we should have sign and c14n methods set */
     xmlSecAssert2(dsigCtx->signMethod != NULL, -1);
     xmlSecAssert2(dsigCtx->c14nMethod != NULL, -1);
 
@@ -567,17 +567,17 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                     "xmlSecDSigCtxProcessKeyInfoNode",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);     
-    }                           
+        return(-1);
+    }
     /* as the result, we should have a key */
     xmlSecAssert2(dsigCtx->signKey != NULL, -1);
 
     /* if we need to write result to xml node then we need base64 encode result */
-    if(dsigCtx->operation == xmlSecTransformOperationSign) {    
+    if(dsigCtx->operation == xmlSecTransformOperationSign) {
         xmlSecTransformPtr base64Encode;
-        
+
         /* we need to add base64 encode transform */
-        base64Encode = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx), 
+        base64Encode = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
                                                          xmlSecTransformBase64Id);
         if(base64Encode == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -590,8 +590,8 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
         base64Encode->operation = xmlSecTransformOperationEncode;
     }
 
-    firstType = xmlSecTransformGetDataType(dsigCtx->transformCtx.first, 
-                                           xmlSecTransformModePush, 
+    firstType = xmlSecTransformGetDataType(dsigCtx->transformCtx.first,
+                                           xmlSecTransformModePush,
                                            &(dsigCtx->transformCtx));
     if((firstType & xmlSecTransformDataTypeXml) != 0) {
         xmlSecNodeSetPtr nodeset = NULL;
@@ -632,58 +632,58 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     return(0);
 }
 
-/** 
+/**
  * xmlSecDSigCtxProcessSignedInfoNode:
  *
  * The SignedInfo Element (http://www.w3.org/TR/xmldsig-core/#sec-SignedInfo)
- * 
- * The structure of SignedInfo includes the canonicalization algorithm, 
- * a result algorithm, and one or more references. The SignedInfo element 
- * may contain an optional ID attribute that will allow it to be referenced by 
+ *
+ * The structure of SignedInfo includes the canonicalization algorithm,
+ * a result algorithm, and one or more references. The SignedInfo element
+ * may contain an optional ID attribute that will allow it to be referenced by
  * other signatures and objects.
  *
  * SignedInfo does not include explicit result or digest properties (such as
- * calculation time, cryptographic device serial number, etc.). If an 
- * application needs to associate properties with the result or digest, 
- * it may include such information in a SignatureProperties element within 
+ * calculation time, cryptographic device serial number, etc.). If an
+ * application needs to associate properties with the result or digest,
+ * it may include such information in a SignatureProperties element within
  * an Object element.
  *
  * Schema Definition:
  *
- *  <element name="SignedInfo" type="ds:SignedInfoType"/> 
+ *  <element name="SignedInfo" type="ds:SignedInfoType"/>
  *  <complexType name="SignedInfoType">
- *    <sequence> 
+ *    <sequence>
  *      <element ref="ds:CanonicalizationMethod"/>
- *      <element ref="ds:SignatureMethod"/> 
- *      <element ref="ds:Reference" maxOccurs="unbounded"/> 
- *    </sequence> 
- *    <attribute name="Id" type="ID" use="optional"/> 
+ *      <element ref="ds:SignatureMethod"/>
+ *      <element ref="ds:Reference" maxOccurs="unbounded"/>
+ *    </sequence>
+ *    <attribute name="Id" type="ID" use="optional"/>
  *  </complexType>
- *    
+ *
  * DTD:
- *    
+ *
  *  <!ELEMENT SignedInfo (CanonicalizationMethod, SignatureMethod,  Reference+) >
  *  <!ATTLIST SignedInfo  Id   ID      #IMPLIED>
- * 
+ *
  */
-static int 
+static int
 xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     xmlSecDSigReferenceCtxPtr dsigRefCtx;
     xmlNodePtr cur;
     int ret;
-    
-    xmlSecAssert2(dsigCtx != NULL, -1); 
+
+    xmlSecAssert2(dsigCtx != NULL, -1);
     xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1);
     xmlSecAssert2(dsigCtx->signMethod == NULL, -1);
     xmlSecAssert2(dsigCtx->c14nMethod == NULL, -1);
     xmlSecAssert2((dsigCtx->operation == xmlSecTransformOperationSign) || (dsigCtx->operation == xmlSecTransformOperationVerify), -1);
     xmlSecAssert2(xmlSecPtrListGetSize(&(dsigCtx->signedInfoReferences)) == 0, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     /* first node is required CanonicalizationMethod. */
     cur = xmlSecGetNextElementNode(node->children);
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCanonicalizationMethod, xmlSecDSigNs))) {
-        dsigCtx->c14nMethod = xmlSecTransformCtxNodeRead(&(dsigCtx->transformCtx), 
+        dsigCtx->c14nMethod = xmlSecTransformCtxNodeRead(&(dsigCtx->transformCtx),
                                         cur, xmlSecTransformUsageC14NMethod);
         if(dsigCtx->c14nMethod == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -692,13 +692,13 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
-            return(-1); 
-        }       
+            return(-1);
+        }
     } else if(dsigCtx->defC14NMethodId != xmlSecTransformIdUnknown) {
         /* the dsig spec does require CanonicalizationMethod node
          * to be present but in some case it application might decide to
          * minimize traffic */
-        dsigCtx->c14nMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx), 
+        dsigCtx->c14nMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
                                                               dsigCtx->defC14NMethodId);
         if(dsigCtx->c14nMethod == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -717,11 +717,11 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                     xmlSecErrorsSafeString(xmlSecNodeCanonicalizationMethod));
         return(-1);
     }
-    
+
     /* insert membuf if requested */
     if((dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNATURE) != 0) {
         xmlSecAssert2(dsigCtx->preSignMemBufMethod == NULL, -1);
-        dsigCtx->preSignMemBufMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx), 
+        dsigCtx->preSignMemBufMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
                                                 xmlSecTransformMemBufId);
         if(dsigCtx->preSignMemBufMethod == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -732,11 +732,11 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                         xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
         }
     }
-        
+
     /* next node is required SignatureMethod. */
     cur = xmlSecGetNextElementNode( ((cur != NULL) ? cur->next : node->children) );
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeSignatureMethod, xmlSecDSigNs))) {
-        dsigCtx->signMethod = xmlSecTransformCtxNodeRead(&(dsigCtx->transformCtx), 
+        dsigCtx->signMethod = xmlSecTransformCtxNodeRead(&(dsigCtx->transformCtx),
                                         cur, xmlSecTransformUsageSignatureMethod);
         if(dsigCtx->signMethod == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -745,13 +745,13 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
-            return(-1); 
-        }       
+            return(-1);
+        }
     } else if(dsigCtx->defSignMethodId != xmlSecTransformIdUnknown) {
         /* the dsig spec does require SignatureMethod node
          * to be present but in some case it application might decide to
          * minimize traffic */
-        dsigCtx->signMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx), 
+        dsigCtx->signMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
                                                               dsigCtx->defSignMethodId);
         if(dsigCtx->signMethod == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -769,9 +769,9 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                     "expected=%s",
                     xmlSecErrorsSafeString(xmlSecNodeSignatureMethod));
         return(-1);
-    }   
+    }
     dsigCtx->signMethod->operation = dsigCtx->operation;
-    
+
     /* calculate references */
     cur = xmlSecGetNextElementNode(cur->next);
     while((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeReference, xmlSecDSigNs))) {
@@ -783,7 +783,7 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                         "xmlSecDSigReferenceCtxCreate",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1);     
+            return(-1);
         }
 
         /* add to the list */
@@ -795,7 +795,7 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecDSigReferenceCtxDestroy(dsigRefCtx);
-            return(-1);     
+            return(-1);
         }
 
         /* process */
@@ -807,13 +807,13 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
-            return(-1);     
+            return(-1);
         }
 
         /* bail out if next Reference processing failed */
         if(dsigRefCtx->status != xmlSecDSigStatusSucceeded) {
             dsigCtx->status = xmlSecDSigStatusInvalid;
-            return(0); 
+            return(0);
         }
         cur = xmlSecGetNextElementNode(cur->next);
     }
@@ -840,10 +840,10 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     return(0);
 }
 
-static int 
+static int
 xmlSecDSigCtxProcessKeyInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     int ret;
-    
+
     xmlSecAssert2(dsigCtx != NULL, -1);
     xmlSecAssert2(dsigCtx->signMethod != NULL, -1);
 
@@ -857,15 +857,15 @@ xmlSecDSigCtxProcessKeyInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformGetName(dsigCtx->signMethod)));
         return(-1);
-    }   
-    
+    }
+
     /* ignore <dsig:KeyInfo /> if there is the key is already set */
     /* todo: throw an error if key is set and node != NULL? */
-    if((dsigCtx->signKey == NULL) && (dsigCtx->keyInfoReadCtx.keysMngr != NULL) 
-                        && (dsigCtx->keyInfoReadCtx.keysMngr->getKey != NULL)) {        
+    if((dsigCtx->signKey == NULL) && (dsigCtx->keyInfoReadCtx.keysMngr != NULL)
+                        && (dsigCtx->keyInfoReadCtx.keysMngr->getKey != NULL)) {
         dsigCtx->signKey = (dsigCtx->keyInfoReadCtx.keysMngr->getKey)(node, &(dsigCtx->keyInfoReadCtx));
     }
-    
+
     /* check that we have exactly what we want */
     if((dsigCtx->signKey == NULL) || (!xmlSecKeyMatch(dsigCtx->signKey, NULL, &(dsigCtx->keyInfoReadCtx.keyReq)))) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -875,7 +875,7 @@ xmlSecDSigCtxProcessKeyInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     /* set the key to the transform */
     ret = xmlSecTransformSetKey(dsigCtx->signMethod, dsigCtx->signKey);
     if(ret < 0) {
@@ -889,7 +889,7 @@ xmlSecDSigCtxProcessKeyInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     }
 
     /* if we are signing document, update <dsig:KeyInfo/> node */
-    if((node != NULL) && (dsigCtx->operation == xmlSecTransformOperationSign)) {        
+    if((node != NULL) && (dsigCtx->operation == xmlSecTransformOperationSign)) {
         ret = xmlSecKeyInfoNodeWrite(node, dsigCtx->signKey, &(dsigCtx->keyInfoWriteCtx));
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -898,38 +898,38 @@ xmlSecDSigCtxProcessKeyInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
+        }
     }
-    
+
     return(0);
 }
 
 /**
  * xmlSecDSigCtxProcessObjectNode:
- *      
+ *
  * The Object Element (http://www.w3.org/TR/xmldsig-core/#sec-Object)
- * 
- * Object is an optional element that may occur one or more times. When 
- * present, this element may contain any data. The Object element may include 
+ *
+ * Object is an optional element that may occur one or more times. When
+ * present, this element may contain any data. The Object element may include
  * optional MIME type, ID, and encoding attributes.
- *     
+ *
  * Schema Definition:
- *     
- * <element name="Object" type="ds:ObjectType"/> 
+ *
+ * <element name="Object" type="ds:ObjectType"/>
  * <complexType name="ObjectType" mixed="true">
  *   <sequence minOccurs="0" maxOccurs="unbounded">
  *     <any namespace="##any" processContents="lax"/>
  *   </sequence>
- *   <attribute name="Id" type="ID" use="optional"/> 
+ *   <attribute name="Id" type="ID" use="optional"/>
  *   <attribute name="MimeType" type="string" use="optional"/>
- *   <attribute name="Encoding" type="anyURI" use="optional"/> 
+ *   <attribute name="Encoding" type="anyURI" use="optional"/>
  * </complexType>
- *      
+ *
  * DTD:
- *      
+ *
  * <!ELEMENT Object (#PCDATA|Signature|SignatureProperties|Manifest %Object.ANY;)* >
- * <!ATTLIST Object  Id  ID  #IMPLIED 
- *                   MimeType    CDATA   #IMPLIED 
+ * <!ATTLIST Object  Id  ID  #IMPLIED
+ *                   MimeType    CDATA   #IMPLIED
  *                   Encoding    CDATA   #IMPLIED >
  */
 static int
@@ -937,10 +937,10 @@ xmlSecDSigCtxProcessObjectNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     xmlNodePtr cur;
     int ret;
 
-    xmlSecAssert2(dsigCtx != NULL, -1); 
+    xmlSecAssert2(dsigCtx != NULL, -1);
     xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     /* we care about Manifest nodes only; ignore everything else */
     cur = xmlSecGetNextElementNode(node->children);
     while(cur != NULL) {
@@ -952,7 +952,7 @@ xmlSecDSigCtxProcessObjectNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                             "xmlSecDSigCtxProcessManifestNode",
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
-                return(-1);         
+                return(-1);
             }
         }
         cur = xmlSecGetNextElementNode(cur->next);
@@ -961,30 +961,30 @@ xmlSecDSigCtxProcessObjectNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
 }
 
 /**
- * xmlSecDSigCtxProcessManifestNode: 
+ * xmlSecDSigCtxProcessManifestNode:
  *
  * The Manifest  Element (http://www.w3.org/TR/xmldsig-core/#sec-Manifest)
  *
- * The Manifest element provides a list of References. The difference from 
- * the list in SignedInfo is that it is application defined which, if any, of 
- * the digests are actually checked against the objects referenced and what to 
- * do if the object is inaccessible or the digest compare fails. If a Manifest 
- * is pointed to from SignedInfo, the digest over the Manifest itself will be 
- * checked by the core result validation behavior. The digests within such 
- * a Manifest are checked at the application's discretion. If a Manifest is 
- * referenced from another Manifest, even the overall digest of this two level 
+ * The Manifest element provides a list of References. The difference from
+ * the list in SignedInfo is that it is application defined which, if any, of
+ * the digests are actually checked against the objects referenced and what to
+ * do if the object is inaccessible or the digest compare fails. If a Manifest
+ * is pointed to from SignedInfo, the digest over the Manifest itself will be
+ * checked by the core result validation behavior. The digests within such
+ * a Manifest are checked at the application's discretion. If a Manifest is
+ * referenced from another Manifest, even the overall digest of this two level
  * deep Manifest might not be checked.
- *     
+ *
  * Schema Definition:
- *     
- * <element name="Manifest" type="ds:ManifestType"/> 
+ *
+ * <element name="Manifest" type="ds:ManifestType"/>
  * <complexType name="ManifestType">
  *   <sequence>
- *     <element ref="ds:Reference" maxOccurs="unbounded"/> 
- *   </sequence> 
- *   <attribute name="Id" type="ID" use="optional"/> 
+ *     <element ref="ds:Reference" maxOccurs="unbounded"/>
+ *   </sequence>
+ *   <attribute name="Id" type="ID" use="optional"/>
  *  </complexType>
- *      
+ *
  * DTD:
  *
  * <!ELEMENT Manifest (Reference+)  >
@@ -996,7 +996,7 @@ xmlSecDSigCtxProcessManifestNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
     xmlNodePtr cur;
     int ret;
 
-    xmlSecAssert2(dsigCtx != NULL, -1); 
+    xmlSecAssert2(dsigCtx != NULL, -1);
     xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1);
     xmlSecAssert2(node != NULL, -1);
 
@@ -1011,7 +1011,7 @@ xmlSecDSigCtxProcessManifestNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                         "xmlSecDSigReferenceCtxCreate",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1);     
+            return(-1);
         }
 
         /* add to the list */
@@ -1023,7 +1023,7 @@ xmlSecDSigCtxProcessManifestNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             xmlSecDSigReferenceCtxDestroy(dsigRefCtx);
-            return(-1);     
+            return(-1);
         }
 
         /* process */
@@ -1035,7 +1035,7 @@ xmlSecDSigCtxProcessManifestNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
-            return(-1);     
+            return(-1);
         }
 
         /* we don;t care if Reference processing failed because
@@ -1051,7 +1051,7 @@ xmlSecDSigCtxProcessManifestNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
                     XMLSEC_ERRORS_R_UNEXPECTED_NODE,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
     return(0);
 }
 
@@ -1062,12 +1062,12 @@ xmlSecDSigCtxProcessManifestNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
  *
  * Prints the debug information about @dsigCtx to @output.
  */
-void 
+void
 xmlSecDSigCtxDebugDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
     xmlSecAssert(dsigCtx != NULL);
     xmlSecAssert(output != NULL);
 
-    if(dsigCtx->operation == xmlSecTransformOperationSign) {    
+    if(dsigCtx->operation == xmlSecTransformOperationSign) {
         fprintf(output, "= SIGNATURE CONTEXT\n");
     } else {
         fprintf(output, "= VERIFICATION CONTEXT\n");
@@ -1089,7 +1089,7 @@ xmlSecDSigCtxDebugDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
     if(dsigCtx->id != NULL) {
         fprintf(output, "== Id: \"%s\"\n", dsigCtx->id);
     }
-    
+
     fprintf(output, "== Key Info Read Ctx:\n");
     xmlSecKeyInfoCtxDebugDump(&(dsigCtx->keyInfoReadCtx), output);
     fprintf(output, "== Key Info Write Ctx:\n");
@@ -1107,31 +1107,31 @@ xmlSecDSigCtxDebugDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
         fprintf(output, "== Signature Key:\n");
         xmlSecKeyDebugDump(dsigCtx->signKey, output);
     }
-    
+
     fprintf(output, "== SignedInfo References List:\n");
     xmlSecPtrListDebugDump(&(dsigCtx->signedInfoReferences), output);
 
     fprintf(output, "== Manifest References List:\n");
     xmlSecPtrListDebugDump(&(dsigCtx->manifestReferences), output);
-    
-    if((dsigCtx->result != NULL) && 
+
+    if((dsigCtx->result != NULL) &&
        (xmlSecBufferGetData(dsigCtx->result) != NULL)) {
 
         fprintf(output, "== Result - start buffer:\n");
-        fwrite(xmlSecBufferGetData(dsigCtx->result), 
-               xmlSecBufferGetSize(dsigCtx->result), 
+        fwrite(xmlSecBufferGetData(dsigCtx->result),
+               xmlSecBufferGetSize(dsigCtx->result),
                1, output);
         fprintf(output, "\n== Result - end buffer\n");
     }
     if(((dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNATURE) != 0) &&
        (xmlSecDSigCtxGetPreSignBuffer(dsigCtx) != NULL) &&
        (xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)) != NULL)) {
-       
+
         fprintf(output, "== PreSigned data - start buffer:\n");
-        fwrite(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)), 
-               xmlSecBufferGetSize(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)), 
+        fwrite(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
+               xmlSecBufferGetSize(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
                1, output);
-        fprintf(output, "\n== PreSigned data - end buffer\n");       
+        fprintf(output, "\n== PreSigned data - end buffer\n");
     }
 }
 
@@ -1142,12 +1142,12 @@ xmlSecDSigCtxDebugDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
  *
  * Prints the debug information about @dsigCtx to @output in XML format.
  */
-void 
+void
 xmlSecDSigCtxDebugXmlDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
     xmlSecAssert(dsigCtx != NULL);
     xmlSecAssert(output != NULL);
 
-    if(dsigCtx->operation == xmlSecTransformOperationSign) {    
+    if(dsigCtx->operation == xmlSecTransformOperationSign) {
         fprintf(output, "<SignatureContext \n");
     } else {
         fprintf(output, "<VerificationContext \n");
@@ -1203,27 +1203,27 @@ xmlSecDSigCtxDebugXmlDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
     xmlSecPtrListDebugXmlDump(&(dsigCtx->manifestReferences), output);
     fprintf(output, "</ManifestReferences>\n");
 
-    if((dsigCtx->result != NULL) && 
+    if((dsigCtx->result != NULL) &&
        (xmlSecBufferGetData(dsigCtx->result) != NULL)) {
 
         fprintf(output, "<Result>");
-        fwrite(xmlSecBufferGetData(dsigCtx->result), 
-               xmlSecBufferGetSize(dsigCtx->result), 
+        fwrite(xmlSecBufferGetData(dsigCtx->result),
+               xmlSecBufferGetSize(dsigCtx->result),
                1, output);
         fprintf(output, "</Result>\n");
     }
     if(((dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNATURE) != 0) &&
        (xmlSecDSigCtxGetPreSignBuffer(dsigCtx) != NULL) &&
        (xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)) != NULL)) {
-       
+
         fprintf(output, "<PreSignedData>");
-        fwrite(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)), 
-               xmlSecBufferGetSize(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)), 
+        fwrite(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
+               xmlSecBufferGetSize(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
                1, output);
-        fprintf(output, "</PreSignedData>\n");       
+        fprintf(output, "</PreSignedData>\n");
     }
 
-    if(dsigCtx->operation == xmlSecTransformOperationSign) {    
+    if(dsigCtx->operation == xmlSecTransformOperationSign) {
         fprintf(output, "</SignatureContext>\n");
     } else {
         fprintf(output, "</VerificationContext>\n");
@@ -1246,24 +1246,24 @@ xmlSecDSigCtxDebugXmlDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
  *
  * Returns: pointer to newly created context or NULL if an error occurs.
  */
-xmlSecDSigReferenceCtxPtr       
+xmlSecDSigReferenceCtxPtr
 xmlSecDSigReferenceCtxCreate(xmlSecDSigCtxPtr dsigCtx, xmlSecDSigReferenceOrigin origin) {
     xmlSecDSigReferenceCtxPtr dsigRefCtx;
     int ret;
-    
+
     xmlSecAssert2(dsigCtx != NULL, NULL);
-    
+
     dsigRefCtx = (xmlSecDSigReferenceCtxPtr) xmlMalloc(sizeof(xmlSecDSigReferenceCtx));
     if(dsigRefCtx == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecDSigReferenceCtx)=%d", 
+                    "sizeof(xmlSecDSigReferenceCtx)=%d",
                     sizeof(xmlSecDSigReferenceCtx));
         return(NULL);
     }
-    
+
     ret = xmlSecDSigReferenceCtxInitialize(dsigRefCtx, dsigCtx, origin);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1272,21 +1272,21 @@ xmlSecDSigReferenceCtxCreate(xmlSecDSigCtxPtr dsigCtx, xmlSecDSigReferenceOrigin
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecDSigReferenceCtxDestroy(dsigRefCtx);
-        return(NULL);   
+        return(NULL);
     }
-    return(dsigRefCtx);    
+    return(dsigRefCtx);
 }
 
-/** 
+/**
  * xmlSecDSigReferenceCtxDestroy:
  * @dsigRefCtx:         the pointer to <dsig:Reference/> element processing context.
  *
  * Destroy context object created with #xmlSecDSigReferenceCtxCreate function.
  */
-void  
+void
 xmlSecDSigReferenceCtxDestroy(xmlSecDSigReferenceCtxPtr dsigRefCtx) {
     xmlSecAssert(dsigRefCtx != NULL);
-    
+
     xmlSecDSigReferenceCtxFinalize(dsigRefCtx);
     xmlFree(dsigRefCtx);
 }
@@ -1303,19 +1303,19 @@ xmlSecDSigReferenceCtxDestroy(xmlSecDSigReferenceCtxPtr dsigRefCtx) {
  *
  * Returns: 0 on succes or aa negative value otherwise.
  */
-int 
+int
 xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlSecDSigCtxPtr dsigCtx,
                                 xmlSecDSigReferenceOrigin origin) {
     int ret;
-    
+
     xmlSecAssert2(dsigCtx != NULL, -1);
     xmlSecAssert2(dsigRefCtx != NULL, -1);
-    
+
     memset(dsigRefCtx, 0, sizeof(xmlSecDSigReferenceCtx));
-    
+
     dsigRefCtx->dsigCtx = dsigCtx;
     dsigRefCtx->origin = origin;
-    
+
     /* initializes transforms dsigRefCtx */
     ret = xmlSecTransformCtxInitialize(&(dsigRefCtx->transformCtx));
     if(ret < 0) {
@@ -1324,12 +1324,12 @@ xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlSecDSi
                     "xmlSecTransformCtxInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
-    
+
     /* copy enabled transforms */
     if(dsigCtx->enabledReferenceTransforms != NULL) {
-        ret = xmlSecPtrListCopy(&(dsigRefCtx->transformCtx.enabledTransforms), 
+        ret = xmlSecPtrListCopy(&(dsigRefCtx->transformCtx.enabledTransforms),
                                      dsigCtx->enabledReferenceTransforms);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1337,9 +1337,9 @@ xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlSecDSi
                         "xmlSecPtrListCopy",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
-            return(-1);   
+            return(-1);
         }
-    }    
+    }
     dsigRefCtx->transformCtx.preExecCallback = dsigCtx->referencePreExecuteCallback;
     dsigRefCtx->transformCtx.enabledUris = dsigCtx->enabledReferenceUris;
 
@@ -1349,33 +1349,33 @@ xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlSecDSi
     return(0);
 }
 
-/** 
+/**
  * xmlSecDSigReferenceCtxFinalize:
  * @dsigRefCtx:         the pointer to <dsig:Reference/> element processing context.
  *
  * Cleans up context object created with #xmlSecDSigReferenceCtxInitialize function.
  */
-void 
+void
 xmlSecDSigReferenceCtxFinalize(xmlSecDSigReferenceCtxPtr dsigRefCtx) {
     xmlSecAssert(dsigRefCtx != NULL);
 
     xmlSecTransformCtxFinalize(&(dsigRefCtx->transformCtx));
     if(dsigRefCtx->id != NULL) {
         xmlFree(dsigRefCtx->id);
-    }   
+    }
     if(dsigRefCtx->uri != NULL) {
         xmlFree(dsigRefCtx->uri);
-    }   
+    }
     if(dsigRefCtx->type != NULL) {
         xmlFree(dsigRefCtx->type);
-    }   
+    }
     memset(dsigRefCtx, 0, sizeof(xmlSecDSigReferenceCtx));
 }
 
 /**
  * xmlSecDSigReferenceCtxGetPreDigestBuffer:
  * @dsigRefCtx:         the pointer to <dsig:Reference/> element processing context.
- * 
+ *
  * Gets the results of <dsig:Reference/> node processing just before digesting
  * (valid only if #XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES or
  * #XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES flas of signature context
@@ -1383,11 +1383,11 @@ xmlSecDSigReferenceCtxFinalize(xmlSecDSigReferenceCtxPtr dsigRefCtx) {
  *
  * Returns: pointer to the buffer or NULL if an error occurs.
  */
-xmlSecBufferPtr 
+xmlSecBufferPtr
 xmlSecDSigReferenceCtxGetPreDigestBuffer(xmlSecDSigReferenceCtxPtr dsigRefCtx) {
     xmlSecAssert2(dsigRefCtx != NULL, NULL);
-    
-    return((dsigRefCtx->preDigestMemBufMethod != NULL) ? 
+
+    return((dsigRefCtx->preDigestMemBufMethod != NULL) ?
             xmlSecTransformMemBufGetBuffer(dsigRefCtx->preDigestMemBufMethod) : NULL);
 }
 
@@ -1397,27 +1397,27 @@ xmlSecDSigReferenceCtxGetPreDigestBuffer(xmlSecDSigReferenceCtxPtr dsigRefCtx) {
  * @node:               the pointer to <dsig:Reference/> node.
 
  * The Reference Element (http://www.w3.org/TR/xmldsig-core/#sec-Reference)
- * 
- * Reference is an element that may occur one or more times. It specifies 
- * a digest algorithm and digest value, and optionally an identifier of the 
- * object being signed, the type of the object, and/or a list of transforms 
- * to be applied prior to digesting. The identification (URI) and transforms 
- * describe how the digested content (i.e., the input to the digest method) 
- * was created. The Type attribute facilitates the processing of referenced 
- * data. For example, while this specification makes no requirements over 
- * external data, an application may wish to signal that the referent is a 
- * Manifest. An optional ID attribute permits a Reference to be referenced 
+ *
+ * Reference is an element that may occur one or more times. It specifies
+ * a digest algorithm and digest value, and optionally an identifier of the
+ * object being signed, the type of the object, and/or a list of transforms
+ * to be applied prior to digesting. The identification (URI) and transforms
+ * describe how the digested content (i.e., the input to the digest method)
+ * was created. The Type attribute facilitates the processing of referenced
+ * data. For example, while this specification makes no requirements over
+ * external data, an application may wish to signal that the referent is a
+ * Manifest. An optional ID attribute permits a Reference to be referenced
  * from elsewhere.
  *
  * Returns: 0 on succes or aa negative value otherwise.
  */
-int 
+int
 xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodePtr node) {
     xmlSecTransformCtxPtr transformCtx;
     xmlNodePtr digestValueNode;
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(dsigRefCtx != NULL, -1);
     xmlSecAssert2(dsigRefCtx->dsigCtx != NULL, -1);
     xmlSecAssert2(dsigRefCtx->digestMethod == NULL, -1);
@@ -1448,7 +1448,7 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
     /* first is optional Transforms node */
     cur  = xmlSecGetNextElementNode(node->children);
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeTransforms, xmlSecDSigNs))) {
-        ret = xmlSecTransformCtxNodesListRead(transformCtx, 
+        ret = xmlSecTransformCtxNodesListRead(transformCtx,
                                         cur, xmlSecTransformUsageDSigTransform);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1458,8 +1458,8 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
             return(-1);
-        }       
-        
+        }
+
         cur = xmlSecGetNextElementNode(cur->next);
     }
 
@@ -1471,7 +1471,7 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
 
         xmlSecAssert2(dsigRefCtx->preDigestMemBufMethod == NULL, -1);
         dsigRefCtx->preDigestMemBufMethod = xmlSecTransformCtxCreateAndAppend(
-                                                transformCtx, 
+                                                transformCtx,
                                                 xmlSecTransformMemBufId);
         if(dsigRefCtx->preDigestMemBufMethod == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1483,10 +1483,10 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
             return(-1);
         }
     }
-        
+
     /* next node is required DigestMethod. */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDigestMethod, xmlSecDSigNs))) {
-        dsigRefCtx->digestMethod = xmlSecTransformCtxNodeRead(&(dsigRefCtx->transformCtx), 
+        dsigRefCtx->digestMethod = xmlSecTransformCtxNodeRead(&(dsigRefCtx->transformCtx),
                                         cur, xmlSecTransformUsageDigestMethod);
         if(dsigRefCtx->digestMethod == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1495,15 +1495,15 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
-            return(-1); 
-        }       
-        
-        cur = xmlSecGetNextElementNode(cur->next);     
+            return(-1);
+        }
+
+        cur = xmlSecGetNextElementNode(cur->next);
     } else if(dsigRefCtx->dsigCtx->defSignMethodId != xmlSecTransformIdUnknown) {
         /* the dsig spec does require DigestMethod node
          * to be present but in some case it application might decide to
          * minimize traffic */
-        dsigRefCtx->digestMethod = xmlSecTransformCtxCreateAndAppend(&(dsigRefCtx->transformCtx), 
+        dsigRefCtx->digestMethod = xmlSecTransformCtxCreateAndAppend(&(dsigRefCtx->transformCtx),
                                                               dsigRefCtx->dsigCtx->defSignMethodId);
         if(dsigRefCtx->digestMethod == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1521,13 +1521,13 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
                     "expected=%s",
                     xmlSecErrorsSafeString(xmlSecNodeDigestMethod));
         return(-1);
-    }   
+    }
     dsigRefCtx->digestMethod->operation = dsigRefCtx->dsigCtx->operation;
 
     /* last node is required DigestValue */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDigestValue, xmlSecDSigNs))) {
         digestValueNode = cur;
-        cur = xmlSecGetNextElementNode(cur->next);     
+        cur = xmlSecGetNextElementNode(cur->next);
     } else {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1549,9 +1549,9 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
     }
 
     /* if we need to write result to xml node then we need base64 encode result */
-    if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {        
+    if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
         xmlSecTransformPtr base64Encode;
-        
+
         /* we need to add base64 encode transform */
         base64Encode = xmlSecTransformCtxCreateAndAppend(transformCtx, xmlSecTransformBase64Id);
         if(base64Encode == NULL) {
@@ -1574,10 +1574,10 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
     dsigRefCtx->result = transformCtx->result;
 
-    if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {        
+    if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
         if((dsigRefCtx->result == NULL) || (xmlSecBufferGetData(dsigRefCtx->result) == NULL)) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
@@ -1586,17 +1586,17 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-        
+
         /* write signed data to xml */
         xmlNodeSetContentLen(digestValueNode,
                             xmlSecBufferGetData(dsigRefCtx->result),
                             xmlSecBufferGetSize(dsigRefCtx->result));
-    
+
         /* set success status and we are done */
         dsigRefCtx->status = xmlSecDSigStatusSucceeded;
     } else {
         /* verify SignatureValue node content */
-        ret = xmlSecTransformVerifyNodeContent(dsigRefCtx->digestMethod, 
+        ret = xmlSecTransformVerifyNodeContent(dsigRefCtx->digestMethod,
                             digestValueNode, transformCtx);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1606,7 +1606,7 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-    
+
         /* set status and we are done */
         if(dsigRefCtx->digestMethod->status == xmlSecTransformStatusOk) {
             dsigRefCtx->status = xmlSecDSigStatusSucceeded;
@@ -1625,13 +1625,13 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
  *
  * Prints debug information about @dsigRefCtx to @output.
  */
-void 
+void
 xmlSecDSigReferenceCtxDebugDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* output) {
     xmlSecAssert(dsigRefCtx != NULL);
     xmlSecAssert(dsigRefCtx->dsigCtx != NULL);
     xmlSecAssert(output != NULL);
 
-    if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {    
+    if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
         fprintf(output, "= REFERENCE CALCULATION CONTEXT\n");
     } else {
         fprintf(output, "= REFERENCE VERIFICATION CONTEXT\n");
@@ -1667,19 +1667,19 @@ xmlSecDSigReferenceCtxDebugDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* outp
 
     if((xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx) != NULL) &&
        (xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)) != NULL)) {
-       
+
         fprintf(output, "== PreDigest data - start buffer:\n");
-        fwrite(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)), 
-               xmlSecBufferGetSize(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)), 
+        fwrite(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
+               xmlSecBufferGetSize(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
                1, output);
-        fprintf(output, "\n== PreDigest data - end buffer\n");       
+        fprintf(output, "\n== PreDigest data - end buffer\n");
     }
 
-    if((dsigRefCtx->result != NULL) && 
+    if((dsigRefCtx->result != NULL) &&
        (xmlSecBufferGetData(dsigRefCtx->result) != NULL)) {
 
         fprintf(output, "== Result - start buffer:\n");
-        fwrite(xmlSecBufferGetData(dsigRefCtx->result), 
+        fwrite(xmlSecBufferGetData(dsigRefCtx->result),
                xmlSecBufferGetSize(dsigRefCtx->result), 1,
                output);
         fprintf(output, "\n== Result - end buffer\n");
@@ -1693,13 +1693,13 @@ xmlSecDSigReferenceCtxDebugDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* outp
  *
  * Prints debug information about @dsigRefCtx to @output in output format.
  */
-void 
+void
 xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* output) {
     xmlSecAssert(dsigRefCtx != NULL);
     xmlSecAssert(dsigRefCtx->dsigCtx != NULL);
     xmlSecAssert(output != NULL);
 
-    if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {    
+    if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
         fprintf(output, "<ReferenceCalculationContext ");
     } else {
         fprintf(output, "<ReferenceVerificationContext ");
@@ -1738,11 +1738,11 @@ xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* o
         fprintf(output, "</DigestMethod>\n");
     }
 
-    if((dsigRefCtx->result != NULL) && 
+    if((dsigRefCtx->result != NULL) &&
        (xmlSecBufferGetData(dsigRefCtx->result) != NULL)) {
 
         fprintf(output, "<Result>");
-        fwrite(xmlSecBufferGetData(dsigRefCtx->result), 
+        fwrite(xmlSecBufferGetData(dsigRefCtx->result),
                xmlSecBufferGetSize(dsigRefCtx->result), 1,
                output);
         fprintf(output, "</Result>\n");
@@ -1750,14 +1750,14 @@ xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* o
 
     if((xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx) != NULL) &&
        (xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)) != NULL)) {
-       
+
         fprintf(output, "<PreDigestData>");
-        fwrite(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)), 
-               xmlSecBufferGetSize(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)), 
+        fwrite(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
+               xmlSecBufferGetSize(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
                1, output);
-        fprintf(output, "</PreDigestData>\n");       
+        fprintf(output, "</PreDigestData>\n");
     }
-    if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {    
+    if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
         fprintf(output, "</ReferenceCalculationContext>\n");
     } else {
         fprintf(output, "</ReferenceVerificationContext>\n");
@@ -1785,7 +1785,7 @@ static xmlSecPtrListKlass xmlSecDSigReferenceCtxListKlass = {
  *
  * Returns: <dsig:Reference/> element processing context list klass.
  */
-xmlSecPtrListId 
+xmlSecPtrListId
 xmlSecDSigReferenceCtxListGetKlass(void) {
     return(&xmlSecDSigReferenceCtxListKlass);
 }
diff --git a/src/xmlenc.c b/src/xmlenc.c
index 837870f..694dc62 100644
--- a/src/xmlenc.c
+++ b/src/xmlenc.c
@@ -1,24 +1,24 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * "XML Encryption" implementation
  *  http://www.w3.org/TR/xmlenc-core
- * 
+ *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
 
 #ifndef XMLSEC_NO_XMLENC
- 
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
 #include <libxml/tree.h>
-#include <libxml/parser.h> 
+#include <libxml/parser.h>
 
 #include <xmlsec/xmlsec.h>
 #include <xmlsec/buffer.h>
@@ -30,12 +30,12 @@
 #include <xmlsec/xmlenc.h>
 #include <xmlsec/errors.h>
 
-static int      xmlSecEncCtxEncDataNodeRead             (xmlSecEncCtxPtr encCtx, 
+static int      xmlSecEncCtxEncDataNodeRead             (xmlSecEncCtxPtr encCtx,
                                                          xmlNodePtr node);
 static int      xmlSecEncCtxEncDataNodeWrite            (xmlSecEncCtxPtr encCtx);
-static int      xmlSecEncCtxCipherDataNodeRead          (xmlSecEncCtxPtr encCtx, 
+static int      xmlSecEncCtxCipherDataNodeRead          (xmlSecEncCtxPtr encCtx,
                                                          xmlNodePtr node);
-static int      xmlSecEncCtxCipherReferenceNodeRead     (xmlSecEncCtxPtr encCtx, 
+static int      xmlSecEncCtxCipherReferenceNodeRead     (xmlSecEncCtxPtr encCtx,
                                                          xmlNodePtr node);
 
 /* The ID attribute in XMLEnc is 'Id' */
@@ -47,28 +47,28 @@ static const xmlChar*           xmlSecEncIds[] = { BAD_CAST "Id", NULL };
  * @keysMngr:           the pointer to keys manager.
  *
  * Creates <enc:EncryptedData/> element processing context.
- * The caller is responsible for destroying returend object by calling 
+ * The caller is responsible for destroying returend object by calling
  * #xmlSecEncCtxDestroy function.
  *
  * Returns: pointer to newly allocated context object or NULL if an error
  * occurs.
  */
-xmlSecEncCtxPtr 
+xmlSecEncCtxPtr
 xmlSecEncCtxCreate(xmlSecKeysMngrPtr keysMngr) {
     xmlSecEncCtxPtr encCtx;
     int ret;
-    
+
     encCtx = (xmlSecEncCtxPtr) xmlMalloc(sizeof(xmlSecEncCtx));
     if(encCtx == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_MALLOC_FAILED,
-                    "sizeof(xmlSecEncCtx)=%d", 
+                    "sizeof(xmlSecEncCtx)=%d",
                     sizeof(xmlSecEncCtx));
         return(NULL);
     }
-    
+
     ret = xmlSecEncCtxInitialize(encCtx, keysMngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -77,9 +77,9 @@ xmlSecEncCtxCreate(xmlSecKeysMngrPtr keysMngr) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecEncCtxDestroy(encCtx);
-        return(NULL);   
+        return(NULL);
     }
-    return(encCtx);    
+    return(encCtx);
 }
 
 /**
@@ -88,10 +88,10 @@ xmlSecEncCtxCreate(xmlSecKeysMngrPtr keysMngr) {
  *
  * Destroy context object created with #xmlSecEncCtxCreate function.
  */
-void  
+void
 xmlSecEncCtxDestroy(xmlSecEncCtxPtr encCtx) {
     xmlSecAssert(encCtx != NULL);
-    
+
     xmlSecEncCtxFinalize(encCtx);
     xmlFree(encCtx);
 }
@@ -102,17 +102,17 @@ xmlSecEncCtxDestroy(xmlSecEncCtxPtr encCtx) {
  * @keysMngr:           the pointer to keys manager.
  *
  * Initializes <enc:EncryptedData/> element processing context.
- * The caller is responsible for cleaing up returend object by calling 
+ * The caller is responsible for cleaing up returend object by calling
  * #xmlSecEncCtxFinalize function.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr) {
     int ret;
-    
+
     xmlSecAssert2(encCtx != NULL, -1);
-    
+
     memset(encCtx, 0, sizeof(xmlSecEncCtx));
 
     /* initialize key info */
@@ -123,10 +123,10 @@ xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr) {
                     "xmlSecKeyInfoCtxInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
     encCtx->keyInfoReadCtx.mode = xmlSecKeyInfoModeRead;
-    
+
     ret = xmlSecKeyInfoCtxInitialize(&(encCtx->keyInfoWriteCtx), keysMngr);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -134,7 +134,7 @@ xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr) {
                     "xmlSecKeyInfoCtxInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
     encCtx->keyInfoWriteCtx.mode = xmlSecKeyInfoModeWrite;
     /* it's not wise to write private key :) */
@@ -148,7 +148,7 @@ xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr) {
                     "xmlSecTransformCtxInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(-1);   
+        return(-1);
     }
 
     return(0);
@@ -160,12 +160,12 @@ xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr) {
  *
  * Cleans up @encCtx object.
  */
-void 
+void
 xmlSecEncCtxFinalize(xmlSecEncCtxPtr encCtx) {
     xmlSecAssert(encCtx != NULL);
 
     xmlSecEncCtxReset(encCtx);
-    
+
     xmlSecTransformCtxFinalize(&(encCtx->transformCtx));
     xmlSecKeyInfoCtxFinalize(&(encCtx->keyInfoReadCtx));
     xmlSecKeyInfoCtxFinalize(&(encCtx->keyInfoWriteCtx));
@@ -179,10 +179,10 @@ xmlSecEncCtxFinalize(xmlSecEncCtxPtr encCtx) {
  *
  * Resets @encCtx object, user settings are not touched.
  */
-void 
+void
 xmlSecEncCtxReset(xmlSecEncCtxPtr encCtx) {
     xmlSecAssert(encCtx != NULL);
-    
+
     xmlSecTransformCtxReset(&(encCtx->transformCtx));
     xmlSecKeyInfoCtxReset(&(encCtx->keyInfoReadCtx));
     xmlSecKeyInfoCtxReset(&(encCtx->keyInfoWriteCtx));
@@ -192,21 +192,21 @@ xmlSecEncCtxReset(xmlSecEncCtxPtr encCtx) {
     encCtx->resultBase64Encoded = 0;
     encCtx->resultReplaced      = 0;
     encCtx->encMethod           = NULL;
-    
-    if (encCtx->replacedNodeList != NULL) { 
+
+    if (encCtx->replacedNodeList != NULL) {
                 xmlFreeNodeList(encCtx->replacedNodeList);
         encCtx->replacedNodeList = NULL;
     }
-    
+
     if(encCtx->encKey != NULL) {
             xmlSecKeyDestroy(encCtx->encKey);
             encCtx->encKey = NULL;
     }
-    
+
     if(encCtx->id != NULL) {
             xmlFree(encCtx->id);
             encCtx->id = NULL;
-    }   
+    }
 
     if(encCtx->type != NULL) {
             xmlFree(encCtx->type);
@@ -221,7 +221,7 @@ xmlSecEncCtxReset(xmlSecEncCtxPtr encCtx) {
     if(encCtx->encoding != NULL) {
             xmlFree(encCtx->encoding);
             encCtx->encoding = NULL;
-    }   
+    }
 
     if(encCtx->recipient != NULL) {
             xmlFree(encCtx->recipient);
@@ -232,8 +232,8 @@ xmlSecEncCtxReset(xmlSecEncCtxPtr encCtx) {
             xmlFree(encCtx->carriedKeyName);
             encCtx->carriedKeyName = NULL;
     }
-    
-    encCtx->encDataNode = encCtx->encMethodNode = 
+
+    encCtx->encDataNode = encCtx->encMethodNode =
         encCtx->keyInfoNode = encCtx->cipherValueNode = NULL;
 }
 
@@ -241,15 +241,15 @@ xmlSecEncCtxReset(xmlSecEncCtxPtr encCtx) {
  * xmlSecEncCtxCopyUserPref:
  * @dst:                the pointer to destination context.
  * @src:                the pointer to source context.
- * 
+ *
  * Copies user preference from @src context to @dst.
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecEncCtxCopyUserPref(xmlSecEncCtxPtr dst, xmlSecEncCtxPtr src) {
     int ret;
-    
+
     xmlSecAssert2(dst != NULL, -1);
     xmlSecAssert2(src != NULL, -1);
 
@@ -258,7 +258,7 @@ xmlSecEncCtxCopyUserPref(xmlSecEncCtxPtr dst, xmlSecEncCtxPtr src) {
     dst->flags2         = src->flags2;
     dst->defEncMethodId = src->defEncMethodId;
     dst->mode           = src->mode;
-    
+
     ret = xmlSecTransformCtxCopyUserPref(&(dst->transformCtx), &(src->transformCtx));
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -290,7 +290,7 @@ xmlSecEncCtxCopyUserPref(xmlSecEncCtxPtr dst, xmlSecEncCtxPtr src) {
     }
 
     return(0);
-} 
+}
 
 /**
  * xmlSecEncCtxBinaryEncrypt:
@@ -303,17 +303,17 @@ xmlSecEncCtxCopyUserPref(xmlSecEncCtxPtr dst, xmlSecEncCtxPtr src) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
-xmlSecEncCtxBinaryEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, 
+int
+xmlSecEncCtxBinaryEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl,
                           const xmlSecByte* data, xmlSecSize dataSize) {
     int ret;
-    
+
     xmlSecAssert2(encCtx != NULL, -1);
     xmlSecAssert2(encCtx->result == NULL, -1);
     xmlSecAssert2(tmpl != NULL, -1);
     xmlSecAssert2(data != NULL, -1);
 
-    /* initialize context and add ID atributes to the list of known ids */    
+    /* initialize context and add ID atributes to the list of known ids */
     encCtx->operation = xmlSecTransformOperationEncrypt;
     xmlSecAddIDs(tmpl->doc, tmpl, xmlSecEncIds);
 
@@ -341,7 +341,7 @@ xmlSecEncCtxBinaryEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl,
 
     encCtx->result = encCtx->transformCtx.result;
     xmlSecAssert2(encCtx->result != NULL, -1);
-    
+
     ret = xmlSecEncCtxEncDataNodeWrite(encCtx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -351,7 +351,7 @@ xmlSecEncCtxBinaryEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    return(0);    
+    return(0);
 }
 
 /**
@@ -365,18 +365,18 @@ xmlSecEncCtxBinaryEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl,
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node) {
     xmlOutputBufferPtr output;
     int ret;
-    
+
     xmlSecAssert2(encCtx != NULL, -1);
     xmlSecAssert2(encCtx->result == NULL, -1);
     xmlSecAssert2(tmpl != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(node->doc != NULL, -1);
 
-    /* initialize context and add ID atributes to the list of known ids */    
+    /* initialize context and add ID atributes to the list of known ids */
     encCtx->operation = xmlSecTransformOperationEncrypt;
     xmlSecAddIDs(tmpl->doc, tmpl, xmlSecEncIds);
 
@@ -400,9 +400,9 @@ xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node)
                     "type=bin");
         return(-1);
     }
-    
+
     xmlSecAssert2(encCtx->transformCtx.first != NULL, -1);
-    output = xmlSecTransformCreateOutputBuffer(encCtx->transformCtx.first, 
+    output = xmlSecTransformCreateOutputBuffer(encCtx->transformCtx.first,
                                                 &(encCtx->transformCtx));
     if(output == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -429,12 +429,12 @@ xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node)
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_TYPE,
-                    "type=%s", 
+                    "type=%s",
                     xmlSecErrorsSafeString(encCtx->type));
         xmlOutputBufferClose(output);
-        return(-1);             
+        return(-1);
     }
-    
+
     /* close the buffer and flush everything */
     ret = xmlOutputBufferClose(output);
     if(ret < 0) {
@@ -448,7 +448,7 @@ xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node)
 
     encCtx->result = encCtx->transformCtx.result;
     xmlSecAssert2(encCtx->result != NULL, -1);
-    
+
     ret = xmlSecEncCtxEncDataNodeWrite(encCtx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -458,7 +458,7 @@ xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node)
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     /* now we need to update our original document */
     if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncElement)) {
         /* check if we need to return the replaced node */
@@ -486,10 +486,10 @@ xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node)
             }
         }
 
-            encCtx->resultReplaced = 1;                        
+            encCtx->resultReplaced = 1;
     } else if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncContent)) {
         /* check if we need to return the replaced node */
-        if((encCtx->flags & XMLSEC_ENC_RETURN_REPLACED_NODE) != 0) {        
+        if((encCtx->flags & XMLSEC_ENC_RETURN_REPLACED_NODE) != 0) {
             ret = xmlSecReplaceContentAndReturn(node, tmpl, &(encCtx->replacedNodeList));
             if(ret < 0) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -513,18 +513,18 @@ xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node)
             }
         }
 
-        encCtx->resultReplaced = 1;                            
+        encCtx->resultReplaced = 1;
     } else {
             /* we should've catached this error before */
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_INVALID_TYPE,
-                        "type=%s", 
+                        "type=%s",
                         xmlSecErrorsSafeString(encCtx->type));
-            return(-1);         
+            return(-1);
     }
-    return(0);    
+    return(0);
 }
 
 /**
@@ -537,16 +537,16 @@ xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node)
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecEncCtxUriEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, const xmlChar *uri) {
     int ret;
-    
+
     xmlSecAssert2(encCtx != NULL, -1);
     xmlSecAssert2(encCtx->result == NULL, -1);
     xmlSecAssert2(tmpl != NULL, -1);
     xmlSecAssert2(uri != NULL, -1);
 
-    /* initialize context and add ID atributes to the list of known ids */    
+    /* initialize context and add ID atributes to the list of known ids */
     encCtx->operation = xmlSecTransformOperationEncrypt;
     xmlSecAddIDs(tmpl->doc, tmpl, xmlSecEncIds);
 
@@ -583,10 +583,10 @@ xmlSecEncCtxUriEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, const xmlChar *u
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-        
+
     encCtx->result = encCtx->transformCtx.result;
     xmlSecAssert2(encCtx->result != NULL, -1);
-    
+
     ret = xmlSecEncCtxEncDataNodeWrite(encCtx);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -595,8 +595,8 @@ xmlSecEncCtxUriEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, const xmlChar *u
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
-    
+    }
+
     return(0);
 }
 
@@ -609,14 +609,14 @@ xmlSecEncCtxUriEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, const xmlChar *u
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
     xmlSecBufferPtr buffer;
     int ret;
-    
+
     xmlSecAssert2(encCtx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     /* decrypt */
     buffer = xmlSecEncCtxDecryptToBuffer(encCtx, node);
     if(buffer == NULL) {
@@ -627,7 +627,7 @@ xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     /* replace original node if requested */
     if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncElement)) {
         /* check if we need to return the replaced node */
@@ -640,7 +640,7 @@ xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                                 "node=%s",
                                 xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
-                    return(-1);         
+                    return(-1);
                 }
         } else {
                 ret = xmlSecReplaceNodeBuffer(node, xmlSecBufferGetData(buffer),  xmlSecBufferGetSize(buffer));
@@ -651,11 +651,11 @@ xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                                 "node=%s",
                                 xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
-                    return(-1);         
+                    return(-1);
                 }
         }
 
-        encCtx->resultReplaced = 1;                            
+        encCtx->resultReplaced = 1;
     } else if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncContent)) {
         /* replace the node with the buffer */
 
@@ -669,8 +669,8 @@ xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                                 "node=%s",
                                 xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
-                    return(-1);         
-                }       
+                    return(-1);
+                }
         } else {
             ret = xmlSecReplaceNodeBuffer(node, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer));
                 if(ret < 0) {
@@ -680,10 +680,10 @@ xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                                 XMLSEC_ERRORS_R_XMLSEC_FAILED,
                                 "node=%s",
                                 xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
-                    return(-1);         
-                }         
+                    return(-1);
+                }
         }
-        encCtx->resultReplaced = 1;                            
+        encCtx->resultReplaced = 1;
     }
 
     return(0);
@@ -693,7 +693,7 @@ xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
  * xmlSecEncCtxDecryptToBuffer:
  * @encCtx:             the pointer to <enc:EncryptedData/> processing context.
  * @node:               the pointer to <enc:EncryptedData/> node.
- * 
+ *
  * Decrypts @node data to the @encCtx buffer.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -701,12 +701,12 @@ xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
 xmlSecBufferPtr
 xmlSecEncCtxDecryptToBuffer(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
     int ret;
-    
+
     xmlSecAssert2(encCtx != NULL, NULL);
     xmlSecAssert2(encCtx->result == NULL, NULL);
     xmlSecAssert2(node != NULL, NULL);
 
-    /* initialize context and add ID atributes to the list of known ids */    
+    /* initialize context and add ID atributes to the list of known ids */
     encCtx->operation = xmlSecTransformOperationDecrypt;
     xmlSecAddIDs(node->doc, node, xmlSecEncIds);
 
@@ -733,7 +733,7 @@ xmlSecEncCtxDecryptToBuffer(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                         XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(NULL);
-        }       
+        }
         dataSize = xmlStrlen(data);
 
         ret = xmlSecTransformCtxBinaryExecute(&(encCtx->transformCtx), data, dataSize);
@@ -762,18 +762,18 @@ xmlSecEncCtxDecryptToBuffer(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
             return(NULL);
         }
     }
-    
+
     encCtx->result = encCtx->transformCtx.result;
     xmlSecAssert2(encCtx->result != NULL, NULL);
-    
+
     return(encCtx->result);
 }
 
-static int 
+static int
 xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(encCtx != NULL, -1);
     xmlSecAssert2((encCtx->operation == xmlSecTransformOperationEncrypt) || (encCtx->operation == xmlSecTransformOperationDecrypt), -1);
     xmlSecAssert2(node != NULL, -1);
@@ -787,7 +787,7 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                             XMLSEC_ERRORS_R_INVALID_NODE,
                             "expected=%s",
                             xmlSecErrorsSafeString(xmlSecNodeEncryptedData));
-                return(-1);         
+                return(-1);
             }
             break;
         case xmlEncCtxModeEncryptedKey:
@@ -798,11 +798,11 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                             XMLSEC_ERRORS_R_INVALID_NODE,
                             "expected=%s",
                             xmlSecErrorsSafeString(xmlSecNodeEncryptedKey));
-                return(-1);         
+                return(-1);
             }
             break;
     }
-    
+
     /* first read node data */
     xmlSecAssert2(encCtx->id == NULL, -1);
     xmlSecAssert2(encCtx->type == NULL, -1);
@@ -810,17 +810,17 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
     xmlSecAssert2(encCtx->encoding == NULL, -1);
     xmlSecAssert2(encCtx->recipient == NULL, -1);
     xmlSecAssert2(encCtx->carriedKeyName == NULL, -1);
-    
+
     encCtx->id = xmlGetProp(node, xmlSecAttrId);
     encCtx->type = xmlGetProp(node, xmlSecAttrType);
     encCtx->mimeType = xmlGetProp(node, xmlSecAttrMimeType);
-    encCtx->encoding = xmlGetProp(node, xmlSecAttrEncoding);    
+    encCtx->encoding = xmlGetProp(node, xmlSecAttrEncoding);
     if(encCtx->mode == xmlEncCtxModeEncryptedKey) {
-        encCtx->recipient = xmlGetProp(node, xmlSecAttrRecipient);    
+        encCtx->recipient = xmlGetProp(node, xmlSecAttrRecipient);
         /* todo: check recipient? */
     }
     cur = xmlSecGetNextElementNode(node->children);
-    
+
     /* first node is optional EncryptionMethod, we'll read it later */
     xmlSecAssert2(encCtx->encMethodNode == NULL, -1);
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeEncryptionMethod, xmlSecEncNs))) {
@@ -833,7 +833,7 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs))) {
         encCtx->keyInfoNode = cur;
         cur = xmlSecGetNextElementNode(cur->next);
-    }    
+    }
 
     /* next is required CipherData node */
     if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeCipherData, xmlSecEncNs))) {
@@ -845,7 +845,7 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                     xmlSecErrorsSafeString(xmlSecNodeCipherData));
         return(-1);
     }
-    
+
     ret = xmlSecEncCtxCipherDataNodeRead(encCtx, cur);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -908,10 +908,10 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->encMethodNode)));
-            return(-1);     
-        }       
+            return(-1);
+        }
     } else if(encCtx->defEncMethodId != xmlSecTransformIdUnknown) {
-        encCtx->encMethod = xmlSecTransformCtxCreateAndAppend(&(encCtx->transformCtx), 
+        encCtx->encMethod = xmlSecTransformCtxCreateAndAppend(&(encCtx->transformCtx),
                                                               encCtx->defEncMethodId);
         if(encCtx->encMethod == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -930,7 +930,7 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
         return(-1);
     }
     encCtx->encMethod->operation = encCtx->operation;
-    
+
     /* we have encryption method, find key */
     ret = xmlSecTransformSetKeyReq(encCtx->encMethod, &(encCtx->keyInfoReadCtx.keyReq));
     if(ret < 0) {
@@ -941,17 +941,17 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                     "transform=%s",
                     xmlSecErrorsSafeString(xmlSecTransformGetName(encCtx->encMethod)));
         return(-1);
-    }   
+    }
 
-    /* TODO: KeyInfo node != NULL and encKey != NULL */         
-    if((encCtx->encKey == NULL) && (encCtx->keyInfoReadCtx.keysMngr != NULL) 
+    /* TODO: KeyInfo node != NULL and encKey != NULL */
+    if((encCtx->encKey == NULL) && (encCtx->keyInfoReadCtx.keysMngr != NULL)
                         && (encCtx->keyInfoReadCtx.keysMngr->getKey != NULL)) {
-        encCtx->encKey = (encCtx->keyInfoReadCtx.keysMngr->getKey)(encCtx->keyInfoNode, 
+        encCtx->encKey = (encCtx->keyInfoReadCtx.keysMngr->getKey)(encCtx->keyInfoNode,
                                                              &(encCtx->keyInfoReadCtx));
     }
-    
+
     /* check that we have exactly what we want */
-    if((encCtx->encKey == NULL) || 
+    if((encCtx->encKey == NULL) ||
        (!xmlSecKeyMatch(encCtx->encKey, NULL, &(encCtx->keyInfoReadCtx.keyReq)))) {
 
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -961,7 +961,7 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     /* set the key to the transform */
     ret = xmlSecTransformSetKey(encCtx->encMethod, encCtx->encKey);
     if(ret < 0) {
@@ -975,9 +975,9 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
     }
 
     /* if we need to write result to xml node then we need base64 encode it */
-    if((encCtx->operation == xmlSecTransformOperationEncrypt) && (encCtx->cipherValueNode != NULL)) {   
+    if((encCtx->operation == xmlSecTransformOperationEncrypt) && (encCtx->cipherValueNode != NULL)) {
         xmlSecTransformPtr base64Encode;
-        
+
         /* we need to add base64 encode transform */
         base64Encode = xmlSecTransformCtxCreateAndAppend(&(encCtx->transformCtx), xmlSecTransformBase64Id);
         if(base64Encode == NULL) {
@@ -991,20 +991,20 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
         base64Encode->operation         = xmlSecTransformOperationEncode;
         encCtx->resultBase64Encoded     = 1;
     }
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecEncCtxEncDataNodeWrite(xmlSecEncCtxPtr encCtx) {
     int ret;
-    
+
     xmlSecAssert2(encCtx != NULL, -1);
     xmlSecAssert2(encCtx->result != NULL, -1);
     xmlSecAssert2(encCtx->encKey != NULL, -1);
-    
+
     /* write encrypted data to xml (if requested) */
-    if(encCtx->cipherValueNode != NULL) {       
+    if(encCtx->cipherValueNode != NULL) {
         xmlSecAssert2(xmlSecBufferGetData(encCtx->result) != NULL, -1);
 
         xmlNodeSetContentLen(encCtx->cipherValueNode,
@@ -1023,29 +1023,29 @@ xmlSecEncCtxEncDataNodeWrite(xmlSecEncCtxPtr encCtx) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
+        }
     }
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecEncCtxCipherDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
     xmlNodePtr cur;
     int ret;
-    
+
     xmlSecAssert2(encCtx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     cur = xmlSecGetNextElementNode(node->children);
-    
+
     /* we either have CipherValue or CipherReference node  */
     xmlSecAssert2(encCtx->cipherValueNode == NULL, -1);
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCipherValue, xmlSecEncNs))) {
         /* don't need data from CipherData node when we are encrypting */
         if(encCtx->operation == xmlSecTransformOperationDecrypt) {
             xmlSecTransformPtr base64Decode;
-        
+
             /* we need to add base64 decode transform */
             base64Decode = xmlSecTransformCtxCreateAndPrepend(&(encCtx->transformCtx), xmlSecTransformBase64Id);
             if(base64Decode == NULL) {
@@ -1070,12 +1070,12 @@ xmlSecEncCtxCipherDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                             XMLSEC_ERRORS_R_XMLSEC_FAILED,
                             "node=%s",
                             xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
-                return(-1);         
+                return(-1);
             }
-        }       
+        }
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -1087,15 +1087,15 @@ xmlSecEncCtxCipherDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
     return(0);
 }
 
-static int 
+static int
 xmlSecEncCtxCipherReferenceNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
     xmlNodePtr cur;
     xmlChar* uri;
     int ret;
-    
+
     xmlSecAssert2(encCtx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
-    
+
     /* first read the optional uri attr and check that we can process it */
     uri = xmlGetProp(node, xmlSecAttrURI);
     ret = xmlSecTransformCtxSetUri(&(encCtx->transformCtx), uri, node);
@@ -1107,12 +1107,12 @@ xmlSecEncCtxCipherReferenceNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                     "uri=%s",
                     xmlSecErrorsSafeString(uri));
         xmlFree(uri);
-        return(-1);         
-    }           
+        return(-1);
+    }
     xmlFree(uri);
 
     cur = xmlSecGetNextElementNode(node->children);
-    
+
     /* the only one node is optional Transforms node */
     if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeTransforms, xmlSecEncNs))) {
         ret = xmlSecTransformCtxNodesListRead(&(encCtx->transformCtx), cur,
@@ -1124,11 +1124,11 @@ xmlSecEncCtxCipherReferenceNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->encMethodNode)));
-            return(-1);     
-        }       
+            return(-1);
+        }
         cur = xmlSecGetNextElementNode(cur->next);
     }
-    
+
     /* if there is something left than it's an error */
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1148,21 +1148,21 @@ xmlSecEncCtxCipherReferenceNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
  *
  * Prints the debug information about @encCtx to @output.
  */
-void 
+void
 xmlSecEncCtxDebugDump(xmlSecEncCtxPtr encCtx, FILE* output) {
     xmlSecAssert(encCtx != NULL);
     xmlSecAssert(output != NULL);
 
     switch(encCtx->mode) {
         case xmlEncCtxModeEncryptedData:
-            if(encCtx->operation == xmlSecTransformOperationEncrypt) {    
+            if(encCtx->operation == xmlSecTransformOperationEncrypt) {
                 fprintf(output, "= DATA ENCRYPTION CONTEXT\n");
             } else {
                 fprintf(output, "= DATA DECRYPTION CONTEXT\n");
             }
             break;
         case xmlEncCtxModeEncryptedKey:
-            if(encCtx->operation == xmlSecTransformOperationEncrypt) {    
+            if(encCtx->operation == xmlSecTransformOperationEncrypt) {
                 fprintf(output, "= KEY ENCRYPTION CONTEXT\n");
             } else {
                 fprintf(output, "= KEY DECRYPTION CONTEXT\n");
@@ -1193,7 +1193,7 @@ xmlSecEncCtxDebugDump(xmlSecEncCtxPtr encCtx, FILE* output) {
     if(encCtx->carriedKeyName != NULL) {
         fprintf(output, "== CarriedKeyName: \"%s\"\n", encCtx->carriedKeyName);
     }
-    
+
     fprintf(output, "== Key Info Read Ctx:\n");
     xmlSecKeyInfoCtxDebugDump(&(encCtx->keyInfoReadCtx), output);
 
@@ -1212,13 +1212,13 @@ xmlSecEncCtxDebugDump(xmlSecEncCtxPtr encCtx, FILE* output) {
         fprintf(output, "== Encryption Key:\n");
         xmlSecKeyDebugDump(encCtx->encKey, output);
     }
-    
-    if((encCtx->result != NULL) && 
-       (xmlSecBufferGetData(encCtx->result) != NULL) && 
+
+    if((encCtx->result != NULL) &&
+       (xmlSecBufferGetData(encCtx->result) != NULL) &&
        (encCtx->resultBase64Encoded != 0)) {
 
         fprintf(output, "== Result - start buffer:\n");
-        fwrite(xmlSecBufferGetData(encCtx->result), 
+        fwrite(xmlSecBufferGetData(encCtx->result),
                xmlSecBufferGetSize(encCtx->result), 1,
                output);
         fprintf(output, "\n== Result - end buffer\n");
@@ -1232,21 +1232,21 @@ xmlSecEncCtxDebugDump(xmlSecEncCtxPtr encCtx, FILE* output) {
  *
  * Prints the debug information about @encCtx to @output in XML format.
  */
-void 
+void
 xmlSecEncCtxDebugXmlDump(xmlSecEncCtxPtr encCtx, FILE* output) {
     xmlSecAssert(encCtx != NULL);
     xmlSecAssert(output != NULL);
 
     switch(encCtx->mode) {
         case xmlEncCtxModeEncryptedData:
-            if(encCtx->operation == xmlSecTransformOperationEncrypt) {    
+            if(encCtx->operation == xmlSecTransformOperationEncrypt) {
                 fprintf(output, "<DataEncryptionContext ");
             } else {
                 fprintf(output, "<DataDecryptionContext ");
             }
             break;
         case xmlEncCtxModeEncryptedKey:
-            if(encCtx->operation == xmlSecTransformOperationEncrypt) {    
+            if(encCtx->operation == xmlSecTransformOperationEncrypt) {
                 fprintf(output, "<KeyEncryptionContext ");
             } else {
                 fprintf(output, "<KeyDecryptionContext ");
@@ -1265,7 +1265,7 @@ xmlSecEncCtxDebugXmlDump(xmlSecEncCtxPtr encCtx, FILE* output) {
     fprintf(output, "<Type>");
     xmlSecPrintXmlString(output, encCtx->type);
     fprintf(output, "</Type>");
-    
+
     fprintf(output, "<MimeType>");
     xmlSecPrintXmlString(output, encCtx->mimeType);
     fprintf(output, "</MimeType>");
@@ -1305,13 +1305,13 @@ xmlSecEncCtxDebugXmlDump(xmlSecEncCtxPtr encCtx, FILE* output) {
         xmlSecKeyDebugXmlDump(encCtx->encKey, output);
         fprintf(output, "</EncryptionKey>\n");
     }
-    
-    if((encCtx->result != NULL) && 
-       (xmlSecBufferGetData(encCtx->result) != NULL) && 
+
+    if((encCtx->result != NULL) &&
+       (xmlSecBufferGetData(encCtx->result) != NULL) &&
        (encCtx->resultBase64Encoded != 0)) {
 
         fprintf(output, "<Result>");
-        fwrite(xmlSecBufferGetData(encCtx->result), 
+        fwrite(xmlSecBufferGetData(encCtx->result),
                xmlSecBufferGetSize(encCtx->result), 1,
                output);
         fprintf(output, "</Result>\n");
@@ -1319,14 +1319,14 @@ xmlSecEncCtxDebugXmlDump(xmlSecEncCtxPtr encCtx, FILE* output) {
 
     switch(encCtx->mode) {
         case xmlEncCtxModeEncryptedData:
-            if(encCtx->operation == xmlSecTransformOperationEncrypt) {    
+            if(encCtx->operation == xmlSecTransformOperationEncrypt) {
                 fprintf(output, "</DataEncryptionContext>\n");
             } else {
                 fprintf(output, "</DataDecryptionContext>\n");
             }
             break;
         case xmlEncCtxModeEncryptedKey:
-            if(encCtx->operation == xmlSecTransformOperationEncrypt) {    
+            if(encCtx->operation == xmlSecTransformOperationEncrypt) {
                 fprintf(output, "</KeyEncryptionContext>\n");
             } else {
                 fprintf(output, "</KeyDecryptionContext>\n");
diff --git a/src/xmlsec.c b/src/xmlsec.c
index a1b25d4..2f7e7f6 100644
--- a/src/xmlsec.c
+++ b/src/xmlsec.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * General functions.
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -36,7 +36,7 @@ int
 xmlSecInit(void) {
     xmlSecErrorsInit();
     xmlSecIOInit();
-    
+
 #ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING
     if(xmlSecCryptoDLInit() < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -47,7 +47,7 @@ xmlSecInit(void) {
         return(-1);
     }
 #endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */
-    
+
     if(xmlSecKeyDataIdsInit() < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -56,7 +56,7 @@ xmlSecInit(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     if(xmlSecTransformIdsInit() < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -65,8 +65,8 @@ xmlSecInit(void) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
-#ifndef XMLSEC_NO_XKMS    
+
+#ifndef XMLSEC_NO_XKMS
     if(xmlSecXkmsRespondWithIdsInit() < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
@@ -99,9 +99,9 @@ xmlSecInit(void) {
  */
 int
 xmlSecShutdown(void) {
-    int res = 0;    
+    int res = 0;
 
-#ifndef XMLSEC_NO_XKMS    
+#ifndef XMLSEC_NO_XKMS
     xmlSecXkmsServerRequestIdsShutdown();
     xmlSecXkmsRespondWithIdsShutdown();
 #endif /* XMLSEC_NO_XKMS */
@@ -121,11 +121,11 @@ xmlSecShutdown(void) {
 #endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */
 
     xmlSecIOShutdown();
-    xmlSecErrorsShutdown();    
+    xmlSecErrorsShutdown();
     return(res);
 }
 
-/** 
+/**
  * xmlSecCheckVersionExt:
  * @major:              the major version number.
  * @minor:              the minor version number.
@@ -137,11 +137,11 @@ xmlSecShutdown(void) {
  * Returns: 1 if the loaded xmlsec library version is OK to use
  * 0 if it is not or a negative value if an error occurs.
  */
-int 
+int
 xmlSecCheckVersionExt(int major, int minor, int subminor, xmlSecCheckVersionMode mode) {
     /* we always want to have a match for major version number */
     if(major != XMLSEC_VERSION_MAJOR) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     NULL,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -149,11 +149,11 @@ xmlSecCheckVersionExt(int major, int minor, int subminor, xmlSecCheckVersionMode
                     XMLSEC_VERSION_MAJOR, major);
         return(0);
     }
-    
+
     switch(mode) {
     case xmlSecCheckVersionExactMatch:
         if((minor != XMLSEC_VERSION_MINOR) || (subminor != XMLSEC_VERSION_SUBMINOR)) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -165,9 +165,9 @@ xmlSecCheckVersionExt(int major, int minor, int subminor, xmlSecCheckVersionMode
         break;
     case xmlSecCheckVersionABICompatible:
         if((minor < XMLSEC_VERSION_MINOR) ||
-           ((minor == XMLSEC_VERSION_MINOR) && 
+           ((minor == XMLSEC_VERSION_MINOR) &&
             (subminor < XMLSEC_VERSION_SUBMINOR))) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         NULL,
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
@@ -178,7 +178,7 @@ xmlSecCheckVersionExt(int major, int minor, int subminor, xmlSecCheckVersionMode
         }
         break;
     }
-    
+
     return(1);
 }
 
diff --git a/src/xmltree.c b/src/xmltree.c
index b7d9cd0..27ad09e 100644
--- a/src/xmltree.c
+++ b/src/xmltree.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * Common XML Doc utility functions
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -14,7 +14,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
- 
+
 #include <libxml/tree.h>
 #include <libxml/valid.h>
 #include <libxml/xpath.h>
@@ -33,19 +33,19 @@
  * @name:               the name.
  * @ns:                 the namespace href (may be NULL).
  *
- * Searches a direct child of the @parent node having given name and 
+ * Searches a direct child of the @parent node having given name and
  * namespace href.
- * 
- * Returns: the pointer to the found node or NULL if an error occurs or 
+ *
+ * Returns: the pointer to the found node or NULL if an error occurs or
  * node is not found.
  */
 xmlNodePtr
 xmlSecFindChild(const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) {
     xmlNodePtr cur;
-        
+
     xmlSecAssert2(parent != NULL, NULL);
     xmlSecAssert2(name != NULL, NULL);
-    
+
     cur = parent->children;
     while(cur != NULL) {
         if(cur->type == XML_ELEMENT_NODE) {
@@ -64,16 +64,16 @@ xmlSecFindChild(const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns)
  * @name:               the name.
  * @ns:                 the namespace href (may be NULL).
  *
- * Searches the ancestors axis of the @cur node for a node having given name 
+ * Searches the ancestors axis of the @cur node for a node having given name
  * and namespace href.
- * 
- * Returns: the pointer to the found node or NULL if an error occurs or 
+ *
+ * Returns: the pointer to the found node or NULL if an error occurs or
  * node is not found.
  */
 xmlNodePtr
 xmlSecFindParent(const xmlNodePtr cur, const xmlChar *name, const xmlChar *ns) {
     xmlSecAssert2(cur != NULL, NULL);
-    xmlSecAssert2(name != NULL, NULL);        
+    xmlSecAssert2(name != NULL, NULL);
 
     if(xmlSecCheckNodeName(cur, name, ns)) {
         return(cur);
@@ -89,19 +89,19 @@ xmlSecFindParent(const xmlNodePtr cur, const xmlChar *name, const xmlChar *ns) {
  * @name:               the name.
  * @ns:                 the namespace href (may be NULL).
  *
- * Searches all children of the @parent node having given name and 
+ * Searches all children of the @parent node having given name and
  * namespace href.
- * 
- * Returns: the pointer to the found node or NULL if an error occurs or 
+ *
+ * Returns: the pointer to the found node or NULL if an error occurs or
  * node is not found.
  */
-xmlNodePtr              
+xmlNodePtr
 xmlSecFindNode(const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) {
     xmlNodePtr cur;
     xmlNodePtr ret;
-        
-    xmlSecAssert2(name != NULL, NULL); 
-    
+
+    xmlSecAssert2(name != NULL, NULL);
+
     cur = parent;
     while(cur != NULL) {
         if((cur->type == XML_ELEMENT_NODE) && xmlSecCheckNodeName(cur, name, ns)) {
@@ -110,7 +110,7 @@ xmlSecFindNode(const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns)
         if(cur->children != NULL) {
             ret = xmlSecFindNode(cur->children, name, ns);
             if(ret != NULL) {
-                return(ret);        
+                return(ret);
             }
         }
         cur = cur->next;
@@ -126,27 +126,27 @@ xmlSecFindNode(const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns)
  *
  * Returns: node's namespace href.
  */
-const xmlChar* 
+const xmlChar*
 xmlSecGetNodeNsHref(const xmlNodePtr cur) {
     xmlNsPtr ns;
-    
+
     xmlSecAssert2(cur != NULL, NULL);
-    
+
     /* do we have a namespace in the node? */
     if(cur->ns != NULL) {
         return(cur->ns->href);
     }
-    
+
     /* search for default namespace */
     ns = xmlSearchNs(cur->doc, cur, NULL);
     if(ns != NULL) {
         return(ns->href);
     }
-        
+
     return(NULL);
 }
 
-/** 
+/**
  * xmlSecCheckNodeName:
  * @cur:                the pointer to an XML node.
  * @name:               the name,
@@ -159,8 +159,8 @@ xmlSecGetNodeNsHref(const xmlNodePtr cur) {
 int
 xmlSecCheckNodeName(const xmlNodePtr cur, const xmlChar *name, const xmlChar *ns) {
     xmlSecAssert2(cur != NULL, 0);
-    
-    return(xmlStrEqual(cur->name, name) && 
+
+    return(xmlStrEqual(cur->name, name) &&
            xmlStrEqual(xmlSecGetNodeNsHref(cur), ns));
 }
 
@@ -174,18 +174,18 @@ xmlSecCheckNodeName(const xmlNodePtr cur, const xmlChar *name, const xmlChar *ns
  *
  * Returns: pointer to the new node or NULL if an error occurs.
  */
-xmlNodePtr              
+xmlNodePtr
 xmlSecAddChild(xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) {
     xmlNodePtr cur;
     xmlNodePtr text;
 
     xmlSecAssert2(parent != NULL, NULL);
-    xmlSecAssert2(name != NULL, NULL);        
+    xmlSecAssert2(name != NULL, NULL);
 
     if(parent->children == NULL) {
         /* TODO: add indents */
-        text = xmlNewText(xmlSecStringCR); 
-        if(text == NULL) {      
+        text = xmlNewText(xmlSecStringCR);
+        if(text == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlNewText",
@@ -209,7 +209,7 @@ xmlSecAddChild(xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) {
     /* namespaces support */
     if(ns != NULL) {
         xmlNsPtr nsPtr;
-        
+
         /* find namespace by href and check that its prefix is not overwritten */
         nsPtr = xmlSearchNsByHref(cur->doc, cur, ns);
         if((nsPtr == NULL) || (xmlSearchNs(cur->doc, cur, nsPtr->prefix) != nsPtr)) {
@@ -217,10 +217,10 @@ xmlSecAddChild(xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) {
         }
         xmlSetNs(cur, nsPtr);
     }
-    
+
     /* TODO: add indents */
-    text = xmlNewText(xmlSecStringCR); 
-    if(text == NULL) {  
+    text = xmlNewText(xmlSecStringCR);
+    if(text == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlNewText",
@@ -242,17 +242,17 @@ xmlSecAddChild(xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) {
  *
  * Returns: pointer to the new node or NULL if an error occurs.
  */
-xmlNodePtr              
+xmlNodePtr
 xmlSecAddChildNode(xmlNodePtr parent, xmlNodePtr child) {
     xmlNodePtr text;
 
     xmlSecAssert2(parent != NULL, NULL);
-    xmlSecAssert2(child != NULL, NULL);        
+    xmlSecAssert2(child != NULL, NULL);
 
     if(parent->children == NULL) {
         /* TODO: add indents */
-        text = xmlNewText(xmlSecStringCR); 
-        if(text == NULL) {      
+        text = xmlNewText(xmlSecStringCR);
+        if(text == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlNewText",
@@ -266,8 +266,8 @@ xmlSecAddChildNode(xmlNodePtr parent, xmlNodePtr child) {
     xmlAddChild(parent, child);
 
     /* TODO: add indents */
-    text = xmlNewText(xmlSecStringCR); 
-    if(text == NULL) {  
+    text = xmlNewText(xmlSecStringCR);
+    if(text == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlNewText",
@@ -296,7 +296,7 @@ xmlSecAddNextSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
     xmlNodePtr text;
 
     xmlSecAssert2(node != NULL, NULL);
-    xmlSecAssert2(name != NULL, NULL);    
+    xmlSecAssert2(name != NULL, NULL);
 
     cur = xmlNewNode(NULL, name);
     if(cur == NULL) {
@@ -312,7 +312,7 @@ xmlSecAddNextSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
     /* namespaces support */
     if(ns != NULL) {
         xmlNsPtr nsPtr;
-        
+
         /* find namespace by href and check that its prefix is not overwritten */
         nsPtr = xmlSearchNsByHref(cur->doc, cur, ns);
         if((nsPtr == NULL) || (xmlSearchNs(cur->doc, cur, nsPtr->prefix) != nsPtr)) {
@@ -323,7 +323,7 @@ xmlSecAddNextSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
 
     /* TODO: add indents */
     text = xmlNewText(xmlSecStringCR);
-    if(text == NULL) {  
+    if(text == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlNewText",
@@ -332,7 +332,7 @@ xmlSecAddNextSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
         return(NULL);
     }
     xmlAddNextSibling(node, text);
-    
+
     return(cur);
 }
 
@@ -352,7 +352,7 @@ xmlSecAddPrevSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
     xmlNodePtr text;
 
     xmlSecAssert2(node != NULL, NULL);
-    xmlSecAssert2(name != NULL, NULL);    
+    xmlSecAssert2(name != NULL, NULL);
 
     cur = xmlNewNode(NULL, name);
     if(cur == NULL) {
@@ -368,7 +368,7 @@ xmlSecAddPrevSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
     /* namespaces support */
     if(ns != NULL) {
         xmlNsPtr nsPtr;
-        
+
         /* find namespace by href and check that its prefix is not overwritten */
         nsPtr = xmlSearchNsByHref(cur->doc, cur, ns);
         if((nsPtr == NULL) || (xmlSearchNs(cur->doc, cur, nsPtr->prefix) != nsPtr)) {
@@ -379,7 +379,7 @@ xmlSecAddPrevSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
 
     /* TODO: add indents */
     text = xmlNewText(xmlSecStringCR);
-    if(text == NULL) {  
+    if(text == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlNewText",
@@ -402,7 +402,7 @@ xmlSecAddPrevSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
  */
 xmlNodePtr
 xmlSecGetNextElementNode(xmlNodePtr cur) {
-    
+
     while((cur != NULL) && (cur->type != XML_ELEMENT_NODE)) {
         cur = cur->next;
     }
@@ -413,7 +413,7 @@ xmlSecGetNextElementNode(xmlNodePtr cur) {
  * xmlSecReplaceNode:
  * @node:               the current node.
  * @newNode:            the new node.
- * 
+ *
  * Swaps the @node and @newNode in the XML tree.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -423,12 +423,12 @@ xmlSecReplaceNode(xmlNodePtr node, xmlNodePtr newNode) {
     return xmlSecReplaceNodeAndReturn(node, newNode, NULL);
 }
 
-/**                 
+/**
  * xmlSecReplaceNodeAndReturn:
  * @node:               the current node.
  * @newNode:            the new node.
  * @replaced:           the replaced node, or release it if NULL is given
- * 
+ *
  * Swaps the @node and @newNode in the XML tree.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -437,9 +437,9 @@ int
 xmlSecReplaceNodeAndReturn(xmlNodePtr node, xmlNodePtr newNode, xmlNodePtr* replaced) {
     xmlNodePtr oldNode;
     int restoreRoot = 0;
-    
+
     xmlSecAssert2(node != NULL, -1);
-    xmlSecAssert2(newNode != NULL, -1);    
+    xmlSecAssert2(newNode != NULL, -1);
 
     /* fix documents children if necessary first */
     if((node->doc != NULL) && (node->doc->children == node)) {
@@ -466,11 +466,11 @@ xmlSecReplaceNodeAndReturn(xmlNodePtr node, xmlNodePtr newNode, xmlNodePtr* repl
 
     /* return the old node if requested */
     if(replaced != NULL) {
-        (*replaced) = oldNode;                  
+        (*replaced) = oldNode;
     } else {
-        xmlFreeNode(oldNode); 
+        xmlFreeNode(oldNode);
     }
-   
+
     return(0);
 }
 
@@ -478,7 +478,7 @@ xmlSecReplaceNodeAndReturn(xmlNodePtr node, xmlNodePtr newNode, xmlNodePtr* repl
  * xmlSecReplaceContent
  * @node:               the current node.
  * @newNode:            the new node.
- * 
+ *
  * Swaps the content of @node and @newNode.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -493,7 +493,7 @@ xmlSecReplaceContent(xmlNodePtr node, xmlNodePtr newNode) {
  * @node:               the current node.
  * @newNode:            the new node.
  * @replaced:           the replaced nodes, or release them if NULL is given
- * 
+ *
  * Swaps the content of @node and @newNode.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -501,7 +501,7 @@ xmlSecReplaceContent(xmlNodePtr node, xmlNodePtr newNode) {
 int
 xmlSecReplaceContentAndReturn(xmlNodePtr node, xmlNodePtr newNode, xmlNodePtr *replaced) {
     xmlSecAssert2(node != NULL, -1);
-    xmlSecAssert2(newNode != NULL, -1);  
+    xmlSecAssert2(newNode != NULL, -1);
 
     xmlUnlinkNode(newNode);
     xmlSetTreeDoc(newNode, node->doc);
@@ -514,13 +514,13 @@ xmlSecReplaceContentAndReturn(xmlNodePtr node, xmlNodePtr newNode, xmlNodePtr *r
         for(cur = node->children; (cur != NULL); cur = next) {
             next = cur->next;
             if((*replaced) != NULL) {
-                /* n is unlinked in this function */            
-                xmlAddNextSibling(tail, cur); 
+                /* n is unlinked in this function */
+                xmlAddNextSibling(tail, cur);
                 tail = cur;
             } else {
                 /* this is the first node, (*replaced) is the head */
                 xmlUnlinkNode(cur);
-                (*replaced) = tail = cur;           
+                (*replaced) = tail = cur;
           }
         }
     } else {
@@ -539,7 +539,7 @@ xmlSecReplaceContentAndReturn(xmlNodePtr node, xmlNodePtr newNode, xmlNodePtr *r
  * @node:               the current node.
  * @buffer:             the XML data.
  * @size:               the XML data size.
- * 
+ *
  * Swaps the @node and the parsed XML data from the @buffer in the XML tree.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -555,7 +555,7 @@ xmlSecReplaceNodeBuffer(xmlNodePtr node, const xmlSecByte *buffer, xmlSecSize si
  * @buffer:             the XML data.
  * @size:               the XML data size.
  * @replaced:           the replaced nodes, or release them if NULL is given
- * 
+ *
  * Swaps the @node and the parsed XML data from the @buffer in the XML tree.
  *
  * Returns: 0 on success or a negative value if an error occurs.
@@ -575,7 +575,7 @@ xmlSecReplaceNodeBufferAndReturn(xmlNodePtr node, const xmlSecByte *buffer, xmlS
                     "xmlParseInNodeContext",
                     XMLSEC_ERRORS_R_XML_FAILED,
                     "Failed to parse content");
-        return(-1);         
+        return(-1);
     }
 
     /* add new nodes */
@@ -590,9 +590,9 @@ xmlSecReplaceNodeBufferAndReturn(xmlNodePtr node, const xmlSecByte *buffer, xmlS
 
     /* return the old node if requested */
     if(replaced != NULL) {
-        (*replaced) = node;             
+        (*replaced) = node;
     } else {
-        xmlFreeNode(node); 
+        xmlFreeNode(node);
     }
 
     return(0);
@@ -612,18 +612,18 @@ int
 xmlSecNodeEncodeAndSetContent(xmlNodePtr node, const xmlChar * buffer) {
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(node->doc != NULL, -1);
-    
+
     if(buffer != NULL) {
             xmlChar * tmp;
 
-        tmp = xmlEncodeSpecialChars(node->doc, buffer);        
+        tmp = xmlEncodeSpecialChars(node->doc, buffer);
         if (tmp == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlEncodeSpecialChars",
                         XMLSEC_ERRORS_R_XML_FAILED,
                         "Failed to encode special characters");
-            return(-1);         
+            return(-1);
         }
 
         xmlNodeSetContent(node, tmp);
@@ -641,22 +641,22 @@ xmlSecNodeEncodeAndSetContent(xmlNodePtr node, const xmlChar * buffer) {
  * @cur:                the pointer to an XML node.
  * @ids:                the pointer to a NULL terminated list of ID attributes.
  *
- * Walks thru all children of the @cur node and adds all attributes 
+ * Walks thru all children of the @cur node and adds all attributes
  * from the @ids list to the @doc document IDs attributes hash.
  */
-void    
+void
 xmlSecAddIDs(xmlDocPtr doc, xmlNodePtr cur, const xmlChar** ids) {
     xmlNodePtr children = NULL;
 
     xmlSecAssert(doc != NULL);
-    xmlSecAssert(ids != NULL);    
-    
+    xmlSecAssert(ids != NULL);
+
     if((cur != NULL) && (cur->type == XML_ELEMENT_NODE)) {
         xmlAttrPtr attr;
         xmlAttrPtr tmp;
         int i;
         xmlChar* name;
-        
+
         for(attr = cur->properties; attr != NULL; attr = attr->next) {
             for(i = 0; ids[i] != NULL; ++i) {
                 if(xmlStrEqual(attr->name, ids[i])) {
@@ -670,20 +670,20 @@ xmlSecAddIDs(xmlDocPtr doc, xmlNodePtr cur, const xmlChar** ids) {
                                         NULL,
                                         NULL,
                                         XMLSEC_ERRORS_R_INVALID_DATA,
-                                        "id=%s already defined", 
+                                        "id=%s already defined",
                                         xmlSecErrorsSafeString(name));
                         }
                         xmlFree(name);
-                    }               
+                    }
                 }
             }
         }
-        
+
         children = cur->children;
     } else if(cur == NULL) {
         children = doc->children;
     }
-    
+
     while(children != NULL) {
         if(children->type == XML_ELEMENT_NODE) {
             xmlSecAddIDs(doc, children, ids);
@@ -704,13 +704,13 @@ xmlSecAddIDs(xmlDocPtr doc, xmlNodePtr cur, const xmlChar** ids) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecGenerateAndAddID(xmlNodePtr node, const xmlChar* attrName, const xmlChar* prefix, xmlSecSize len) {
     xmlChar* id;
     int count;
-    
-    xmlSecAssert2(node != NULL, -1);    
-    xmlSecAssert2(attrName != NULL, -1);    
+
+    xmlSecAssert2(node != NULL, -1);
+    xmlSecAssert2(attrName != NULL, -1);
 
     /* we will try 5 times before giving up */
     for(count = 0; count < 5; count++) {
@@ -733,9 +733,9 @@ xmlSecGenerateAndAddID(xmlNodePtr node, const xmlChar* attrName, const xmlChar*
                             XMLSEC_ERRORS_R_XML_FAILED,
                             XMLSEC_ERRORS_NO_MESSAGE);
                 xmlFree(id);
-                return(-1);     
+                return(-1);
             }
-            
+
             xmlFree(id);
             return(0);
         }
@@ -757,17 +757,17 @@ xmlSecGenerateAndAddID(xmlNodePtr node, const xmlChar* attrName, const xmlChar*
  */
 xmlChar*
 xmlSecGenerateID(const xmlChar* prefix, xmlSecSize len) {
-    xmlSecBuffer buffer;    
+    xmlSecBuffer buffer;
     xmlSecSize i, binLen;
     xmlChar* res;
     xmlChar* p;
     int ret;
 
-    xmlSecAssert2(len > 0, NULL);    
-    
+    xmlSecAssert2(len > 0, NULL);
+
     /* we will do base64 decoding later */
     binLen = (3 * len + 1) / 4;
-    
+
     ret = xmlSecBufferInitialize(&buffer, binLen + 1);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -775,11 +775,11 @@ xmlSecGenerateID(const xmlChar* prefix, xmlSecSize len) {
                     "xmlSecBufferInitialize",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        return(NULL);   
+        return(NULL);
     }
     xmlSecAssert2(xmlSecBufferGetData(&buffer) != NULL, NULL);
     xmlSecAssert2(xmlSecBufferGetMaxSize(&buffer) >= binLen, NULL);
-    
+
     ret = xmlSecBufferSetSize(&buffer, binLen);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -788,15 +788,15 @@ xmlSecGenerateID(const xmlChar* prefix, xmlSecSize len) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecBufferFinalize(&buffer);
-        return(NULL);   
+        return(NULL);
     }
     xmlSecAssert2(xmlSecBufferGetSize(&buffer) == binLen, NULL);
-    
+
     /* create random bytes */
     for(i = 0; i < binLen; i++) {
         (xmlSecBufferGetData(&buffer)) [i] = (xmlSecByte) (256.0 * rand() / (RAND_MAX + 1.0));
     }
-    
+
     /* base64 encode random bytes */
     res = xmlSecBase64Encode(xmlSecBufferGetData(&buffer), xmlSecBufferGetSize(&buffer), 0);
     if((res == NULL) || (xmlStrlen(res) == 0)) {
@@ -806,7 +806,7 @@ xmlSecGenerateID(const xmlChar* prefix, xmlSecSize len) {
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecBufferFinalize(&buffer);
-        return(NULL);   
+        return(NULL);
     }
     xmlSecBufferFinalize(&buffer);
 
@@ -815,18 +815,18 @@ xmlSecGenerateID(const xmlChar* prefix, xmlSecSize len) {
         res[len] = '\0';
     }
 
-    /* we need to cleanup base64 encoded id because ID attr can't have '+' or '/' characters */ 
+    /* we need to cleanup base64 encoded id because ID attr can't have '+' or '/' characters */
     for(p = res; (*p) != '\0'; p++) {
         if(((*p) == '+') || ((*p) == '/')) {
             (*p) = '_';
         }
     }
-    
+
     /* add prefix if exist */
     if(prefix) {
         xmlChar* tmp;
         xmlSecSize tmpLen;
-        
+
         tmpLen = xmlStrlen(prefix) + xmlStrlen(res) + 1;
         tmp = xmlMalloc(tmpLen + 1);
         if(tmp == NULL) {
@@ -838,18 +838,18 @@ xmlSecGenerateID(const xmlChar* prefix, xmlSecSize len) {
             xmlFree(res);
             return(NULL);
         }
-        
+
         xmlSecStrPrintf(tmp, tmpLen, BAD_CAST "%s%s", prefix, res);
         xmlFree(res);
-        res = tmp;    
+        res = tmp;
     } else {
         /* no prefix: check that ID attribute starts from a letter */
-        if(!(((res[0] >= 'A') && (res[0] <= 'Z')) || 
+        if(!(((res[0] >= 'A') && (res[0] <= 'Z')) ||
              ((res[0] >= 'a') && (res[0] <= 'z')))) {
              res[0] = 'A';
         }
     }
-    
+
     return(res);
 }
 
@@ -863,12 +863,12 @@ xmlSecGenerateID(const xmlChar* prefix, xmlSecSize len) {
  *
  * Returns: pointer to the newly created tree or NULL if an error occurs.
  */
-xmlDocPtr 
+xmlDocPtr
 xmlSecCreateTree(const xmlChar* rootNodeName, const xmlChar* rootNodeNs) {
     xmlDocPtr doc;
     xmlNodePtr root;
     xmlNsPtr ns;
-    
+
     xmlSecAssert2(rootNodeName != NULL, NULL);
 
     /* create doc */
@@ -881,11 +881,11 @@ xmlSecCreateTree(const xmlChar* rootNodeName, const xmlChar* rootNodeNs) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(NULL);
     }
-    
+
     /* create root node */
-    root = xmlNewDocNode(doc, NULL, rootNodeName, NULL); 
+    root = xmlNewDocNode(doc, NULL, rootNodeName, NULL);
     if(root == NULL) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "xmlNewDocNode",
                     XMLSEC_ERRORS_R_XML_FAILED,
@@ -904,7 +904,7 @@ xmlSecCreateTree(const xmlChar* rootNodeName, const xmlChar* rootNodeNs) {
                     XMLSEC_ERRORS_R_XML_FAILED,
                     "ns=%s",
                     xmlSecErrorsSafeString(rootNodeNs));
-        xmlFreeDoc(doc); 
+        xmlFreeDoc(doc);
         return(NULL);
     }
     xmlSetNs(root, ns);
@@ -920,22 +920,22 @@ xmlSecCreateTree(const xmlChar* rootNodeName, const xmlChar* rootNodeNs) {
  *
  * Returns: 1 if @node is empty, 0 otherwise or a negative value if an error occurs.
  */
-int 
+int
 xmlSecIsEmptyNode(xmlNodePtr node) {
     xmlChar* content;
     int res;
-    
+
     xmlSecAssert2(node != NULL, -1);
 
     if(xmlSecGetNextElementNode(node->children) != NULL) {
         return(0);
     }
-    
+
     content = xmlNodeGetContent(node);
     if(content == NULL) {
         return(1);
     }
-    
+
     res = xmlSecIsEmptyString(content);
     xmlFree(content);
     return(res);
@@ -949,10 +949,10 @@ xmlSecIsEmptyNode(xmlNodePtr node) {
  *
  * Returns: 1 if @str is empty, 0 otherwise or a negative value if an error occurs.
  */
-int 
+int
 xmlSecIsEmptyString(const xmlChar* str) {
     xmlSecAssert2(str != NULL, -1);
-    
+
     for( ;*str != '\0'; ++str) {
         if(!isspace((int)(*str))) {
             return(0);
@@ -962,7 +962,7 @@ xmlSecIsEmptyString(const xmlChar* str) {
 }
 
 /**
- * xmlSecPrintXmlString: 
+ * xmlSecPrintXmlString:
  * @fd:                the file descriptor to write the XML string to
  * @str:               the string
  *
@@ -970,15 +970,15 @@ xmlSecIsEmptyString(const xmlChar* str) {
  *
  * Returns: he number of bytes transmitted or a negative value if an error occurs.
  */
-int 
+int
 xmlSecPrintXmlString(FILE * fd, const xmlChar * str) {
     int res;
-    
-    if(str != NULL) {    
+
+    if(str != NULL) {
         xmlChar * encoded_str = NULL;
         encoded_str = xmlEncodeSpecialChars(NULL, str);
         if(encoded_str == NULL) {
-            xmlSecError(XMLSEC_ERRORS_HERE,     
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlEncodeSpecialChars",
                         XMLSEC_ERRORS_R_XML_FAILED,
@@ -986,15 +986,15 @@ xmlSecPrintXmlString(FILE * fd, const xmlChar * str) {
                         xmlSecErrorsSafeString(str));
             return(-1);
         }
-    
+
         res = fprintf(fd, "%s", (const char*)encoded_str);
         xmlFree(encoded_str);
     } else {
         res = fprintf(fd, "NULL");
     }
-    
+
     if(res < 0) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     NULL,
                     "fprintf",
                     XMLSEC_ERRORS_R_IO_FAILED,
@@ -1006,7 +1006,7 @@ xmlSecPrintXmlString(FILE * fd, const xmlChar * str) {
 }
 
 
-/** 
+/**
  * xmlSecGetQName:
  * @node:               the context node.
  * @href:               the QName href (can be NULL).
@@ -1017,7 +1017,7 @@ xmlSecPrintXmlString(FILE * fd, const xmlChar * str) {
  *
  * Returns: qname or NULL if an error occurs.
  */
-xmlChar* 
+xmlChar*
 xmlSecGetQName(xmlNodePtr node, const xmlChar* href, const xmlChar* local) {
     xmlChar* qname;
     xmlNsPtr ns;
@@ -1038,10 +1038,10 @@ xmlSecGetQName(xmlNodePtr node, const xmlChar* href, const xmlChar* local) {
                     xmlSecErrorsSafeString(href));
         return(NULL);
     }
-        
+
     if((ns != NULL) && (ns->prefix != NULL)) {
         xmlSecSize len;
-        
+
         len = xmlStrlen(local) + xmlStrlen(ns->prefix) + 4;
         qname = xmlMalloc(len);
         if(qname == NULL) {
@@ -1077,17 +1077,17 @@ xmlSecGetQName(xmlNodePtr node, const xmlChar* href, const xmlChar* local) {
  * QName <-> Integer mapping
  *
  ************************************************************************/
-/** 
+/**
  * xmlSecQName2IntegerGetInfo:
  * @info:               the qname<->integer mapping information.
  * @intValue:           the integer value.
  *
  * Maps integer @intValue to a QName prefix.
- * 
+ *
  * Returns: the QName info that is mapped to @intValue or NULL if such value
  * is not found.
  */
-xmlSecQName2IntegerInfoConstPtr 
+xmlSecQName2IntegerInfoConstPtr
 xmlSecQName2IntegerGetInfo(xmlSecQName2IntegerInfoConstPtr info, int intValue) {
     unsigned int ii;
 
@@ -1102,20 +1102,20 @@ xmlSecQName2IntegerGetInfo(xmlSecQName2IntegerInfoConstPtr info, int intValue) {
     return(NULL);
 }
 
-/** 
+/**
  * xmlSecQName2IntegerGetInteger:
  * @info:               the qname<->integer mapping information.
  * @qnameHref:          the qname href value.
  * @qnameLocalPart:     the qname local part value.
  * @intValue:           the pointer to result integer value.
- * 
+ *
  * Maps qname qname to an integer and returns it in @intValue.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs,
  */
-int 
-xmlSecQName2IntegerGetInteger(xmlSecQName2IntegerInfoConstPtr info, 
-                             const xmlChar* qnameHref, const xmlChar* qnameLocalPart, 
+int
+xmlSecQName2IntegerGetInteger(xmlSecQName2IntegerInfoConstPtr info,
+                             const xmlChar* qnameHref, const xmlChar* qnameLocalPart,
                              int* intValue) {
     unsigned int ii;
 
@@ -1124,7 +1124,7 @@ xmlSecQName2IntegerGetInteger(xmlSecQName2IntegerInfoConstPtr info,
     xmlSecAssert2(intValue != NULL, -1);
 
     for(ii = 0; info[ii].qnameLocalPart != NULL; ii++) {
-        if(xmlStrEqual(info[ii].qnameLocalPart, qnameLocalPart) && 
+        if(xmlStrEqual(info[ii].qnameLocalPart, qnameLocalPart) &&
            xmlStrEqual(info[ii].qnameHref, qnameHref)) {
             (*intValue) = info[ii].intValue;
             return(0);
@@ -1134,18 +1134,18 @@ xmlSecQName2IntegerGetInteger(xmlSecQName2IntegerInfoConstPtr info,
     return(-1);
 }
 
-/** 
+/**
  * xmlSecQName2IntegerGetIntegerFromString:
  * @info:               the qname<->integer mapping information.
  * @node:               the pointer to node.
  * @qname:              the qname string.
  * @intValue:           the pointer to result integer value.
- * 
+ *
  * Converts @qname into integer in context of @node.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs,
  */
-int 
+int
 xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info,
                                         xmlNodePtr node, const xmlChar* qname,
                                         int* intValue) {
@@ -1154,12 +1154,12 @@ xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info,
     const xmlChar* qnameHref;
     xmlNsPtr ns;
     int ret;
-    
+
     xmlSecAssert2(info != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(qname != NULL, -1);
     xmlSecAssert2(intValue != NULL, -1);
-    
+
     qnameLocalPart = xmlStrchr(qname, ':');
     if(qnameLocalPart != NULL) {
         qnamePrefix = xmlStrndup(qname, qnameLocalPart - qname);
@@ -1171,14 +1171,14 @@ xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info,
                         "node=%s,value=%s",
                         xmlSecErrorsSafeString(node->name),
                         xmlSecErrorsSafeString(qname));
-            return(-1); 
+            return(-1);
         }
         qnameLocalPart++;
     } else {
         qnamePrefix = NULL;
         qnameLocalPart = qname;
     }
-    
+
     /* search namespace href */
     ns = xmlSearchNs(node->doc, node, qnamePrefix);
     if((ns == NULL) && (qnamePrefix != NULL)) {
@@ -1192,7 +1192,7 @@ xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info,
         if(qnamePrefix != NULL) {
             xmlFree(qnamePrefix);
         }
-        return(-1);     
+        return(-1);
     }
     qnameHref = (ns != NULL) ? ns->href : BAD_CAST NULL;
 
@@ -1210,7 +1210,7 @@ xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info,
         if(qnamePrefix != NULL) {
             xmlFree(qnamePrefix);
         }
-        return(-1);     
+        return(-1);
     }
 
     if(qnamePrefix != NULL) {
@@ -1220,18 +1220,18 @@ xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info,
 }
 
 
-/** 
+/**
  * xmlSecQName2IntegerGetStringFromInteger:
  * @info:               the qname<->integer mapping information.
  * @node:               the pointer to node.
  * @intValue:           the integer value.
- * 
+ *
  * Creates qname string for @intValue in context of given @node. Caller
  * is responsible for freeing returned string with @xmlFree.
- * 
+ *
  * Returns: pointer to newly allocated string on success or NULL if an error occurs,
  */
-xmlChar* 
+xmlChar*
 xmlSecQName2IntegerGetStringFromInteger(xmlSecQName2IntegerInfoConstPtr info,
                                         xmlNodePtr node, int intValue) {
     xmlSecQName2IntegerInfoConstPtr qnameInfo;
@@ -1250,22 +1250,22 @@ xmlSecQName2IntegerGetStringFromInteger(xmlSecQName2IntegerInfoConstPtr info,
                     intValue);
         return(NULL);
     }
-    
+
     return (xmlSecGetQName(node, qnameInfo->qnameHref, qnameInfo->qnameLocalPart));
 }
 
-/** 
+/**
  * xmlSecQName2IntegerNodeRead:
  * @info:               the qname<->integer mapping information.
  * @node:               the pointer to node.
  * @intValue:           the pointer to result integer value.
- * 
- * Reads the content of @node and converts it to an integer using mapping 
+ *
+ * Reads the content of @node and converts it to an integer using mapping
  * from @info.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs,
  */
-int 
+int
 xmlSecQName2IntegerNodeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr node, int* intValue) {
     xmlChar* content = NULL;
     int ret;
@@ -1282,7 +1282,7 @@ xmlSecQName2IntegerNodeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr nod
                     XMLSEC_ERRORS_R_XML_FAILED,
                     "node=%s",
                     xmlSecErrorsSafeString(node->name));
-        return(-1);     
+        return(-1);
     }
     /* todo: trim content? */
 
@@ -1296,26 +1296,26 @@ xmlSecQName2IntegerNodeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr nod
                     xmlSecErrorsSafeString(node->name),
                     xmlSecErrorsSafeString(content));
         xmlFree(content);
-        return(-1);     
+        return(-1);
     }
 
     xmlFree(content);
     return(0);
 }
 
-/** 
+/**
  * xmlSecQName2IntegerNodeWrite:
  * @info:               the qname<->integer mapping information.
  * @node:               the parent node.
  * @nodeName:           the child node name.
  * @nodeNs:             the child node namespace.
  * @intValue:           the integer value.
- * 
+ *
  * Creates new child node in @node and sets its value to @intValue.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs,
  */
-int 
+int
 xmlSecQName2IntegerNodeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr node,
                             const xmlChar* nodeName, const xmlChar* nodeNs, int intValue) {
     xmlNodePtr cur;
@@ -1337,7 +1337,7 @@ xmlSecQName2IntegerNodeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr no
                     intValue);
         return(-1);
     }
-    
+
     cur = xmlSecAddChild(node, nodeName, nodeNs);
     if(cur == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1356,19 +1356,19 @@ xmlSecQName2IntegerNodeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr no
     return(0);
 }
 
-/** 
+/**
  * xmlSecQName2IntegerAttributeRead:
  * @info:               the qname<->integer mapping information.
- * @node:               the element node. 
+ * @node:               the element node.
  * @attrName:           the attribute name.
  * @intValue:           the pointer to result integer value.
- * 
+ *
  * Gets the value of @attrName atrtibute from @node and converts it to integer
  * according to @info.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs,
  */
-int 
+int
 xmlSecQName2IntegerAttributeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr node,
                             const xmlChar* attrName, int* intValue) {
     xmlChar* attrValue;
@@ -1388,7 +1388,7 @@ xmlSecQName2IntegerAttributeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePt
                     "node=%s,attrValue=%s",
                     xmlSecErrorsSafeString(node->name),
                     xmlSecErrorsSafeString(attrName));
-        return(-1);     
+        return(-1);
     }
     /* todo: trim value? */
 
@@ -1403,23 +1403,23 @@ xmlSecQName2IntegerAttributeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePt
                     xmlSecErrorsSafeString(attrName),
                     xmlSecErrorsSafeString(attrValue));
         xmlFree(attrValue);
-        return(-1);     
+        return(-1);
     }
 
     xmlFree(attrValue);
     return(0);
 }
 
-/** 
+/**
  * xmlSecQName2IntegerAttributeWrite:
  * @info:               the qname<->integer mapping information.
  * @node:               the parent node.
  * @attrName:           the name of attribute.
  * @intValue:           the integer value.
- * 
- * Converts @intValue to a qname and sets it to the value of 
+ *
+ * Converts @intValue to a qname and sets it to the value of
  * attribute @attrName in @node.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs,
  */
 int
@@ -1464,16 +1464,16 @@ xmlSecQName2IntegerAttributeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodeP
     return(0);
 }
 
-/** 
+/**
  * xmlSecQName2IntegerDebugDump:
  * @info:               the qname<->integer mapping information.
  * @intValue:           the integer value.
  * @name:               the value name to print.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints @intValue into @output.
  */
-void 
+void
 xmlSecQName2IntegerDebugDump(xmlSecQName2IntegerInfoConstPtr info, int intValue,
                             const xmlChar* name, FILE* output) {
     xmlSecQName2IntegerInfoConstPtr qnameInfo;
@@ -1484,22 +1484,22 @@ xmlSecQName2IntegerDebugDump(xmlSecQName2IntegerInfoConstPtr info, int intValue,
 
     qnameInfo = xmlSecQName2IntegerGetInfo(info, intValue);
     if(qnameInfo != NULL) {
-        fprintf(output, "== %s: %d (name=\"%s\", href=\"%s\")\n", name, intValue, 
+        fprintf(output, "== %s: %d (name=\"%s\", href=\"%s\")\n", name, intValue,
             (qnameInfo->qnameLocalPart) ? qnameInfo->qnameLocalPart : BAD_CAST NULL,
             (qnameInfo->qnameHref) ? qnameInfo->qnameHref : BAD_CAST NULL);
-    }    
+    }
 }
 
-/** 
+/**
  * xmlSecQName2IntegerDebugXmlDump:
  * @info:               the qname<->integer mapping information.
  * @intValue:           the integer value.
  * @name:               the value name to print.
  * @output:             the pointer to output FILE.
- * 
- * Prints @intValue into @output in XML format. 
+ *
+ * Prints @intValue into @output in XML format.
  */
-void 
+void
 xmlSecQName2IntegerDebugXmlDump(xmlSecQName2IntegerInfoConstPtr info, int intValue,
                             const xmlChar* name, FILE* output) {
     xmlSecQName2IntegerInfoConstPtr qnameInfo;
@@ -1510,24 +1510,24 @@ xmlSecQName2IntegerDebugXmlDump(xmlSecQName2IntegerInfoConstPtr info, int intVal
 
     qnameInfo = xmlSecQName2IntegerGetInfo(info, intValue);
     if(qnameInfo != NULL) {
-        fprintf(output, "<%s value=\"%d\" href=\"%s\">%s<%s>\n", name, intValue, 
+        fprintf(output, "<%s value=\"%d\" href=\"%s\">%s<%s>\n", name, intValue,
             (qnameInfo->qnameHref) ? qnameInfo->qnameHref : BAD_CAST NULL,
             (qnameInfo->qnameLocalPart) ? qnameInfo->qnameLocalPart : BAD_CAST NULL,
             name);
-    }    
+    }
 }
-                                                                 
+
 
 /*************************************************************************
  *
  * QName <-> Bits mask mapping
  *
  ************************************************************************/
-/** 
+/**
  * xmlSecQName2BitMaskGetInfo:
  * @info:               the qname<->bit mask mapping information.
  * @mask:               the bit mask.
- * 
+ *
  * Converts @mask to qname.
  *
  * Returns: pointer to the qname info for @mask or NULL if mask is unknown.
@@ -1548,19 +1548,19 @@ xmlSecQName2BitMaskGetInfo(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask m
     return(NULL);
 }
 
-/** 
+/**
  * xmlSecQName2BitMaskGetBitMask:
  * @info:               the qname<->bit mask mapping information.
  * @qnameHref:          the qname Href value.
  * @qnameLocalPart:     the qname LocalPart value.
  * @mask:               the pointer to result mask.
- * 
+ *
  * Converts @qnameLocalPart to @mask.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs,
  */
-int 
-xmlSecQName2BitMaskGetBitMask(xmlSecQName2BitMaskInfoConstPtr info, 
+int
+xmlSecQName2BitMaskGetBitMask(xmlSecQName2BitMaskInfoConstPtr info,
                             const xmlChar* qnameHref, const xmlChar* qnameLocalPart,
                             xmlSecBitMask* mask) {
     unsigned int ii;
@@ -1571,7 +1571,7 @@ xmlSecQName2BitMaskGetBitMask(xmlSecQName2BitMaskInfoConstPtr info,
 
     for(ii = 0; info[ii].qnameLocalPart != NULL; ii++) {
         xmlSecAssert2(info[ii].mask != 0, -1);
-        if(xmlStrEqual(info[ii].qnameLocalPart, qnameLocalPart) && 
+        if(xmlStrEqual(info[ii].qnameLocalPart, qnameLocalPart) &&
            xmlStrEqual(info[ii].qnameHref, qnameHref)) {
 
             (*mask) = info[ii].mask;
@@ -1582,18 +1582,18 @@ xmlSecQName2BitMaskGetBitMask(xmlSecQName2BitMaskInfoConstPtr info,
     return(-1);
 }
 
-/** 
+/**
  * xmlSecQName2BitMaskGetBitMaskFromString:
  * @info:               the qname<->integer mapping information.
  * @node:               the pointer to node.
  * @qname:              the qname string.
  * @mask:               the pointer to result msk value.
- * 
+ *
  * Converts @qname into integer in context of @node.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs,
  */
-int 
+int
 xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info,
                                         xmlNodePtr node, const xmlChar* qname,
                                         xmlSecBitMask* mask) {
@@ -1602,7 +1602,7 @@ xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info,
     const xmlChar* qnameHref;
     xmlNsPtr ns;
     int ret;
-    
+
     xmlSecAssert2(info != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
     xmlSecAssert2(qname != NULL, -1);
@@ -1619,14 +1619,14 @@ xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info,
                         "node=%s,value=%s",
                         xmlSecErrorsSafeString(node->name),
                         xmlSecErrorsSafeString(qname));
-            return(-1); 
+            return(-1);
         }
         qnameLocalPart++;
     } else {
         qnamePrefix = NULL;
         qnameLocalPart = qname;
     }
-    
+
     /* search namespace href */
     ns = xmlSearchNs(node->doc, node, qnamePrefix);
     if((ns == NULL) && (qnamePrefix != NULL)) {
@@ -1640,7 +1640,7 @@ xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info,
         if(qnamePrefix != NULL) {
             xmlFree(qnamePrefix);
         }
-        return(-1);     
+        return(-1);
     }
     qnameHref = (ns != NULL) ? ns->href : BAD_CAST NULL;
 
@@ -1658,7 +1658,7 @@ xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info,
         if(qnamePrefix != NULL) {
             xmlFree(qnamePrefix);
         }
-        return(-1);     
+        return(-1);
     }
 
     if(qnamePrefix != NULL) {
@@ -1668,18 +1668,18 @@ xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info,
 }
 
 
-/** 
+/**
  * xmlSecQName2BitMaskGetStringFromBitMask:
  * @info:               the qname<->integer mapping information.
  * @node:               the pointer to node.
  * @mask:               the mask.
- * 
+ *
  * Creates qname string for @mask in context of given @node. Caller
  * is responsible for freeing returned string with @xmlFree.
- * 
+ *
  * Returns: pointer to newly allocated string on success or NULL if an error occurs,
  */
-xmlChar* 
+xmlChar*
 xmlSecQName2BitMaskGetStringFromBitMask(xmlSecQName2BitMaskInfoConstPtr info,
                                         xmlNodePtr node, xmlSecBitMask mask) {
     xmlSecQName2BitMaskInfoConstPtr qnameInfo;
@@ -1698,11 +1698,11 @@ xmlSecQName2BitMaskGetStringFromBitMask(xmlSecQName2BitMaskInfoConstPtr info,
                     mask);
         return(NULL);
     }
-    
+
     return(xmlSecGetQName(node, qnameInfo->qnameHref, qnameInfo->qnameLocalPart));
 }
 
-/** 
+/**
  * xmlSecQName2BitMaskNodesRead:
  * @info:               the qname<->bit mask mapping information.
  * @node:               the start.
@@ -1711,16 +1711,16 @@ xmlSecQName2BitMaskGetStringFromBitMask(xmlSecQName2BitMaskInfoConstPtr info,
  * @stopOnUnknown:      if this flag is set then function exits if unknown
  *                      value was found.
  * @mask:               the pointer to result mask.
- * 
+ *
  * Reads <@nodeNs:@nodeName> elements and puts the result bit mask
  * into @mask. When function exits, @node points to the first element node
  * after all the <@nodeNs:@nodeName> elements.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs,
  */
-int 
+int
 xmlSecQName2BitMaskNodesRead(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr* node,
-                            const xmlChar* nodeName, const xmlChar* nodeNs, 
+                            const xmlChar* nodeName, const xmlChar* nodeNs,
                             int stopOnUnknown, xmlSecBitMask* mask) {
     xmlNodePtr cur;
     xmlChar* content;
@@ -1742,9 +1742,9 @@ xmlSecQName2BitMaskNodesRead(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr* n
                         XMLSEC_ERRORS_R_XML_FAILED,
                         "node=%s",
                         xmlSecErrorsSafeString(cur->name));
-            return(-1); 
+            return(-1);
         }
-        
+
         ret = xmlSecQName2BitMaskGetBitMaskFromString(info, cur, content, &tmp);
         if(ret < 0) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1754,7 +1754,7 @@ xmlSecQName2BitMaskNodesRead(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr* n
                         "value=%s",
                         xmlSecErrorsSafeString(content));
             xmlFree(content);
-            return(-1); 
+            return(-1);
         }
         xmlFree(content);
 
@@ -1766,32 +1766,32 @@ xmlSecQName2BitMaskNodesRead(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr* n
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "value=%s",
                         xmlSecErrorsSafeString(content));
-            return(-1); 
+            return(-1);
         }
-        
+
         (*mask) |= tmp;
         cur = xmlSecGetNextElementNode(cur->next);
     }
 
-    (*node) = cur;    
-    return(0); 
+    (*node) = cur;
+    return(0);
 }
 
-/** 
+/**
  * xmlSecQName2BitMaskNodesWrite:
  * @info:               the qname<->bit mask mapping information.
  * @node:               the parent element for mask nodes.
  * @nodeName:           the mask nodes name.
  * @nodeNs:             the mask nodes namespace.
  * @mask:               the bit mask.
- * 
+ *
  * Writes <@nodeNs:@nodeName> elemnts with values from @mask to @node.
- * 
+ *
  * Returns: 0 on success or a negative value if an error occurs,
  */
-int 
+int
 xmlSecQName2BitMaskNodesWrite(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr node,
-                            const xmlChar* nodeName, const xmlChar* nodeNs, 
+                            const xmlChar* nodeName, const xmlChar* nodeNs,
                             xmlSecBitMask mask) {
     unsigned int ii;
 
@@ -1805,7 +1805,7 @@ xmlSecQName2BitMaskNodesWrite(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr n
         if((mask & info[ii].mask) != 0) {
             xmlNodePtr cur;
             xmlChar* qname;
-            
+
             qname = xmlSecGetQName(node, info[ii].qnameHref, info[ii].qnameLocalPart);
             if(qname == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1814,9 +1814,9 @@ xmlSecQName2BitMaskNodesWrite(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr n
                             XMLSEC_ERRORS_R_XML_FAILED,
                             "node=%s",
                             xmlSecErrorsSafeString(nodeName));
-                return(-1);     
+                return(-1);
             }
-            
+
             cur = xmlSecAddChild(node, nodeName, nodeNs);
             if(cur == NULL) {
                 xmlSecError(XMLSEC_ERRORS_HERE,
@@ -1828,7 +1828,7 @@ xmlSecQName2BitMaskNodesWrite(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr n
                 xmlFree(qname);
                 return(-1);
             }
-            
+
             xmlNodeSetContent(cur, qname);
             xmlFree(qname);
         }
@@ -1836,16 +1836,16 @@ xmlSecQName2BitMaskNodesWrite(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr n
     return(0);
 }
 
-/** 
+/**
  * xmlSecQName2BitMaskDebugDump:
  * @info:               the qname<->bit mask mapping information.
  * @mask:               the bit mask.
  * @name:               the value name to print.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints debug information about @mask to @output.
  */
-void 
+void
 xmlSecQName2BitMaskDebugDump(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask mask,
                             const xmlChar* name, FILE* output) {
     unsigned int ii;
@@ -1869,16 +1869,16 @@ xmlSecQName2BitMaskDebugDump(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask
     fprintf(output, "\n");
 }
 
-/** 
+/**
  * xmlSecQName2BitMaskDebugXmlDump:
  * @info:               the qname<->bit mask mapping information.
  * @mask:               the bit mask.
  * @name:               the value name to print.
  * @output:             the pointer to output FILE.
- * 
+ *
  * Prints debug information about @mask to @output in XML format.
  */
-void 
+void
 xmlSecQName2BitMaskDebugXmlDump(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask mask,
                             const xmlChar* name, FILE* output) {
     unsigned int ii;
@@ -1896,13 +1896,13 @@ xmlSecQName2BitMaskDebugXmlDump(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitM
         xmlSecAssert(info[ii].mask != 0);
 
         if((mask & info[ii].mask) != 0) {
-            fprintf(output, "<%s href=\"%s\">%s</%s>\n", name, 
+            fprintf(output, "<%s href=\"%s\">%s</%s>\n", name,
                     info[ii].qnameHref, info[ii].qnameLocalPart, name);
         }
     }
     fprintf(output, "</%sList>\n", name);
 }
-                                                                 
+
 
 
 
diff --git a/src/xpath.c b/src/xpath.c
index b8bc203..afa7c52 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * XPath transform
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -33,11 +33,11 @@
  * @nargs:              the arguments nubmer.
  *
  * The implementation of XPath "here()" function.
- * See xmlXPtrHereFunction() in xpointer.c. the only change is that 
+ * See xmlXPtrHereFunction() in xpointer.c. the only change is that
  * we return NodeSet instead of NodeInterval.
  *
  *****************************************************************************/
-static void 
+static void
 xmlSecXPathHereFunction(xmlXPathParserContextPtr ctxt, int nargs) {
     CHECK_ARITY(0);
 
@@ -65,14 +65,14 @@ struct _xmlSecXPathData {
     xmlXPathContextPtr                  ctx;
     xmlChar*                            expr;
     xmlSecNodeSetOp                     nodeSetOp;
-    xmlSecNodeSetType                   nodeSetType;    
+    xmlSecNodeSetType                   nodeSetType;
 };
 
 static xmlSecXPathDataPtr       xmlSecXPathDataCreate           (xmlSecXPathDataType type);
 static void                     xmlSecXPathDataDestroy          (xmlSecXPathDataPtr data);
 static int                      xmlSecXPathDataSetExpr          (xmlSecXPathDataPtr data,
                                                                  const xmlChar* expr);
-static int                      xmlSecXPathDataRegisterNamespaces(xmlSecXPathDataPtr data, 
+static int                      xmlSecXPathDataRegisterNamespaces(xmlSecXPathDataPtr data,
                                                                  xmlNodePtr node);
 static int                      xmlSecXPathDataNodeRead         (xmlSecXPathDataPtr data,
                                                                  xmlNodePtr node);
@@ -80,7 +80,7 @@ static xmlSecNodeSetPtr         xmlSecXPathDataExecute          (xmlSecXPathData
                                                                  xmlDocPtr doc,
                                                                  xmlNodePtr hereNode);
 
-static xmlSecXPathDataPtr  
+static xmlSecXPathDataPtr
 xmlSecXPathDataCreate(xmlSecXPathDataType type) {
     xmlSecXPathDataPtr data;
 
@@ -94,15 +94,15 @@ xmlSecXPathDataCreate(xmlSecXPathDataType type) {
                     sizeof(xmlSecXPathData));
         return(NULL);
     }
-    memset(data, 0, sizeof(xmlSecXPathData)); 
+    memset(data, 0, sizeof(xmlSecXPathData));
 
     data->type = type;
     data->nodeSetType = xmlSecNodeSetTree;
 
     /* create xpath or xpointer context */
     switch(data->type) {
-    case xmlSecXPathDataTypeXPath:    
-    case xmlSecXPathDataTypeXPath2:    
+    case xmlSecXPathDataTypeXPath:
+    case xmlSecXPathDataTypeXPath2:
         data->ctx = xmlXPathNewContext(NULL); /* we'll set doc in the context later */
         if(data->ctx == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -114,7 +114,7 @@ xmlSecXPathDataCreate(xmlSecXPathDataType type) {
             return(NULL);
         }
         break;
-    case xmlSecXPathDataTypeXPointer:    
+    case xmlSecXPathDataTypeXPointer:
         data->ctx = xmlXPtrNewContext(NULL, NULL, NULL); /* we'll set doc in the context later */
         if(data->ctx == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -131,9 +131,9 @@ xmlSecXPathDataCreate(xmlSecXPathDataType type) {
     return(data);
 }
 
-static void                             
+static void
 xmlSecXPathDataDestroy(xmlSecXPathDataPtr data) {
-    xmlSecAssert(data != NULL);    
+    xmlSecAssert(data != NULL);
 
     if(data->expr != NULL) {
         xmlFree(data->expr);
@@ -141,17 +141,17 @@ xmlSecXPathDataDestroy(xmlSecXPathDataPtr data) {
     if(data->ctx != NULL) {
         xmlXPathFreeContext(data->ctx);
     }
-    memset(data, 0, sizeof(xmlSecXPathData));  
+    memset(data, 0, sizeof(xmlSecXPathData));
     xmlFree(data);
 }
 
-static int 
+static int
 xmlSecXPathDataSetExpr(xmlSecXPathDataPtr data, const xmlChar* expr) {
-    xmlSecAssert2(data != NULL, -1);    
+    xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(data->expr == NULL, -1);
     xmlSecAssert2(data->ctx != NULL, -1);
-    xmlSecAssert2(expr != NULL, -1);    
-            
+    xmlSecAssert2(expr != NULL, -1);
+
     data->expr = xmlStrdup(expr);
     if(data->expr == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -165,13 +165,13 @@ xmlSecXPathDataSetExpr(xmlSecXPathDataPtr data, const xmlChar* expr) {
 }
 
 
-static int 
+static int
 xmlSecXPathDataRegisterNamespaces(xmlSecXPathDataPtr data, xmlNodePtr node) {
     xmlNodePtr cur;
     xmlNsPtr ns;
     int ret;
-    
-    xmlSecAssert2(data != NULL, -1);    
+
+    xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(data->ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
 
@@ -188,21 +188,21 @@ xmlSecXPathDataRegisterNamespaces(xmlSecXPathDataPtr data, xmlNodePtr node) {
                                 XMLSEC_ERRORS_R_XML_FAILED,
                                 "href=%s;prefix=%s",
                                 xmlSecErrorsSafeString(ns->href),
-                                xmlSecErrorsSafeString(ns->prefix)); 
+                                xmlSecErrorsSafeString(ns->prefix));
                     return(-1);
                 }
             }
         }
     }
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecXPathDataNodeRead(xmlSecXPathDataPtr data, xmlNodePtr node) {
     int ret;
-    
-    xmlSecAssert2(data != NULL, -1);    
+
+    xmlSecAssert2(data != NULL, -1);
     xmlSecAssert2(data->expr == NULL, -1);
     xmlSecAssert2(data->ctx != NULL, -1);
     xmlSecAssert2(node != NULL, -1);
@@ -216,7 +216,7 @@ xmlSecXPathDataNodeRead(xmlSecXPathDataPtr data, xmlNodePtr node) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     /* read node content and set expr */
     data->expr = xmlNodeGetContent(node);
     if(data->expr == NULL) {
@@ -227,16 +227,16 @@ xmlSecXPathDataNodeRead(xmlSecXPathDataPtr data, xmlNodePtr node) {
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     return(0);
 }
 
 static xmlSecNodeSetPtr
 xmlSecXPathDataExecute(xmlSecXPathDataPtr data, xmlDocPtr doc, xmlNodePtr hereNode) {
-    xmlXPathObjectPtr xpathObj = NULL; 
+    xmlXPathObjectPtr xpathObj = NULL;
     xmlSecNodeSetPtr nodes;
 
-    xmlSecAssert2(data != NULL, NULL);    
+    xmlSecAssert2(data != NULL, NULL);
     xmlSecAssert2(data->expr != NULL, NULL);
     xmlSecAssert2(data->ctx != NULL, NULL);
     xmlSecAssert2(doc != NULL, NULL);
@@ -244,7 +244,7 @@ xmlSecXPathDataExecute(xmlSecXPathDataPtr data, xmlDocPtr doc, xmlNodePtr hereNo
 
     /* do not forget to set the doc */
     data->ctx->doc = doc;
-    
+
     /* here function works only on the same document */
     if(hereNode->doc == doc) {
         xmlXPathRegisterFunc(data->ctx, (xmlChar *)"here", xmlSecXPathHereFunction);
@@ -254,33 +254,33 @@ xmlSecXPathDataExecute(xmlSecXPathDataPtr data, xmlDocPtr doc, xmlNodePtr hereNo
 
     /* execute xpath or xpointer expression */
     switch(data->type) {
-    case xmlSecXPathDataTypeXPath:    
-    case xmlSecXPathDataTypeXPath2:    
+    case xmlSecXPathDataTypeXPath:
+    case xmlSecXPathDataTypeXPath2:
         xpathObj = xmlXPathEvalExpression(data->expr, data->ctx);
         if(xpathObj == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlXPathEvalExpression",
                         XMLSEC_ERRORS_R_XML_FAILED,
-                        "expr=%s", 
+                        "expr=%s",
                         xmlSecErrorsSafeString(data->expr));
             return(NULL);
         }
         break;
-    case xmlSecXPathDataTypeXPointer:    
+    case xmlSecXPathDataTypeXPointer:
         xpathObj = xmlXPtrEval(data->expr, data->ctx);
         if(xpathObj == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
                         NULL,
                         "xmlXPtrEval",
                         XMLSEC_ERRORS_R_XML_FAILED,
-                        "expr=%s", 
+                        "expr=%s",
                         xmlSecErrorsSafeString(data->expr));
             return(NULL);
         }
         break;
     }
-    
+
     nodes = xmlSecNodeSetCreate(doc, xpathObj->nodesetval, data->nodeSetType);
     if(nodes == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -288,12 +288,12 @@ xmlSecXPathDataExecute(xmlSecXPathDataPtr data, xmlDocPtr doc, xmlNodePtr hereNo
                     "xmlSecNodeSetCreate",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     "type=%d", data->nodeSetType);
-        xmlXPathFreeObject(xpathObj);     
+        xmlXPathFreeObject(xpathObj);
         return(NULL);
     }
     xpathObj->nodesetval = NULL;
-    xmlXPathFreeObject(xpathObj); 
-    
+    xmlXPathFreeObject(xpathObj);
+
     return(nodes);
 }
 
@@ -319,18 +319,18 @@ static xmlSecPtrListKlass xmlSecXPathDataListKlass = {
     NULL,                                               /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
 };
 
-static xmlSecPtrListId 
+static xmlSecPtrListId
 xmlSecXPathDataListGetKlass(void) {
     return(&xmlSecXPathDataListKlass);
 }
 
-static xmlSecNodeSetPtr 
-xmlSecXPathDataListExecute(xmlSecPtrListPtr dataList, xmlDocPtr doc, 
+static xmlSecNodeSetPtr
+xmlSecXPathDataListExecute(xmlSecPtrListPtr dataList, xmlDocPtr doc,
                            xmlNodePtr hereNode, xmlSecNodeSetPtr nodes) {
     xmlSecXPathDataPtr data;
     xmlSecNodeSetPtr res, tmp, tmp2;
     xmlSecSize pos;
-    
+
     xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), NULL);
     xmlSecAssert2(xmlSecPtrListGetSize(dataList) > 0, NULL);
     xmlSecAssert2(doc != NULL, NULL);
@@ -362,7 +362,7 @@ xmlSecXPathDataListExecute(xmlSecPtrListPtr dataList, xmlDocPtr doc,
                 xmlSecNodeSetDestroy(res);
             }
             return(NULL);
-        }    
+        }
 
         tmp2 = xmlSecNodeSetAdd(res, tmp, data->nodeSetOp);
         if(tmp2 == NULL) {
@@ -388,7 +388,7 @@ xmlSecXPathDataListExecute(xmlSecPtrListPtr dataList, xmlDocPtr doc,
  * XPath/XPointer transforms
  *
  * xmlSecXPathDataList is located after xmlSecTransform structure
- * 
+ *
  *****************************************************************************/
 #define xmlSecXPathTransformSize        \
     (sizeof(xmlSecTransform) + sizeof(xmlSecPtrList))
@@ -404,19 +404,19 @@ xmlSecXPathDataListExecute(xmlSecPtrListPtr dataList, xmlDocPtr doc,
 static int              xmlSecTransformXPathInitialize  (xmlSecTransformPtr transform);
 static void             xmlSecTransformXPathFinalize    (xmlSecTransformPtr transform);
 static int              xmlSecTransformXPathExecute     (xmlSecTransformPtr transform,
-                                                         int last, 
+                                                         int last,
                                                          xmlSecTransformCtxPtr transformCtx);
 
 static int
-xmlSecTransformXPathInitialize(xmlSecTransformPtr transform) {  
+xmlSecTransformXPathInitialize(xmlSecTransformPtr transform) {
     xmlSecPtrListPtr dataList;
     int ret;
-        
+
     xmlSecAssert2(xmlSecTransformXPathCheckId(transform), -1);
 
     dataList = xmlSecXPathTransformGetDataList(transform);
     xmlSecAssert2(dataList != NULL, -1);
-    
+
     ret = xmlSecPtrListInitialize(dataList, xmlSecXPathDataListId);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -437,7 +437,7 @@ xmlSecTransformXPathFinalize(xmlSecTransformPtr transform) {
 
     dataList = xmlSecXPathTransformGetDataList(transform);
     xmlSecAssert(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId));
-    
+
     xmlSecPtrListFinalize(dataList);
 }
 
@@ -446,7 +446,7 @@ xmlSecTransformXPathExecute(xmlSecTransformPtr transform, int last,
                             xmlSecTransformCtxPtr transformCtx) {
     xmlSecPtrListPtr dataList;
     xmlDocPtr doc;
-    
+
     xmlSecAssert2(xmlSecTransformXPathCheckId(transform), -1);
     xmlSecAssert2(transform->hereNode != NULL, -1);
     xmlSecAssert2(transform->outNodes == NULL, -1);
@@ -460,7 +460,7 @@ xmlSecTransformXPathExecute(xmlSecTransformPtr transform, int last,
     doc = (transform->inNodes != NULL) ? transform->inNodes->doc : transform->hereNode->doc;
     xmlSecAssert2(doc != NULL, -1);
 
-    transform->outNodes = xmlSecXPathDataListExecute(dataList, doc, 
+    transform->outNodes = xmlSecXPathDataListExecute(dataList, doc,
                                 transform->hereNode, transform->inNodes);
     if(transform->outNodes == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -469,14 +469,14 @@ xmlSecTransformXPathExecute(xmlSecTransformPtr transform, int last,
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
     return(0);
 }
 
 /******************************************************************************
  *
  * XPath transform
- * 
+ *
  *****************************************************************************/
 static int              xmlSecTransformXPathNodeRead    (xmlSecTransformPtr transform,
                                                          xmlNodePtr node,
@@ -504,7 +504,7 @@ static xmlSecTransformKlass xmlSecTransformXPathKlass = {
     xmlSecTransformDefaultPushXml,              /* xmlSecTransformPushXmlMethod pushXml; */
     xmlSecTransformDefaultPopXml,               /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecTransformXPathExecute,                /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
@@ -512,19 +512,19 @@ static xmlSecTransformKlass xmlSecTransformXPathKlass = {
 /**
  * xmlSecTransformXPathGetKlass:
  *
- * The XPath transform evaluates given XPath expression and 
- * intersects the result with the previous nodes set. See 
+ * The XPath transform evaluates given XPath expression and
+ * intersects the result with the previous nodes set. See
  * http://www.w3.org/TR/xmldsig-core/#sec-XPath for more details.
  *
  * Returns: XPath transform id.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformXPathGetKlass(void) {
     return(&xmlSecTransformXPathKlass);
 }
 
 static const char xpathPattern[] = "(//. | //@* | //namespace::*)[boolean(%s)]";
-static int 
+static int
 xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) {
     xmlSecPtrListPtr dataList;
     xmlSecXPathDataPtr data;
@@ -541,7 +541,7 @@ xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
     xmlSecAssert2(xmlSecPtrListGetSize(dataList) == 0, -1);
 
     /* there is only one required node */
-    cur = xmlSecGetNextElementNode(node->children);  
+    cur = xmlSecGetNextElementNode(node->children);
     if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeXPath, xmlSecDSigNs))) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -551,7 +551,7 @@ xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
                     xmlSecErrorsSafeString(xmlSecNodeXPath));
         return(-1);
     }
-    
+
     /* read information from the node */
     data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPath);
     if(data == NULL) {
@@ -562,7 +562,7 @@ xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
     }
-    
+
     ret = xmlSecXPathDataNodeRead(data, cur);
     if(ret < 0) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -573,7 +573,7 @@ xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
         xmlSecXPathDataDestroy(data);
         return(-1);
     }
-        
+
     /* append it to the list */
     ret = xmlSecPtrListAdd(dataList, data);
     if(ret < 0) {
@@ -585,10 +585,10 @@ xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
         xmlSecXPathDataDestroy(data);
         return(-1);
     }
-    
+
     /* create full XPath expression */
     xmlSecAssert2(data->expr != NULL, -1);
-    tmp = (xmlChar*) xmlMalloc(sizeof(xmlChar) * (xmlStrlen(data->expr) + 
+    tmp = (xmlChar*) xmlMalloc(sizeof(xmlChar) * (xmlStrlen(data->expr) +
                                                   strlen(xpathPattern) + 1));
     if(tmp == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -599,16 +599,16 @@ xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
                     xmlStrlen(data->expr) + strlen(xpathPattern) + 1);
         return(-1);
     }
-    sprintf((char*)tmp, xpathPattern, (char*)data->expr);       
+    sprintf((char*)tmp, xpathPattern, (char*)data->expr);
     xmlFree(data->expr);
     data->expr = tmp;
 
     /* set correct node set type and operation */
     data->nodeSetOp     = xmlSecNodeSetIntersection;
     data->nodeSetType   = xmlSecNodeSetNormal;
-    
+
     /* check that we have nothing else */
-    cur = xmlSecGetNextElementNode(cur->next);        
+    cur = xmlSecGetNextElementNode(cur->next);
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -623,7 +623,7 @@ xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
 /******************************************************************************
  *
  * XPath2 transform
- * 
+ *
  *****************************************************************************/
 static int              xmlSecTransformXPath2NodeRead   (xmlSecTransformPtr transform,
                                                          xmlNodePtr node,
@@ -657,17 +657,17 @@ static xmlSecTransformKlass xmlSecTransformXPath2Klass = {
 
 /**
  * xmlSecTransformXPath2GetKlass:
- * 
+ *
  * The XPath2 transform (http://www.w3.org/TR/xmldsig-filter2/).
  *
  * Returns: XPath2 transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformXPath2GetKlass(void) {
     return(&xmlSecTransformXPath2Klass);
 }
 
-static int 
+static int
 xmlSecTransformXPath2NodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) {
     xmlSecPtrListPtr dataList;
     xmlSecXPathDataPtr data;
@@ -682,9 +682,9 @@ xmlSecTransformXPath2NodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xml
     dataList = xmlSecXPathTransformGetDataList(transform);
     xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), -1);
     xmlSecAssert2(xmlSecPtrListGetSize(dataList) == 0, -1);
-    
+
     /* There are only xpath nodes */
-    cur = xmlSecGetNextElementNode(node->children);  
+    cur = xmlSecGetNextElementNode(node->children);
     while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeXPath2, xmlSecXPath2Ns)) {
         /* read information from the node */
         data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPath2);
@@ -707,7 +707,7 @@ xmlSecTransformXPath2NodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xml
             xmlSecXPathDataDestroy(data);
             return(-1);
         }
-    
+
         /* append it to the list */
         ret = xmlSecPtrListAdd(dataList, data);
         if(ret < 0) {
@@ -743,14 +743,14 @@ xmlSecTransformXPath2NodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xml
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         xmlSecErrorsSafeString(xmlSecAttrFilter),
                         XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
-                        "filter=%s", 
+                        "filter=%s",
                         xmlSecErrorsSafeString(op));
             xmlFree(op);
             return(-1);
         }
         xmlFree(op);
 
-        cur = xmlSecGetNextElementNode(cur->next);  
+        cur = xmlSecGetNextElementNode(cur->next);
     }
 
     /* check that we have nothing else */
@@ -768,7 +768,7 @@ xmlSecTransformXPath2NodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xml
 /******************************************************************************
  *
  * XPointer transform
- * 
+ *
  *****************************************************************************/
 static int              xmlSecTransformXPointerNodeRead (xmlSecTransformPtr transform,
                                                          xmlNodePtr node,
@@ -802,19 +802,19 @@ static xmlSecTransformKlass xmlSecTransformXPointerKlass = {
 
 /**
  * xmlSecTransformXPointerGetKlass:
- * 
- * The XPointer transform klass 
+ *
+ * The XPointer transform klass
  * (http://www.ietf.org/internet-drafts/draft-eastlake-xmldsig-uri-02.txt).
  *
  * Returns: XPointer transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformXPointerGetKlass(void) {
     return(&xmlSecTransformXPointerKlass);
 }
 
 /**
- * xmlSecTransformXPointerSetExpr: 
+ * xmlSecTransformXPointerSetExpr:
  * @transform:          the pointer to XPointer transform.
  * @expr:               the XPointer expression.
  * @nodeSetType:        the type of evaluated XPointer expression.
@@ -824,8 +824,8 @@ xmlSecTransformXPointerGetKlass(void) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
-xmlSecTransformXPointerSetExpr(xmlSecTransformPtr transform, const xmlChar* expr, 
+int
+xmlSecTransformXPointerSetExpr(xmlSecTransformPtr transform, const xmlChar* expr,
                             xmlSecNodeSetType  nodeSetType, xmlNodePtr hereNode) {
     xmlSecPtrListPtr dataList;
     xmlSecXPathDataPtr data;
@@ -834,10 +834,10 @@ xmlSecTransformXPointerSetExpr(xmlSecTransformPtr transform, const xmlChar* expr
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXPointerId), -1);
     xmlSecAssert2(transform->hereNode == NULL, -1);
     xmlSecAssert2(expr != NULL, -1);
-    xmlSecAssert2(hereNode != NULL, -1);    
+    xmlSecAssert2(hereNode != NULL, -1);
 
     transform->hereNode = hereNode;
-    
+
     dataList = xmlSecXPathTransformGetDataList(transform);
     xmlSecAssert2(xmlSecPtrListCheckId(dataList, xmlSecXPathDataListId), -1);
     xmlSecAssert2(xmlSecPtrListGetSize(dataList) == 0, -1);
@@ -861,7 +861,7 @@ xmlSecTransformXPointerSetExpr(xmlSecTransformPtr transform, const xmlChar* expr
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlSecXPathDataDestroy(data);
         return(-1);
-    }    
+    }
 
     ret = xmlSecXPathDataSetExpr(data, expr);
     if(ret < 0) {
@@ -873,7 +873,7 @@ xmlSecTransformXPointerSetExpr(xmlSecTransformPtr transform, const xmlChar* expr
         xmlSecXPathDataDestroy(data);
         return(-1);
     }
-    
+
     /* append it to the list */
     ret = xmlSecPtrListAdd(dataList, data);
     if(ret < 0) {
@@ -889,11 +889,11 @@ xmlSecTransformXPointerSetExpr(xmlSecTransformPtr transform, const xmlChar* expr
     /* set correct node set type and operation */
     data->nodeSetOp     = xmlSecNodeSetIntersection;
     data->nodeSetType   = nodeSetType;
-    
+
     return(0);
 }
 
-static int 
+static int
 xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) {
     xmlSecPtrListPtr dataList;
     xmlSecXPathDataPtr data;
@@ -909,7 +909,7 @@ xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, x
     xmlSecAssert2(xmlSecPtrListGetSize(dataList) == 0, -1);
 
     /* there is only one required node */
-    cur = xmlSecGetNextElementNode(node->children);  
+    cur = xmlSecGetNextElementNode(node->children);
     if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeXPointer, xmlSecXPointerNs))) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -919,7 +919,7 @@ xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, x
                     xmlSecErrorsSafeString(xmlSecNodeXPath));
         return(-1);
     }
-    
+
     /* read information from the node */
     data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPointer);
     if(data == NULL) {
@@ -941,7 +941,7 @@ xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, x
         xmlSecXPathDataDestroy(data);
         return(-1);
     }
-    
+
     /* append it to the list */
     ret = xmlSecPtrListAdd(dataList, data);
     if(ret < 0) {
@@ -957,9 +957,9 @@ xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, x
     /* set correct node set type and operation */
     data->nodeSetOp     = xmlSecNodeSetIntersection;
     data->nodeSetType   = xmlSecNodeSetTree;
-    
+
     /* check that we have nothing else */
-    cur = xmlSecGetNextElementNode(cur->next);        
+    cur = xmlSecGetNextElementNode(cur->next);
     if(cur != NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
@@ -975,7 +975,7 @@ xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, x
 /******************************************************************************
  *
  * Visa3DHack transform
- * 
+ *
  *****************************************************************************/
 #define xmlSecVisa3DHackTransformSize   \
     (sizeof(xmlSecTransform) + sizeof(xmlChar*))
@@ -989,7 +989,7 @@ xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, x
 static int              xmlSecTransformVisa3DHackInitialize     (xmlSecTransformPtr transform);
 static void             xmlSecTransformVisa3DHackFinalize       (xmlSecTransformPtr transform);
 static int              xmlSecTransformVisa3DHackExecute        (xmlSecTransformPtr transform,
-                                                                 int last, 
+                                                                 int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
 
 static xmlSecTransformKlass xmlSecTransformVisa3DHackKlass = {
@@ -1021,15 +1021,15 @@ static xmlSecTransformKlass xmlSecTransformVisa3DHackKlass = {
 
 /**
  * xmlSecTransformVisa3DHackGetKlass:
- * 
- * The Visa3DHack transform klass. The only reason why we need this 
- * is Visa3D protocol. It doesn't follow XML/XPointer/XMLDSig specs and allows 
- * invalid XPointer expressions in the URI attribute. Since we couldn't evaluate 
- * such expressions thru XPath/XPointer engine, we need to have this hack here. 
+ *
+ * The Visa3DHack transform klass. The only reason why we need this
+ * is Visa3D protocol. It doesn't follow XML/XPointer/XMLDSig specs and allows
+ * invalid XPointer expressions in the URI attribute. Since we couldn't evaluate
+ * such expressions thru XPath/XPointer engine, we need to have this hack here.
  *
  * Returns: Visa3DHack transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformVisa3DHackGetKlass(void) {
     return(&xmlSecTransformVisa3DHackKlass);
 }
@@ -1043,10 +1043,10 @@ xmlSecTransformVisa3DHackGetKlass(void) {
  *
  * Returns: 0 on success or a negative value if an error occurs.
  */
-int 
+int
 xmlSecTransformVisa3DHackSetID(xmlSecTransformPtr transform, const xmlChar* id) {
     xmlChar** idPtr;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformVisa3DHackId), -1);
     xmlSecAssert2(id != NULL, -1);
 
@@ -1068,7 +1068,7 @@ xmlSecTransformVisa3DHackSetID(xmlSecTransformPtr transform, const xmlChar* id)
 }
 
 static int
-xmlSecTransformVisa3DHackInitialize(xmlSecTransformPtr transform) {     
+xmlSecTransformVisa3DHackInitialize(xmlSecTransformPtr transform) {
     xmlSecAssert2(xmlSecTransformVisa3DHackCheckId(transform), -1);
 
     return(0);
@@ -1082,7 +1082,7 @@ xmlSecTransformVisa3DHackFinalize(xmlSecTransformPtr transform) {
 
     idPtr = xmlSecVisa3DHackTransformGetIDPtr(transform);
     xmlSecAssert(idPtr != NULL);
-    
+
     if((*idPtr) != NULL) {
         xmlFree((*idPtr));
     }
@@ -1096,7 +1096,7 @@ xmlSecTransformVisa3DHackExecute(xmlSecTransformPtr transform, int last,
     xmlDocPtr doc;
     xmlAttrPtr attr;
     xmlNodeSetPtr nodeSet;
-    
+
     xmlSecAssert2(xmlSecTransformVisa3DHackCheckId(transform), -1);
     xmlSecAssert2(transform->outNodes == NULL, -1);
     xmlSecAssert2(last != 0, -1);
@@ -1118,7 +1118,7 @@ xmlSecTransformVisa3DHackExecute(xmlSecTransformPtr transform, int last,
                     "id=\"%s\"",
                     xmlSecErrorsSafeString((*idPtr)));
         return(-1);
-    }    
+    }
 
     nodeSet = xmlXPathNodeSetCreate(attr->parent);
     if(nodeSet == NULL) {
@@ -1129,7 +1129,7 @@ xmlSecTransformVisa3DHackExecute(xmlSecTransformPtr transform, int last,
                     "id=\"%s\"",
                     xmlSecErrorsSafeString((*idPtr)));
         return(-1);
-    }    
+    }
 
     transform->outNodes = xmlSecNodeSetCreate(doc, nodeSet, xmlSecNodeSetTreeWithoutComments);
     if(transform->outNodes == NULL) {
@@ -1140,7 +1140,7 @@ xmlSecTransformVisa3DHackExecute(xmlSecTransformPtr transform, int last,
                     XMLSEC_ERRORS_NO_MESSAGE);
         xmlXPathFreeNodeSet(nodeSet);
         return(-1);
-    }    
+    }
     return(0);
 }
 
diff --git a/src/xslt.c b/src/xslt.c
index 33e8cae..21b502d 100644
--- a/src/xslt.c
+++ b/src/xslt.c
@@ -1,11 +1,11 @@
-/** 
+/**
  * XML Security Library (http://www.aleksey.com/xmlsec).
  *
  * XSLT Transform (http://www.w3.org/TR/xmldsig-core/#sec-XSLT)
  *
  * This is free software; see Copyright file in the source
  * distribution for preciese wording.
- * 
+ *
  * Copyright (C) 2002-2003 Aleksey Sanin <aleksey aleksey com>
  */
 #include "globals.h"
@@ -14,7 +14,7 @@
 
 #include <stdlib.h>
 #include <string.h>
- 
+
 #include <libxml/tree.h>
 #include <libxslt/xslt.h>
 #include <libxslt/xsltInternals.h>
@@ -38,17 +38,17 @@ typedef struct _xmlSecXsltCtx                   xmlSecXsltCtx, *xmlSecXsltCtxPtr
 struct _xmlSecXsltCtx {
     xsltStylesheetPtr   xslt;
     xmlParserCtxtPtr    parserCtx;
-};          
+};
 
 /****************************************************************************
  *
  * XSLT transform
  *
  * xmlSecXsltCtx is located after xmlSecTransform
- * 
+ *
  ***************************************************************************/
 #define xmlSecXsltSize  \
-    (sizeof(xmlSecTransform) + sizeof(xmlSecXsltCtx))   
+    (sizeof(xmlSecTransform) + sizeof(xmlSecXsltCtx))
 #define xmlSecXsltGetCtx(transform) \
     ((xmlSecXsltCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
 
@@ -57,12 +57,12 @@ static void             xmlSecXsltFinalize                      (xmlSecTransform
 static int              xmlSecXsltReadNode                      (xmlSecTransformPtr transform,
                                                                  xmlNodePtr node,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int              xmlSecXsltPushBin                       (xmlSecTransformPtr transform, 
+static int              xmlSecXsltPushBin                       (xmlSecTransformPtr transform,
                                                                  const xmlSecByte* data,
                                                                  xmlSecSize dataSize,
                                                                  int final,
                                                                  xmlSecTransformCtxPtr transformCtx);
-static int              xmlSecXsltExecute                       (xmlSecTransformPtr transform, 
+static int              xmlSecXsltExecute                       (xmlSecTransformPtr transform,
                                                                  int last,
                                                                  xmlSecTransformCtxPtr transformCtx);
 static int              xmlSecXslProcess                        (xmlSecBufferPtr in,
@@ -90,7 +90,7 @@ static xmlSecTransformKlass xmlSecXsltKlass = {
     NULL,                                       /* xmlSecTransformPushXmlMethod pushXml; */
     NULL,                                       /* xmlSecTransformPopXmlMethod popXml; */
     xmlSecXsltExecute,                          /* xmlSecTransformExecuteMethod execute; */
-    
+
     NULL,                                       /* void* reserved0; */
     NULL,                                       /* void* reserved1; */
 };
@@ -100,48 +100,48 @@ static xmlSecTransformKlass xmlSecXsltKlass = {
  *
  * XSLT transform klass (http://www.w3.org/TR/xmldsig-core/#sec-XSLT):
  *
- * The normative specification for XSL Transformations is [XSLT]. 
- * Specification of a namespace-qualified stylesheet element, which MUST be 
- * the sole child of the Transform element, indicates that the specified style 
- * sheet should be used. Whether this instantiates in-line processing of local 
- * XSLT declarations within the resource is determined by the XSLT processing 
- * model; the ordered application of multiple stylesheet may require multiple 
- * Transforms. No special provision is made for the identification of a remote 
- * stylesheet at a given URI because it can be communicated via an  xsl:include 
+ * The normative specification for XSL Transformations is [XSLT].
+ * Specification of a namespace-qualified stylesheet element, which MUST be
+ * the sole child of the Transform element, indicates that the specified style
+ * sheet should be used. Whether this instantiates in-line processing of local
+ * XSLT declarations within the resource is determined by the XSLT processing
+ * model; the ordered application of multiple stylesheet may require multiple
+ * Transforms. No special provision is made for the identification of a remote
+ * stylesheet at a given URI because it can be communicated via an  xsl:include
  * or  xsl:import within the stylesheet child of the Transform.
  *
- * This transform requires an octet stream as input. If the actual input is an 
- * XPath node-set, then the signature application should attempt to convert it 
- * to octets (apply Canonical XML]) as described in the Reference Processing 
+ * This transform requires an octet stream as input. If the actual input is an
+ * XPath node-set, then the signature application should attempt to convert it
+ * to octets (apply Canonical XML]) as described in the Reference Processing
  * Model (section 4.3.3.2).]
  *
- * The output of this transform is an octet stream. The processing rules for 
+ * The output of this transform is an octet stream. The processing rules for
  * the XSL style sheet or transform element are stated in the XSLT specification
- * [XSLT]. We RECOMMEND that XSLT transform authors use an output method of xml 
- * for XML and HTML. As XSLT implementations do not produce consistent 
- * serializations of their output, we further RECOMMEND inserting a transform 
- * after the XSLT transform to canonicalize the output. These steps will help 
- * to ensure interoperability of the resulting signatures among applications 
- * that support the XSLT transform. Note that if the output is actually HTML, 
+ * [XSLT]. We RECOMMEND that XSLT transform authors use an output method of xml
+ * for XML and HTML. As XSLT implementations do not produce consistent
+ * serializations of their output, we further RECOMMEND inserting a transform
+ * after the XSLT transform to canonicalize the output. These steps will help
+ * to ensure interoperability of the resulting signatures among applications
+ * that support the XSLT transform. Note that if the output is actually HTML,
  * then the result of these steps is logically equivalent [XHTML].
  *
  * Returns: pointer to XSLT transform klass.
  */
-xmlSecTransformId 
+xmlSecTransformId
 xmlSecTransformXsltGetKlass(void) {
     return(&xmlSecXsltKlass);
 }
-    
-static int 
-xmlSecXsltInitialize(xmlSecTransformPtr transform) {    
+
+static int
+xmlSecXsltInitialize(xmlSecTransformPtr transform) {
     xmlSecXsltCtxPtr ctx;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXsltId), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecXsltSize), -1);
 
     ctx = xmlSecXsltGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
-    
+
     /* initialize context */
     memset(ctx, 0, sizeof(xmlSecXsltCtx));
     return(0);
@@ -156,7 +156,7 @@ xmlSecXsltFinalize(xmlSecTransformPtr transform) {
 
     ctx = xmlSecXsltGetCtx(transform);
     xmlSecAssert(ctx != NULL);
-    
+
     if(ctx->xslt != NULL) {
         xsltFreeStylesheet(ctx->xslt);
     }
@@ -172,17 +172,17 @@ xmlSecXsltReadNode(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransfor
     xmlBufferPtr buffer;
     xmlDocPtr doc;
     xmlNodePtr cur;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXsltId), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecXsltSize), -1);
-    xmlSecAssert2(node != NULL, -1);    
-    xmlSecAssert2(transformCtx != NULL, -1);    
+    xmlSecAssert2(node != NULL, -1);
+    xmlSecAssert2(transformCtx != NULL, -1);
 
     ctx = xmlSecXsltGetCtx(transform);
     xmlSecAssert2(ctx != NULL, -1);
     xmlSecAssert2(ctx->xslt == NULL, -1);
 
-    /* read content in the buffer */    
+    /* read content in the buffer */
     buffer = xmlBufferCreate();
     if(buffer == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -191,15 +191,15 @@ xmlSecXsltReadNode(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransfor
                     XMLSEC_ERRORS_R_XML_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         return(-1);
-    }    
+    }
     cur = node->children;
     while(cur != NULL) {
         xmlNodeDump(buffer, cur->doc, cur, 0, 0);
         cur = cur->next;
     }
-    
+
     /* parse the buffer */
-    doc = xmlSecParseMemory(xmlBufferContent(buffer), 
+    doc = xmlSecParseMemory(xmlBufferContent(buffer),
                              xmlBufferLength(buffer), 1);
     if(doc == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -211,7 +211,7 @@ xmlSecXsltReadNode(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransfor
         return(-1);
     }
 
-    /* pre-process stylesheet */    
+    /* pre-process stylesheet */
     ctx->xslt = xsltParseStylesheetDoc(doc);
     if(ctx->xslt == NULL) {
         xmlSecError(XMLSEC_ERRORS_HERE,
@@ -220,22 +220,22 @@ xmlSecXsltReadNode(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransfor
                     XMLSEC_ERRORS_R_XSLT_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
         /* after parsing stylesheet doc is assigned
-         * to it and will be freed by xsltFreeStylesheet() */    
+         * to it and will be freed by xsltFreeStylesheet() */
         xmlFreeDoc(doc);
         xmlBufferFree(buffer);
         return(-1);
     }
-    
+
     xmlBufferFree(buffer);
     return(0);
 }
 
-static int 
+static int
 xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
                                 xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
     xmlSecXsltCtxPtr ctx;
     int ret;
-    
+
     xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformXsltId), -1);
     xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecXsltSize), -1);
     xmlSecAssert2(transformCtx != NULL, -1);
@@ -247,7 +247,7 @@ xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
     /* check/update current transform status */
     if(transform->status == xmlSecTransformStatusNone) {
         xmlSecAssert2(ctx->parserCtx == NULL, -1);
-        
+
         ctx->parserCtx = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
         if(ctx->parserCtx == NULL) {
             xmlSecError(XMLSEC_ERRORS_HERE,
@@ -259,14 +259,14 @@ xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
         }
 
         /* required for c14n! */
-        ctx->parserCtx->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; 
+        ctx->parserCtx->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
         ctx->parserCtx->replaceEntities = 1;
 
         transform->status = xmlSecTransformStatusWorking;
     } else if(transform->status == xmlSecTransformStatusFinished) {
         return(0);
     } else if(transform->status != xmlSecTransformStatusWorking) {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -275,7 +275,7 @@ xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
     }
     xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1);
     xmlSecAssert2(ctx->parserCtx != NULL, -1);
-    
+
     /* push data to the input buffer */
     if((data != NULL) && (dataSize > 0)) {
         ret = xmlParseChunk(ctx->parserCtx, (const char*)data, dataSize, 0);
@@ -286,9 +286,9 @@ xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
                         XMLSEC_ERRORS_R_XML_FAILED,
                         "size=%d", dataSize);
             return(-1);
-        }       
-    }    
-    
+        }
+    }
+
     /* finish parsing, apply xslt transforms and push to next in the chain */
     if(final != 0) {
         xmlDocPtr docIn;
@@ -304,7 +304,7 @@ xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
                         XMLSEC_ERRORS_R_XML_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
-        }       
+        }
 
         /* todo: check that document is well formed? */
         docIn = ctx->parserCtx->myDoc;
@@ -321,7 +321,7 @@ xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
             return(-1);
         }
         xmlFreeDoc(docIn);
-    
+
         if(transform->next != NULL) {
             output = xmlSecTransformCreateOutputBuffer(transform->next, transformCtx);
             if(output == NULL) {
@@ -344,7 +344,7 @@ xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
                 xmlFreeDoc(docOut);
                 return(-1);
             }
-        }       
+        }
 
         ret = xsltSaveResultTo(output, docOut, ctx->xslt);
         if(ret < 0) {
@@ -375,7 +375,7 @@ xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
     return(0);
 }
 
-static int 
+static int
 xmlSecXsltExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
     xmlSecXsltCtxPtr ctx;
     xmlSecBufferPtr in, out;
@@ -393,12 +393,12 @@ xmlSecXsltExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr
     in = &(transform->inBuf);
     out = &(transform->outBuf);
     inSize = xmlSecBufferGetSize(in);
-    outSize = xmlSecBufferGetSize(out);    
-    
+    outSize = xmlSecBufferGetSize(out);
+
     if(transform->status == xmlSecTransformStatusNone) {
         transform->status = xmlSecTransformStatusWorking;
-    } 
-    
+    }
+
     if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
         /* just do nothing */
         xmlSecAssert2(outSize == 0, -1);
@@ -408,30 +408,30 @@ xmlSecXsltExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr
 
         ret = xmlSecXslProcess(in, out, ctx->xslt);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecXslProcess",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         XMLSEC_ERRORS_NO_MESSAGE);
             return(-1);
         }
-        
+
         ret = xmlSecBufferRemoveHead(in, inSize);
         if(ret < 0) {
-            xmlSecError(XMLSEC_ERRORS_HERE, 
+            xmlSecError(XMLSEC_ERRORS_HERE,
                         xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                         "xmlSecBufferRemoveHead",
                         XMLSEC_ERRORS_R_XMLSEC_FAILED,
                         "size=%d", inSize);
             return(-1);
         }
-        
+
         transform->status = xmlSecTransformStatusFinished;
     } else if(transform->status == xmlSecTransformStatusFinished) {
         /* the only way we can get here is if there is no input */
         xmlSecAssert2(inSize == 0, -1);
     } else {
-        xmlSecError(XMLSEC_ERRORS_HERE, 
+        xmlSecError(XMLSEC_ERRORS_HERE,
                     xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
                     NULL,
                     XMLSEC_ERRORS_R_INVALID_STATUS,
@@ -442,7 +442,7 @@ xmlSecXsltExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr
 }
 
 /* TODO: create PopBin method instead */
-static int 
+static int
 xmlSecXslProcess(xmlSecBufferPtr in, xmlSecBufferPtr out,  xsltStylesheetPtr stylesheet) {
     xmlDocPtr docIn = NULL;
     xmlDocPtr docOut = NULL;
@@ -461,7 +461,7 @@ xmlSecXslProcess(xmlSecBufferPtr in, xmlSecBufferPtr out,  xsltStylesheetPtr sty
                     "xmlSecParseMemory",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        goto done;      
+        goto done;
     }
 
     docOut = xsltApplyStylesheet(stylesheet, docIn, NULL);
@@ -471,7 +471,7 @@ xmlSecXslProcess(xmlSecBufferPtr in, xmlSecBufferPtr out,  xsltStylesheetPtr sty
                     "xsltApplyStylesheet",
                     XMLSEC_ERRORS_R_XSLT_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        goto done;      
+        goto done;
     }
 
     output = xmlSecBufferCreateOutputBuffer(out);
@@ -481,7 +481,7 @@ xmlSecXslProcess(xmlSecBufferPtr in, xmlSecBufferPtr out,  xsltStylesheetPtr sty
                     "xmlSecBufferCreateOutputBuffer",
                     XMLSEC_ERRORS_R_XMLSEC_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        goto done;      
+        goto done;
     }
 
     ret = xsltSaveResultTo(output, docOut, stylesheet);
@@ -491,7 +491,7 @@ xmlSecXslProcess(xmlSecBufferPtr in, xmlSecBufferPtr out,  xsltStylesheetPtr sty
                     "xsltSaveResultTo",
                     XMLSEC_ERRORS_R_XSLT_FAILED,
                     XMLSEC_ERRORS_NO_MESSAGE);
-        goto done;      
+        goto done;
     }
 
     ret = xmlOutputBufferClose(output);
@@ -507,11 +507,11 @@ xmlSecXslProcess(xmlSecBufferPtr in, xmlSecBufferPtr out,  xsltStylesheetPtr sty
 
     res = 0;
 
-done:   
+done:
     if(output != NULL) xmlOutputBufferClose(output);
     if(docIn != NULL) xmlFreeDoc(docIn);
     if(docOut != NULL) xmlFreeDoc(docOut);
-    return(res);    
+    return(res);
 }
 
 #endif /* XMLSEC_NO_XSLT */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]