data size and RSA encryption
From: Tim Wallace (twallace-ThisDoesNotBelong-AT-emailDOTcom)
Date: 09/19/05
- Next message: Stephen Noronha: "Re: Windows authentication only"
- Previous message: Dominick Baier [DevelopMentor]: "Re: Importance of salt"
- Next in thread: Valery Pryamikov: "Re: data size and RSA encryption"
- Reply: Valery Pryamikov: "Re: data size and RSA encryption"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 19 Sep 2005 12:34:48 -0400
I am getting an error stating "...data to be encrypted exceeds the maximum
for this modulus of 256 bytes". I am at a loss as to how this could be, as
I'm only attempting to encrypt less than 30 characters. Does anyone have
any ideas as to what could cause this error? I'm creating my keys in a
separate application like so:
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(2048);
string rsaXml = rsa.ToXmlString(true);
StreamWriter sw = new StreamWriter("c:\\some_file_ name.key");
sw.Write( rsaXml );
sw.Close();
Then, in the application where I encrypt, I do it like so:
RSACryptoServiceProvider rsacspServer = new RSACryptoServiceProvider(2048);
string rsaXml = string.Empty;
StreamReader sr = new StreamReader("c:\\some_file_name.key");
rsaXml = sr.ReadToEnd();
sr.Close();
rsacspServer.FromXmlString(rsaXml);
Next, I encrypt like this: rsacspServer.Encrypt( a, false ); // a is a
byte[]
Over in the app that is decrypting (the bytes are being sent using
TCPClient), I do the same as the encrytion, save for calling Decrypt.
Any ideas?
Tim
- Next message: Stephen Noronha: "Re: Windows authentication only"
- Previous message: Dominick Baier [DevelopMentor]: "Re: Importance of salt"
- Next in thread: Valery Pryamikov: "Re: data size and RSA encryption"
- Reply: Valery Pryamikov: "Re: data size and RSA encryption"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]