Re: rsa encryption with stonybrook modula
- From: "Norman Black" <nospam@xxxxxxxxxx>
- Date: Fri, 29 Jul 2005 15:26:34 GMT
"rko" <rko@xxxxxxxxxxxxxx> wrote in message
news:1122618646.090601.230980@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> thanx for the super explanations. it gave some more insides of what is
> happening in this (for me) whole blackbox.
> i am glad that you found that problem too. i have a 40 byte (byte
> array) encrypted with rc4 that then is encrypted using the rsa and the
> decryption was failing sporadically.
> drove me nuts (not that i am not nuts already). i'll try the padding
> and i hope i'll get that to work.
> can't wait to get a solution - thank you for the insides and your
> analysis.
> should you have any more pointers, i'll be glad to read them
There is no "solution" for using the raw RSA.PublicFunction and
RSA.PrivateFunction as you have show in your example code. The solution is
to know that when you decrypt that the item size is known and insert any
necessary leading zeros. As I said, RSA cannot know what the destination
decrypted data size should be. Another way to deal with this would be to
encode the item size into the encrypted data itself. For example if you have
40 bytes then append one byte with the value of 40. Encrypt that (41 bytes).
When you decrypt take the last byte and if the buffer bytes are not the
correct size (41) then insert leading zeros as necessary given the buffer
data and the size fields. A mechanism like this allows for arbitrary packet
sizes.
The only "solution" is a fix to the OAEP encryption procedures in the RSA
module. Also the PSS signing procedures. They have a known packet size and
the decrypt needs to account for this and add leading zeros as necessary.
The raw RSA routines cannot know what is necessary.
Norman
.
- References:
- Prev by Date: Re: rsa encryption with stonybrook modula
- Next by Date: Re: rsa encryption with stonybrook modula
- Previous by thread: Re: rsa encryption with stonybrook modula
- Next by thread: Re: rsa encryption with stonybrook modula
- Index(es):
Relevant Pages
|