Re: Design choice in LTC
- From: Tom St Denis <tom@xxxxxxx>
- Date: Fri, 4 Sep 2009 05:29:56 -0700 (PDT)
On Sep 4, 7:52 am, Noob <r...@xxxxxxxxx> wrote:
How do you qualify a signature failure, if it is not an error?
The document could have been modified. So it's still a valid
signature but not for that document. An error is more like you ran
out of ram, the padding was wrong, etc.
How do you handle the case (err == 0 && res != 1) ?
Depends on the application. In my cases I handle err != 0 as a fatal
error (usually because you ran out of ram or have malformed inputs),
and res != 1 as a soft error (because the user may have specified the
wrong message to verify) both with different messages to the user.
Please correct me if I'm wrong. A signature failure could only occur if the
owner of the private key signed the wrong document? An attacker cannot generate
a wrong signature, only an invalid signature?
I'll gladly correct you since you are in fact wrong. An attacker
could shove any matter of data your way. RSA signatures are just
arbitrary byte sequences until you perform the public operation, then
you have to check for padding.
It's no more correct or wrong than merging it into an error condition,
it just happens to be the style I chose at the time.
I did not write "incorrect" or "wrong".
I said unintuitive and error-prone (and not consistent).
With what though? It's consistent with my other PK APIs inside the
library. And in fact in the 8 years the projects have been around
you're the first person to complain that the two-fold channel is hard
to use.
Do you dispute that it is unintuitive and error-prone, considering that the
other functions only return an error code?
Other functions don't really have the ability to successfully compute
the wrong data though.
If you could do it over again today, would you still use two distinct variables,
or would you add an extra error code?
I did do it over again. The company I work at has a library similar
to LTC that has the exact same style API. None of our customers have
complained about it.
I'm not disputing that you could just return CRYPT_SIGNATURE_MISMATCH
or something similar. I am disputing that that's better. To me
return codes other than CRYPT_OK really mean something is wrong with
the environment, whereas the additional channel of the status allows
more logical processing. So now you do
err = rsa_verify_hash(...)
if (err != OK) { error(); }
if (!stat) { signature_failed(); }
The equivalent in your preferred style would be
if (err == CRYPT_SIGNATURE_MISMATCH) {
signature_failed();
} else if (err != OK) {
error();
}
It's just as complicated.
Finally, the library is public domain, you're at liberty to modify and
redistribute as you see fit. So stop bitching at me about the API and
go fix it yourself.
Tom
.
- Follow-Ups:
- Re: Design choice in LTC
- From: Noob
- Re: Design choice in LTC
- References:
- Design choice in LTC
- From: Noob
- Re: Design choice in LTC
- From: Tom St Denis
- Re: Design choice in LTC
- From: Noob
- Design choice in LTC
- Prev by Date: Re: Design choice in LTC
- Next by Date: Re: RSA SecurID & AES
- Previous by thread: Re: Design choice in LTC
- Next by thread: Re: Design choice in LTC
- Index(es):
Relevant Pages
|