Jump to content
Registration disabled at the moment Read more... ×
softtouch

Lockbox 3 GenerateKeys = Range Check Error

Recommended Posts

Delphi 12.2, I installed LockBox 3 via GetIt. So far so good.

 

I try to generate public and private keys, but I get all the time a range check error.

 

Here is the example code:


 

  CryptoLib := TCryptographicLibrary.Create(nil);
  CodecRSA := TCodec.Create(nil);
  Signatory := TSignatory.Create(nil);

  CodecRSA.CryptoLibrary := CryptoLib;
  CodecRSA.StreamCipherId := 'native.RSA';
  CodecRSA.AsymetricKeySizeInBits := 1024;
  Signatory.Codec := CodecRSA;

  Signatory.GenerateKeys;  // <== Range Check Error

  Signatory.Free;
  CodecRSA.Free;
  CryptoLib.Free;

 

What am I doing wrong?

Share this post


Link to post
54 minutes ago, softtouch said:

Delphi 12.2, I installed LockBox 3 via GetIt. So far so good.

 

I try to generate public and private keys, but I get all the time a range check error.

 

Here is the example code:


 


  CryptoLib := TCryptographicLibrary.Create(nil);
  CodecRSA := TCodec.Create(nil);
  Signatory := TSignatory.Create(nil);

  CodecRSA.CryptoLibrary := CryptoLib;
  CodecRSA.StreamCipherId := 'native.RSA';
  CodecRSA.AsymetricKeySizeInBits := 1024;
  Signatory.Codec := CodecRSA;

  Signatory.GenerateKeys;  // <== Range Check Error

  Signatory.Free;
  CodecRSA.Free;
  CryptoLib.Free;

 

What am I doing wrong?

Probably nothing :). The default setting for range checking changed to "on" and the Lockbox version in GetIt may not reflect that yet. Try to use the latest version from github instead: https://github.com/TurboPack/LockBox3

Share this post


Link to post

I just installed the latest version from github, it does exactly the same.

Share this post


Link to post
Posted (edited)
-                b8_1  := P8^ shl ShiftAmnt; 
+                b8_1  := Byte(P8^ shl ShiftAmnt); //(3 shl 7) do not fit into Byte

-                b8_1 := P8^ shl ShiftComp8;
+                b8_1 := Byte(P8^ shl ShiftComp8);

-  PoweredFactor, Power, iFactor: integer;
+  PoweredFactor, Power, iFactor: uint32;

After some changes in /run/utilities/uTPLb_HugeCardinal.pas no more errors... but it works?

If it worked with range checking OFF then probably it will work.

Edited by Cristian Peța

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×