Re: rsa encryption with stonybrook modula




"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


.



Relevant Pages

  • Re: Decrypt RSA using D
    ... We are planning on using RSA with WSE, so it only uses RSA to encrypt the symmetric key used for the SOAP body--the same scenario you outlined below. ... owner of the private key can decrypt it. ... always embedded inside the CSP key container and never passed out into the ...
    (microsoft.public.dotnet.framework)
  • Re: Converting SSH2-RSA key to RSA numbers
    ... What I have in hand is a basic RSA ... the world can decrypt your messages. ... to encrypt and only you decrypt. ... >the key in an OpenSSH SSH2 RSA private key file into the aforementioned ...
    (comp.security.ssh)
  • Re: RSA - Public vs. Private Keys
    ... machine, and have it decrypted on another machine (say, the target ... My idea was to take a message, encrypt it using RSA, and dumping the ... Public Key and Decrypt with a Private key. ...
    (microsoft.public.dotnet.security)
  • Re: Encrypting symmetric keys
    ... Is RSAPKCS1KeyExchangeFormatter only meant to be used on valid ... and want to encrypt both the Key and IV values. ... but when I try to decrypt (after getting RSA csp with private key for same public key of course) ... i recover the Key value properly, but get bad data error in trying to decrypt the IV. ...
    (microsoft.public.dotnet.security)
  • Re: The question about the RSA cryptography.
    ... I can't speak for RSA, or whatever software is being used to encrypt the ... When the server receive ... he ready to use his private key to decrypt it. ...
    (microsoft.public.security)