[xmlsec] ErrorsCallback ???

Aleksey Sanin aleksey at aleksey.com
Thu Jan 5 21:00:51 PST 2006


Ed,

I think I found the reason for your confusion. In the first email
in this thread you gave several example for MSCrypto error messages
with and without errors callback set. I'll pick one of them and
will explain the problem:

mscrypto
********

epmErrorCallback xmlsec error follows:
file                                    ..\src\mscrypto\app.c
line                                    614
func                                    xmlSecMSCryptoAppPkcs12LoadMemory
errorObject                             None
errorSubject                            PFXVerifyPassword
reason                                  4
msg

No ErrorsCallback set
*********************

func=xmlSecMSCryptoAppPkcs12LoadMemory:file=..\src\mscrypto\app.c:line=614:o
bj=unknown:subj=PFXVerifyPassword:error=4:crypto library function failed:
;last error=86 (0x00000056);last error msg=The specified network password is
not correct.



The 'msg' you see in the first case (with epmErrorsCallback) is provided
by the xmlsec-mscrypto (or xmlsec-openssl) author. If you go to the
corresponding file, you'll see that there is *no* message provided
in this case thus you observe correct results.

The messages you see in the second case (no custom ErrorsCallback) are
created by xmlSecMSCryptoErrorsDefaultCallback() function which is *the*
default errors callback when xmlsec-mscrypto is used (yes, it is a 
little bit confusing :( ). This function simply calls Windows
GetLastError() and FormatMessage() to generate the

   "last error=86 (0x00000056);last error msg=The specified network
    password is not correct."

message and append it to *all* error messages.


I agree, this is confusing but the system does what it was written
to do. May be a better approach would be to move this "extra"
xmlSecMSCryptoErrorsDefaultCallback() functionality into the generic
xmlSecErrorsDefaultCallback() and just ifdef it for Windows only.
Then the output will be consistent between different crypto libraries.


Aleksey








More information about the xmlsec mailing list