TSCKEY Encrypt/Decrypt

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
otbgroup
Posts: 1
Joined: Thu 27 Mar 2008 08:56

TSCKEY Encrypt/Decrypt

Post by otbgroup » Thu 27 Mar 2008 09:06

Good morning,
I tried out this:

var
Key : TScKey;
KeyList : TScKeyList;
Buf, RetBuf : SysUtils.TBytes;
ms : TMemoryStream;
begin

ms := TMemoryStream.Create;
ms.LoadFromFile('c:\testo.txt');
ms.Seek(0, soFromBeginning);

SetLength(Buf, ms.Size);
ms.Read(Buf[0], ms.Size);

KeyList := TScKeyList.Create(dmMain.FileStorage);
key := TScKey.Create(KeyList);
Key.KeyName := 'Key4';
RetBuf := Key.Encrypt(Buf);
Key.KeyName := 'Key4';
Buf := Key.Decrypt(RetBuf);
end;

I'm using trial of ScureBridge
Well, wether c:\testo.txt is quite small, all works well. If not, I receive the message: "An error occurred when encrypting data: length not valid"
Is that a limit or something wrong in my code?
Thank in advance,
Oscar

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 28 Mar 2008 08:55

SecureBridge uses CryptoAPI for encrypting data, and limitations of data block size depend on CryptoAPI.
TScKey is not meant for encrypting big data blocks.

Post Reply