Discussion:
[xmlsec] whats is the correct way to reset dsigCtx, without destroing it?
Ranier VF
2017-12-05 12:15:42 UTC
Permalink
Hi,
I'm around one problem with sign xml with function: xmlSecDSigCtxSign
func=xmlSecDSigCtxSign:file=..\src\xmldsig.c:line=274:obj=unknown:subj=dsigCtx->
result == NULL:error=100:assertion:

On first sign, all is ok, the xml is correctly signed.
On second sign, the error is raised.

Question: whats is the correct way to reset dsigCtx, without destroing it?
In case, I'm reusing struct dsigCtx.

Thank you.

Best regards,

Ranier Vilela
Aleksey Sanin
2017-12-05 19:06:51 UTC
Permalink
Use either xmlSecDSigCtxCreate/xmlSecDSigCtxDestroy or
xmlSecDSigCtxInitialize/xmlSecDSigCtxFinalize depending on
whether you create it on the heap or on the stack.

Aleksey
Post by Ranier VF
Hi,
I'm around one problem with sign xml with function: xmlSecDSigCtxSign
func=xmlSecDSigCtxSign:file=..\src\xmldsig.c:line=274:obj=unknown:subj=dsigCtx->
On first sign, all is ok, the xml is correctly signed.
On second sign, the error is raised.
Question: whats is the correct way to reset dsigCtx, without destroing it?
In case, I'm reusing struct dsigCtx.
Thank you.
Best regards,
Ranier Vilela
_______________________________________________
xmlsec mailing list
http://www.aleksey.com/mailman/listinfo/xmlsec
Aleksey Sanin
2017-12-06 15:18:32 UTC
Permalink
1)
tmpKey = NULL;
swap(dsigCtx->signKey,tmpKey);

2)
xmlSecDSigCtxFinalize(&dsigCtx);

3)
swap(dsigCtx->signKey,tmpKey);
assert(tmpKey == NULL);

Aleksey
Hi,
I considered use of xmlSecDSigCtxInitialize/xmlSecDSigCtxFinalize,
but xmlSecDSigCtxFinalize calls xmlSecKeyDestroy, releasing precisely,
which should be preserved, the struct signKey.
The purpose is reutilze the keys in memory, instead reload from disk.
Thanks,
Ranier
________________________________________
Enviado: terça-feira, 5 de dezembro de 2017 19:06
Assunto: Re: [xmlsec] whats is the correct way to reset dsigCtx, without destroing it?
Use either xmlSecDSigCtxCreate/xmlSecDSigCtxDestroy or
xmlSecDSigCtxInitialize/xmlSecDSigCtxFinalize depending on
whether you create it on the heap or on the stack.
Aleksey
Post by Ranier VF
Hi,
I'm around one problem with sign xml with function: xmlSecDSigCtxSign
func=xmlSecDSigCtxSign:file=..\src\xmldsig.c:line=274:obj=unknown:subj=dsigCtx->
On first sign, all is ok, the xml is correctly signed.
On second sign, the error is raised.
Question: whats is the correct way to reset dsigCtx, without destroing it?
In case, I'm reusing struct dsigCtx.
Thank you.
Best regards,
Ranier Vilela
_______________________________________________
xmlsec mailing list
http://www.aleksey.com/mailman/listinfo/xmlsec
Loading...