EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Encryption-RSA

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#7176
Posted: 08/01/2008 09:33:55
by Paras Jain (Basic support level)
Joined: 08/01/2008
Posts: 1

Hi List,

I am getting error Input Too Long while encrypting a string. following is the code in Delphi 7:
EE := TElRSAPublicKeyCrypto.Create();
E := TElRSAKeyMaterial.Create();
Instr := '0101,0,0,2,4,6,tatatatata.12345678909887665433';
SetLength(INStr,64);
SetLength(OutStr,64);
SetLength(ExStr,64);
try
E.Generate(128);
EE.KeyMaterial := E;
EE.Encrypt(@Instr[1],Length(Instr),@OutStr[1],OutStrSize);;
EE.Decrypt(@Outstr[1],OutStrSize,@ExStr[1],ExStrSize);;
finally
FreeAndNil(E);
FreeAndNil(Ee);
end;


I am new in this so can you help me out?

Thanks
Paras
#7178
Posted: 08/01/2008 09:49:19
by Eugene Mayevski (Team)

Output string will be larger than the input one so you need to make the resulting buffers longer than the original one.


Sincerely yours
Eugene Mayevski
#7180
Posted: 08/01/2008 09:53:44
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Also, note, that 128-bit key which you are generating is not able to encrypt 64-byte string. You will need 768 bit key or so (not 512, because some padding is added to the string being encrypted).

Reply

Statistics

Topic viewed 1258 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!