Hi Eugene,

> Here you just write first byte or few (depending on size of bool) of
> the message into boolean.
> ...
> bool result = *((bool*)message.data());
I don't believe this is correct. The previous is equivalent to:

StringSource( signature+message, true /*pump all*/,
   new SignatureVerificationFilter(
       ECDSA<ECP,SHA1>::Verifier(publicKey),
       new ArraySink( (byte*)&result, sizeof(result) ),
       DEFAULT_FLAGS
   ) // SignatureVerificationFilter
);

with DEFAULT_FLAGS = SIGNATURE_AT_BEGIN | PUT_RESULT. The
SignatureVerificationFilter puts its result (due to the flag
PUT_RESULT), and the result is declared as 'bool m_verified'. See
filters.h around line 400.

I also took a quick look at 'result' under the debugger. It is indeed
'put' as a bool: 01 CC CC CC (success).

Jeff

On Fri, Dec 18, 2009 at 12:24 PM, Eugene Zolenko <[email protected]> wrote:
> If you mean your result variable, then no :).
>
> Actually I just noticed that it is bool in first case, it supposed to
> be std::string or byte queue or char* buffer. Something that can take
> copy of contents of your message variable.
>
> Here you just write first byte or few (depending on size of bool) of
> the message into boolean.
>
> That is what you are doing:
>
> bool result = *((bool*)message.data());
>
> This is probably not what you want. :)
>
> On Dec 18, 9:54 am, Charlie <[email protected]> wrote:
>> But the result of the signature and the verification is the same in
>> both cases, isn't it?
>>
>> On 18 dic, 17:29, Eugene Zolenko <[email protected]> wrote:
>>
>>
>>
>> > First way will throw exception if verification failed, second returns
>> > false.
>>
>> > It is possible to suppress exception I think and get an error code
>> > with some combination of filters and flags. Need to use redirector to
>> > pass in verifier filter without giving up ownership and then check
>> > result of verification.
>>
>> > Anyway, first one also copies message without signature into output
>> > buffer.
>>
>> > Use first when you get signed message that you need to process with
>> > other filters as well (encryption, encoding, etc).
>>
>> > Use second if you have the message already at destination buffer and
>> > you need only to verify it.
>
> --
> You received this message because you are subscribed to the "Crypto++ Users" 
> Google Group.
> To unsubscribe, send an email to [email protected].
> More information about Crypto++ and this group is available at 
> http://www.cryptopp.com.

-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.

Reply via email to