2

I convert our project from Delphi 5 to XE4. I used LockBox 2 in Delphi 5. Now I want to use LockBox 3, but I have some RSA keys (generated in LockBox 2). I can't load this keys in LockBox 3. I looked for some info about LockBox 2. I found that LockBox 2 use ASN.1 format for saving keys. Is it true? I can't find which format use LockBox 3. Is there any way to convert private and public keys from ASN.1 to format which use LockBox 3?

Use in Delphi 5 (LockBox 2):

PrivateRSAKey: TLbRSAKey;
MemStream: TMemoryStream; 
...
PrivateRSAKey.LoadFromStream(MemStream);
...
Result := RSAEncryptString(CryptedText, PrivateRSAKey, false); //works fine

Use in XE4 (LockBox 3):

Codec: TCodec;
Key: TSymetricKey;
MemStream: TMemoryStream; //contains same data as MemStream in Delphi 5
...
Key := Codec.Asymetric_Engine.CreateFromStream(MemStream, [partPrivate]);
Codec.InitFromKey(Key);
...
Codec.DecryptStream(DecryptStream, CryptStream); //CryptedStream contains same data as CryptedText in Delphi 5
  //Now DecryptStream contains different data as Result in Delphi 5
arny
  • 21
  • 2
  • Is it possible that it happens because you're declaring Key as TSymetricKey? I don't know the details about LockBox but does it contains TAsymetricKey class or some asym key usage example? – Hasan Manzak Oct 25 '13 at 11:12
  • why not asking official support forum ? http://lockbox.seanbdurkin.id.au/tiki-view_forum.php?forumId=2 – Arioch 'The Oct 25 '13 at 12:37

0 Answers0