[xmlsec] whats is the correct way to reset dsigCtx, without destroing it?

Aleksey Sanin aleksey at aleksey.com
Wed Dec 6 07:18:32 PST 2017


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

2)
xmlSecDSigCtxFinalize(&dsigCtx);

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

Aleksey

On 12/6/17 4:41 AM, Ranier VF wrote:
> 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
> ________________________________________
> De: Aleksey Sanin <aleksey at aleksey.com>
> Enviado: terça-feira, 5 de dezembro de 2017 19:06
> Para: Ranier VF; xmlsec at aleksey.com
> 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
> 
> On 12/5/17 4:15 AM, Ranier VF wrote:
>> 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
>> _______________________________________________
>> xmlsec mailing list
>> xmlsec at aleksey.com
>> http://www.aleksey.com/mailman/listinfo/xmlsec
>>


More information about the xmlsec mailing list