Re: CryptoAPI problem -> decrypt possible with wrong key?
"Meier Rudolf" <firstname.lastname@example.org> wrote in message
I wrote a little program that shows my problem. What I want to do is
0) generate a pair of RSA keys (private, public). 1) encrypt some
text with the public key and 2) decrypt it with the private key...
now, that works fine. But then I tryed something else... I tryed to
use the public key for decrypting the data (which shouldn't work, as
far as I know... but currently I'm a bit confused... anyway). So I
expected an error when decrypting with the public key... but... it
worked... can someone explain me this?
Decryption with the wrong key does not work in the sense that the output
is garbage, it doesn't produce an error. If the encrypted stream
contained sufficient information to determine that a particular key is
wrong, that in itself would be a weakness.
As an illustration, consider a very simple encryption algorithm: the
plaintext data is simply XORed with the key. Decryption is the same: you
XOR the cyphertext with the key again. Now, if you use a wrong key, you
can XOR with it just fine, there is no error, but the result is garbage.
Moreover, for every plaintext message a key exists that decrypts a given
cyphertext to this message, so you can't even check whether the data is
meaningful to determine if the key is correct: it may be, just by
accident, but it's not the intended plaintext.
With best wishes,
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925